Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 0 additions & 14 deletions .dockerignore

This file was deleted.

4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ leetcode login -l
2. run the latest code:
```
cd <your local repo>
git pull --rebase origin master
./bin/install // install globally, OR
git pull --rebase origin main
pnpm install
./bin/leetcode <command> // run the command locally
```
-->
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node: [20, 22, 24]
node: [22, 24]
Comment on lines 11 to +14
steps:
- uses: actions/checkout@v4

Expand Down
46 changes: 42 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,15 @@ permissions:
contents: write

jobs:
release:
runs-on: ubuntu-latest
build:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
- os: macos-latest
- os: windows-latest
Comment on lines +15 to +18
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

Expand All @@ -24,14 +31,44 @@ jobs:

- run: pnpm install --frozen-lockfile

- name: build standalone binaries
# pkg compiles node from source for any target without a cached
# binary, which cannot be cross-compiled (arm64 from an x64 host
# fails in openssl's arm_arch.h). Building the native arch only
# avoids that: the host arch is inferred from the runner and pkg
# picks the matching node* target from the config.
- name: build standalone binaries (native arch)
Comment on lines 31 to +39
run: pnpm exec pkg . --out-path dist

- name: checksums
shell: bash
run: |
cd dist
for f in *; do sha256sum "$f" > "$f.sha256"; done

Comment on lines 42 to 47
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: dist-${{ matrix.os }}
path: dist/*

release:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4

- name: download all artifacts
uses: actions/download-artifact@v4
with:
path: dist-all
merge-multiple: true

Comment on lines +63 to +67
- uses: actions/setup-node@v4
with:
node-version: 22

- name: create release
env:
GH_TOKEN: ${{ github.token }}
Expand All @@ -41,6 +78,7 @@ jobs:
echo "tag $TAG already exists, skipping (bump version in package.json for a new release)"
exit 0
fi
gh release create "$TAG" dist/* \
gh release create "$TAG" dist-all/* \
--title "$TAG" \
--generate-notes

7 changes: 2 additions & 5 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
.github/
docs/
test/
.eslintrc.js
eslint.config.js
.gitignore
.travis.yml
Dockerfile
.dockerignore
.nyc_output/
.vscode/
coverage/
coverage/
25 changes: 0 additions & 25 deletions .travis.yml

This file was deleted.

29 changes: 0 additions & 29 deletions 1.js

This file was deleted.

13 changes: 0 additions & 13 deletions Dockerfile

This file was deleted.

13 changes: 0 additions & 13 deletions bin/entrypoint

This file was deleted.

36 changes: 0 additions & 36 deletions bin/install

This file was deleted.

20 changes: 0 additions & 20 deletions bin/pkg

This file was deleted.

25 changes: 0 additions & 25 deletions bin/pkg.bat

This file was deleted.

26 changes: 0 additions & 26 deletions bin/pkg.sh

This file was deleted.

12 changes: 0 additions & 12 deletions icons/ascii.json

This file was deleted.

12 changes: 0 additions & 12 deletions icons/win7.json

This file was deleted.

21 changes: 20 additions & 1 deletion lib/commands/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ var h = require('../helper');
var chalk = require('../chalk');
var log = require('../log');
var cache = require('../cache');
var core = require('../core');
var session = require('../session');
var sprintf = require('../sprintf');

Expand All @@ -19,6 +20,12 @@ const cmd = {
describe: 'Delete cache by keyword',
default: false
})
.option('r', {
alias: 'refresh',
type: 'boolean',
describe: 'Force refresh the problems list from leetcode',
default: false
})
.positional('keyword', {
type: 'string',
describe: 'Cache name or question id',
Expand All @@ -28,13 +35,25 @@ const cmd = {
.example(chalk.yellow('leetcode cache 1'), 'Show cache of question 1')
.example('', '')
.example(chalk.yellow('leetcode cache -d'), 'Delete all cache')
.example(chalk.yellow('leetcode cache 1 -d'), 'Delete cache of question 1');
.example(chalk.yellow('leetcode cache 1 -d'), 'Delete cache of question 1')
.example(chalk.yellow('leetcode cache -r'), 'Force refresh the problems list');
}
};

cmd.handler = function(argv) {
session.argv = argv;

if (argv.refresh) {
// drop the problems cache so the next fetch is a fresh one
cache.del(h.KEYS.problems);
cache.del(h.KEYS.problemsMeta);
core.getProblems(!argv.dontTranslate, function(e, problems) {
if (e) return log.fail(e);
log.info('Problems list refreshed (' + problems.length + ' questions).');
});
return;
}
Comment on lines +46 to +55

const name = argv.keyword;
const isInteger = Number.isInteger(Number(name));

Expand Down
Loading
Loading