jiek 2.0.1 → 2.0.2-alpha.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. package/{dist/cli-only-build.cjs → cli-only-build.cjs} +19 -87
  2. package/{dist/cli-only-build.js → cli-only-build.js} +19 -87
  3. package/{dist/cli.cjs → cli.cjs} +385 -531
  4. package/cli.d.cts +14 -0
  5. package/cli.d.ts +14 -0
  6. package/{dist/cli.js → cli.js} +385 -530
  7. package/{dist/index.d.cts → index.d.cts} +0 -53
  8. package/{dist/index.d.ts → index.d.ts} +0 -53
  9. package/package.json +29 -36
  10. package/{dist/rollup → rollup}/index.cjs +2 -2
  11. package/{dist/rollup → rollup}/index.js +2 -2
  12. package/README.md +0 -78
  13. package/bin/jiek-build.js +0 -16
  14. package/bin/jiek.js +0 -13
  15. package/dist/cli.d.cts +0 -67
  16. package/dist/cli.d.ts +0 -67
  17. package/src/cli-only-build.ts +0 -7
  18. package/src/cli.ts +0 -3
  19. package/src/commands/base.ts +0 -18
  20. package/src/commands/build.ts +0 -462
  21. package/src/commands/descriptions.ts +0 -17
  22. package/src/commands/init.ts +0 -373
  23. package/src/commands/meta.ts +0 -5
  24. package/src/commands/publish.ts +0 -204
  25. package/src/index.ts +0 -8
  26. package/src/inner.ts +0 -11
  27. package/src/rollup/base.ts +0 -137
  28. package/src/rollup/index.ts +0 -565
  29. package/src/rollup/plugins/progress.ts +0 -26
  30. package/src/rollup/plugins/skip.ts +0 -21
  31. package/src/rollup/utils/commonOptions.ts +0 -9
  32. package/src/rollup/utils/externalResolver.ts +0 -35
  33. package/src/rollup/utils/globalResolver.ts +0 -13
  34. package/src/rollup/utils/withMinify.ts +0 -18
  35. package/src/utils/filterSupport.ts +0 -91
  36. package/src/utils/getExports.ts +0 -140
  37. package/src/utils/getRoot.ts +0 -16
  38. package/src/utils/getWD.ts +0 -31
  39. package/src/utils/loadConfig.ts +0 -111
  40. package/src/utils/recusiveListFiles.ts +0 -13
  41. package/src/utils/ts.ts +0 -94
  42. package/src/utils/tsRegister.ts +0 -26
  43. /package/{dist/cli-only-build.d.cts → cli-only-build.d.cts} +0 -0
  44. /package/{dist/cli-only-build.d.ts → cli-only-build.d.ts} +0 -0
  45. /package/{dist/index.cjs → index.cjs} +0 -0
  46. /package/{dist/index.js → index.js} +0 -0
  47. /package/{dist/rollup → rollup}/index.d.cts +0 -0
  48. /package/{dist/rollup → rollup}/index.d.ts +0 -0
@@ -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.1";
119
+ var version = "2.0.2-alpha.9";
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,8 @@ var files = [
138
139
  "README.md"
139
140
  ];
140
141
  var scripts = {
141
- prepublish: "jb --noMin"
142
+ prepublish: "jb -nm && jk",
143
+ postpublish: "jk"
142
144
  };
143
145
  var exports$1 = {
144
146
  "./package.json": "./package.json",
@@ -154,6 +156,7 @@ var dependencies = {
154
156
  "@jiek/pkger": "workspace:^",
155
157
  "@jiek/rollup-plugin-dts": "^6.2.1",
156
158
  "@jiek/utils": "workspace:^",
159
+ "@inquirer/prompts": "^7.1.0",
157
160
  "@rollup/plugin-commonjs": "^28.0.0",
158
161
  "@rollup/plugin-json": "^6.0.1",
159
162
  "@rollup/plugin-node-resolve": "^15.3.0",
@@ -161,7 +164,6 @@ var dependencies = {
161
164
  commander: "^12.0.0",
162
165
  "detect-indent": "^6.1.0",
163
166
  execa: "9.3.1",
164
- inquirer: "^8.2.6",
165
167
  "js-yaml": "^4.1.0",
166
168
  "jsonc-parser": "^3.2.1",
167
169
  rollup: "4.13.2"
@@ -176,32 +178,6 @@ var peerDependencies = {
176
178
  "rollup-plugin-swc3": "^0.12.1",
177
179
  typescript: "^4.0.0||^5.0.0"
178
180
  };
179
- var peerDependenciesMeta = {
180
- "@rollup/plugin-terser": {
181
- optional: true
182
- },
183
- "@pnpm/filter-workspace-packages": {
184
- optional: true
185
- },
186
- "esbuild-register": {
187
- optional: true
188
- },
189
- postcss: {
190
- optional: true
191
- },
192
- "rollup-plugin-postcss": {
193
- optional: true
194
- },
195
- "rollup-plugin-esbuild": {
196
- optional: true
197
- },
198
- "rollup-plugin-swc3": {
199
- optional: true
200
- },
201
- typescript: {
202
- optional: true
203
- }
204
- };
205
181
  var devDependencies = {
206
182
  "@npm/types": "^1.0.2",
207
183
  "@pnpm/filter-workspace-packages": "^7.2.13",
@@ -219,44 +195,6 @@ var devDependencies = {
219
195
  "rollup-plugin-esbuild": "^6.1.0",
220
196
  "rollup-plugin-swc3": "^0.12.1"
221
197
  };
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
198
  var pkg = {
261
199
  name: name,
262
200
  type: type,
@@ -273,9 +211,7 @@ var pkg = {
273
211
  imports: imports,
274
212
  dependencies: dependencies,
275
213
  peerDependencies: peerDependencies,
276
- peerDependenciesMeta: peerDependenciesMeta,
277
- devDependencies: devDependencies,
278
- publishConfig: publishConfig
214
+ devDependencies: devDependencies
279
215
  };
280
216
 
281
217
  const entriesDescription = `
@@ -421,7 +357,7 @@ const require$1 = node_module.createRequire((typeof document === 'undefined' ? r
421
357
  const isDefault = process.env.JIEK_IS_ONLY_BUILD === "true";
422
358
  const description = `
423
359
  Build the package according to the 'exports' field from the package.json.
424
- If you want to rewrite the \`rollup\` command options, you can pass the options after '--'.
360
+ If you want to through the options to the \`rollup\` command, you can pass the options after '--'.
425
361
  ${isDefault ? "This command is the default command." : ""}
426
362
  `.trim();
427
363
  async function checkDependency(dependency) {
@@ -429,12 +365,13 @@ async function checkDependency(dependency) {
429
365
  require$1.resolve(dependency);
430
366
  } catch (e) {
431
367
  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
368
  const { notWorkspace } = getWD();
434
- if (answer === "Y") {
435
- await execa.execaCommand(`pnpm install -${notWorkspace ? "" : "w"}D ${dependency}`);
369
+ const command2 = `pnpm install -${notWorkspace ? "" : "w"}D ${dependency}`;
370
+ if (await prompts.confirm({ message: "Do you want to install it now?" })) {
371
+ await execa.execaCommand(command2);
436
372
  } else {
437
- return;
373
+ console.warn(`You can run the command '${command2}' to install it manually.`);
374
+ process.exit(1);
438
375
  }
439
376
  }
440
377
  }
@@ -462,20 +399,15 @@ const buildEntriesDescription = `
462
399
  ${entriesDescription}
463
400
  If you pass the --entries option, it will merge into the entries of the command.
464
401
  `.trim();
465
- const command = isDefault ? commander.program.name("jb/jiek-build").helpCommand(false) : commander.program;
466
- if (IS_WORKSPACE) {
467
- if (isDefault) {
468
- command.argument("[filters]", buildFilterDescription);
402
+ const command = isDefault ? (() => {
403
+ const c = commander.program.name("jb/jiek-build").helpCommand(false);
404
+ if (IS_WORKSPACE) {
405
+ c.argument("[filters]", buildFilterDescription);
469
406
  } else {
470
- command.command("build [filters]");
407
+ c.argument("[entries]", buildEntriesDescription);
471
408
  }
472
- } else {
473
- if (isDefault) {
474
- command.argument("[entries]", buildEntriesDescription);
475
- } else {
476
- command.command("build [entries]");
477
- }
478
- }
409
+ return c;
410
+ })() : commander.program.command(`build [${IS_WORKSPACE ? "filters" : "entries"}]`);
479
411
  command.description(description).option("-t, --type <TYPE>", `The type of build, support ${BUILDER_TYPES.map((s) => `"${s}"`).join(", ")}.`, (v) => {
480
412
  if (!BUILDER_TYPES.includes(v)) {
481
413
  throw new Error(`The value of 'type' must be ${BUILDER_TYPES.map((s) => `"${s}"`).join(", ")}`);
@@ -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.1";
111
+ var version = "2.0.2-alpha.9";
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,8 @@ var files = [
130
131
  "README.md"
131
132
  ];
132
133
  var scripts = {
133
- prepublish: "jb --noMin"
134
+ prepublish: "jb -nm && jk",
135
+ postpublish: "jk"
134
136
  };
135
137
  var exports = {
136
138
  "./package.json": "./package.json",
@@ -146,6 +148,7 @@ var dependencies = {
146
148
  "@jiek/pkger": "workspace:^",
147
149
  "@jiek/rollup-plugin-dts": "^6.2.1",
148
150
  "@jiek/utils": "workspace:^",
151
+ "@inquirer/prompts": "^7.1.0",
149
152
  "@rollup/plugin-commonjs": "^28.0.0",
150
153
  "@rollup/plugin-json": "^6.0.1",
151
154
  "@rollup/plugin-node-resolve": "^15.3.0",
@@ -153,7 +156,6 @@ var dependencies = {
153
156
  commander: "^12.0.0",
154
157
  "detect-indent": "^6.1.0",
155
158
  execa: "9.3.1",
156
- inquirer: "^8.2.6",
157
159
  "js-yaml": "^4.1.0",
158
160
  "jsonc-parser": "^3.2.1",
159
161
  rollup: "4.13.2"
@@ -168,32 +170,6 @@ var peerDependencies = {
168
170
  "rollup-plugin-swc3": "^0.12.1",
169
171
  typescript: "^4.0.0||^5.0.0"
170
172
  };
171
- var peerDependenciesMeta = {
172
- "@rollup/plugin-terser": {
173
- optional: true
174
- },
175
- "@pnpm/filter-workspace-packages": {
176
- optional: true
177
- },
178
- "esbuild-register": {
179
- optional: true
180
- },
181
- postcss: {
182
- optional: true
183
- },
184
- "rollup-plugin-postcss": {
185
- optional: true
186
- },
187
- "rollup-plugin-esbuild": {
188
- optional: true
189
- },
190
- "rollup-plugin-swc3": {
191
- optional: true
192
- },
193
- typescript: {
194
- optional: true
195
- }
196
- };
197
173
  var devDependencies = {
198
174
  "@npm/types": "^1.0.2",
199
175
  "@pnpm/filter-workspace-packages": "^7.2.13",
@@ -211,44 +187,6 @@ var devDependencies = {
211
187
  "rollup-plugin-esbuild": "^6.1.0",
212
188
  "rollup-plugin-swc3": "^0.12.1"
213
189
  };
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
190
  var pkg = {
253
191
  name: name,
254
192
  type: type,
@@ -265,9 +203,7 @@ var pkg = {
265
203
  imports: imports,
266
204
  dependencies: dependencies,
267
205
  peerDependencies: peerDependencies,
268
- peerDependenciesMeta: peerDependenciesMeta,
269
- devDependencies: devDependencies,
270
- publishConfig: publishConfig
206
+ devDependencies: devDependencies
271
207
  };
272
208
 
273
209
  const entriesDescription = `
@@ -413,7 +349,7 @@ const require = createRequire(import.meta.url);
413
349
  const isDefault = process.env.JIEK_IS_ONLY_BUILD === "true";
414
350
  const description = `
415
351
  Build the package according to the 'exports' field from the package.json.
416
- If you want to rewrite the \`rollup\` command options, you can pass the options after '--'.
352
+ If you want to through the options to the \`rollup\` command, you can pass the options after '--'.
417
353
  ${isDefault ? "This command is the default command." : ""}
418
354
  `.trim();
419
355
  async function checkDependency(dependency) {
@@ -421,12 +357,13 @@ async function checkDependency(dependency) {
421
357
  require.resolve(dependency);
422
358
  } catch (e) {
423
359
  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
360
  const { notWorkspace } = getWD();
426
- if (answer === "Y") {
427
- await execaCommand(`pnpm install -${notWorkspace ? "" : "w"}D ${dependency}`);
361
+ const command2 = `pnpm install -${notWorkspace ? "" : "w"}D ${dependency}`;
362
+ if (await confirm({ message: "Do you want to install it now?" })) {
363
+ await execaCommand(command2);
428
364
  } else {
429
- return;
365
+ console.warn(`You can run the command '${command2}' to install it manually.`);
366
+ process.exit(1);
430
367
  }
431
368
  }
432
369
  }
@@ -454,20 +391,15 @@ const buildEntriesDescription = `
454
391
  ${entriesDescription}
455
392
  If you pass the --entries option, it will merge into the entries of the command.
456
393
  `.trim();
457
- const command = isDefault ? program.name("jb/jiek-build").helpCommand(false) : program;
458
- if (IS_WORKSPACE) {
459
- if (isDefault) {
460
- command.argument("[filters]", buildFilterDescription);
394
+ const command = isDefault ? (() => {
395
+ const c = program.name("jb/jiek-build").helpCommand(false);
396
+ if (IS_WORKSPACE) {
397
+ c.argument("[filters]", buildFilterDescription);
461
398
  } else {
462
- command.command("build [filters]");
399
+ c.argument("[entries]", buildEntriesDescription);
463
400
  }
464
- } else {
465
- if (isDefault) {
466
- command.argument("[entries]", buildEntriesDescription);
467
- } else {
468
- command.command("build [entries]");
469
- }
470
- }
401
+ return c;
402
+ })() : program.command(`build [${IS_WORKSPACE ? "filters" : "entries"}]`);
471
403
  command.description(description).option("-t, --type <TYPE>", `The type of build, support ${BUILDER_TYPES.map((s) => `"${s}"`).join(", ")}.`, (v) => {
472
404
  if (!BUILDER_TYPES.includes(v)) {
473
405
  throw new Error(`The value of 'type' must be ${BUILDER_TYPES.map((s) => `"${s}"`).join(", ")}`);