jiek 2.0.1 → 2.0.2-alpha.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.
- package/dist/cli-only-build.cjs +18 -60
- package/dist/cli-only-build.js +18 -60
- package/dist/cli.cjs +230 -480
- package/dist/cli.d.cts +0 -53
- package/dist/cli.d.ts +0 -53
- package/dist/cli.js +229 -478
- package/dist/index.d.cts +0 -53
- package/dist/index.d.ts +0 -53
- package/dist/package.json +125 -0
- package/dist/rollup/index.cjs +2 -2
- package/dist/rollup/index.js +2 -2
- package/package.json +7 -36
- package/src/cli.ts +0 -1
- package/src/commands/build.ts +19 -22
- package/src/commands/publish.ts +48 -10
- package/src/rollup/index.ts +2 -2
- package/src/commands/init.ts +0 -373
package/dist/index.d.cts
CHANGED
@@ -90,59 +90,6 @@ declare module 'jiek' {
|
|
90
90
|
}
|
91
91
|
}
|
92
92
|
|
93
|
-
declare module 'jiek' {
|
94
|
-
type InitNamedFunction = (argument: string, paths: {
|
95
|
-
full: string;
|
96
|
-
relative: string;
|
97
|
-
basename?: string;
|
98
|
-
}) => [name?: string, path?: string];
|
99
|
-
type InitNamed = InitNamedFunction | {
|
100
|
-
[key: string]: string | InitNamedFunction;
|
101
|
-
};
|
102
|
-
interface Config {
|
103
|
-
init?: {
|
104
|
-
/**
|
105
|
-
* the package.json template file path or file content
|
106
|
-
*
|
107
|
-
* if it can be parsed as json, it will be parsed
|
108
|
-
* if it is a relative file path, it will be resolved to an absolute path based on the current working directory
|
109
|
-
* if it is an absolute file path, it will be used directly
|
110
|
-
* @default '.jiek.template.package.json'
|
111
|
-
*/
|
112
|
-
template?: string;
|
113
|
-
/**
|
114
|
-
* the readme content
|
115
|
-
*
|
116
|
-
* $name will be replaced with the package name
|
117
|
-
* $license will be replaced with the license
|
118
|
-
*/
|
119
|
-
readme?: string | ((ctx: {
|
120
|
-
dir: string;
|
121
|
-
packageJson: Record<string, any>;
|
122
|
-
}) => string);
|
123
|
-
/**
|
124
|
-
* the readme template file path
|
125
|
-
* @default '.jiek.template.readme.md'
|
126
|
-
*/
|
127
|
-
readmeTemplate?: string;
|
128
|
-
bug?: {
|
129
|
-
/**
|
130
|
-
* @default 'bug_report.yml'
|
131
|
-
*/
|
132
|
-
template?: string;
|
133
|
-
/**
|
134
|
-
* @default ['bug']
|
135
|
-
*/
|
136
|
-
labels?: string[] | ((ctx: {
|
137
|
-
name: string;
|
138
|
-
dir: string;
|
139
|
-
}) => string[]);
|
140
|
-
};
|
141
|
-
named?: InitNamed;
|
142
|
-
};
|
143
|
-
}
|
144
|
-
}
|
145
|
-
|
146
93
|
declare module 'jiek' {
|
147
94
|
interface Config {
|
148
95
|
publish?: {
|
package/dist/index.d.ts
CHANGED
@@ -90,59 +90,6 @@ declare module 'jiek' {
|
|
90
90
|
}
|
91
91
|
}
|
92
92
|
|
93
|
-
declare module 'jiek' {
|
94
|
-
type InitNamedFunction = (argument: string, paths: {
|
95
|
-
full: string;
|
96
|
-
relative: string;
|
97
|
-
basename?: string;
|
98
|
-
}) => [name?: string, path?: string];
|
99
|
-
type InitNamed = InitNamedFunction | {
|
100
|
-
[key: string]: string | InitNamedFunction;
|
101
|
-
};
|
102
|
-
interface Config {
|
103
|
-
init?: {
|
104
|
-
/**
|
105
|
-
* the package.json template file path or file content
|
106
|
-
*
|
107
|
-
* if it can be parsed as json, it will be parsed
|
108
|
-
* if it is a relative file path, it will be resolved to an absolute path based on the current working directory
|
109
|
-
* if it is an absolute file path, it will be used directly
|
110
|
-
* @default '.jiek.template.package.json'
|
111
|
-
*/
|
112
|
-
template?: string;
|
113
|
-
/**
|
114
|
-
* the readme content
|
115
|
-
*
|
116
|
-
* $name will be replaced with the package name
|
117
|
-
* $license will be replaced with the license
|
118
|
-
*/
|
119
|
-
readme?: string | ((ctx: {
|
120
|
-
dir: string;
|
121
|
-
packageJson: Record<string, any>;
|
122
|
-
}) => string);
|
123
|
-
/**
|
124
|
-
* the readme template file path
|
125
|
-
* @default '.jiek.template.readme.md'
|
126
|
-
*/
|
127
|
-
readmeTemplate?: string;
|
128
|
-
bug?: {
|
129
|
-
/**
|
130
|
-
* @default 'bug_report.yml'
|
131
|
-
*/
|
132
|
-
template?: string;
|
133
|
-
/**
|
134
|
-
* @default ['bug']
|
135
|
-
*/
|
136
|
-
labels?: string[] | ((ctx: {
|
137
|
-
name: string;
|
138
|
-
dir: string;
|
139
|
-
}) => string[]);
|
140
|
-
};
|
141
|
-
named?: InitNamed;
|
142
|
-
};
|
143
|
-
}
|
144
|
-
}
|
145
|
-
|
146
93
|
declare module 'jiek' {
|
147
94
|
interface Config {
|
148
95
|
publish?: {
|
@@ -0,0 +1,125 @@
|
|
1
|
+
{
|
2
|
+
"name": "jiek",
|
3
|
+
"type": "module",
|
4
|
+
"version": "2.0.2-alpha.2",
|
5
|
+
"description": "A lightweight toolkit for compiling and managing libraries based on `package.json` metadata and suitable for `Monorepo`.",
|
6
|
+
"author": "YiJie <yijie4188@gmail.com>",
|
7
|
+
"repository": {
|
8
|
+
"url": "nwylzw/jiek",
|
9
|
+
"directory": "packages/jiek"
|
10
|
+
},
|
11
|
+
"homepage": "https://github.com/NWYLZW/jiek/tree/master/packages/jiek#readme",
|
12
|
+
"bugs": "https://github.com/NWYLZW/jiek/issues?q=is%3Aissue+is%3Aopen+jiek",
|
13
|
+
"bin": {
|
14
|
+
"jiek": "bin/jiek.js",
|
15
|
+
"jk": "bin/jiek.js",
|
16
|
+
"jiek-build": "bin/jiek-build.js",
|
17
|
+
"jb": "bin/jiek-build.js"
|
18
|
+
},
|
19
|
+
"files": ["dist", "src", "bin", "LICENSE", "README.md"],
|
20
|
+
"scripts": {
|
21
|
+
"prepublish": "jb -nm -nc"
|
22
|
+
},
|
23
|
+
"exports": {
|
24
|
+
"./package.json": "./package.json",
|
25
|
+
".": "./src/index.ts",
|
26
|
+
"./cli": "./src/cli.ts",
|
27
|
+
"./cli-only-build": "./src/cli-only-build.ts",
|
28
|
+
"./rollup": "./src/rollup/index.ts"
|
29
|
+
},
|
30
|
+
"imports": {
|
31
|
+
"#~/*": "./src/*"
|
32
|
+
},
|
33
|
+
"dependencies": {
|
34
|
+
"@jiek/pkger": "workspace:^",
|
35
|
+
"@jiek/rollup-plugin-dts": "^6.2.1",
|
36
|
+
"@jiek/utils": "workspace:^",
|
37
|
+
"@inquirer/prompts": "^7.1.0",
|
38
|
+
"@rollup/plugin-commonjs": "^28.0.0",
|
39
|
+
"@rollup/plugin-json": "^6.0.1",
|
40
|
+
"@rollup/plugin-node-resolve": "^15.3.0",
|
41
|
+
"cli-progress": "^3.12.0",
|
42
|
+
"commander": "^12.0.0",
|
43
|
+
"detect-indent": "^6.1.0",
|
44
|
+
"execa": "9.3.1",
|
45
|
+
"js-yaml": "^4.1.0",
|
46
|
+
"jsonc-parser": "^3.2.1",
|
47
|
+
"rollup": "4.13.2"
|
48
|
+
},
|
49
|
+
"peerDependencies": {
|
50
|
+
"@rollup/plugin-terser": "^0.4.4",
|
51
|
+
"@pnpm/filter-workspace-packages": "^7.2.13",
|
52
|
+
"esbuild-register": "^3.5.0",
|
53
|
+
"postcss": "^8.4.47",
|
54
|
+
"rollup-plugin-postcss": "^4.0.2",
|
55
|
+
"rollup-plugin-esbuild": "^6.1.0",
|
56
|
+
"rollup-plugin-swc3": "^0.12.1",
|
57
|
+
"typescript": "^4.0.0||^5.0.0"
|
58
|
+
},
|
59
|
+
"peerDependenciesMeta": {
|
60
|
+
"@rollup/plugin-terser": { "optional": true },
|
61
|
+
"@pnpm/filter-workspace-packages": { "optional": true },
|
62
|
+
"esbuild-register": { "optional": true },
|
63
|
+
"postcss": { "optional": true },
|
64
|
+
"rollup-plugin-postcss": { "optional": true },
|
65
|
+
"rollup-plugin-esbuild": { "optional": true },
|
66
|
+
"rollup-plugin-swc3": { "optional": true },
|
67
|
+
"typescript": { "optional": true }
|
68
|
+
},
|
69
|
+
"devDependencies": {
|
70
|
+
"@npm/types": "^1.0.2",
|
71
|
+
"@pnpm/filter-workspace-packages": "^7.2.13",
|
72
|
+
"@pnpm/workspace.pkgs-graph": "^2.0.15",
|
73
|
+
"@rollup/plugin-terser": "^0.4.4",
|
74
|
+
"@types/cli-progress": "^3.11.5",
|
75
|
+
"@types/inquirer": "^9.0.7",
|
76
|
+
"@types/js-yaml": "^4.0.9",
|
77
|
+
"@types/micromatch": "^4.0.6",
|
78
|
+
"esbuild-register": "^3.5.0",
|
79
|
+
"micromatch": "^4.0.5",
|
80
|
+
"node-sass": "^9.0.0",
|
81
|
+
"postcss": "^8.4.47",
|
82
|
+
"rollup-plugin-postcss": "^4.0.2",
|
83
|
+
"rollup-plugin-esbuild": "^6.1.0",
|
84
|
+
"rollup-plugin-swc3": "^0.12.1"
|
85
|
+
},
|
86
|
+
"publishConfig": {
|
87
|
+
"exports": {
|
88
|
+
"./package.json": "./package.json",
|
89
|
+
".": {
|
90
|
+
"source": "./src/index.ts",
|
91
|
+
"require": "./dist/index.cjs",
|
92
|
+
"default": "./dist/index.js"
|
93
|
+
},
|
94
|
+
"./cli": {
|
95
|
+
"source": "./src/cli.ts",
|
96
|
+
"require": "./dist/cli.cjs",
|
97
|
+
"default": "./dist/cli.js"
|
98
|
+
},
|
99
|
+
"./cli-only-build": {
|
100
|
+
"source": "./src/cli-only-build.ts",
|
101
|
+
"require": "./dist/cli-only-build.cjs",
|
102
|
+
"default": "./dist/cli-only-build.js"
|
103
|
+
},
|
104
|
+
"./rollup": {
|
105
|
+
"source": "./src/rollup/index.ts",
|
106
|
+
"require": "./dist/rollup/index.cjs",
|
107
|
+
"default": "./dist/rollup/index.js"
|
108
|
+
}
|
109
|
+
},
|
110
|
+
"main": "./dist/index.cjs",
|
111
|
+
"module": "./dist/index.js",
|
112
|
+
"typesVersions": {
|
113
|
+
"<5.0": {
|
114
|
+
"*": [
|
115
|
+
"*",
|
116
|
+
"./dist/*",
|
117
|
+
"./dist/*/index.d.ts",
|
118
|
+
"./dist/*/index.d.mts",
|
119
|
+
"./dist/*/index.d.cts"
|
120
|
+
]
|
121
|
+
}
|
122
|
+
},
|
123
|
+
"directory": "./dist"
|
124
|
+
}
|
125
|
+
}
|
package/dist/rollup/index.cjs
CHANGED
@@ -4503,7 +4503,7 @@ const {
|
|
4503
4503
|
JIEK_WITHOUT_DTS,
|
4504
4504
|
JIEK_WITHOUT_MINIFY,
|
4505
4505
|
JIEK_MINIFY_TYPE,
|
4506
|
-
|
4506
|
+
JIEK_CLEAN,
|
4507
4507
|
JIEK_ONLY_MINIFY,
|
4508
4508
|
JIEK_TSCONFIG,
|
4509
4509
|
JIEK_DTSCONFIG
|
@@ -4527,7 +4527,7 @@ const WITHOUT_JS = JIEK_WITHOUT_JS === "true";
|
|
4527
4527
|
const WITHOUT_DTS = JIEK_WITHOUT_DTS === "true";
|
4528
4528
|
const WITHOUT_MINIFY = JIEK_WITHOUT_MINIFY === "true";
|
4529
4529
|
const ONLY_MINIFY = JIEK_ONLY_MINIFY === "true";
|
4530
|
-
const CLEAN =
|
4530
|
+
const CLEAN = JIEK_CLEAN === "true";
|
4531
4531
|
const MINIFY_DEFAULT_VALUE = WITHOUT_MINIFY ? false : ONLY_MINIFY ? "only-minify" : true;
|
4532
4532
|
const BUILDER_OPTIONS = {
|
4533
4533
|
type: JIEK_BUILDER ?? "esbuild"
|
package/dist/rollup/index.js
CHANGED
@@ -4490,7 +4490,7 @@ const {
|
|
4490
4490
|
JIEK_WITHOUT_DTS,
|
4491
4491
|
JIEK_WITHOUT_MINIFY,
|
4492
4492
|
JIEK_MINIFY_TYPE,
|
4493
|
-
|
4493
|
+
JIEK_CLEAN,
|
4494
4494
|
JIEK_ONLY_MINIFY,
|
4495
4495
|
JIEK_TSCONFIG,
|
4496
4496
|
JIEK_DTSCONFIG
|
@@ -4514,7 +4514,7 @@ const WITHOUT_JS = JIEK_WITHOUT_JS === "true";
|
|
4514
4514
|
const WITHOUT_DTS = JIEK_WITHOUT_DTS === "true";
|
4515
4515
|
const WITHOUT_MINIFY = JIEK_WITHOUT_MINIFY === "true";
|
4516
4516
|
const ONLY_MINIFY = JIEK_ONLY_MINIFY === "true";
|
4517
|
-
const CLEAN =
|
4517
|
+
const CLEAN = JIEK_CLEAN === "true";
|
4518
4518
|
const MINIFY_DEFAULT_VALUE = WITHOUT_MINIFY ? false : ONLY_MINIFY ? "only-minify" : true;
|
4519
4519
|
const BUILDER_OPTIONS = {
|
4520
4520
|
type: JIEK_BUILDER ?? "esbuild"
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "jiek",
|
3
3
|
"type": "module",
|
4
|
-
"version": "2.0.
|
4
|
+
"version": "2.0.2-alpha.2",
|
5
5
|
"description": "A lightweight toolkit for compiling and managing libraries based on `package.json` metadata and suitable for `Monorepo`.",
|
6
6
|
"author": "YiJie <yijie4188@gmail.com>",
|
7
7
|
"repository": {
|
@@ -25,32 +25,17 @@
|
|
25
25
|
],
|
26
26
|
"exports": {
|
27
27
|
"./package.json": "./package.json",
|
28
|
-
".":
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
},
|
33
|
-
"./cli": {
|
34
|
-
"source": "./src/cli.ts",
|
35
|
-
"require": "./dist/cli.cjs",
|
36
|
-
"default": "./dist/cli.js"
|
37
|
-
},
|
38
|
-
"./cli-only-build": {
|
39
|
-
"source": "./src/cli-only-build.ts",
|
40
|
-
"require": "./dist/cli-only-build.cjs",
|
41
|
-
"default": "./dist/cli-only-build.js"
|
42
|
-
},
|
43
|
-
"./rollup": {
|
44
|
-
"source": "./src/rollup/index.ts",
|
45
|
-
"require": "./dist/rollup/index.cjs",
|
46
|
-
"default": "./dist/rollup/index.js"
|
47
|
-
}
|
28
|
+
".": "./src/index.ts",
|
29
|
+
"./cli": "./src/cli.ts",
|
30
|
+
"./cli-only-build": "./src/cli-only-build.ts",
|
31
|
+
"./rollup": "./src/rollup/index.ts"
|
48
32
|
},
|
49
33
|
"imports": {
|
50
34
|
"#~/*": "./src/*"
|
51
35
|
},
|
52
36
|
"dependencies": {
|
53
37
|
"@jiek/rollup-plugin-dts": "^6.2.1",
|
38
|
+
"@inquirer/prompts": "^7.1.0",
|
54
39
|
"@rollup/plugin-commonjs": "^28.0.0",
|
55
40
|
"@rollup/plugin-json": "^6.0.1",
|
56
41
|
"@rollup/plugin-node-resolve": "^15.3.0",
|
@@ -58,7 +43,6 @@
|
|
58
43
|
"commander": "^12.0.0",
|
59
44
|
"detect-indent": "^6.1.0",
|
60
45
|
"execa": "9.3.1",
|
61
|
-
"inquirer": "^8.2.6",
|
62
46
|
"js-yaml": "^4.1.0",
|
63
47
|
"jsonc-parser": "^3.2.1",
|
64
48
|
"rollup": "4.13.2",
|
@@ -119,19 +103,6 @@
|
|
119
103
|
"rollup-plugin-swc3": "^0.12.1"
|
120
104
|
},
|
121
105
|
"scripts": {
|
122
|
-
"prepublish": "jb
|
123
|
-
},
|
124
|
-
"main": "./dist/index.cjs",
|
125
|
-
"module": "./dist/index.js",
|
126
|
-
"typesVersions": {
|
127
|
-
"<5.0": {
|
128
|
-
"*": [
|
129
|
-
"*",
|
130
|
-
"./dist/*",
|
131
|
-
"./dist/*/index.d.ts",
|
132
|
-
"./dist/*/index.d.mts",
|
133
|
-
"./dist/*/index.d.cts"
|
134
|
-
]
|
135
|
-
}
|
106
|
+
"prepublish": "jb -nm -nc"
|
136
107
|
}
|
137
108
|
}
|
package/src/cli.ts
CHANGED
package/src/commands/build.ts
CHANGED
@@ -2,6 +2,7 @@ import fs from 'node:fs'
|
|
2
2
|
import { createRequire } from 'node:module'
|
3
3
|
import path from 'node:path'
|
4
4
|
|
5
|
+
import { confirm } from '@inquirer/prompts'
|
5
6
|
import { MultiBar, Presets } from 'cli-progress'
|
6
7
|
import { program } from 'commander'
|
7
8
|
import { execaCommand } from 'execa'
|
@@ -40,7 +41,7 @@ const isDefault = process.env.JIEK_IS_ONLY_BUILD === 'true'
|
|
40
41
|
|
41
42
|
const description = `
|
42
43
|
Build the package according to the 'exports' field from the package.json.
|
43
|
-
If you want to
|
44
|
+
If you want to through the options to the \`rollup\` command, you can pass the options after '--'.
|
44
45
|
${isDefault ? 'This command is the default command.' : ''}
|
45
46
|
`.trim()
|
46
47
|
|
@@ -100,12 +101,13 @@ async function checkDependency(dependency: string) {
|
|
100
101
|
require.resolve(dependency)
|
101
102
|
} catch (e) {
|
102
103
|
console.error(`The package '${dependency}' is not installed, please install it first.`)
|
103
|
-
const answer = prompt('Do you want to install it now? (Y/n)', 'Y')
|
104
104
|
const { notWorkspace } = getWD()
|
105
|
-
|
106
|
-
|
105
|
+
const command = `pnpm install -${notWorkspace ? '' : 'w'}D ${dependency}`
|
106
|
+
if (await confirm({ message: 'Do you want to install it now?' })) {
|
107
|
+
await execaCommand(command)
|
107
108
|
} else {
|
108
|
-
|
109
|
+
console.warn(`You can run the command '${command}' to install it manually.`)
|
110
|
+
process.exit(1)
|
109
111
|
}
|
110
112
|
}
|
111
113
|
}
|
@@ -137,24 +139,19 @@ If you pass the --entries option, it will merge into the entries of the command.
|
|
137
139
|
`.trim()
|
138
140
|
|
139
141
|
const command = isDefault
|
140
|
-
?
|
141
|
-
|
142
|
-
|
142
|
+
? (() => {
|
143
|
+
const c = program
|
144
|
+
.name('jb/jiek-build')
|
145
|
+
.helpCommand(false)
|
146
|
+
if (IS_WORKSPACE) {
|
147
|
+
c.argument('[filters]', buildFilterDescription)
|
148
|
+
} else {
|
149
|
+
c.argument('[entries]', buildEntriesDescription)
|
150
|
+
}
|
151
|
+
return c
|
152
|
+
})()
|
143
153
|
: program
|
144
|
-
|
145
|
-
if (IS_WORKSPACE) {
|
146
|
-
if (isDefault) {
|
147
|
-
command.argument('[filters]', buildFilterDescription)
|
148
|
-
} else {
|
149
|
-
command.command('build [filters]')
|
150
|
-
}
|
151
|
-
} else {
|
152
|
-
if (isDefault) {
|
153
|
-
command.argument('[entries]', buildEntriesDescription)
|
154
|
-
} else {
|
155
|
-
command.command('build [entries]')
|
156
|
-
}
|
157
|
-
}
|
154
|
+
.command(`build [${IS_WORKSPACE ? 'filters' : 'entries'}]`)
|
158
155
|
|
159
156
|
command
|
160
157
|
.description(description)
|
package/src/commands/publish.ts
CHANGED
@@ -28,8 +28,14 @@ declare module 'jiek' {
|
|
28
28
|
}
|
29
29
|
}
|
30
30
|
|
31
|
+
const description = `
|
32
|
+
Publish package to npm registry, and auto generate exports field and other fields in published package.json.
|
33
|
+
If you want to through the options to the \`pnpm publish\` command, you can pass the options after '--'.
|
34
|
+
`.trim()
|
35
|
+
|
31
36
|
program
|
32
37
|
.command('publish')
|
38
|
+
.description(description)
|
33
39
|
.aliases(['pub', 'p'])
|
34
40
|
.option('-b, --bumper <bumper>', 'bump version', 'patch')
|
35
41
|
.option('-no-b, --no-bumper', 'no bump version')
|
@@ -42,6 +48,21 @@ program
|
|
42
48
|
silent?: boolean
|
43
49
|
bumper: false | BumperType
|
44
50
|
}) => {
|
51
|
+
let shouldPassThrough = false
|
52
|
+
|
53
|
+
const passThroughOptions = process.argv
|
54
|
+
.reduce(
|
55
|
+
(acc, value) => {
|
56
|
+
if (shouldPassThrough) {
|
57
|
+
acc.push(value)
|
58
|
+
}
|
59
|
+
if (value === '--') {
|
60
|
+
shouldPassThrough = true
|
61
|
+
}
|
62
|
+
return acc
|
63
|
+
},
|
64
|
+
[] as string[]
|
65
|
+
)
|
45
66
|
actionRestore()
|
46
67
|
|
47
68
|
const { value = {} } = await getSelectedProjectsGraph() ?? {}
|
@@ -83,7 +104,9 @@ program
|
|
83
104
|
return acc
|
84
105
|
}, [] as string[])
|
85
106
|
for (const [dir, manifest, resolvedOutdir] of manifests) {
|
86
|
-
const
|
107
|
+
const resolveByDir = (...paths: string[]) => path.resolve(dir, ...paths)
|
108
|
+
|
109
|
+
const oldJSONString = fs.readFileSync(resolveByDir('package.json'), 'utf-8')
|
87
110
|
const oldJSON = JSON.parse(oldJSONString) ?? '0.0.0'
|
88
111
|
const newVersion = bumper ? bump(oldJSON.version, bumper) : oldJSON.version
|
89
112
|
// TODO detectIndent by editorconfig
|
@@ -178,26 +201,41 @@ program
|
|
178
201
|
{ formattingOptions }
|
179
202
|
)
|
180
203
|
)
|
204
|
+
newJSONString = applyEdits(
|
205
|
+
newJSONString,
|
206
|
+
modify(newJSONString, ['publishConfig', 'directory'], resolvedOutdir, { formattingOptions })
|
207
|
+
)
|
208
|
+
!silent && console.log(newJSONString)
|
209
|
+
if (preview) {
|
210
|
+
continue
|
211
|
+
}
|
212
|
+
const effects: (() => void)[] = []
|
181
213
|
try {
|
182
|
-
fs.renameSync(
|
183
|
-
|
184
|
-
!
|
185
|
-
|
186
|
-
|
214
|
+
// fs.renameSync(resolveByDir('package.json'), resolveByDir('package.json.bak'))
|
215
|
+
|
216
|
+
if (!fs.existsSync(resolveByDir(resolvedOutdir))) {
|
217
|
+
fs.mkdirSync(resolveByDir(resolvedOutdir))
|
218
|
+
effects.push(() => fs.rmdirSync(resolveByDir(resolvedOutdir), { recursive: true }))
|
187
219
|
}
|
220
|
+
// fs.writeFileSync(resolveByDir('package.json'), newJSONString)
|
221
|
+
fs.writeFileSync(resolveByDir(resolvedOutdir, 'package.json'), newJSONString)
|
222
|
+
effects.push(() => fs.unlinkSync(resolveByDir(resolvedOutdir, 'package.json')))
|
223
|
+
|
224
|
+
const modifyVersionPackageJSON = applyEdits(oldJSONString, modify(oldJSONString, ['version'], newVersion, {}))
|
225
|
+
fs.writeFileSync(resolveByDir('package.json'), modifyVersionPackageJSON)
|
226
|
+
effects.push(() => fs.writeFileSync(resolveByDir('package.json'), oldJSONString))
|
227
|
+
|
188
228
|
const args = ['pnpm', 'publish', '--access', 'public', '--no-git-checks', ...passArgs]
|
189
229
|
if (bumper && TAGS.includes(bumper)) {
|
190
230
|
args.push('--tag', bumper)
|
191
231
|
}
|
232
|
+
args.push(...passThroughOptions)
|
192
233
|
childProcess.execSync(args.join(' '), {
|
193
234
|
cwd: dir,
|
194
235
|
stdio: 'inherit'
|
195
236
|
})
|
196
|
-
const modifyVersionPackageJSON = applyEdits(oldJSONString, modify(oldJSONString, ['version'], newVersion, {}))
|
197
|
-
fs.writeFileSync(path.join(dir, 'package.json.bak'), modifyVersionPackageJSON)
|
198
237
|
} finally {
|
199
|
-
|
200
|
-
fs.renameSync(path.join(dir, 'package.json.bak'), path.join(dir, 'package.json'))
|
238
|
+
effects.forEach(effect => effect())
|
201
239
|
}
|
202
240
|
}
|
203
241
|
actionDone()
|
package/src/rollup/index.ts
CHANGED
@@ -39,7 +39,7 @@ const {
|
|
39
39
|
JIEK_WITHOUT_DTS,
|
40
40
|
JIEK_WITHOUT_MINIFY,
|
41
41
|
JIEK_MINIFY_TYPE,
|
42
|
-
|
42
|
+
JIEK_CLEAN,
|
43
43
|
JIEK_ONLY_MINIFY,
|
44
44
|
JIEK_TSCONFIG,
|
45
45
|
JIEK_DTSCONFIG
|
@@ -74,7 +74,7 @@ const WITHOUT_MINIFY = JIEK_WITHOUT_MINIFY === 'true'
|
|
74
74
|
|
75
75
|
const ONLY_MINIFY = JIEK_ONLY_MINIFY === 'true'
|
76
76
|
|
77
|
-
const CLEAN =
|
77
|
+
const CLEAN = JIEK_CLEAN === 'true'
|
78
78
|
|
79
79
|
const MINIFY_DEFAULT_VALUE = WITHOUT_MINIFY
|
80
80
|
? false
|