@liuli-util/cli 3.14.0 → 3.17.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. package/CHANGELOG.md +100 -80
  2. package/LICENSE +21 -0
  3. package/dist/bin.js +96 -77
  4. package/dist/bin.js.map +3 -3
  5. package/dist/commands/deploy/DeployService.d.ts +52 -0
  6. package/dist/commands/deploy/DeployService.d.ts.map +1 -0
  7. package/dist/commands/deploy/deploy.d.ts +3 -0
  8. package/dist/commands/deploy/deploy.d.ts.map +1 -0
  9. package/dist/commands/deploy/index.d.ts +3 -0
  10. package/dist/commands/deploy/index.d.ts.map +1 -0
  11. package/dist/commands/deploy/util/FileLock.d.ts +14 -0
  12. package/dist/commands/deploy/util/FileLock.d.ts.map +1 -0
  13. package/dist/commands/deploy/util/PromiseUtil.d.ts +14 -0
  14. package/dist/commands/deploy/util/PromiseUtil.d.ts.map +1 -0
  15. package/dist/commands/deploy/util/createArchive.d.ts +10 -0
  16. package/dist/commands/deploy/util/createArchive.d.ts.map +1 -0
  17. package/dist/commands/deploy/util/execPromise.d.ts +4 -0
  18. package/dist/commands/deploy/util/execPromise.d.ts.map +1 -0
  19. package/dist/commands/deploy/util/wait.d.ts +9 -0
  20. package/dist/commands/deploy/util/wait.d.ts.map +1 -0
  21. package/dist/commands/esbuild/ESBuildProgram.d.ts.map +1 -1
  22. package/dist/commands/generate/GenerateProgram.d.ts.map +1 -1
  23. package/dist/commands/sync/SyncProgram.d.ts.map +1 -1
  24. package/dist/index.esm.js +1 -1
  25. package/dist/index.esm.js.map +2 -2
  26. package/dist/index.js +2 -2
  27. package/dist/index.js.map +2 -2
  28. package/dist/utils/nodeCacheDir.d.ts +2 -0
  29. package/dist/utils/nodeCacheDir.d.ts.map +1 -0
  30. package/package.json +73 -66
  31. package/src/bin.ts +3 -2
  32. package/src/commands/deploy/DeployService.ts +174 -0
  33. package/src/commands/deploy/__tests__/DeployService.test.ts +75 -0
  34. package/src/commands/deploy/__tests__/FileLock.test.ts +27 -0
  35. package/src/commands/deploy/__tests__/conf.test.ts +29 -0
  36. package/src/commands/deploy/__tests__/simpleGit.test.ts +34 -0
  37. package/src/commands/deploy/__tests__/util/deployGhPageWorker.ts +16 -0
  38. package/src/commands/deploy/deploy.ts +48 -0
  39. package/src/commands/deploy/index.ts +8 -0
  40. package/src/commands/deploy/util/FileLock.ts +31 -0
  41. package/src/commands/deploy/util/PromiseUtil.ts +34 -0
  42. package/src/commands/deploy/util/createArchive.ts +30 -0
  43. package/src/commands/deploy/util/execPromise.ts +13 -0
  44. package/src/commands/deploy/util/wait.ts +23 -0
  45. package/src/commands/esbuild/ESBuildProgram.ts +1 -1
  46. package/src/commands/esbuild/__tests__/.temp/getDeps/package.json +1 -0
  47. package/src/commands/generate/__tests__/.temp/test-cli/CHANGELOG.md +1 -0
  48. package/src/commands/generate/__tests__/.temp/test-cli/README.md +1 -0
  49. package/src/commands/generate/__tests__/.temp/test-cli/bin.js +3 -0
  50. package/src/commands/generate/__tests__/.temp/test-cli/package.json +44 -0
  51. package/src/commands/generate/__tests__/.temp/test-cli/src/bin.ts +13 -0
  52. package/src/commands/generate/__tests__/.temp/test-cli/src/index.ts +1 -0
  53. package/src/commands/generate/__tests__/.temp/test-cli/tsconfig.json +28 -0
  54. package/src/commands/sync/SyncProgram.ts +15 -41
  55. package/src/commands/sync/__tests__/SyncProgram.test.ts +13 -1
  56. package/src/utils/__tests__/nodeCacheDir.test.ts +6 -0
  57. package/src/utils/nodeCacheDir.ts +54 -0
  58. package/templates/cli/package.json +4 -10
  59. package/templates/cli/tsconfig.json +28 -28
  60. package/templates/lib/package.json +2 -8
  61. package/templates/lib/tsconfig.json +28 -28
  62. package/tsconfig.json +34 -34
  63. package/src/commands/sync/__tests__/.temp/lerna.json +0 -6
  64. package/src/commands/sync/__tests__/.temp/package.json +0 -58
@@ -0,0 +1,54 @@
1
+ /*
2
+ copy by https://github.com/LinusU/node-cachedir
3
+ */
4
+ import * as os from 'os'
5
+ import * as path from 'path'
6
+
7
+ function posix(id: string) {
8
+ const cacheHome = process.env.XDG_CACHE_HOME || path.join(os.homedir(), '.cache')
9
+ return path.join(cacheHome, id)
10
+ }
11
+
12
+ function darwin(id: string) {
13
+ return path.join(os.homedir(), 'Library', 'Caches', id)
14
+ }
15
+
16
+ function win32(id: string) {
17
+ const appData = process.env.LOCALAPPDATA || path.join(os.homedir(), 'AppData', 'Local')
18
+ return path.join(appData, id, 'Cache')
19
+ }
20
+
21
+ const implementation = (function () {
22
+ switch (os.platform()) {
23
+ case 'darwin':
24
+ return darwin
25
+ case 'win32':
26
+ return win32
27
+ case 'aix':
28
+ case 'android':
29
+ case 'freebsd':
30
+ case 'linux':
31
+ case 'netbsd':
32
+ case 'openbsd':
33
+ case 'sunos':
34
+ return posix
35
+ default:
36
+ console.error(
37
+ `(node:${
38
+ process.pid
39
+ }) [cachedir] Warning: the platform "${os.platform()}" is not currently supported by node-cachedir, falling back to "posix". Please file an issue with your platform here: https://github.com/LinusU/node-cachedir/issues/new`,
40
+ )
41
+ return posix
42
+ }
43
+ })()
44
+
45
+ export function nodeCacheDir(id: string): string {
46
+ if (id.length === 0) {
47
+ throw new Error('id cannot be empty')
48
+ }
49
+ if (/[^0-9a-zA-Z-]/.test(id)) {
50
+ throw new Error('id cannot contain special characters')
51
+ }
52
+
53
+ return implementation(id)
54
+ }
@@ -8,11 +8,7 @@
8
8
  "scripts": {
9
9
  "build": "rimraf dist && liuli-cli build cli",
10
10
  "dev": "liuli-cli build cli -w",
11
- "start": "esno src/bin.ts",
12
- "docs:server": "live-server docs",
13
- "docs:dev": "typedoc --watch",
14
- "docs:build": "rimraf docs && typedoc",
15
- "docs:deploy": "yarn docs:build && gh-pages -d docs/ -e / -a"
11
+ "start": "esno src/bin.ts"
16
12
  },
17
13
  "bin": {
18
14
  "cli-name": "./bin.js"
@@ -22,23 +18,21 @@
22
18
  },
23
19
  "dependencies": {
24
20
  "commander": "^8.2.0",
25
- "fs-extra": "^10.0.0",
26
- "inquirer": "^8.1.5"
21
+ "enquirer": "^2.3.6",
22
+ "fs-extra": "^10.0.0"
27
23
  },
28
24
  "devDependencies": {
29
- "@liuli-util/cli": "^3.11.1",
25
+ "@liuli-util/cli": "workspace:*",
30
26
  "@types/fs-extra": "^9.0.13",
31
27
  "@types/inquirer": "^8.1.2",
32
28
  "@types/jest": "^27.0.2",
33
29
  "@types/lodash": "^4.14.173",
34
30
  "@types/node": "^16.9.6",
35
31
  "esno": "^0.9.1",
36
- "gh-pages": "^3.2.3",
37
32
  "jest": "^27.2.1",
38
33
  "rimraf": "^3.0.2",
39
34
  "ts-jest": "^27.0.5",
40
35
  "type-fest": "^2.3.4",
41
- "typedoc": "^0.22.4",
42
36
  "typescript": "^4.4.3"
43
37
  }
44
38
  }
@@ -1,28 +1,28 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ESNext",
4
- "lib": [
5
- "ESNext"
6
- ],
7
- "outDir": "./dist",
8
- "skipLibCheck": true,
9
- "esModuleInterop": true,
10
- "strict": true,
11
- "module": "ESNext",
12
- "moduleResolution": "node",
13
- "sourceMap": true,
14
- "declaration": true,
15
- "declarationMap": true
16
- },
17
- "include": [
18
- "src"
19
- ],
20
- "typedocOptions": {
21
- "entryPoints": [
22
- "src/index.ts"
23
- ],
24
- "out": "docs",
25
- "readme": "README.md",
26
- "gitRemote": "origin"
27
- }
28
- }
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ESNext",
4
+ "lib": [
5
+ "ESNext"
6
+ ],
7
+ "outDir": "./dist",
8
+ "skipLibCheck": true,
9
+ "esModuleInterop": true,
10
+ "strict": true,
11
+ "module": "ESNext",
12
+ "moduleResolution": "node",
13
+ "sourceMap": true,
14
+ "declaration": true,
15
+ "declarationMap": true
16
+ },
17
+ "include": [
18
+ "src"
19
+ ],
20
+ "typedocOptions": {
21
+ "entryPoints": [
22
+ "src/index.ts"
23
+ ],
24
+ "out": "docs",
25
+ "readme": "README.md",
26
+ "gitRemote": "origin"
27
+ }
28
+ }
@@ -8,25 +8,19 @@
8
8
  "license": "MIT",
9
9
  "scripts": {
10
10
  "build": "rimraf dist && liuli-cli build pkg",
11
- "dev": "liuli-cli build pkg -w",
12
- "docs:server": "live-server docs",
13
- "docs:dev": "typedoc --watch",
14
- "docs:build": "rimraf docs && typedoc",
15
- "docs:deploy": "yarn docs:build && gh-pages -d docs/ -e / -a"
11
+ "dev": "liuli-cli build pkg -w"
16
12
  },
17
13
  "jest": {
18
14
  "preset": "ts-jest"
19
15
  },
20
16
  "devDependencies": {
21
- "@liuli-util/cli": "^3.11.1",
17
+ "@liuli-util/cli": "workspace:*",
22
18
  "@types/jest": "^27.0.2",
23
19
  "esno": "^0.9.1",
24
- "gh-pages": "^3.2.3",
25
20
  "jest": "^27.2.1",
26
21
  "rimraf": "^3.0.2",
27
22
  "ts-jest": "^27.0.5",
28
23
  "type-fest": "^2.3.4",
29
- "typedoc": "^0.22.4",
30
24
  "typescript": "^4.4.3"
31
25
  }
32
26
  }
@@ -1,28 +1,28 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ESNext",
4
- "lib": [
5
- "ESNext"
6
- ],
7
- "outDir": "./dist",
8
- "skipLibCheck": true,
9
- "esModuleInterop": true,
10
- "strict": true,
11
- "module": "ESNext",
12
- "moduleResolution": "node",
13
- "sourceMap": true,
14
- "declaration": true,
15
- "declarationMap": true
16
- },
17
- "include": [
18
- "src"
19
- ],
20
- "typedocOptions": {
21
- "entryPoints": [
22
- "src/index.ts"
23
- ],
24
- "out": "docs",
25
- "readme": "README.md",
26
- "gitRemote": "origin"
27
- }
28
- }
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ESNext",
4
+ "lib": [
5
+ "ESNext"
6
+ ],
7
+ "outDir": "./dist",
8
+ "skipLibCheck": true,
9
+ "esModuleInterop": true,
10
+ "strict": true,
11
+ "module": "ESNext",
12
+ "moduleResolution": "node",
13
+ "sourceMap": true,
14
+ "declaration": true,
15
+ "declarationMap": true
16
+ },
17
+ "include": [
18
+ "src"
19
+ ],
20
+ "typedocOptions": {
21
+ "entryPoints": [
22
+ "src/index.ts"
23
+ ],
24
+ "out": "docs",
25
+ "readme": "README.md",
26
+ "gitRemote": "origin"
27
+ }
28
+ }
package/tsconfig.json CHANGED
@@ -1,34 +1,34 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ESNext",
4
- "lib": [
5
- "ESNext"
6
- ],
7
- "outDir": "./dist",
8
- "skipLibCheck": true,
9
- "esModuleInterop": true,
10
- "strict": true,
11
- "module": "ESNext",
12
- "moduleResolution": "node",
13
- "sourceMap": true,
14
- "declaration": true,
15
- "declarationMap": true,
16
- "resolveJsonModule": true
17
- },
18
- "include": [
19
- "src"
20
- ],
21
- "typedocOptions": {
22
- "entryPoints": [
23
- "src/index.ts"
24
- ],
25
- "out": "docs",
26
- "readme": "README.md",
27
- "gitRemote": "origin"
28
- },
29
- "ts-node": {
30
- "compilerOptions": {
31
- "module": "CommonJS"
32
- }
33
- }
34
- }
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ESNext",
4
+ "lib": [
5
+ "ESNext"
6
+ ],
7
+ "outDir": "./dist",
8
+ "skipLibCheck": true,
9
+ "esModuleInterop": true,
10
+ "strict": true,
11
+ "module": "ESNext",
12
+ "moduleResolution": "node",
13
+ "sourceMap": true,
14
+ "declaration": true,
15
+ "declarationMap": true,
16
+ "resolveJsonModule": true
17
+ },
18
+ "include": [
19
+ "src"
20
+ ],
21
+ "typedocOptions": {
22
+ "entryPoints": [
23
+ "src/index.ts"
24
+ ],
25
+ "out": "docs",
26
+ "readme": "README.md",
27
+ "gitRemote": "origin"
28
+ },
29
+ "ts-node": {
30
+ "compilerOptions": {
31
+ "module": "CommonJS"
32
+ }
33
+ }
34
+ }
@@ -1,6 +0,0 @@
1
- {
2
- "packages": [
3
- "packages/common/*",
4
- "apps/*"
5
- ]
6
- }
@@ -1,58 +0,0 @@
1
- {
2
- "name": "temp",
3
- "license": "mit",
4
- "private": true,
5
- "sync": [
6
- "prettier",
7
- "commitlint",
8
- "workspaces",
9
- "gitignore",
10
- "simplehooks",
11
- "eslint-ts",
12
- "jest"
13
- ],
14
- "workspaces": [
15
- "packages/common/*",
16
- "apps/*"
17
- ],
18
- "prettier": "@liuli-util/prettier-standard-config",
19
- "devDependencies": {
20
- "prettier": "^2.3.2",
21
- "@liuli-util/prettier-standard-config": "^0.1.0",
22
- "@commitlint/cli": "^12.1.4",
23
- "@liuli-util/commitlint-standard-config": "^0.1.6",
24
- "@liuli-util/eslint-config-ts": "^0.2.0",
25
- "simple-git-hooks": "^2.5.1",
26
- "lint-staged": "^11.1.1"
27
- },
28
- "simple-git-hooks": {
29
- "commit-msg": "yarn commitlint --edit $1",
30
- "pre-commit": "yarn lint-staged"
31
- },
32
- "commitlint": {
33
- "extends": [
34
- "@liuli-util/commitlint-standard-config"
35
- ]
36
- },
37
- "eslintConfig": {
38
- "extends": [
39
- "@liuli-util/eslint-config-ts"
40
- ]
41
- },
42
- "jest": {
43
- "preset": "ts-jest",
44
- "testMatch": [
45
- "<rootDir>/src/**/__tests__/*.test.ts"
46
- ]
47
- },
48
- "scripts": {
49
- "postinstall": "npx simple-git-hooks"
50
- },
51
- "lint-staged": {
52
- "*.{ts,tsx,js,jsx,css,vue}": [
53
- "prettier --write",
54
- "eslint --fix",
55
- "git add"
56
- ]
57
- }
58
- }