Skip to content

Commit 4a238a2

Browse files
author
VuXfi
committed
fix user bonus spending
1 parent 1928b20 commit 4a238a2

File tree

348 files changed

+28726
-28664
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

348 files changed

+28726
-28664
lines changed

.gitattributes

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
*.ejs linguist-detectable=false
1+
*.ejs linguist-detectable=false
22
*.js linguist-detectable=false

.github/git_hooks/pre-push

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
#!/bin/sh
1+
#!/bin/sh
22
npm run test

.github/workflows/alpha.yml

+41-41
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
1-
name: Publish Package to npmjs
2-
on:
3-
push:
4-
branches:
5-
- alpha
6-
- next
7-
jobs:
8-
build:
9-
runs-on: ubuntu-latest
10-
steps:
11-
- uses: actions/checkout@v3
12-
# Setup .npmrc file to publish to npm
13-
- uses: actions/setup-node@v3
14-
with:
15-
node-version: '18.x'
16-
registry-url: 'https://registry.npmjs.org'
17-
18-
# waiting https://github.com/ds300/patch-package/issues/339
19-
- run: npm install 2>&1 || true && npm run test:init 2>&1 || true && npm run test
20-
21-
# resolve version
22-
- run: |
23-
set -x
24-
BRANCH=${GITHUB_REF##*/}
25-
PACKAGE=$(cat package.json | jq -r '.["name"]')
26-
VERLOC=$(cat package.json | jq -r '.["version"]')
27-
VERNPMRAW=$(curl -s https://registry.npmjs.org/$PACKAGE | jq -r '.["dist-tags"].'$BRANCH'')
28-
BUILD_VERSION=1
29-
if [[ "$VERNPMRAW" == "null" ]]; then
30-
VEROUT=$VERLOC
31-
else
32-
VERNPM=$(echo $VERNPMRAW | cut -d'-' -f1)
33-
if [[ "$VERLOC" == "$VERNPM" ]]; then
34-
BUILD_VERSION=$(echo $VERNPMRAW | awk -F '[.-]' '{print $5+1}')
35-
fi
36-
VEROUT=$VERLOC
37-
fi
38-
jq -r '.version = "'${VEROUT}'-build.'$BUILD_VERSION'"' package.json > /tmp/package.json && mv /tmp/package.json ./package.json
39-
- run: npm publish --tag ${GITHUB_REF##*/}
40-
env:
41-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
1+
name: Publish Package to npmjs
2+
on:
3+
push:
4+
branches:
5+
- alpha
6+
- next
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
# Setup .npmrc file to publish to npm
13+
- uses: actions/setup-node@v3
14+
with:
15+
node-version: '18.x'
16+
registry-url: 'https://registry.npmjs.org'
17+
18+
# waiting https://github.com/ds300/patch-package/issues/339
19+
- run: npm install 2>&1 || true && npm run test:init 2>&1 || true && npm run test
20+
21+
# resolve version
22+
- run: |
23+
set -x
24+
BRANCH=${GITHUB_REF##*/}
25+
PACKAGE=$(cat package.json | jq -r '.["name"]')
26+
VERLOC=$(cat package.json | jq -r '.["version"]')
27+
VERNPMRAW=$(curl -s https://registry.npmjs.org/$PACKAGE | jq -r '.["dist-tags"].'$BRANCH'')
28+
BUILD_VERSION=1
29+
if [[ "$VERNPMRAW" == "null" ]]; then
30+
VEROUT=$VERLOC
31+
else
32+
VERNPM=$(echo $VERNPMRAW | cut -d'-' -f1)
33+
if [[ "$VERLOC" == "$VERNPM" ]]; then
34+
BUILD_VERSION=$(echo $VERNPMRAW | awk -F '[.-]' '{print $5+1}')
35+
fi
36+
VEROUT=$VERLOC
37+
fi
38+
jq -r '.version = "'${VEROUT}'-build.'$BUILD_VERSION'"' package.json > /tmp/package.json && mv /tmp/package.json ./package.json
39+
- run: npm publish --tag ${GITHUB_REF##*/}
40+
env:
41+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/dev.yml

+18-18
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
name: Run tests
2-
on:
3-
push:
4-
branches-ignore:
5-
- master
6-
- alpha
7-
- next
8-
- test-with-postgres
9-
jobs:
10-
build:
11-
runs-on: ubuntu-latest
12-
steps:
13-
- uses: actions/checkout@v3
14-
# Setup .npmrc file to publish to npm
15-
- uses: actions/setup-node@v3
16-
with:
17-
node-version: '18.x'
18-
registry-url: 'https://registry.npmjs.org'
1+
name: Run tests
2+
on:
3+
push:
4+
branches-ignore:
5+
- master
6+
- alpha
7+
- next
8+
- test-with-postgres
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
# Setup .npmrc file to publish to npm
15+
- uses: actions/setup-node@v3
16+
with:
17+
node-version: '18.x'
18+
registry-url: 'https://registry.npmjs.org'
1919
- run: npm install 2>&1 || true && npm run test:init 2>&1 || true && npm run test

.github/workflows/release.yml

+65-65
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,65 @@
1-
name: Release
2-
3-
on:
4-
push:
5-
branches:
6-
- master
7-
8-
jobs:
9-
release:
10-
runs-on: ubuntu-latest
11-
12-
services:
13-
postgres:
14-
image: postgres:14.5
15-
env:
16-
POSTGRES_PASSWORD: postgres
17-
POSTGRES_USER: postgres
18-
POSTGRES_DB: postgres
19-
ports:
20-
- 5432:5432
21-
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
22-
23-
steps:
24-
- uses: actions/checkout@v3
25-
26-
# Setup .npmrc file to publish to npm
27-
- uses: actions/setup-node@v3
28-
with:
29-
node-version: '18.x'
30-
registry-url: 'https://registry.npmjs.org'
31-
32-
# Set up PostgreSQL client
33-
- run: sudo apt-get -yqq install postgresql-client
34-
35-
36-
# waiting https://github.com/ds300/patch-package/issues/339
37-
- run: npm install 2>&1 || true && npm run test:init 2>&1 || true && npm run test:updb && npm run test:release
38-
39-
# resolve version
40-
- run: set -x; PACKAGE=$(cat package.json | jq -r '.["name"]') VERNPM=$(curl https://registry.npmjs.org/$PACKAGE | jq -r '.["dist-tags"].latest' | awk -F. -v OFS=. '{$NF += 1 ; print}') VERLOC=$(cat package.json | jq -r '.["version"]') VEROUT=$(printf "$VERNPM\n$VERLOC\n" | sort -V -r | awk 'NR==1 {print; exit}') && jq -r '.version = "'${VEROUT}'"' package.json > /tmp/package.json && mv /tmp/package.json ./package.json
41-
42-
- run: npm publish
43-
44-
# Remove old versions of the package (with "build" in their name)
45-
- run: sleep 15
46-
- run: |
47-
PACKAGE=$(cat package.json | jq -r '.["name"]')
48-
current_version=$(npm show $PACKAGE version)
49-
npm_versions=$(npm show $PACKAGE versions --json)
50-
versions_array=($(echo $npm_versions | jq -r '.[]'))
51-
52-
vercmp() {
53-
dpkg --compare-versions "$1" ge "$2"
54-
}
55-
56-
for version in "${versions_array[@]}"; do
57-
if [[ $version == *"build"* ]]; then
58-
if ! vercmp "$version" "$current_version"; then
59-
echo "remove expired build version: $version"
60-
npm unpublish $PACKAGE@$version
61-
fi
62-
fi
63-
done
64-
env:
65-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
12+
services:
13+
postgres:
14+
image: postgres:14.5
15+
env:
16+
POSTGRES_PASSWORD: postgres
17+
POSTGRES_USER: postgres
18+
POSTGRES_DB: postgres
19+
ports:
20+
- 5432:5432
21+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
22+
23+
steps:
24+
- uses: actions/checkout@v3
25+
26+
# Setup .npmrc file to publish to npm
27+
- uses: actions/setup-node@v3
28+
with:
29+
node-version: '18.x'
30+
registry-url: 'https://registry.npmjs.org'
31+
32+
# Set up PostgreSQL client
33+
- run: sudo apt-get -yqq install postgresql-client
34+
35+
36+
# waiting https://github.com/ds300/patch-package/issues/339
37+
- run: npm install 2>&1 || true && npm run test:init 2>&1 || true && npm run test:updb && npm run test:release
38+
39+
# resolve version
40+
- run: set -x; PACKAGE=$(cat package.json | jq -r '.["name"]') VERNPM=$(curl https://registry.npmjs.org/$PACKAGE | jq -r '.["dist-tags"].latest' | awk -F. -v OFS=. '{$NF += 1 ; print}') VERLOC=$(cat package.json | jq -r '.["version"]') VEROUT=$(printf "$VERNPM\n$VERLOC\n" | sort -V -r | awk 'NR==1 {print; exit}') && jq -r '.version = "'${VEROUT}'"' package.json > /tmp/package.json && mv /tmp/package.json ./package.json
41+
42+
- run: npm publish
43+
44+
# Remove old versions of the package (with "build" in their name)
45+
- run: sleep 15
46+
- run: |
47+
PACKAGE=$(cat package.json | jq -r '.["name"]')
48+
current_version=$(npm show $PACKAGE version)
49+
npm_versions=$(npm show $PACKAGE versions --json)
50+
versions_array=($(echo $npm_versions | jq -r '.[]'))
51+
52+
vercmp() {
53+
dpkg --compare-versions "$1" ge "$2"
54+
}
55+
56+
for version in "${versions_array[@]}"; do
57+
if [[ $version == *"build"* ]]; then
58+
if ! vercmp "$version" "$current_version"; then
59+
echo "remove expired build version: $version"
60+
npm unpublish $PACKAGE@$version
61+
fi
62+
fi
63+
done
64+
env:
65+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
+38-38
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
1-
name: Release
2-
3-
on:
4-
push:
5-
branches:
6-
- test-with-postgres
7-
8-
jobs:
9-
build:
10-
runs-on: ubuntu-latest
11-
12-
services:
13-
postgres:
14-
image: postgres:14.5
15-
env:
16-
POSTGRES_PASSWORD: postgres
17-
POSTGRES_USER: postgres
18-
POSTGRES_DB: postgres
19-
ports:
20-
- 5432:5432
21-
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
22-
23-
steps:
24-
- uses: actions/checkout@v3
25-
26-
# Setup .npmrc file to publish to npm
27-
- uses: actions/setup-node@v3
28-
with:
29-
node-version: '18.x'
30-
registry-url: 'https://registry.npmjs.org'
31-
32-
# Set up PostgreSQL client
33-
- run: sudo apt-get -yqq install postgresql-client
34-
35-
36-
37-
# waiting https://github.com/ds300/patch-package/issues/339
38-
- run: npm install 2>&1 || true && npm run test:init 2>&1 || true && npm run test:updb && npm run test:release
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- test-with-postgres
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
services:
13+
postgres:
14+
image: postgres:14.5
15+
env:
16+
POSTGRES_PASSWORD: postgres
17+
POSTGRES_USER: postgres
18+
POSTGRES_DB: postgres
19+
ports:
20+
- 5432:5432
21+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
22+
23+
steps:
24+
- uses: actions/checkout@v3
25+
26+
# Setup .npmrc file to publish to npm
27+
- uses: actions/setup-node@v3
28+
with:
29+
node-version: '18.x'
30+
registry-url: 'https://registry.npmjs.org'
31+
32+
# Set up PostgreSQL client
33+
- run: sudo apt-get -yqq install postgresql-client
34+
35+
36+
37+
# waiting https://github.com/ds300/patch-package/issues/339
38+
- run: npm install 2>&1 || true && npm run test:init 2>&1 || true && npm run test:updb && npm run test:release

0 commit comments

Comments
 (0)