Skip to content
This repository has been archived by the owner on Dec 1, 2023. It is now read-only.

Bump to v2 #67

Open
wants to merge 34 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
0ca667c
chore: update author and add repository field in package.json
wdzeng Jul 29, 2023
9763d7b
feat: implement v2
wdzeng Jul 21, 2023
41a83b8
docs: update docs and demo pictures for v2
wdzeng Jul 21, 2023
d22e820
feat: update Dockerfile for v2
wdzeng Jul 21, 2023
7350898
ci/cd: update CI/CD for v2
wdzeng Jul 21, 2023
4fdb853
Bump to v2.0.0-alpha.0
wdzeng Jul 21, 2023
14e22fb
fix: incorrect checkin list length for history command JSON output
wdzeng Jul 21, 2023
ce01cc6
Bump to v2.0.0-alpha.1
wdzeng Jul 21, 2023
0295dfa
fix: some unknown argument bypass
wdzeng Jul 22, 2023
bfda81e
fix: redundant linefeed for `history` command JSON output
wdzeng Jul 22, 2023
7ee0c50
build: add `non-cache` on `apk add` in Dockerfile
wdzeng Jul 23, 2023
1e28a74
docs: state that do not log out after getting cookie in instructions
wdzeng Jul 25, 2023
e231656
Bump to v2.0.0-alpha.2
wdzeng Jul 25, 2023
481c49d
docs: fix `history` command output format instruction
wdzeng Jul 25, 2023
18ef0a9
docs: state that all CLIs in demos are omitting usage of `-v` and `-c`
wdzeng Jul 25, 2023
b883a9c
fix: output color is yellow for command `balance`
wdzeng Jul 25, 2023
83c960d
refact: replace loglevel with our own implementation
wdzeng Jul 25, 2023
74463da
docs: add instruction about reporting issues for v2
wdzeng Jul 28, 2023
7fb0a2f
refact: remove global variables in index.ts
wdzeng Jul 29, 2023
bc4bfea
refact: separate CLI and internal API
wdzeng Jul 29, 2023
e888b3d
build: replace webpack with esbuild
wdzeng Jul 29, 2023
eb842bf
feat: add more error handling about expired cookie
wdzeng Sep 2, 2023
e919e4d
chore: upgrade dependencies and package manager and use nolyfill
wdzeng Sep 2, 2023
4e27ba8
refact: api types
wdzeng Sep 2, 2023
ff611b9
style: update src/cli/index.js concerning process exit styles
wdzeng Sep 2, 2023
217aba4
docs: update README for v2 release
wdzeng Sep 5, 2023
3ac5a7a
feat: replace fetch with axios
wdzeng Sep 5, 2023
8a6948a
chore: update version replacement comment
wdzeng Sep 5, 2023
4b3996f
refact: use @commander-js/extra-typings and split code under cli
wdzeng Sep 5, 2023
3cf17dc
refact: improve error handling
wdzeng Sep 30, 2023
16111e7
chore: upgrade dependencies and default package manager
wdzeng Sep 30, 2023
ff85bc3
ci/cd: merge workflow unittests.yml into publish.yml
wdzeng Sep 30, 2023
5c78944
chore: add fake test script
wdzeng Sep 30, 2023
1f56446
Bump to v2.0.0-alpha.3
wdzeng Sep 30, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions .devcontainer/Dockerfile

This file was deleted.

26 changes: 0 additions & 26 deletions .devcontainer/devcontainer.json

This file was deleted.

2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.eslintrc.cjs
build.cjs
dist
webpack.config.js
16 changes: 12 additions & 4 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
/* eslint-env node */
module.exports = {
root: true,
extends: ['wdzeng', 'wdzeng/typescript', 'plugin:prettier/recommended'],
extends: ['wdzeng/typescript'],
env: {
browser: false,
es2022: true,
node: true
},
parserOptions: {
ecmaVersion: 13,
sourceType: 'module'
sourceType: 'module',
project: './tsconfig.json'
},
rules: {
// Your custom rules go here ...
'prettier/prettier': 'warn'
}
},
overrides: [
{
files: ['src/cli/**/*.ts'],
rules: {
'unicorn/no-process-exit': 'off',
}
}
]
}
60 changes: 31 additions & 29 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,56 +4,60 @@ on:
workflow_dispatch: ~
push:
branches:
- dev
- main
paths:
- src/**
schedule:
- cron: '0 22 * * 1' # 06:00 AM +08:00 every Monday

jobs:
unittests:
uses: ./.github/workflows/unittests.yml
name: Run unittests
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node.js v20
uses: actions/setup-node@v3
with:
node-version: 20
- name: Install pnpm and dependencies
uses: pnpm/action-setup@v2
with:
run_install: true
- name: Run unittests
run: pnpm test

build:
name: Build project and push image to dockerhub and ghcr
name: Build project and push image to Dockerhub and Github Container Registry
if: ${{ (github.event_name == 'push' && github.ref == 'refs/head/main') || github.event_name == 'workflow_dispatch' }}
needs:
- unittests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node.js v20
uses: actions/setup-node@v3
with:
node-version: 20
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
run_install: true
- name: Build project
run: pnpm build
- name: Build kelly image
uses: wdzeng/image@v2
with:
dockerhub-username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub-password: ${{ secrets.DOCKERHUB_TOKEN }}
variant: kelly
platforms: linux/amd64,linux/arm64,linux/arm/v7
build-args: |
BASE_IMAGE=alpine-base
VARIANT=kelly
repo-description: Get Shopee coins everyday
repo-license: MIT
- name: Build regular image
uses: wdzeng/image@v2
- name: Build image
uses: wdzeng/image@v3
with:
dockerhub-username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub-password: ${{ secrets.DOCKERHUB_TOKEN }}
init: false
platforms: linux/amd64,linux/arm64,linux/arm/v7
build-args: |
BASE_IMAGE=alpine-font
VARIANT=''
repo-description: Get Shopee coins everyday
repo-license: MIT

tag:
name: Add tags to repository
if: ${{ github.event_name == 'push' }}
if: ${{ github.event_name == 'push' && github.ref == 'refs/head/main' }}
needs:
- build
runs-on: ubuntu-latest
Expand All @@ -67,8 +71,6 @@ jobs:
run: |
git tag -f ${{ steps.version.outputs.major }} main
git tag -f ${{ steps.version.outputs.minor }} main
git tag -f ${{ steps.version.outputs.version }} main
git push -f origin \
${{ steps.version.outputs.major }} \
${{ steps.version.outputs.minor }} \
${{ steps.version.outputs.version }}
git tag ${{ steps.version.outputs.version }} main
git push -f origin ${{ steps.version.outputs.major }} ${{ steps.version.outputs.minor }}
git push origin ${{ steps.version.outputs.version }}
30 changes: 0 additions & 30 deletions .github/workflows/unittests.yml

This file was deleted.

3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
"semi": false,
"singleQuote": true,
"trailingComma": "none",
"endOfLine": "lf"
"endOfLine": "lf",
"quoteProps": "consistent"
}
21 changes: 3 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,8 @@
ARG BASE_IMAGE
FROM docker.io/node:20.5.0-alpine3.17


FROM alpine:3.17.2 AS alpine-base
RUN apk add --no-cache chromium chromium-chromedriver nodejs tini \
&& adduser -u 1000 -H -D bot
# Replace cdc token to prevent begin detected
RUN sed -i s/cdc_/fan_/g /usr/bin/chromedriver
ENV CHROME_BIN=/usr/bin/chromium-browser CHROME_PATH=/usr/lib/chromium/


FROM alpine-base AS alpine-font
RUN apk add --no-cache font-noto-cjk


FROM ${BASE_IMAGE}
ARG VARIANT
USER bot
COPY dist/index.cjs /app/index.js
RUN apk add --no-cache tini

ENV TZ=Asia/Taipei
ENV IMAGE_VARIANT=${VARIANT}
WORKDIR /app
ENTRYPOINT [ "/sbin/tini", "--", "node", "index.js" ]
Loading