create-pkgbld 1.4.3 → 1.4.5

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
@@ -38,11 +38,11 @@ async function execute() {
38
38
  }
39
39
  }
40
40
  });
41
- args.showVersion();
41
+ !args.flags.quiet && args.showVersion();
42
42
  const targetDir = path.join(process.cwd(), args._.packageName ?? '.');
43
- console.log(kleur.grey(pad16plus('Target Directory', 0)) + kleur.white(targetDir));
43
+ !args.flags.quiet && console.log(kleur.grey(pad16plus('Target Directory', 0)) + kleur.white(targetDir));
44
44
  const pkg = await readPackage(targetDir);
45
- console.log(kleur.grey(pad16plus('Mode', 0)) + kleur.white(pkg.mode));
45
+ !args.flags.quiet && console.log(kleur.grey(pad16plus('Mode', 0)) + kleur.white(pkg.mode));
46
46
  const packageName = path.basename(targetDir);
47
47
  let cancelled = false;
48
48
  const options = getBasicOptions(packageName, pkg);
@@ -111,25 +111,41 @@ function updatePackage(pkg, options) {
111
111
  'description',
112
112
  'license',
113
113
  'author',
114
+ 'contributors',
115
+ 'funding',
114
116
  'bin',
115
117
  'main',
118
+ 'browser',
116
119
  'module',
117
120
  'exports',
121
+ 'imports',
118
122
  'types',
119
123
  'typings',
120
124
  'files',
125
+ 'packageManager',
126
+ 'sideEffects',
121
127
  'engines',
128
+ 'os',
129
+ 'cpu',
130
+ 'man',
131
+ 'directories',
122
132
  'repository',
123
133
  'bugs',
124
134
  'homepage',
125
135
  'readme',
126
136
  'keywords',
127
137
  'scripts',
138
+ 'config',
128
139
  'dependencies',
129
140
  'devDependencies',
130
141
  'peerDependencies',
142
+ 'peerDependenciesMeta',
143
+ 'bundleDependencies',
144
+ 'bundledDependencies',
131
145
  'optionalDependencies',
132
- 'publishConfig'
146
+ 'overrides',
147
+ 'publishConfig',
148
+ 'workspaces'
133
149
  ]);
134
150
  const newPkg = {};
135
151
  for (const key of order) {
@@ -506,18 +522,16 @@ async function readPackage(dir) {
506
522
  const readmeFile = await fs.readFile(readmeFileName);
507
523
  const pkg = JSON.parse(pkgFile.toString());
508
524
  const isValidPackageJson = (input => {
509
- 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) && (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)) && Object.keys(input).every(key => {
510
- if (["private", "version", "name", "license", "author", "description", "scripts", "dependencies", "devDependencies", "peerDependencies"].some(prop => key === prop))
511
- return true;
525
+ 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));
526
+ const $io1 = input => (undefined === input.name || "string" === typeof input.name) && (undefined === input.email || "string" === typeof input.email) && (undefined === input.url || "string" === typeof input.url);
527
+ const $io2 = input => Object.keys(input).every(key => {
512
528
  const value = input[key];
513
529
  if (undefined === value)
514
530
  return true;
515
531
  if (RegExp(/(.*)/).test(key))
516
- return true;
532
+ return "string" === typeof value;
517
533
  return true;
518
534
  });
519
- const $io1 = input => (undefined === input.name || "string" === typeof input.name) && (undefined === input.email || "string" === typeof input.email) && (undefined === input.url || "string" === typeof input.url);
520
- const $io2 = input => (undefined === input.build || "string" === typeof input.build) && (undefined === input.lint || "string" === typeof input.lint);
521
535
  const $io3 = input => Object.keys(input).every(key => {
522
536
  const value = input[key];
523
537
  if (undefined === value)
@@ -550,7 +564,7 @@ async function writePackage(dir, pkg) {
550
564
  const readmeFileName = path.resolve(dir, 'README.md');
551
565
  try {
552
566
  await fs.mkdir(dir, { recursive: true });
553
- await fs.writeFile(packageFileName, JSON.stringify(pkg.pkg, null, 2), {});
567
+ await fs.writeFile(packageFileName, JSON.stringify(pkg.pkg, null, 2) + '\n', {});
554
568
  await fs.writeFile(readmeFileName, pkg.readme);
555
569
  }
556
570
  catch (e) {
package/dist/index.mjs CHANGED
@@ -35,11 +35,11 @@ async function execute() {
35
35
  }
36
36
  }
37
37
  });
38
- args.showVersion();
38
+ !args.flags.quiet && args.showVersion();
39
39
  const targetDir = path.join(process.cwd(), args._.packageName ?? '.');
40
- console.log(kleur.grey(pad16plus('Target Directory', 0)) + kleur.white(targetDir));
40
+ !args.flags.quiet && console.log(kleur.grey(pad16plus('Target Directory', 0)) + kleur.white(targetDir));
41
41
  const pkg = await readPackage(targetDir);
42
- console.log(kleur.grey(pad16plus('Mode', 0)) + kleur.white(pkg.mode));
42
+ !args.flags.quiet && console.log(kleur.grey(pad16plus('Mode', 0)) + kleur.white(pkg.mode));
43
43
  const packageName = path.basename(targetDir);
44
44
  let cancelled = false;
45
45
  const options = getBasicOptions(packageName, pkg);
@@ -108,25 +108,41 @@ function updatePackage(pkg, options) {
108
108
  'description',
109
109
  'license',
110
110
  'author',
111
+ 'contributors',
112
+ 'funding',
111
113
  'bin',
112
114
  'main',
115
+ 'browser',
113
116
  'module',
114
117
  'exports',
118
+ 'imports',
115
119
  'types',
116
120
  'typings',
117
121
  'files',
122
+ 'packageManager',
123
+ 'sideEffects',
118
124
  'engines',
125
+ 'os',
126
+ 'cpu',
127
+ 'man',
128
+ 'directories',
119
129
  'repository',
120
130
  'bugs',
121
131
  'homepage',
122
132
  'readme',
123
133
  'keywords',
124
134
  'scripts',
135
+ 'config',
125
136
  'dependencies',
126
137
  'devDependencies',
127
138
  'peerDependencies',
139
+ 'peerDependenciesMeta',
140
+ 'bundleDependencies',
141
+ 'bundledDependencies',
128
142
  'optionalDependencies',
129
- 'publishConfig'
143
+ 'overrides',
144
+ 'publishConfig',
145
+ 'workspaces'
130
146
  ]);
131
147
  const newPkg = {};
132
148
  for (const key of order) {
@@ -503,18 +519,16 @@ async function readPackage(dir) {
503
519
  const readmeFile = await fs.readFile(readmeFileName);
504
520
  const pkg = JSON.parse(pkgFile.toString());
505
521
  const isValidPackageJson = (input => {
506
- 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) && (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)) && Object.keys(input).every(key => {
507
- if (["private", "version", "name", "license", "author", "description", "scripts", "dependencies", "devDependencies", "peerDependencies"].some(prop => key === prop))
508
- return true;
522
+ 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));
523
+ const $io1 = input => (undefined === input.name || "string" === typeof input.name) && (undefined === input.email || "string" === typeof input.email) && (undefined === input.url || "string" === typeof input.url);
524
+ const $io2 = input => Object.keys(input).every(key => {
509
525
  const value = input[key];
510
526
  if (undefined === value)
511
527
  return true;
512
528
  if (RegExp(/(.*)/).test(key))
513
- return true;
529
+ return "string" === typeof value;
514
530
  return true;
515
531
  });
516
- const $io1 = input => (undefined === input.name || "string" === typeof input.name) && (undefined === input.email || "string" === typeof input.email) && (undefined === input.url || "string" === typeof input.url);
517
- const $io2 = input => (undefined === input.build || "string" === typeof input.build) && (undefined === input.lint || "string" === typeof input.lint);
518
532
  const $io3 = input => Object.keys(input).every(key => {
519
533
  const value = input[key];
520
534
  if (undefined === value)
@@ -547,7 +561,7 @@ async function writePackage(dir, pkg) {
547
561
  const readmeFileName = path.resolve(dir, 'README.md');
548
562
  try {
549
563
  await fs.mkdir(dir, { recursive: true });
550
- await fs.writeFile(packageFileName, JSON.stringify(pkg.pkg, null, 2), {});
564
+ await fs.writeFile(packageFileName, JSON.stringify(pkg.pkg, null, 2) + '\n', {});
551
565
  await fs.writeFile(readmeFileName, pkg.readme);
552
566
  }
553
567
  catch (e) {
package/dist/types.d.ts CHANGED
@@ -23,6 +23,7 @@ export type PackageJson = {
23
23
  version?: string;
24
24
  name?: string;
25
25
  license?: string;
26
+ readme?: string;
26
27
  author?: string | {
27
28
  name?: string;
28
29
  email?: string;
@@ -30,13 +31,11 @@ export type PackageJson = {
30
31
  };
31
32
  description?: string;
32
33
  scripts?: {
33
- build?: string;
34
- lint?: string;
34
+ [key: string]: string;
35
35
  };
36
36
  dependencies?: Record<string, string>;
37
37
  devDependencies?: Record<string, string>;
38
38
  peerDependencies?: Record<string, string>;
39
- [key: string]: any;
40
39
  };
41
40
  export type PkgInfo = {
42
41
  readme: string;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.4.3",
2
+ "version": "1.4.5",
3
3
  "name": "create-pkgbld",
4
4
  "license": "MIT",
5
5
  "author": "Konstantin Shutkin",