create-pkgbld 1.5.0 → 1.7.0

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/index.cjs CHANGED
@@ -8,10 +8,10 @@ var userName = require('git-user-name');
8
8
  var gitConfig = require('parse-git-config');
9
9
  var cleye = require('cleye');
10
10
  var kleur = require('kleur');
11
- require('typia');
12
11
  var stringArgv = require('string-argv');
13
12
  var childProcess = require('node:child_process');
14
13
  var util = require('node:util');
14
+ var lodash = require('lodash');
15
15
 
16
16
  async function getGitRoot() {
17
17
  const exec = util.promisify(childProcess.exec);
@@ -19,6 +19,206 @@ async function getGitRoot() {
19
19
  return stdout.trim();
20
20
  }
21
21
 
22
+ function isPackageJson(value) {
23
+ return (input => {
24
+ const $io0 = input => (undefined === input.private || "boolean" === typeof input.private) && (undefined === input.version || "string" === typeof input.version) && (undefined === input.name || "string" === typeof input.name) && (undefined === input.license || "string" === typeof input.license) && (undefined === input.readme || "string" === typeof input.readme) && (null !== input.author && (undefined === input.author || "string" === typeof input.author || "object" === typeof input.author && null !== input.author && false === Array.isArray(input.author) && $io1(input.author))) && (undefined === input.description || "string" === typeof input.description) && (undefined === input.scripts || "object" === typeof input.scripts && null !== input.scripts && false === Array.isArray(input.scripts) && $io2(input.scripts)) && (undefined === input.repository || "object" === typeof input.repository && null !== input.repository && false === Array.isArray(input.repository) && $io3(input.repository)) && (undefined === input.bugs || "string" === typeof input.bugs) && (undefined === input.homepage || "string" === typeof input.homepage) && (undefined === input.dependencies || "object" === typeof input.dependencies && null !== input.dependencies && false === Array.isArray(input.dependencies) && $io4(input.dependencies)) && (undefined === input.devDependencies || "object" === typeof input.devDependencies && null !== input.devDependencies && false === Array.isArray(input.devDependencies) && $io4(input.devDependencies)) && (undefined === input.peerDependencies || "object" === typeof input.peerDependencies && null !== input.peerDependencies && false === Array.isArray(input.peerDependencies) && $io4(input.peerDependencies));
25
+ const $io1 = input => (undefined === input.name || "string" === typeof input.name) && (undefined === input.email || "string" === typeof input.email) && (undefined === input.url || "string" === typeof input.url);
26
+ const $io2 = input => Object.keys(input).every(key => {
27
+ const value = input[key];
28
+ if (undefined === value)
29
+ return true;
30
+ if (RegExp(/(.*)/).test(key))
31
+ return "string" === typeof value;
32
+ return true;
33
+ });
34
+ const $io3 = input => (undefined === input.type || "string" === typeof input.type) && (undefined === input.url || "string" === typeof input.url);
35
+ const $io4 = input => Object.keys(input).every(key => {
36
+ const value = input[key];
37
+ if (undefined === value)
38
+ return true;
39
+ if (RegExp(/(.*)/).test(key))
40
+ return "string" === typeof value;
41
+ return true;
42
+ });
43
+ return "object" === typeof input && null !== input && false === Array.isArray(input) && $io0(input);
44
+ })(value);
45
+ }
46
+ function CommaSeparatedString(value) {
47
+ return value.split(',').map((arg) => arg.trim());
48
+ }
49
+ function CommaSeparatedStringOrBoolean(value) {
50
+ if (typeof value === 'boolean') {
51
+ return value;
52
+ }
53
+ if (Array.isArray(value) && value.length === 0) {
54
+ return true;
55
+ }
56
+ return CommaSeparatedString(value);
57
+ }
58
+ const cliFlagsDefaults = {
59
+ formats: ['es', 'cjs'],
60
+ umd: [],
61
+ compress: ['umd'],
62
+ sourcemaps: ['umd'],
63
+ preprocess: [],
64
+ dest: 'dist',
65
+ src: 'src',
66
+ bin: undefined,
67
+ includeExternals: false,
68
+ eject: false,
69
+ noTsConfig: false,
70
+ noUpdatePackageJson: false,
71
+ commonjsPattern: '[name].cjs',
72
+ esmPattern: '[name].mjs',
73
+ umdPattern: '[name].umd.js',
74
+ formatPackageJson: false
75
+ };
76
+ const cliFlags = {
77
+ umd: {
78
+ type: CommaSeparatedString,
79
+ description: 'Package subpath exports in UMD format',
80
+ default: cliFlagsDefaults.umd
81
+ },
82
+ compress: {
83
+ type: CommaSeparatedString,
84
+ description: 'Compress formats using terser',
85
+ default: cliFlagsDefaults.compress
86
+ },
87
+ sourcemaps: {
88
+ type: CommaSeparatedString,
89
+ description: 'Emit sourcemaps for the specified formats',
90
+ default: cliFlagsDefaults.sourcemaps
91
+ },
92
+ formats: {
93
+ type: CommaSeparatedString,
94
+ description: 'Formats to emit',
95
+ default: cliFlagsDefaults.formats
96
+ },
97
+ preprocess: {
98
+ type: CommaSeparatedString,
99
+ description: 'Preprocess entry points / subpath exports',
100
+ default: cliFlagsDefaults.preprocess
101
+ },
102
+ dest: {
103
+ type: String,
104
+ description: 'Output directory',
105
+ default: cliFlagsDefaults.dest
106
+ },
107
+ src: {
108
+ type: String,
109
+ description: 'Source directory',
110
+ default: cliFlagsDefaults.src
111
+ },
112
+ bin: {
113
+ type: CommaSeparatedString,
114
+ description: 'Executable files',
115
+ default: cliFlagsDefaults.bin
116
+ },
117
+ includeExternals: {
118
+ type: CommaSeparatedStringOrBoolean,
119
+ description: 'Include all/specified externals into result bundle(s)',
120
+ default: cliFlagsDefaults.includeExternals
121
+ },
122
+ eject: {
123
+ type: Boolean,
124
+ description: 'Eject config',
125
+ default: cliFlagsDefaults.eject
126
+ },
127
+ noTsConfig: {
128
+ type: Boolean,
129
+ description: 'Do not create / update tsconfig.json',
130
+ default: cliFlagsDefaults.noTsConfig
131
+ },
132
+ noUpdatePackageJson: {
133
+ type: Boolean,
134
+ description: 'Do not create / update package.json',
135
+ default: cliFlagsDefaults.noUpdatePackageJson
136
+ },
137
+ commonjsPattern: {
138
+ type: String,
139
+ description: 'CommonJS output file name pattern',
140
+ default: cliFlagsDefaults.commonjsPattern
141
+ },
142
+ esmPattern: {
143
+ type: String,
144
+ description: 'ES output file name pattern',
145
+ default: cliFlagsDefaults.esmPattern
146
+ },
147
+ umdPattern: {
148
+ type: String,
149
+ description: 'UMD output file name pattern',
150
+ default: cliFlagsDefaults.umdPattern
151
+ },
152
+ formatPackageJson: {
153
+ type: Boolean,
154
+ description: 'Format package.json',
155
+ default: cliFlagsDefaults.formatPackageJson
156
+ }
157
+ };
158
+ const packageJsonFieldsOrder = new Set([
159
+ 'private',
160
+ 'type',
161
+ 'version',
162
+ 'name',
163
+ 'scope',
164
+ 'description',
165
+ 'license',
166
+ 'author',
167
+ 'contributors',
168
+ 'funding',
169
+ 'bin',
170
+ 'main',
171
+ 'browser',
172
+ 'unpkg',
173
+ 'module',
174
+ 'exports',
175
+ 'imports',
176
+ 'types',
177
+ 'typings',
178
+ 'files',
179
+ 'packageManager',
180
+ 'sideEffects',
181
+ 'engines',
182
+ 'os',
183
+ 'cpu',
184
+ 'man',
185
+ 'directories',
186
+ 'repository',
187
+ 'bugs',
188
+ 'homepage',
189
+ 'readme',
190
+ 'keywords',
191
+ 'scripts',
192
+ 'config',
193
+ 'dependencies',
194
+ 'devDependencies',
195
+ 'peerDependencies',
196
+ 'peerDependenciesMeta',
197
+ 'bundleDependencies',
198
+ 'bundledDependencies',
199
+ 'optionalDependencies',
200
+ 'overrides',
201
+ 'publishConfig',
202
+ 'workspaces'
203
+ ]);
204
+ function processPackageJson(pkg, needTreatment, treatKey) {
205
+ const newPkg = {};
206
+ for (const key of packageJsonFieldsOrder) {
207
+ if (needTreatment(key)) {
208
+ newPkg[key] = treatKey(key);
209
+ }
210
+ }
211
+ for (const key in pkg) {
212
+ if (!packageJsonFieldsOrder.has(key)) {
213
+ newPkg[key] = pkg[key];
214
+ }
215
+ }
216
+ return newPkg;
217
+ }
218
+ function toFormattedJson(json) {
219
+ return JSON.stringify(json, null, 2) + '\n';
220
+ }
221
+
22
222
  const done = Symbol('done');
23
223
  const formats = ['amd', 'cjs', 'es', 'iife', 'system', 'umd'];
24
224
  const pkgbldBinaries = ['pkgbld', 'pkgbld-internal', 'node ../pkgbld/dist/index.js'];
@@ -46,7 +246,7 @@ async function execute() {
46
246
  const packageName = path.basename(targetDir);
47
247
  let cancelled = false;
48
248
  const options = getBasicOptions(packageName, pkg);
49
- options.push(...await getGitOptions(targetDir));
249
+ options.push(...await getGitOptions(targetDir, pkg.pkg));
50
250
  options.push(...getPkgbldOptions(pkg.pkg));
51
251
  const state = getOptionsValue(options);
52
252
  if (!args.flags.quiet) {
@@ -103,63 +303,7 @@ async function execute() {
103
303
  }
104
304
  execute();
105
305
  function updatePackage(pkg, options) {
106
- const order = new Set([
107
- 'private',
108
- 'type',
109
- 'version',
110
- 'name',
111
- 'description',
112
- 'license',
113
- 'author',
114
- 'contributors',
115
- 'funding',
116
- 'bin',
117
- 'main',
118
- 'browser',
119
- 'unpkg',
120
- 'module',
121
- 'exports',
122
- 'imports',
123
- 'types',
124
- 'typings',
125
- 'files',
126
- 'packageManager',
127
- 'sideEffects',
128
- 'engines',
129
- 'os',
130
- 'cpu',
131
- 'man',
132
- 'directories',
133
- 'repository',
134
- 'bugs',
135
- 'homepage',
136
- 'readme',
137
- 'keywords',
138
- 'scripts',
139
- 'config',
140
- 'dependencies',
141
- 'devDependencies',
142
- 'peerDependencies',
143
- 'peerDependenciesMeta',
144
- 'bundleDependencies',
145
- 'bundledDependencies',
146
- 'optionalDependencies',
147
- 'overrides',
148
- 'publishConfig',
149
- 'workspaces'
150
- ]);
151
- const newPkg = {};
152
- for (const key of order) {
153
- if (key in options || key in pkg.pkg) {
154
- newPkg[key] = treatKey(key);
155
- }
156
- }
157
- for (const key in pkg.pkg) {
158
- if (!order.has(key)) {
159
- newPkg[key] = pkg.pkg[key];
160
- }
161
- }
162
- pkg.pkg = newPkg;
306
+ pkg.pkg = processPackageJson(pkg.pkg, (key) => (key in options || key in pkg.pkg), treatKey);
163
307
  function treatKey(key) {
164
308
  if (key === 'scripts') {
165
309
  ({ ...pkg.pkg.scripts });
@@ -174,7 +318,7 @@ function getScriptValue(pkgbld) {
174
318
  const pkgBldCopy = { ...pkgbld };
175
319
  delete pkgBldCopy['pkgbldBinary'];
176
320
  delete pkgBldCopy['extraParameters'];
177
- return `${binary} ${asCommandLineArgs(pkgBldCopy)} ${extraArgs}`;
321
+ return `${binary} ${asCommandLineArgs(pkgBldCopy, cliFlagsDefaults)} ${extraArgs}`.trimEnd();
178
322
  }
179
323
  function getPromptOption(option, mutateObject) {
180
324
  const value = mutateObject[option.field];
@@ -205,16 +349,19 @@ function mapOption(state) {
205
349
  return (option) => {
206
350
  const fieldValue = state[option.field];
207
351
  return {
208
- title: pad16plus(option.title) + kleur.grey('items' in option ? getPrintString(option.items, (option.mutateInnerObject ? fieldValue : state)) : fieldValue ?? ''),
352
+ title: pad16plus(option.title) + kleur.grey('items' in option ? getPrintString(option, (option.mutateInnerObject ? fieldValue : state)) : fieldValue ?? ''),
209
353
  value: option.field
210
354
  };
211
355
  };
212
356
  }
213
- function getPrintString(items, json) {
214
- return items
357
+ function getPrintString(option, json) {
358
+ if (option.render) {
359
+ return option.render(option, json);
360
+ }
361
+ return option.items
215
362
  .filter(item => item.field in json && json[item.field] && (Array.isArray(json[item.field]) ? json[item.field].length > 0 : true))
216
363
  .map(item => kleur.grey(item.title) + ' ' + (kleur.white('items' in item ?
217
- `[${getPrintString(item.items, (item.mutateInnerObject ? json[item.field] :
364
+ `[${getPrintString(item, (item.mutateInnerObject ? json[item.field] :
218
365
  json))}]` : json[item.field])))
219
366
  .join(', ');
220
367
  }
@@ -241,7 +388,7 @@ async function reportVersion() {
241
388
  const version = createPkgBldPackage.pkg.version ?? '<unknown>';
242
389
  return version;
243
390
  }
244
- async function getGitOptions(targetDir) {
391
+ async function getGitOptions(targetDir, packageJson) {
245
392
  try {
246
393
  const gitCfg = await gitConfig();
247
394
  if (gitCfg) {
@@ -252,6 +399,15 @@ async function getGitOptions(targetDir) {
252
399
  title: 'Git',
253
400
  field: 'git',
254
401
  mutateInnerObject: false,
402
+ render: (_option, value) => lodash.isEqual(removeEmpty({
403
+ repository: value.repository,
404
+ bugs: value.bugs,
405
+ homepage: value.homepage
406
+ }), removeEmpty({
407
+ repository: packageJson.repository,
408
+ bugs: packageJson.bugs,
409
+ homepage: packageJson.homepage
410
+ })) ? `[${kleur.green('Ok')}]` : `[${kleur.blue('Updated')}]`,
255
411
  items: [{
256
412
  title: 'Homepage',
257
413
  field: 'homepage',
@@ -287,23 +443,7 @@ async function getGitOptions(targetDir) {
287
443
  return [];
288
444
  }
289
445
  function getPkgbldOptions(pkg) {
290
- let args = {
291
- formats: ['es', 'cjs'],
292
- umd: [],
293
- compress: ['umd'],
294
- sourcemaps: ['umd'],
295
- preprocess: [],
296
- dir: 'dist',
297
- sourceDir: 'src',
298
- bin: undefined,
299
- includeExternals: false,
300
- eject: false,
301
- noTsConfig: false,
302
- noUpdatePackageJson: false
303
- };
304
- function CommaSeparatedString(value) {
305
- return value.split(',').map((arg) => arg.trim());
306
- }
446
+ let args = cliFlagsDefaults;
307
447
  const cmd = pkg.scripts?.build ?? '';
308
448
  let binary = 'pkgbld';
309
449
  if (cmd) {
@@ -324,56 +464,7 @@ function getPkgbldOptions(pkg) {
324
464
  }
325
465
  const parsedArgs = cleye.cli({
326
466
  help: false,
327
- flags: {
328
- umd: {
329
- type: CommaSeparatedString,
330
- default: args.umd
331
- },
332
- compress: {
333
- type: CommaSeparatedString,
334
- default: args.compress
335
- },
336
- sourcemaps: {
337
- type: CommaSeparatedString,
338
- default: args.sourcemaps
339
- },
340
- formats: {
341
- type: CommaSeparatedString,
342
- default: args.formats
343
- },
344
- preprocess: {
345
- type: CommaSeparatedString,
346
- default: args.preprocess
347
- },
348
- dir: {
349
- type: String,
350
- default: args.dir
351
- },
352
- sourceDir: {
353
- type: String,
354
- default: args.sourceDir
355
- },
356
- bin: {
357
- type: CommaSeparatedString,
358
- default: args.bin
359
- },
360
- includeExternals: {
361
- type: Boolean,
362
- default: args.includeExternals
363
- },
364
- eject: {
365
- type: Boolean,
366
- default: args.eject
367
- },
368
- noTsConfig: {
369
- type: Boolean,
370
- default: args.noTsConfig
371
- },
372
- noUpdatePackageJson: {
373
- type: Boolean,
374
- default: args.noUpdatePackageJson
375
- }
376
- }
467
+ flags: cliFlags
377
468
  }, undefined, stringArgv.parseArgsStringToArgv(cmd));
378
469
  args = parsedArgs.flags;
379
470
  args.extraParameters = asCommandLineArgs(parsedArgs.unknownFlags);
@@ -382,14 +473,15 @@ function getPkgbldOptions(pkg) {
382
473
  title: 'pkgbld',
383
474
  field: 'pkgbld',
384
475
  mutateInnerObject: true,
476
+ render: (_option, value) => cmd === getScriptValue(value) ? `[${kleur.green('Ok')}]` : `[${kleur.blue('Updated')}]`,
385
477
  items: [{
386
478
  title: 'Destination folder',
387
479
  field: 'dest',
388
- initialValue: args.dir
480
+ initialValue: args.dest
389
481
  }, {
390
482
  title: 'Source folder',
391
483
  field: 'src',
392
- initialValue: args.sourceDir
484
+ initialValue: args.src
393
485
  }, {
394
486
  title: 'UMD exports',
395
487
  field: 'umd',
@@ -435,15 +527,15 @@ function getPkgbldOptions(pkg) {
435
527
  type: 'toggle',
436
528
  initialValue: args.eject
437
529
  }, {
438
- title: 'Create tsconfig',
439
- field: 'tsConfig',
530
+ title: 'Do not create tsconfig',
531
+ field: 'noTsConfig',
440
532
  type: 'toggle',
441
- initialValue: !args.noTsConfig
533
+ initialValue: args.noTsConfig
442
534
  }, {
443
- title: 'Update package.json',
444
- field: 'updatePackageJson',
535
+ title: 'Do not update package.json',
536
+ field: 'noUpdatePackageJson',
445
537
  type: 'toggle',
446
- initialValue: !args.noUpdatePackageJson
538
+ initialValue: args.noUpdatePackageJson
447
539
  }, {
448
540
  title: 'Extra parameters',
449
541
  field: 'extraParameters',
@@ -458,11 +550,12 @@ function getPkgbldOptions(pkg) {
458
550
  }]
459
551
  }];
460
552
  }
461
- function asCommandLineArgs(parsedArgs) {
553
+ function asCommandLineArgs(parsedArgs, defaultArgs = {}) {
462
554
  return Object.entries(parsedArgs)
463
- .flatMap(([key, value]) => asArray(value)
555
+ .filter(([key, value]) => !lodash.isEqual(value, defaultArgs[key]))
556
+ .map(([key, value]) => `--${kebabize(key)}${typeof value === 'string' || Array.isArray(value) ? `=${asArray(value).join(',')}` : ''}`)
464
557
  .filter(Boolean)
465
- .map(value => `--${key}${typeof value === 'string' ? `=${value}` : ''}`)).join(' ');
558
+ .join(' ');
466
559
  }
467
560
  function asArray(value) {
468
561
  return Array.isArray(value) ? value : [value];
@@ -471,6 +564,21 @@ function getBasicOptions(packageName, pkg) {
471
564
  return [{
472
565
  title: 'General',
473
566
  field: 'general',
567
+ render: (_option, value) => lodash.isEqual(removeEmpty({
568
+ name: value.name,
569
+ version: value.version,
570
+ description: value.description,
571
+ license: value.license,
572
+ author: value.author,
573
+ readme: value.readme
574
+ }), removeEmpty({
575
+ name: pkg.pkg.name,
576
+ version: pkg.pkg.version,
577
+ description: pkg.pkg.description,
578
+ license: pkg.pkg.license,
579
+ author: pkg.pkg.author,
580
+ readme: pkg.pkg.readme
581
+ })) ? `[${kleur.green('Ok')}]` : `[${kleur.blue('Updated')}]`,
474
582
  items: [{
475
583
  title: 'Package Name',
476
584
  field: 'name',
@@ -522,27 +630,7 @@ async function readPackage(dir) {
522
630
  const pkgFile = await fs.readFile(packageFileName);
523
631
  const readmeFile = await fs.readFile(readmeFileName);
524
632
  const pkg = JSON.parse(pkgFile.toString());
525
- const isValidPackageJson = (input => {
526
- const $io0 = input => (undefined === input.private || "boolean" === typeof input.private) && (undefined === input.version || "string" === typeof input.version) && (undefined === input.name || "string" === typeof input.name) && (undefined === input.license || "string" === typeof input.license) && (undefined === input.readme || "string" === typeof input.readme) && (null !== input.author && (undefined === input.author || "string" === typeof input.author || "object" === typeof input.author && null !== input.author && false === Array.isArray(input.author) && $io1(input.author))) && (undefined === input.description || "string" === typeof input.description) && (undefined === input.scripts || "object" === typeof input.scripts && null !== input.scripts && false === Array.isArray(input.scripts) && $io2(input.scripts)) && (undefined === input.dependencies || "object" === typeof input.dependencies && null !== input.dependencies && false === Array.isArray(input.dependencies) && $io3(input.dependencies)) && (undefined === input.devDependencies || "object" === typeof input.devDependencies && null !== input.devDependencies && false === Array.isArray(input.devDependencies) && $io3(input.devDependencies)) && (undefined === input.peerDependencies || "object" === typeof input.peerDependencies && null !== input.peerDependencies && false === Array.isArray(input.peerDependencies) && $io3(input.peerDependencies));
527
- const $io1 = input => (undefined === input.name || "string" === typeof input.name) && (undefined === input.email || "string" === typeof input.email) && (undefined === input.url || "string" === typeof input.url);
528
- const $io2 = input => Object.keys(input).every(key => {
529
- const value = input[key];
530
- if (undefined === value)
531
- return true;
532
- if (RegExp(/(.*)/).test(key))
533
- return "string" === typeof value;
534
- return true;
535
- });
536
- const $io3 = input => Object.keys(input).every(key => {
537
- const value = input[key];
538
- if (undefined === value)
539
- return true;
540
- if (RegExp(/(.*)/).test(key))
541
- return "string" === typeof value;
542
- return true;
543
- });
544
- return "object" === typeof input && null !== input && false === Array.isArray(input) && $io0(input);
545
- })(pkg);
633
+ const isValidPackageJson = isPackageJson(pkg);
546
634
  if (!isValidPackageJson) {
547
635
  console.error('Invalid package.json');
548
636
  throw new Error('Invalid package.json');
@@ -565,7 +653,7 @@ async function writePackage(dir, pkg) {
565
653
  const readmeFileName = path.resolve(dir, 'README.md');
566
654
  try {
567
655
  await fs.mkdir(dir, { recursive: true });
568
- await fs.writeFile(packageFileName, JSON.stringify(pkg.pkg, null, 2) + '\n', {});
656
+ await fs.writeFile(packageFileName, toFormattedJson(pkg.pkg));
569
657
  await fs.writeFile(readmeFileName, pkg.readme);
570
658
  }
571
659
  catch (e) {
@@ -573,3 +661,9 @@ async function writePackage(dir, pkg) {
573
661
  process.exit(-1);
574
662
  }
575
663
  }
664
+ function removeEmpty(data) {
665
+ return JSON.parse(JSON.stringify(data));
666
+ }
667
+ function kebabize(value) {
668
+ return value.replace(/[A-Z]+(?![a-z])|[A-Z]/g, ($, ofs) => (ofs ? '-' : '') + $.toLowerCase());
669
+ }
package/dist/index.mjs CHANGED
@@ -5,10 +5,10 @@ import userName from 'git-user-name';
5
5
  import gitConfig from 'parse-git-config';
6
6
  import { cli } from 'cleye';
7
7
  import kleur from 'kleur';
8
- import 'typia';
9
8
  import { parseArgsStringToArgv } from 'string-argv';
10
9
  import childProcess from 'node:child_process';
11
10
  import util from 'node:util';
11
+ import { isEqual } from 'lodash';
12
12
 
13
13
  async function getGitRoot() {
14
14
  const exec = util.promisify(childProcess.exec);
@@ -16,6 +16,206 @@ async function getGitRoot() {
16
16
  return stdout.trim();
17
17
  }
18
18
 
19
+ function isPackageJson(value) {
20
+ return (input => {
21
+ const $io0 = input => (undefined === input.private || "boolean" === typeof input.private) && (undefined === input.version || "string" === typeof input.version) && (undefined === input.name || "string" === typeof input.name) && (undefined === input.license || "string" === typeof input.license) && (undefined === input.readme || "string" === typeof input.readme) && (null !== input.author && (undefined === input.author || "string" === typeof input.author || "object" === typeof input.author && null !== input.author && false === Array.isArray(input.author) && $io1(input.author))) && (undefined === input.description || "string" === typeof input.description) && (undefined === input.scripts || "object" === typeof input.scripts && null !== input.scripts && false === Array.isArray(input.scripts) && $io2(input.scripts)) && (undefined === input.repository || "object" === typeof input.repository && null !== input.repository && false === Array.isArray(input.repository) && $io3(input.repository)) && (undefined === input.bugs || "string" === typeof input.bugs) && (undefined === input.homepage || "string" === typeof input.homepage) && (undefined === input.dependencies || "object" === typeof input.dependencies && null !== input.dependencies && false === Array.isArray(input.dependencies) && $io4(input.dependencies)) && (undefined === input.devDependencies || "object" === typeof input.devDependencies && null !== input.devDependencies && false === Array.isArray(input.devDependencies) && $io4(input.devDependencies)) && (undefined === input.peerDependencies || "object" === typeof input.peerDependencies && null !== input.peerDependencies && false === Array.isArray(input.peerDependencies) && $io4(input.peerDependencies));
22
+ const $io1 = input => (undefined === input.name || "string" === typeof input.name) && (undefined === input.email || "string" === typeof input.email) && (undefined === input.url || "string" === typeof input.url);
23
+ const $io2 = input => Object.keys(input).every(key => {
24
+ const value = input[key];
25
+ if (undefined === value)
26
+ return true;
27
+ if (RegExp(/(.*)/).test(key))
28
+ return "string" === typeof value;
29
+ return true;
30
+ });
31
+ const $io3 = input => (undefined === input.type || "string" === typeof input.type) && (undefined === input.url || "string" === typeof input.url);
32
+ const $io4 = input => Object.keys(input).every(key => {
33
+ const value = input[key];
34
+ if (undefined === value)
35
+ return true;
36
+ if (RegExp(/(.*)/).test(key))
37
+ return "string" === typeof value;
38
+ return true;
39
+ });
40
+ return "object" === typeof input && null !== input && false === Array.isArray(input) && $io0(input);
41
+ })(value);
42
+ }
43
+ function CommaSeparatedString(value) {
44
+ return value.split(',').map((arg) => arg.trim());
45
+ }
46
+ function CommaSeparatedStringOrBoolean(value) {
47
+ if (typeof value === 'boolean') {
48
+ return value;
49
+ }
50
+ if (Array.isArray(value) && value.length === 0) {
51
+ return true;
52
+ }
53
+ return CommaSeparatedString(value);
54
+ }
55
+ const cliFlagsDefaults = {
56
+ formats: ['es', 'cjs'],
57
+ umd: [],
58
+ compress: ['umd'],
59
+ sourcemaps: ['umd'],
60
+ preprocess: [],
61
+ dest: 'dist',
62
+ src: 'src',
63
+ bin: undefined,
64
+ includeExternals: false,
65
+ eject: false,
66
+ noTsConfig: false,
67
+ noUpdatePackageJson: false,
68
+ commonjsPattern: '[name].cjs',
69
+ esmPattern: '[name].mjs',
70
+ umdPattern: '[name].umd.js',
71
+ formatPackageJson: false
72
+ };
73
+ const cliFlags = {
74
+ umd: {
75
+ type: CommaSeparatedString,
76
+ description: 'Package subpath exports in UMD format',
77
+ default: cliFlagsDefaults.umd
78
+ },
79
+ compress: {
80
+ type: CommaSeparatedString,
81
+ description: 'Compress formats using terser',
82
+ default: cliFlagsDefaults.compress
83
+ },
84
+ sourcemaps: {
85
+ type: CommaSeparatedString,
86
+ description: 'Emit sourcemaps for the specified formats',
87
+ default: cliFlagsDefaults.sourcemaps
88
+ },
89
+ formats: {
90
+ type: CommaSeparatedString,
91
+ description: 'Formats to emit',
92
+ default: cliFlagsDefaults.formats
93
+ },
94
+ preprocess: {
95
+ type: CommaSeparatedString,
96
+ description: 'Preprocess entry points / subpath exports',
97
+ default: cliFlagsDefaults.preprocess
98
+ },
99
+ dest: {
100
+ type: String,
101
+ description: 'Output directory',
102
+ default: cliFlagsDefaults.dest
103
+ },
104
+ src: {
105
+ type: String,
106
+ description: 'Source directory',
107
+ default: cliFlagsDefaults.src
108
+ },
109
+ bin: {
110
+ type: CommaSeparatedString,
111
+ description: 'Executable files',
112
+ default: cliFlagsDefaults.bin
113
+ },
114
+ includeExternals: {
115
+ type: CommaSeparatedStringOrBoolean,
116
+ description: 'Include all/specified externals into result bundle(s)',
117
+ default: cliFlagsDefaults.includeExternals
118
+ },
119
+ eject: {
120
+ type: Boolean,
121
+ description: 'Eject config',
122
+ default: cliFlagsDefaults.eject
123
+ },
124
+ noTsConfig: {
125
+ type: Boolean,
126
+ description: 'Do not create / update tsconfig.json',
127
+ default: cliFlagsDefaults.noTsConfig
128
+ },
129
+ noUpdatePackageJson: {
130
+ type: Boolean,
131
+ description: 'Do not create / update package.json',
132
+ default: cliFlagsDefaults.noUpdatePackageJson
133
+ },
134
+ commonjsPattern: {
135
+ type: String,
136
+ description: 'CommonJS output file name pattern',
137
+ default: cliFlagsDefaults.commonjsPattern
138
+ },
139
+ esmPattern: {
140
+ type: String,
141
+ description: 'ES output file name pattern',
142
+ default: cliFlagsDefaults.esmPattern
143
+ },
144
+ umdPattern: {
145
+ type: String,
146
+ description: 'UMD output file name pattern',
147
+ default: cliFlagsDefaults.umdPattern
148
+ },
149
+ formatPackageJson: {
150
+ type: Boolean,
151
+ description: 'Format package.json',
152
+ default: cliFlagsDefaults.formatPackageJson
153
+ }
154
+ };
155
+ const packageJsonFieldsOrder = new Set([
156
+ 'private',
157
+ 'type',
158
+ 'version',
159
+ 'name',
160
+ 'scope',
161
+ 'description',
162
+ 'license',
163
+ 'author',
164
+ 'contributors',
165
+ 'funding',
166
+ 'bin',
167
+ 'main',
168
+ 'browser',
169
+ 'unpkg',
170
+ 'module',
171
+ 'exports',
172
+ 'imports',
173
+ 'types',
174
+ 'typings',
175
+ 'files',
176
+ 'packageManager',
177
+ 'sideEffects',
178
+ 'engines',
179
+ 'os',
180
+ 'cpu',
181
+ 'man',
182
+ 'directories',
183
+ 'repository',
184
+ 'bugs',
185
+ 'homepage',
186
+ 'readme',
187
+ 'keywords',
188
+ 'scripts',
189
+ 'config',
190
+ 'dependencies',
191
+ 'devDependencies',
192
+ 'peerDependencies',
193
+ 'peerDependenciesMeta',
194
+ 'bundleDependencies',
195
+ 'bundledDependencies',
196
+ 'optionalDependencies',
197
+ 'overrides',
198
+ 'publishConfig',
199
+ 'workspaces'
200
+ ]);
201
+ function processPackageJson(pkg, needTreatment, treatKey) {
202
+ const newPkg = {};
203
+ for (const key of packageJsonFieldsOrder) {
204
+ if (needTreatment(key)) {
205
+ newPkg[key] = treatKey(key);
206
+ }
207
+ }
208
+ for (const key in pkg) {
209
+ if (!packageJsonFieldsOrder.has(key)) {
210
+ newPkg[key] = pkg[key];
211
+ }
212
+ }
213
+ return newPkg;
214
+ }
215
+ function toFormattedJson(json) {
216
+ return JSON.stringify(json, null, 2) + '\n';
217
+ }
218
+
19
219
  const done = Symbol('done');
20
220
  const formats = ['amd', 'cjs', 'es', 'iife', 'system', 'umd'];
21
221
  const pkgbldBinaries = ['pkgbld', 'pkgbld-internal', 'node ../pkgbld/dist/index.js'];
@@ -43,7 +243,7 @@ async function execute() {
43
243
  const packageName = path.basename(targetDir);
44
244
  let cancelled = false;
45
245
  const options = getBasicOptions(packageName, pkg);
46
- options.push(...await getGitOptions(targetDir));
246
+ options.push(...await getGitOptions(targetDir, pkg.pkg));
47
247
  options.push(...getPkgbldOptions(pkg.pkg));
48
248
  const state = getOptionsValue(options);
49
249
  if (!args.flags.quiet) {
@@ -100,63 +300,7 @@ async function execute() {
100
300
  }
101
301
  execute();
102
302
  function updatePackage(pkg, options) {
103
- const order = new Set([
104
- 'private',
105
- 'type',
106
- 'version',
107
- 'name',
108
- 'description',
109
- 'license',
110
- 'author',
111
- 'contributors',
112
- 'funding',
113
- 'bin',
114
- 'main',
115
- 'browser',
116
- 'unpkg',
117
- 'module',
118
- 'exports',
119
- 'imports',
120
- 'types',
121
- 'typings',
122
- 'files',
123
- 'packageManager',
124
- 'sideEffects',
125
- 'engines',
126
- 'os',
127
- 'cpu',
128
- 'man',
129
- 'directories',
130
- 'repository',
131
- 'bugs',
132
- 'homepage',
133
- 'readme',
134
- 'keywords',
135
- 'scripts',
136
- 'config',
137
- 'dependencies',
138
- 'devDependencies',
139
- 'peerDependencies',
140
- 'peerDependenciesMeta',
141
- 'bundleDependencies',
142
- 'bundledDependencies',
143
- 'optionalDependencies',
144
- 'overrides',
145
- 'publishConfig',
146
- 'workspaces'
147
- ]);
148
- const newPkg = {};
149
- for (const key of order) {
150
- if (key in options || key in pkg.pkg) {
151
- newPkg[key] = treatKey(key);
152
- }
153
- }
154
- for (const key in pkg.pkg) {
155
- if (!order.has(key)) {
156
- newPkg[key] = pkg.pkg[key];
157
- }
158
- }
159
- pkg.pkg = newPkg;
303
+ pkg.pkg = processPackageJson(pkg.pkg, (key) => (key in options || key in pkg.pkg), treatKey);
160
304
  function treatKey(key) {
161
305
  if (key === 'scripts') {
162
306
  ({ ...pkg.pkg.scripts });
@@ -171,7 +315,7 @@ function getScriptValue(pkgbld) {
171
315
  const pkgBldCopy = { ...pkgbld };
172
316
  delete pkgBldCopy['pkgbldBinary'];
173
317
  delete pkgBldCopy['extraParameters'];
174
- return `${binary} ${asCommandLineArgs(pkgBldCopy)} ${extraArgs}`;
318
+ return `${binary} ${asCommandLineArgs(pkgBldCopy, cliFlagsDefaults)} ${extraArgs}`.trimEnd();
175
319
  }
176
320
  function getPromptOption(option, mutateObject) {
177
321
  const value = mutateObject[option.field];
@@ -202,16 +346,19 @@ function mapOption(state) {
202
346
  return (option) => {
203
347
  const fieldValue = state[option.field];
204
348
  return {
205
- title: pad16plus(option.title) + kleur.grey('items' in option ? getPrintString(option.items, (option.mutateInnerObject ? fieldValue : state)) : fieldValue ?? ''),
349
+ title: pad16plus(option.title) + kleur.grey('items' in option ? getPrintString(option, (option.mutateInnerObject ? fieldValue : state)) : fieldValue ?? ''),
206
350
  value: option.field
207
351
  };
208
352
  };
209
353
  }
210
- function getPrintString(items, json) {
211
- return items
354
+ function getPrintString(option, json) {
355
+ if (option.render) {
356
+ return option.render(option, json);
357
+ }
358
+ return option.items
212
359
  .filter(item => item.field in json && json[item.field] && (Array.isArray(json[item.field]) ? json[item.field].length > 0 : true))
213
360
  .map(item => kleur.grey(item.title) + ' ' + (kleur.white('items' in item ?
214
- `[${getPrintString(item.items, (item.mutateInnerObject ? json[item.field] :
361
+ `[${getPrintString(item, (item.mutateInnerObject ? json[item.field] :
215
362
  json))}]` : json[item.field])))
216
363
  .join(', ');
217
364
  }
@@ -238,7 +385,7 @@ async function reportVersion() {
238
385
  const version = createPkgBldPackage.pkg.version ?? '<unknown>';
239
386
  return version;
240
387
  }
241
- async function getGitOptions(targetDir) {
388
+ async function getGitOptions(targetDir, packageJson) {
242
389
  try {
243
390
  const gitCfg = await gitConfig();
244
391
  if (gitCfg) {
@@ -249,6 +396,15 @@ async function getGitOptions(targetDir) {
249
396
  title: 'Git',
250
397
  field: 'git',
251
398
  mutateInnerObject: false,
399
+ render: (_option, value) => isEqual(removeEmpty({
400
+ repository: value.repository,
401
+ bugs: value.bugs,
402
+ homepage: value.homepage
403
+ }), removeEmpty({
404
+ repository: packageJson.repository,
405
+ bugs: packageJson.bugs,
406
+ homepage: packageJson.homepage
407
+ })) ? `[${kleur.green('Ok')}]` : `[${kleur.blue('Updated')}]`,
252
408
  items: [{
253
409
  title: 'Homepage',
254
410
  field: 'homepage',
@@ -284,23 +440,7 @@ async function getGitOptions(targetDir) {
284
440
  return [];
285
441
  }
286
442
  function getPkgbldOptions(pkg) {
287
- let args = {
288
- formats: ['es', 'cjs'],
289
- umd: [],
290
- compress: ['umd'],
291
- sourcemaps: ['umd'],
292
- preprocess: [],
293
- dir: 'dist',
294
- sourceDir: 'src',
295
- bin: undefined,
296
- includeExternals: false,
297
- eject: false,
298
- noTsConfig: false,
299
- noUpdatePackageJson: false
300
- };
301
- function CommaSeparatedString(value) {
302
- return value.split(',').map((arg) => arg.trim());
303
- }
443
+ let args = cliFlagsDefaults;
304
444
  const cmd = pkg.scripts?.build ?? '';
305
445
  let binary = 'pkgbld';
306
446
  if (cmd) {
@@ -321,56 +461,7 @@ function getPkgbldOptions(pkg) {
321
461
  }
322
462
  const parsedArgs = cli({
323
463
  help: false,
324
- flags: {
325
- umd: {
326
- type: CommaSeparatedString,
327
- default: args.umd
328
- },
329
- compress: {
330
- type: CommaSeparatedString,
331
- default: args.compress
332
- },
333
- sourcemaps: {
334
- type: CommaSeparatedString,
335
- default: args.sourcemaps
336
- },
337
- formats: {
338
- type: CommaSeparatedString,
339
- default: args.formats
340
- },
341
- preprocess: {
342
- type: CommaSeparatedString,
343
- default: args.preprocess
344
- },
345
- dir: {
346
- type: String,
347
- default: args.dir
348
- },
349
- sourceDir: {
350
- type: String,
351
- default: args.sourceDir
352
- },
353
- bin: {
354
- type: CommaSeparatedString,
355
- default: args.bin
356
- },
357
- includeExternals: {
358
- type: Boolean,
359
- default: args.includeExternals
360
- },
361
- eject: {
362
- type: Boolean,
363
- default: args.eject
364
- },
365
- noTsConfig: {
366
- type: Boolean,
367
- default: args.noTsConfig
368
- },
369
- noUpdatePackageJson: {
370
- type: Boolean,
371
- default: args.noUpdatePackageJson
372
- }
373
- }
464
+ flags: cliFlags
374
465
  }, undefined, parseArgsStringToArgv(cmd));
375
466
  args = parsedArgs.flags;
376
467
  args.extraParameters = asCommandLineArgs(parsedArgs.unknownFlags);
@@ -379,14 +470,15 @@ function getPkgbldOptions(pkg) {
379
470
  title: 'pkgbld',
380
471
  field: 'pkgbld',
381
472
  mutateInnerObject: true,
473
+ render: (_option, value) => cmd === getScriptValue(value) ? `[${kleur.green('Ok')}]` : `[${kleur.blue('Updated')}]`,
382
474
  items: [{
383
475
  title: 'Destination folder',
384
476
  field: 'dest',
385
- initialValue: args.dir
477
+ initialValue: args.dest
386
478
  }, {
387
479
  title: 'Source folder',
388
480
  field: 'src',
389
- initialValue: args.sourceDir
481
+ initialValue: args.src
390
482
  }, {
391
483
  title: 'UMD exports',
392
484
  field: 'umd',
@@ -432,15 +524,15 @@ function getPkgbldOptions(pkg) {
432
524
  type: 'toggle',
433
525
  initialValue: args.eject
434
526
  }, {
435
- title: 'Create tsconfig',
436
- field: 'tsConfig',
527
+ title: 'Do not create tsconfig',
528
+ field: 'noTsConfig',
437
529
  type: 'toggle',
438
- initialValue: !args.noTsConfig
530
+ initialValue: args.noTsConfig
439
531
  }, {
440
- title: 'Update package.json',
441
- field: 'updatePackageJson',
532
+ title: 'Do not update package.json',
533
+ field: 'noUpdatePackageJson',
442
534
  type: 'toggle',
443
- initialValue: !args.noUpdatePackageJson
535
+ initialValue: args.noUpdatePackageJson
444
536
  }, {
445
537
  title: 'Extra parameters',
446
538
  field: 'extraParameters',
@@ -455,11 +547,12 @@ function getPkgbldOptions(pkg) {
455
547
  }]
456
548
  }];
457
549
  }
458
- function asCommandLineArgs(parsedArgs) {
550
+ function asCommandLineArgs(parsedArgs, defaultArgs = {}) {
459
551
  return Object.entries(parsedArgs)
460
- .flatMap(([key, value]) => asArray(value)
552
+ .filter(([key, value]) => !isEqual(value, defaultArgs[key]))
553
+ .map(([key, value]) => `--${kebabize(key)}${typeof value === 'string' || Array.isArray(value) ? `=${asArray(value).join(',')}` : ''}`)
461
554
  .filter(Boolean)
462
- .map(value => `--${key}${typeof value === 'string' ? `=${value}` : ''}`)).join(' ');
555
+ .join(' ');
463
556
  }
464
557
  function asArray(value) {
465
558
  return Array.isArray(value) ? value : [value];
@@ -468,6 +561,21 @@ function getBasicOptions(packageName, pkg) {
468
561
  return [{
469
562
  title: 'General',
470
563
  field: 'general',
564
+ render: (_option, value) => isEqual(removeEmpty({
565
+ name: value.name,
566
+ version: value.version,
567
+ description: value.description,
568
+ license: value.license,
569
+ author: value.author,
570
+ readme: value.readme
571
+ }), removeEmpty({
572
+ name: pkg.pkg.name,
573
+ version: pkg.pkg.version,
574
+ description: pkg.pkg.description,
575
+ license: pkg.pkg.license,
576
+ author: pkg.pkg.author,
577
+ readme: pkg.pkg.readme
578
+ })) ? `[${kleur.green('Ok')}]` : `[${kleur.blue('Updated')}]`,
471
579
  items: [{
472
580
  title: 'Package Name',
473
581
  field: 'name',
@@ -519,27 +627,7 @@ async function readPackage(dir) {
519
627
  const pkgFile = await fs.readFile(packageFileName);
520
628
  const readmeFile = await fs.readFile(readmeFileName);
521
629
  const pkg = JSON.parse(pkgFile.toString());
522
- const isValidPackageJson = (input => {
523
- const $io0 = input => (undefined === input.private || "boolean" === typeof input.private) && (undefined === input.version || "string" === typeof input.version) && (undefined === input.name || "string" === typeof input.name) && (undefined === input.license || "string" === typeof input.license) && (undefined === input.readme || "string" === typeof input.readme) && (null !== input.author && (undefined === input.author || "string" === typeof input.author || "object" === typeof input.author && null !== input.author && false === Array.isArray(input.author) && $io1(input.author))) && (undefined === input.description || "string" === typeof input.description) && (undefined === input.scripts || "object" === typeof input.scripts && null !== input.scripts && false === Array.isArray(input.scripts) && $io2(input.scripts)) && (undefined === input.dependencies || "object" === typeof input.dependencies && null !== input.dependencies && false === Array.isArray(input.dependencies) && $io3(input.dependencies)) && (undefined === input.devDependencies || "object" === typeof input.devDependencies && null !== input.devDependencies && false === Array.isArray(input.devDependencies) && $io3(input.devDependencies)) && (undefined === input.peerDependencies || "object" === typeof input.peerDependencies && null !== input.peerDependencies && false === Array.isArray(input.peerDependencies) && $io3(input.peerDependencies));
524
- const $io1 = input => (undefined === input.name || "string" === typeof input.name) && (undefined === input.email || "string" === typeof input.email) && (undefined === input.url || "string" === typeof input.url);
525
- const $io2 = input => Object.keys(input).every(key => {
526
- const value = input[key];
527
- if (undefined === value)
528
- return true;
529
- if (RegExp(/(.*)/).test(key))
530
- return "string" === typeof value;
531
- return true;
532
- });
533
- const $io3 = input => Object.keys(input).every(key => {
534
- const value = input[key];
535
- if (undefined === value)
536
- return true;
537
- if (RegExp(/(.*)/).test(key))
538
- return "string" === typeof value;
539
- return true;
540
- });
541
- return "object" === typeof input && null !== input && false === Array.isArray(input) && $io0(input);
542
- })(pkg);
630
+ const isValidPackageJson = isPackageJson(pkg);
543
631
  if (!isValidPackageJson) {
544
632
  console.error('Invalid package.json');
545
633
  throw new Error('Invalid package.json');
@@ -562,7 +650,7 @@ async function writePackage(dir, pkg) {
562
650
  const readmeFileName = path.resolve(dir, 'README.md');
563
651
  try {
564
652
  await fs.mkdir(dir, { recursive: true });
565
- await fs.writeFile(packageFileName, JSON.stringify(pkg.pkg, null, 2) + '\n', {});
653
+ await fs.writeFile(packageFileName, toFormattedJson(pkg.pkg));
566
654
  await fs.writeFile(readmeFileName, pkg.readme);
567
655
  }
568
656
  catch (e) {
@@ -570,3 +658,9 @@ async function writePackage(dir, pkg) {
570
658
  process.exit(-1);
571
659
  }
572
660
  }
661
+ function removeEmpty(data) {
662
+ return JSON.parse(JSON.stringify(data));
663
+ }
664
+ function kebabize(value) {
665
+ return value.replace(/[A-Z]+(?![a-z])|[A-Z]/g, ($, ofs) => (ofs ? '-' : '') + $.toLowerCase());
666
+ }
package/dist/types.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { PackageJson } from 'options';
1
2
  export type Option = ({
2
3
  title: string;
3
4
  field: string;
@@ -17,26 +18,8 @@ export type Option = ({
17
18
  } | {
18
19
  items: Option[];
19
20
  mutateInnerObject: boolean;
21
+ render?: (option: Option, value: OptionsValue) => string;
20
22
  });
21
- export type PackageJson = {
22
- private?: boolean;
23
- version?: string;
24
- name?: string;
25
- license?: string;
26
- readme?: string;
27
- author?: string | {
28
- name?: string;
29
- email?: string;
30
- url?: string;
31
- };
32
- description?: string;
33
- scripts?: {
34
- [key: string]: string;
35
- };
36
- dependencies?: Record<string, string>;
37
- devDependencies?: Record<string, string>;
38
- peerDependencies?: Record<string, string>;
39
- };
40
23
  export type PkgInfo = {
41
24
  readme: string;
42
25
  pkg: PackageJson;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.5.0",
2
+ "version": "1.7.0",
3
3
  "name": "create-pkgbld",
4
4
  "license": "MIT",
5
5
  "author": "Konstantin Shutkin",
@@ -34,23 +34,25 @@
34
34
  "init"
35
35
  ],
36
36
  "dependencies": {
37
- "typia": "^5.0.1",
38
- "string-argv": "^0.3.2",
37
+ "string-argv": "0.3.2",
39
38
  "git-user-name": "2.0.0",
40
- "cleye": "^1.3.2",
39
+ "cleye": "1.3.2",
41
40
  "parse-git-config": "3.0.0",
42
41
  "prompts": "2.4.2",
43
- "kleur": "4.1.5"
42
+ "kleur": "4.1.5",
43
+ "lodash": "4.17.21"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@types/git-user-name": "2.0.1",
47
47
  "@types/parse-git-config": "3.0.2",
48
48
  "@types/prompts": "2.4.5",
49
- "@total-typescript/ts-reset": "^0.5.1",
50
- "pkgbld": "1.18.0"
49
+ "@types/lodash": "4.14.199",
50
+ "@total-typescript/ts-reset": "0.5.1",
51
+ "pkgbld": "1.22.0",
52
+ "options": "0.0.1"
51
53
  },
52
54
  "scripts": {
53
- "build": "node ../pkgbld/dist/index.js",
55
+ "build": "node ../pkgbld/dist/index.js --include-externals=options",
54
56
  "lint": "eslint ./src"
55
57
  }
56
58
  }