@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.
- package/CHANGELOG.md +100 -80
- package/LICENSE +21 -0
- package/dist/bin.js +96 -77
- package/dist/bin.js.map +3 -3
- package/dist/commands/deploy/DeployService.d.ts +52 -0
- package/dist/commands/deploy/DeployService.d.ts.map +1 -0
- package/dist/commands/deploy/deploy.d.ts +3 -0
- package/dist/commands/deploy/deploy.d.ts.map +1 -0
- package/dist/commands/deploy/index.d.ts +3 -0
- package/dist/commands/deploy/index.d.ts.map +1 -0
- package/dist/commands/deploy/util/FileLock.d.ts +14 -0
- package/dist/commands/deploy/util/FileLock.d.ts.map +1 -0
- package/dist/commands/deploy/util/PromiseUtil.d.ts +14 -0
- package/dist/commands/deploy/util/PromiseUtil.d.ts.map +1 -0
- package/dist/commands/deploy/util/createArchive.d.ts +10 -0
- package/dist/commands/deploy/util/createArchive.d.ts.map +1 -0
- package/dist/commands/deploy/util/execPromise.d.ts +4 -0
- package/dist/commands/deploy/util/execPromise.d.ts.map +1 -0
- package/dist/commands/deploy/util/wait.d.ts +9 -0
- package/dist/commands/deploy/util/wait.d.ts.map +1 -0
- package/dist/commands/esbuild/ESBuildProgram.d.ts.map +1 -1
- package/dist/commands/generate/GenerateProgram.d.ts.map +1 -1
- package/dist/commands/sync/SyncProgram.d.ts.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +2 -2
- package/dist/index.js +2 -2
- package/dist/index.js.map +2 -2
- package/dist/utils/nodeCacheDir.d.ts +2 -0
- package/dist/utils/nodeCacheDir.d.ts.map +1 -0
- package/package.json +73 -66
- package/src/bin.ts +3 -2
- package/src/commands/deploy/DeployService.ts +174 -0
- package/src/commands/deploy/__tests__/DeployService.test.ts +75 -0
- package/src/commands/deploy/__tests__/FileLock.test.ts +27 -0
- package/src/commands/deploy/__tests__/conf.test.ts +29 -0
- package/src/commands/deploy/__tests__/simpleGit.test.ts +34 -0
- package/src/commands/deploy/__tests__/util/deployGhPageWorker.ts +16 -0
- package/src/commands/deploy/deploy.ts +48 -0
- package/src/commands/deploy/index.ts +8 -0
- package/src/commands/deploy/util/FileLock.ts +31 -0
- package/src/commands/deploy/util/PromiseUtil.ts +34 -0
- package/src/commands/deploy/util/createArchive.ts +30 -0
- package/src/commands/deploy/util/execPromise.ts +13 -0
- package/src/commands/deploy/util/wait.ts +23 -0
- package/src/commands/esbuild/ESBuildProgram.ts +1 -1
- package/src/commands/esbuild/__tests__/.temp/getDeps/package.json +1 -0
- package/src/commands/generate/__tests__/.temp/test-cli/CHANGELOG.md +1 -0
- package/src/commands/generate/__tests__/.temp/test-cli/README.md +1 -0
- package/src/commands/generate/__tests__/.temp/test-cli/bin.js +3 -0
- package/src/commands/generate/__tests__/.temp/test-cli/package.json +44 -0
- package/src/commands/generate/__tests__/.temp/test-cli/src/bin.ts +13 -0
- package/src/commands/generate/__tests__/.temp/test-cli/src/index.ts +1 -0
- package/src/commands/generate/__tests__/.temp/test-cli/tsconfig.json +28 -0
- package/src/commands/sync/SyncProgram.ts +15 -41
- package/src/commands/sync/__tests__/SyncProgram.test.ts +13 -1
- package/src/utils/__tests__/nodeCacheDir.test.ts +6 -0
- package/src/utils/nodeCacheDir.ts +54 -0
- package/templates/cli/package.json +4 -10
- package/templates/cli/tsconfig.json +28 -28
- package/templates/lib/package.json +2 -8
- package/templates/lib/tsconfig.json +28 -28
- package/tsconfig.json +34 -34
- package/src/commands/sync/__tests__/.temp/lerna.json +0 -6
- 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
|
-
"
|
26
|
-
"
|
21
|
+
"enquirer": "^2.3.6",
|
22
|
+
"fs-extra": "^10.0.0"
|
27
23
|
},
|
28
24
|
"devDependencies": {
|
29
|
-
"@liuli-util/cli": "
|
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": "
|
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,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
|
-
}
|