create-pkgbld 1.4.4 → 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);
@@ -522,18 +522,16 @@ async function readPackage(dir) {
522
522
  const readmeFile = await fs.readFile(readmeFileName);
523
523
  const pkg = JSON.parse(pkgFile.toString());
524
524
  const isValidPackageJson = (input => {
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) && (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 => {
526
- if (["private", "version", "name", "license", "author", "description", "scripts", "dependencies", "devDependencies", "peerDependencies"].some(prop => key === prop))
527
- 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 => {
528
528
  const value = input[key];
529
529
  if (undefined === value)
530
530
  return true;
531
531
  if (RegExp(/(.*)/).test(key))
532
- return true;
532
+ return "string" === typeof value;
533
533
  return true;
534
534
  });
535
- const $io1 = input => (undefined === input.name || "string" === typeof input.name) && (undefined === input.email || "string" === typeof input.email) && (undefined === input.url || "string" === typeof input.url);
536
- const $io2 = input => (undefined === input.build || "string" === typeof input.build) && (undefined === input.lint || "string" === typeof input.lint);
537
535
  const $io3 = input => Object.keys(input).every(key => {
538
536
  const value = input[key];
539
537
  if (undefined === value)
@@ -566,7 +564,7 @@ async function writePackage(dir, pkg) {
566
564
  const readmeFileName = path.resolve(dir, 'README.md');
567
565
  try {
568
566
  await fs.mkdir(dir, { recursive: true });
569
- await fs.writeFile(packageFileName, JSON.stringify(pkg.pkg, null, 2), {});
567
+ await fs.writeFile(packageFileName, JSON.stringify(pkg.pkg, null, 2) + '\n', {});
570
568
  await fs.writeFile(readmeFileName, pkg.readme);
571
569
  }
572
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);
@@ -519,18 +519,16 @@ async function readPackage(dir) {
519
519
  const readmeFile = await fs.readFile(readmeFileName);
520
520
  const pkg = JSON.parse(pkgFile.toString());
521
521
  const isValidPackageJson = (input => {
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) && (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 => {
523
- if (["private", "version", "name", "license", "author", "description", "scripts", "dependencies", "devDependencies", "peerDependencies"].some(prop => key === prop))
524
- 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 => {
525
525
  const value = input[key];
526
526
  if (undefined === value)
527
527
  return true;
528
528
  if (RegExp(/(.*)/).test(key))
529
- return true;
529
+ return "string" === typeof value;
530
530
  return true;
531
531
  });
532
- const $io1 = input => (undefined === input.name || "string" === typeof input.name) && (undefined === input.email || "string" === typeof input.email) && (undefined === input.url || "string" === typeof input.url);
533
- const $io2 = input => (undefined === input.build || "string" === typeof input.build) && (undefined === input.lint || "string" === typeof input.lint);
534
532
  const $io3 = input => Object.keys(input).every(key => {
535
533
  const value = input[key];
536
534
  if (undefined === value)
@@ -563,7 +561,7 @@ async function writePackage(dir, pkg) {
563
561
  const readmeFileName = path.resolve(dir, 'README.md');
564
562
  try {
565
563
  await fs.mkdir(dir, { recursive: true });
566
- await fs.writeFile(packageFileName, JSON.stringify(pkg.pkg, null, 2), {});
564
+ await fs.writeFile(packageFileName, JSON.stringify(pkg.pkg, null, 2) + '\n', {});
567
565
  await fs.writeFile(readmeFileName, pkg.readme);
568
566
  }
569
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.4",
2
+ "version": "1.4.5",
3
3
  "name": "create-pkgbld",
4
4
  "license": "MIT",
5
5
  "author": "Konstantin Shutkin",