create-pkgbld 1.4.4 → 1.4.6
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 +9 -10
- package/dist/index.mjs +9 -10
- package/dist/types.d.ts +2 -3
- package/package.json +1 -1
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);
|
|
@@ -116,6 +116,7 @@ function updatePackage(pkg, options) {
|
|
|
116
116
|
'bin',
|
|
117
117
|
'main',
|
|
118
118
|
'browser',
|
|
119
|
+
'unpkg',
|
|
119
120
|
'module',
|
|
120
121
|
'exports',
|
|
121
122
|
'imports',
|
|
@@ -522,18 +523,16 @@ async function readPackage(dir) {
|
|
|
522
523
|
const readmeFile = await fs.readFile(readmeFileName);
|
|
523
524
|
const pkg = JSON.parse(pkgFile.toString());
|
|
524
525
|
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))
|
|
526
|
-
|
|
527
|
-
|
|
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 => {
|
|
528
529
|
const value = input[key];
|
|
529
530
|
if (undefined === value)
|
|
530
531
|
return true;
|
|
531
532
|
if (RegExp(/(.*)/).test(key))
|
|
532
|
-
return
|
|
533
|
+
return "string" === typeof value;
|
|
533
534
|
return true;
|
|
534
535
|
});
|
|
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
536
|
const $io3 = input => Object.keys(input).every(key => {
|
|
538
537
|
const value = input[key];
|
|
539
538
|
if (undefined === value)
|
|
@@ -566,7 +565,7 @@ async function writePackage(dir, pkg) {
|
|
|
566
565
|
const readmeFileName = path.resolve(dir, 'README.md');
|
|
567
566
|
try {
|
|
568
567
|
await fs.mkdir(dir, { recursive: true });
|
|
569
|
-
await fs.writeFile(packageFileName, JSON.stringify(pkg.pkg, null, 2), {});
|
|
568
|
+
await fs.writeFile(packageFileName, JSON.stringify(pkg.pkg, null, 2) + '\n', {});
|
|
570
569
|
await fs.writeFile(readmeFileName, pkg.readme);
|
|
571
570
|
}
|
|
572
571
|
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);
|
|
@@ -113,6 +113,7 @@ function updatePackage(pkg, options) {
|
|
|
113
113
|
'bin',
|
|
114
114
|
'main',
|
|
115
115
|
'browser',
|
|
116
|
+
'unpkg',
|
|
116
117
|
'module',
|
|
117
118
|
'exports',
|
|
118
119
|
'imports',
|
|
@@ -519,18 +520,16 @@ async function readPackage(dir) {
|
|
|
519
520
|
const readmeFile = await fs.readFile(readmeFileName);
|
|
520
521
|
const pkg = JSON.parse(pkgFile.toString());
|
|
521
522
|
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))
|
|
523
|
-
|
|
524
|
-
|
|
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 => {
|
|
525
526
|
const value = input[key];
|
|
526
527
|
if (undefined === value)
|
|
527
528
|
return true;
|
|
528
529
|
if (RegExp(/(.*)/).test(key))
|
|
529
|
-
return
|
|
530
|
+
return "string" === typeof value;
|
|
530
531
|
return true;
|
|
531
532
|
});
|
|
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
533
|
const $io3 = input => Object.keys(input).every(key => {
|
|
535
534
|
const value = input[key];
|
|
536
535
|
if (undefined === value)
|
|
@@ -563,7 +562,7 @@ async function writePackage(dir, pkg) {
|
|
|
563
562
|
const readmeFileName = path.resolve(dir, 'README.md');
|
|
564
563
|
try {
|
|
565
564
|
await fs.mkdir(dir, { recursive: true });
|
|
566
|
-
await fs.writeFile(packageFileName, JSON.stringify(pkg.pkg, null, 2), {});
|
|
565
|
+
await fs.writeFile(packageFileName, JSON.stringify(pkg.pkg, null, 2) + '\n', {});
|
|
567
566
|
await fs.writeFile(readmeFileName, pkg.readme);
|
|
568
567
|
}
|
|
569
568
|
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
|
-
|
|
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