ticktick-cli 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +3 -11
  2. package/dist/cli.js +7 -0
  3. package/package.json +3 -7
package/README.md CHANGED
@@ -5,7 +5,7 @@ A TypeScript CLI wrapper for the TickTick Open API documented at:
5
5
  - https://developer.ticktick.com/
6
6
  - https://developer.ticktick.com/docs#/openapi
7
7
 
8
- `v1.0.0` covers the documented OAuth flow plus every documented task and project endpoint.
8
+ `v1.0.2` covers the documented OAuth flow plus every documented task and project endpoint.
9
9
 
10
10
  The CLI is available as both `ticktick` and the short alias `tt`.
11
11
 
@@ -205,20 +205,12 @@ ticktick request POST https://httpbin.org/post --no-auth --json '{"hello":"world
205
205
 
206
206
  ## Development
207
207
 
208
- Run the normal test suite:
208
+ Build the CLI:
209
209
 
210
210
  ```bash
211
- npm test
212
- ```
213
-
214
- Run the enforced coverage check:
215
-
216
- ```bash
217
- npm run coverage
211
+ npm run build
218
212
  ```
219
213
 
220
- `npm run coverage` currently enforces `100%` line, branch, and function coverage on the published runtime files.
221
-
222
214
  ## Notes
223
215
 
224
216
  - The docs currently show `api.ticktick.com` for most endpoints, but `api.dida365.com` in the examples for `task/move`, `task/completed`, and `task/filter`. This CLI defaults to the selected service profile and lets you override base URLs explicitly if your account needs something different.
package/dist/cli.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { Command } from "commander";
2
+ import { pathToFileURL } from "node:url";
2
3
  import { buildAuthorizationUrl, exchangeAuthorizationCode, isLoopbackRedirect, openBrowser, waitForOAuthCode, } from "./auth.js";
3
4
  import { TickTickClient } from "./client.js";
4
5
  import { loadStoredConfig, resolveRuntimeConfig, saveStoredConfig, validateService, } from "./config.js";
@@ -524,3 +525,9 @@ function collectString(value, previous = []) {
524
525
  function collectInteger(value, previous = []) {
525
526
  return [...previous, parseInteger(value)];
526
527
  }
528
+ function isDirectExecution() {
529
+ return Boolean(process.argv[1]) && import.meta.url === pathToFileURL(process.argv[1]).href;
530
+ }
531
+ if (isDirectExecution()) {
532
+ await main();
533
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ticktick-cli",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "CLI wrapper for the TickTick Open API",
5
5
  "type": "module",
6
6
  "files": [
@@ -14,14 +14,10 @@
14
14
  },
15
15
  "scripts": {
16
16
  "build": "npm run clean && tsc -p tsconfig.json",
17
- "build:coverage": "npm run clean:coverage && tsc -p tsconfig.coverage.json",
18
- "check": "npm run coverage",
17
+ "check": "npm run build",
19
18
  "clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",
20
- "clean:coverage": "node -e \"require('node:fs').rmSync('.coverage-dist',{recursive:true,force:true})\"",
21
19
  "dev": "tsx src/cli.ts",
22
- "prepack": "npm run coverage",
23
- "test": "npm run build && node --import tsx --test src/test/*.test.ts",
24
- "coverage": "npm run build:coverage && node --experimental-test-coverage --test-coverage-lines=100 --test-coverage-functions=100 --test-coverage-branches=100 --test-coverage-include=.coverage-dist/*.js --test-coverage-exclude=.coverage-dist/bin.js --test .coverage-dist/test/*.test.js"
20
+ "prepack": "npm run build"
25
21
  },
26
22
  "keywords": [
27
23
  "ticktick",