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/cli-only-build.cjs
CHANGED
@@ -7,6 +7,7 @@ var filterWorkspacePackages = require('@pnpm/filter-workspace-packages');
|
|
7
7
|
var commander = require('commander');
|
8
8
|
var jsYaml = require('js-yaml');
|
9
9
|
var getWorkspaceDir = require('@jiek/utils/getWorkspaceDir');
|
10
|
+
var prompts = require('@inquirer/prompts');
|
10
11
|
var cliProgress = require('cli-progress');
|
11
12
|
var execa = require('execa');
|
12
13
|
|
@@ -115,7 +116,7 @@ async function getSelectedProjectsGraph(filter = commander.program.getOptionValu
|
|
115
116
|
|
116
117
|
var name = "jiek";
|
117
118
|
var type = "module";
|
118
|
-
var version = "2.0.
|
119
|
+
var version = "2.0.2-alpha.2";
|
119
120
|
var description$1 = "A lightweight toolkit for compiling and managing libraries based on `package.json` metadata and suitable for `Monorepo`.";
|
120
121
|
var author = "YiJie <yijie4188@gmail.com>";
|
121
122
|
var repository = {
|
@@ -138,7 +139,7 @@ var files = [
|
|
138
139
|
"README.md"
|
139
140
|
];
|
140
141
|
var scripts = {
|
141
|
-
prepublish: "jb
|
142
|
+
prepublish: "jb -nm -nc"
|
142
143
|
};
|
143
144
|
var exports$1 = {
|
144
145
|
"./package.json": "./package.json",
|
@@ -154,6 +155,7 @@ var dependencies = {
|
|
154
155
|
"@jiek/pkger": "workspace:^",
|
155
156
|
"@jiek/rollup-plugin-dts": "^6.2.1",
|
156
157
|
"@jiek/utils": "workspace:^",
|
158
|
+
"@inquirer/prompts": "^7.1.0",
|
157
159
|
"@rollup/plugin-commonjs": "^28.0.0",
|
158
160
|
"@rollup/plugin-json": "^6.0.1",
|
159
161
|
"@rollup/plugin-node-resolve": "^15.3.0",
|
@@ -161,7 +163,6 @@ var dependencies = {
|
|
161
163
|
commander: "^12.0.0",
|
162
164
|
"detect-indent": "^6.1.0",
|
163
165
|
execa: "9.3.1",
|
164
|
-
inquirer: "^8.2.6",
|
165
166
|
"js-yaml": "^4.1.0",
|
166
167
|
"jsonc-parser": "^3.2.1",
|
167
168
|
rollup: "4.13.2"
|
@@ -219,44 +220,6 @@ var devDependencies = {
|
|
219
220
|
"rollup-plugin-esbuild": "^6.1.0",
|
220
221
|
"rollup-plugin-swc3": "^0.12.1"
|
221
222
|
};
|
222
|
-
var publishConfig = {
|
223
|
-
exports: {
|
224
|
-
"./package.json": "./package.json",
|
225
|
-
".": {
|
226
|
-
source: "./src/index.ts",
|
227
|
-
require: "./dist/index.cjs",
|
228
|
-
"default": "./dist/index.js"
|
229
|
-
},
|
230
|
-
"./cli": {
|
231
|
-
source: "./src/cli.ts",
|
232
|
-
require: "./dist/cli.cjs",
|
233
|
-
"default": "./dist/cli.js"
|
234
|
-
},
|
235
|
-
"./cli-only-build": {
|
236
|
-
source: "./src/cli-only-build.ts",
|
237
|
-
require: "./dist/cli-only-build.cjs",
|
238
|
-
"default": "./dist/cli-only-build.js"
|
239
|
-
},
|
240
|
-
"./rollup": {
|
241
|
-
source: "./src/rollup/index.ts",
|
242
|
-
require: "./dist/rollup/index.cjs",
|
243
|
-
"default": "./dist/rollup/index.js"
|
244
|
-
}
|
245
|
-
},
|
246
|
-
main: "./dist/index.cjs",
|
247
|
-
module: "./dist/index.js",
|
248
|
-
typesVersions: {
|
249
|
-
"<5.0": {
|
250
|
-
"*": [
|
251
|
-
"*",
|
252
|
-
"./dist/*",
|
253
|
-
"./dist/*/index.d.ts",
|
254
|
-
"./dist/*/index.d.mts",
|
255
|
-
"./dist/*/index.d.cts"
|
256
|
-
]
|
257
|
-
}
|
258
|
-
}
|
259
|
-
};
|
260
223
|
var pkg = {
|
261
224
|
name: name,
|
262
225
|
type: type,
|
@@ -274,8 +237,7 @@ var pkg = {
|
|
274
237
|
dependencies: dependencies,
|
275
238
|
peerDependencies: peerDependencies,
|
276
239
|
peerDependenciesMeta: peerDependenciesMeta,
|
277
|
-
devDependencies: devDependencies
|
278
|
-
publishConfig: publishConfig
|
240
|
+
devDependencies: devDependencies
|
279
241
|
};
|
280
242
|
|
281
243
|
const entriesDescription = `
|
@@ -421,7 +383,7 @@ const require$1 = node_module.createRequire((typeof document === 'undefined' ? r
|
|
421
383
|
const isDefault = process.env.JIEK_IS_ONLY_BUILD === "true";
|
422
384
|
const description = `
|
423
385
|
Build the package according to the 'exports' field from the package.json.
|
424
|
-
If you want to
|
386
|
+
If you want to through the options to the \`rollup\` command, you can pass the options after '--'.
|
425
387
|
${isDefault ? "This command is the default command." : ""}
|
426
388
|
`.trim();
|
427
389
|
async function checkDependency(dependency) {
|
@@ -429,12 +391,13 @@ async function checkDependency(dependency) {
|
|
429
391
|
require$1.resolve(dependency);
|
430
392
|
} catch (e) {
|
431
393
|
console.error(`The package '${dependency}' is not installed, please install it first.`);
|
432
|
-
const answer = prompt("Do you want to install it now? (Y/n)", "Y");
|
433
394
|
const { notWorkspace } = getWD();
|
434
|
-
|
435
|
-
|
395
|
+
const command2 = `pnpm install -${notWorkspace ? "" : "w"}D ${dependency}`;
|
396
|
+
if (await prompts.confirm({ message: "Do you want to install it now?" })) {
|
397
|
+
await execa.execaCommand(command2);
|
436
398
|
} else {
|
437
|
-
|
399
|
+
console.warn(`You can run the command '${command2}' to install it manually.`);
|
400
|
+
process.exit(1);
|
438
401
|
}
|
439
402
|
}
|
440
403
|
}
|
@@ -462,20 +425,15 @@ const buildEntriesDescription = `
|
|
462
425
|
${entriesDescription}
|
463
426
|
If you pass the --entries option, it will merge into the entries of the command.
|
464
427
|
`.trim();
|
465
|
-
const command = isDefault ?
|
466
|
-
|
467
|
-
if (
|
468
|
-
|
428
|
+
const command = isDefault ? (() => {
|
429
|
+
const c = commander.program.name("jb/jiek-build").helpCommand(false);
|
430
|
+
if (IS_WORKSPACE) {
|
431
|
+
c.argument("[filters]", buildFilterDescription);
|
469
432
|
} else {
|
470
|
-
|
433
|
+
c.argument("[entries]", buildEntriesDescription);
|
471
434
|
}
|
472
|
-
|
473
|
-
|
474
|
-
command.argument("[entries]", buildEntriesDescription);
|
475
|
-
} else {
|
476
|
-
command.command("build [entries]");
|
477
|
-
}
|
478
|
-
}
|
435
|
+
return c;
|
436
|
+
})() : commander.program.command(`build [${IS_WORKSPACE ? "filters" : "entries"}]`);
|
479
437
|
command.description(description).option("-t, --type <TYPE>", `The type of build, support ${BUILDER_TYPES.map((s) => `"${s}"`).join(", ")}.`, (v) => {
|
480
438
|
if (!BUILDER_TYPES.includes(v)) {
|
481
439
|
throw new Error(`The value of 'type' must be ${BUILDER_TYPES.map((s) => `"${s}"`).join(", ")}`);
|
package/dist/cli-only-build.js
CHANGED
@@ -5,6 +5,7 @@ import { filterPackagesFromDir } from '@pnpm/filter-workspace-packages';
|
|
5
5
|
import { program } from 'commander';
|
6
6
|
import { load } from 'js-yaml';
|
7
7
|
import { isWorkspaceDir, getWorkspaceDir } from '@jiek/utils/getWorkspaceDir';
|
8
|
+
import { confirm } from '@inquirer/prompts';
|
8
9
|
import { MultiBar, Presets } from 'cli-progress';
|
9
10
|
import { execaCommand } from 'execa';
|
10
11
|
|
@@ -107,7 +108,7 @@ async function getSelectedProjectsGraph(filter = program.getOptionValue("filter"
|
|
107
108
|
|
108
109
|
var name = "jiek";
|
109
110
|
var type = "module";
|
110
|
-
var version = "2.0.
|
111
|
+
var version = "2.0.2-alpha.2";
|
111
112
|
var description$1 = "A lightweight toolkit for compiling and managing libraries based on `package.json` metadata and suitable for `Monorepo`.";
|
112
113
|
var author = "YiJie <yijie4188@gmail.com>";
|
113
114
|
var repository = {
|
@@ -130,7 +131,7 @@ var files = [
|
|
130
131
|
"README.md"
|
131
132
|
];
|
132
133
|
var scripts = {
|
133
|
-
prepublish: "jb
|
134
|
+
prepublish: "jb -nm -nc"
|
134
135
|
};
|
135
136
|
var exports = {
|
136
137
|
"./package.json": "./package.json",
|
@@ -146,6 +147,7 @@ var dependencies = {
|
|
146
147
|
"@jiek/pkger": "workspace:^",
|
147
148
|
"@jiek/rollup-plugin-dts": "^6.2.1",
|
148
149
|
"@jiek/utils": "workspace:^",
|
150
|
+
"@inquirer/prompts": "^7.1.0",
|
149
151
|
"@rollup/plugin-commonjs": "^28.0.0",
|
150
152
|
"@rollup/plugin-json": "^6.0.1",
|
151
153
|
"@rollup/plugin-node-resolve": "^15.3.0",
|
@@ -153,7 +155,6 @@ var dependencies = {
|
|
153
155
|
commander: "^12.0.0",
|
154
156
|
"detect-indent": "^6.1.0",
|
155
157
|
execa: "9.3.1",
|
156
|
-
inquirer: "^8.2.6",
|
157
158
|
"js-yaml": "^4.1.0",
|
158
159
|
"jsonc-parser": "^3.2.1",
|
159
160
|
rollup: "4.13.2"
|
@@ -211,44 +212,6 @@ var devDependencies = {
|
|
211
212
|
"rollup-plugin-esbuild": "^6.1.0",
|
212
213
|
"rollup-plugin-swc3": "^0.12.1"
|
213
214
|
};
|
214
|
-
var publishConfig = {
|
215
|
-
exports: {
|
216
|
-
"./package.json": "./package.json",
|
217
|
-
".": {
|
218
|
-
source: "./src/index.ts",
|
219
|
-
require: "./dist/index.cjs",
|
220
|
-
"default": "./dist/index.js"
|
221
|
-
},
|
222
|
-
"./cli": {
|
223
|
-
source: "./src/cli.ts",
|
224
|
-
require: "./dist/cli.cjs",
|
225
|
-
"default": "./dist/cli.js"
|
226
|
-
},
|
227
|
-
"./cli-only-build": {
|
228
|
-
source: "./src/cli-only-build.ts",
|
229
|
-
require: "./dist/cli-only-build.cjs",
|
230
|
-
"default": "./dist/cli-only-build.js"
|
231
|
-
},
|
232
|
-
"./rollup": {
|
233
|
-
source: "./src/rollup/index.ts",
|
234
|
-
require: "./dist/rollup/index.cjs",
|
235
|
-
"default": "./dist/rollup/index.js"
|
236
|
-
}
|
237
|
-
},
|
238
|
-
main: "./dist/index.cjs",
|
239
|
-
module: "./dist/index.js",
|
240
|
-
typesVersions: {
|
241
|
-
"<5.0": {
|
242
|
-
"*": [
|
243
|
-
"*",
|
244
|
-
"./dist/*",
|
245
|
-
"./dist/*/index.d.ts",
|
246
|
-
"./dist/*/index.d.mts",
|
247
|
-
"./dist/*/index.d.cts"
|
248
|
-
]
|
249
|
-
}
|
250
|
-
}
|
251
|
-
};
|
252
215
|
var pkg = {
|
253
216
|
name: name,
|
254
217
|
type: type,
|
@@ -266,8 +229,7 @@ var pkg = {
|
|
266
229
|
dependencies: dependencies,
|
267
230
|
peerDependencies: peerDependencies,
|
268
231
|
peerDependenciesMeta: peerDependenciesMeta,
|
269
|
-
devDependencies: devDependencies
|
270
|
-
publishConfig: publishConfig
|
232
|
+
devDependencies: devDependencies
|
271
233
|
};
|
272
234
|
|
273
235
|
const entriesDescription = `
|
@@ -413,7 +375,7 @@ const require = createRequire(import.meta.url);
|
|
413
375
|
const isDefault = process.env.JIEK_IS_ONLY_BUILD === "true";
|
414
376
|
const description = `
|
415
377
|
Build the package according to the 'exports' field from the package.json.
|
416
|
-
If you want to
|
378
|
+
If you want to through the options to the \`rollup\` command, you can pass the options after '--'.
|
417
379
|
${isDefault ? "This command is the default command." : ""}
|
418
380
|
`.trim();
|
419
381
|
async function checkDependency(dependency) {
|
@@ -421,12 +383,13 @@ async function checkDependency(dependency) {
|
|
421
383
|
require.resolve(dependency);
|
422
384
|
} catch (e) {
|
423
385
|
console.error(`The package '${dependency}' is not installed, please install it first.`);
|
424
|
-
const answer = prompt("Do you want to install it now? (Y/n)", "Y");
|
425
386
|
const { notWorkspace } = getWD();
|
426
|
-
|
427
|
-
|
387
|
+
const command2 = `pnpm install -${notWorkspace ? "" : "w"}D ${dependency}`;
|
388
|
+
if (await confirm({ message: "Do you want to install it now?" })) {
|
389
|
+
await execaCommand(command2);
|
428
390
|
} else {
|
429
|
-
|
391
|
+
console.warn(`You can run the command '${command2}' to install it manually.`);
|
392
|
+
process.exit(1);
|
430
393
|
}
|
431
394
|
}
|
432
395
|
}
|
@@ -454,20 +417,15 @@ const buildEntriesDescription = `
|
|
454
417
|
${entriesDescription}
|
455
418
|
If you pass the --entries option, it will merge into the entries of the command.
|
456
419
|
`.trim();
|
457
|
-
const command = isDefault ?
|
458
|
-
|
459
|
-
if (
|
460
|
-
|
420
|
+
const command = isDefault ? (() => {
|
421
|
+
const c = program.name("jb/jiek-build").helpCommand(false);
|
422
|
+
if (IS_WORKSPACE) {
|
423
|
+
c.argument("[filters]", buildFilterDescription);
|
461
424
|
} else {
|
462
|
-
|
425
|
+
c.argument("[entries]", buildEntriesDescription);
|
463
426
|
}
|
464
|
-
|
465
|
-
|
466
|
-
command.argument("[entries]", buildEntriesDescription);
|
467
|
-
} else {
|
468
|
-
command.command("build [entries]");
|
469
|
-
}
|
470
|
-
}
|
427
|
+
return c;
|
428
|
+
})() : program.command(`build [${IS_WORKSPACE ? "filters" : "entries"}]`);
|
471
429
|
command.description(description).option("-t, --type <TYPE>", `The type of build, support ${BUILDER_TYPES.map((s) => `"${s}"`).join(", ")}.`, (v) => {
|
472
430
|
if (!BUILDER_TYPES.includes(v)) {
|
473
431
|
throw new Error(`The value of 'type' must be ${BUILDER_TYPES.map((s) => `"${s}"`).join(", ")}`);
|