@form8ion/javascript 11.0.0 → 11.2.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/lib/index.js +263 -232
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +284 -253
- package/lib/index.mjs.map +1 -1
- package/package.json +9 -9
package/lib/index.js
CHANGED
|
@@ -29,6 +29,7 @@ var filedirname = require('filedirname');
|
|
|
29
29
|
var huskyPlugin = require('@form8ion/husky');
|
|
30
30
|
var prettier = require('@form8ion/prettier');
|
|
31
31
|
var eslint = require('@form8ion/eslint');
|
|
32
|
+
var node_fs = require('node:fs');
|
|
32
33
|
var sortObjectKeys = require('sort-object-keys');
|
|
33
34
|
|
|
34
35
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -151,7 +152,7 @@ function c8IsConfigured ({projectRoot}) {
|
|
|
151
152
|
return core.fileExists(`${projectRoot}/.c8rc.json`);
|
|
152
153
|
}
|
|
153
154
|
|
|
154
|
-
async function tester ({projectRoot}) {
|
|
155
|
+
async function tester$2 ({projectRoot}) {
|
|
155
156
|
const [c8Exists, nycExists] = await Promise.all([c8IsConfigured({projectRoot}), nycIsConfigured({projectRoot})]);
|
|
156
157
|
|
|
157
158
|
return c8Exists || nycExists;
|
|
@@ -161,7 +162,7 @@ var coveragePlugin = /*#__PURE__*/Object.freeze({
|
|
|
161
162
|
__proto__: null,
|
|
162
163
|
scaffold: scaffoldCoverage,
|
|
163
164
|
lift: lift$2,
|
|
164
|
-
test: tester
|
|
165
|
+
test: tester$2
|
|
165
166
|
});
|
|
166
167
|
|
|
167
168
|
const unitTestFrameworksSchema = joi__default["default"].object().required().pattern(/^/, joi__default["default"].object({
|
|
@@ -258,7 +259,7 @@ var codeStylePlugin = /*#__PURE__*/Object.freeze({
|
|
|
258
259
|
scaffold: scaffoldCodeStyle
|
|
259
260
|
});
|
|
260
261
|
|
|
261
|
-
async function test
|
|
262
|
+
async function test({projectRoot}) {
|
|
262
263
|
const {engines} = JSON.parse(await fs.promises.readFile(`${projectRoot}/package.json`, 'utf8'));
|
|
263
264
|
|
|
264
265
|
return !!engines?.node;
|
|
@@ -276,10 +277,257 @@ async function lift$1({projectRoot}) {
|
|
|
276
277
|
|
|
277
278
|
var enginesEnhancer = /*#__PURE__*/Object.freeze({
|
|
278
279
|
__proto__: null,
|
|
279
|
-
test: test
|
|
280
|
+
test: test,
|
|
280
281
|
lift: lift$1
|
|
281
282
|
});
|
|
282
283
|
|
|
284
|
+
function buildDocumentationCommand (packageManager) {
|
|
285
|
+
if (javascriptCore.packageManagers.NPM === packageManager) return 'npm run generate:md';
|
|
286
|
+
if (javascriptCore.packageManagers.YARN === packageManager) return 'yarn generate:md';
|
|
287
|
+
|
|
288
|
+
throw new Error(
|
|
289
|
+
`The ${packageManager} package manager is currently not supported. `
|
|
290
|
+
+ `Only ${Object.values(javascriptCore.packageManagers).join(' and ')} are currently supported.`
|
|
291
|
+
);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
function getInstallationCommand(packageManager) {
|
|
295
|
+
if (javascriptCore.packageManagers.NPM === packageManager) return 'npm install';
|
|
296
|
+
if (javascriptCore.packageManagers.YARN === packageManager) return 'yarn add';
|
|
297
|
+
|
|
298
|
+
throw new Error(
|
|
299
|
+
`The ${packageManager} package manager is currently not supported. `
|
|
300
|
+
+ `Only ${Object.values(javascriptCore.packageManagers).join(' and ')} are currently supported.`
|
|
301
|
+
);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
function scaffoldPackageDocumentation ({scope, packageName, packageManager, visibility, provideExample}) {
|
|
305
|
+
return {
|
|
306
|
+
usage: `### Installation
|
|
307
|
+
${'Private' === visibility ? `
|
|
308
|
+
:warning: this is a private package, so you will need to use an npm token with
|
|
309
|
+
access to private packages under \`@${scope}\`
|
|
310
|
+
` : ''
|
|
311
|
+
}
|
|
312
|
+
\`\`\`sh
|
|
313
|
+
$ ${getInstallationCommand(packageManager)} ${packageName}
|
|
314
|
+
\`\`\`${provideExample
|
|
315
|
+
? `
|
|
316
|
+
|
|
317
|
+
### Example
|
|
318
|
+
|
|
319
|
+
run \`${buildDocumentationCommand(packageManager)}\` to inject the usage example`
|
|
320
|
+
: ''
|
|
321
|
+
}`
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
function defineBadges (packageName, visibility) {
|
|
326
|
+
return {
|
|
327
|
+
consumer: {
|
|
328
|
+
...'Public' === visibility && {
|
|
329
|
+
npm: {
|
|
330
|
+
img: `https://img.shields.io/npm/v/${packageName}?logo=npm`,
|
|
331
|
+
text: 'npm',
|
|
332
|
+
link: `https://www.npmjs.com/package/${packageName}`
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
},
|
|
336
|
+
status: {}
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
async function chooseBundler ({bundlers, decisions}) {
|
|
341
|
+
if (!Object.keys(bundlers).length) return 'Other';
|
|
342
|
+
|
|
343
|
+
const answers = await overridablePrompts.prompt([{
|
|
344
|
+
name: questionNames$1.PACKAGE_BUNDLER,
|
|
345
|
+
type: 'list',
|
|
346
|
+
message: 'Which bundler should be used?',
|
|
347
|
+
choices: [...Object.keys(bundlers), new overridablePrompts.Separator(), 'Other']
|
|
348
|
+
}], decisions);
|
|
349
|
+
|
|
350
|
+
return answers[questionNames$1.PACKAGE_BUNDLER];
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
function determinePathToTemplateFile (fileName) {
|
|
354
|
+
const [, __dirname] = filedirname__default["default"]();
|
|
355
|
+
|
|
356
|
+
return path.resolve(__dirname, '..', 'templates', fileName);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
const defaultBuildDirectory$2 = 'lib';
|
|
360
|
+
|
|
361
|
+
async function createExample(projectRoot, projectName) {
|
|
362
|
+
return fs.promises.writeFile(
|
|
363
|
+
`${projectRoot}/example.js`,
|
|
364
|
+
mustache__default["default"].render(
|
|
365
|
+
await fs.promises.readFile(determinePathToTemplateFile('example.mustache'), 'utf8'),
|
|
366
|
+
{projectName: camelcase__default["default"](projectName)}
|
|
367
|
+
)
|
|
368
|
+
);
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
async function buildDetailsForCommonJsProject({projectRoot, projectName, provideExample}) {
|
|
372
|
+
await Promise.all([
|
|
373
|
+
touch__default["default"](`${projectRoot}/index.js`),
|
|
374
|
+
provideExample
|
|
375
|
+
? fs.promises.writeFile(`${projectRoot}/example.js`, `const ${camelcase__default["default"](projectName)} = require('.');\n`)
|
|
376
|
+
: Promise.resolve()
|
|
377
|
+
]);
|
|
378
|
+
|
|
379
|
+
return {};
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
async function buildDetails ({
|
|
383
|
+
projectRoot,
|
|
384
|
+
projectName,
|
|
385
|
+
visibility,
|
|
386
|
+
packageName,
|
|
387
|
+
packageBundlers,
|
|
388
|
+
dialect,
|
|
389
|
+
provideExample,
|
|
390
|
+
decisions
|
|
391
|
+
}) {
|
|
392
|
+
if (javascriptCore.dialects.COMMON_JS === dialect) return buildDetailsForCommonJsProject({projectRoot, projectName, provideExample});
|
|
393
|
+
|
|
394
|
+
const chosenBundler = await chooseBundler({bundlers: packageBundlers, decisions});
|
|
395
|
+
|
|
396
|
+
const pathToCreatedSrcDirectory = await makeDir__default["default"](`${projectRoot}/src`);
|
|
397
|
+
const [bundlerResults] = await Promise.all([
|
|
398
|
+
javascriptCore.scaffoldChoice(packageBundlers, chosenBundler, {projectRoot, dialect, projectType: javascriptCore.projectTypes.PACKAGE}),
|
|
399
|
+
provideExample ? await createExample(projectRoot, projectName) : Promise.resolve,
|
|
400
|
+
touch__default["default"](`${pathToCreatedSrcDirectory}/index.js`)
|
|
401
|
+
]);
|
|
402
|
+
|
|
403
|
+
return deepmerge__default["default"](
|
|
404
|
+
bundlerResults,
|
|
405
|
+
{
|
|
406
|
+
devDependencies: ['rimraf'],
|
|
407
|
+
scripts: {
|
|
408
|
+
clean: `rimraf ./${defaultBuildDirectory$2}`,
|
|
409
|
+
prebuild: 'run-s clean',
|
|
410
|
+
build: 'npm-run-all --print-label --parallel build:*',
|
|
411
|
+
prepack: 'run-s build',
|
|
412
|
+
...provideExample && {'pregenerate:md': 'run-s build'}
|
|
413
|
+
},
|
|
414
|
+
vcsIgnore: {directories: [`/${defaultBuildDirectory$2}/`]},
|
|
415
|
+
buildDirectory: defaultBuildDirectory$2,
|
|
416
|
+
badges: {
|
|
417
|
+
consumer: {
|
|
418
|
+
...'Public' === visibility && {
|
|
419
|
+
runkit: {
|
|
420
|
+
img: `https://badge.runkitcdn.com/${packageName}.svg`,
|
|
421
|
+
text: `Try ${packageName} on RunKit`,
|
|
422
|
+
link: `https://npm.runkit.com/${packageName}`
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
);
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
async function scaffoldPackageType ({
|
|
432
|
+
projectRoot,
|
|
433
|
+
projectName,
|
|
434
|
+
packageName,
|
|
435
|
+
packageManager,
|
|
436
|
+
visibility,
|
|
437
|
+
scope,
|
|
438
|
+
packageBundlers,
|
|
439
|
+
decisions,
|
|
440
|
+
dialect,
|
|
441
|
+
provideExample,
|
|
442
|
+
publishRegistry
|
|
443
|
+
}) {
|
|
444
|
+
cliMessages.info('Scaffolding Package Details');
|
|
445
|
+
|
|
446
|
+
const [detailsForBuild] = await Promise.all([
|
|
447
|
+
buildDetails({
|
|
448
|
+
projectRoot,
|
|
449
|
+
projectName,
|
|
450
|
+
packageBundlers,
|
|
451
|
+
visibility,
|
|
452
|
+
packageName,
|
|
453
|
+
dialect,
|
|
454
|
+
provideExample,
|
|
455
|
+
decisions
|
|
456
|
+
}),
|
|
457
|
+
javascriptCore.mergeIntoExistingPackageJson({
|
|
458
|
+
projectRoot,
|
|
459
|
+
config: {
|
|
460
|
+
files: ['example.js', ...javascriptCore.dialects.COMMON_JS === dialect ? ['index.js'] : ['lib/']],
|
|
461
|
+
publishConfig: {
|
|
462
|
+
access: 'Public' === visibility ? 'public' : 'restricted',
|
|
463
|
+
provenance: true,
|
|
464
|
+
...publishRegistry && {registry: publishRegistry}
|
|
465
|
+
},
|
|
466
|
+
sideEffects: false,
|
|
467
|
+
...'Public' === visibility && {runkitExampleFilename: './example.js'},
|
|
468
|
+
...javascriptCore.dialects.BABEL === dialect && {
|
|
469
|
+
main: './lib/index.js',
|
|
470
|
+
module: './lib/index.mjs',
|
|
471
|
+
exports: {
|
|
472
|
+
require: './lib/index.js',
|
|
473
|
+
import: './lib/index.mjs'
|
|
474
|
+
}
|
|
475
|
+
},
|
|
476
|
+
...javascriptCore.dialects.ESM === dialect && {
|
|
477
|
+
main: './lib/index.mjs',
|
|
478
|
+
exports: './lib/index.mjs'
|
|
479
|
+
},
|
|
480
|
+
...javascriptCore.dialects.TYPESCRIPT === dialect && {
|
|
481
|
+
main: './lib/index.js',
|
|
482
|
+
module: './lib/index.mjs',
|
|
483
|
+
types: './lib/index.d.ts',
|
|
484
|
+
exports: {
|
|
485
|
+
types: './lib/index.d.ts',
|
|
486
|
+
require: './lib/index.js',
|
|
487
|
+
import: './lib/index.mjs'
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
})
|
|
492
|
+
]);
|
|
493
|
+
|
|
494
|
+
return deepmerge__default["default"].all([
|
|
495
|
+
{
|
|
496
|
+
documentation: scaffoldPackageDocumentation({packageName, visibility, scope, packageManager, provideExample}),
|
|
497
|
+
nextSteps: [
|
|
498
|
+
{summary: 'Add the appropriate `save` flag to the installation instructions in the README'},
|
|
499
|
+
{summary: 'Publish pre-release versions to npm until package is stable enough to publish v1.0.0'}
|
|
500
|
+
],
|
|
501
|
+
scripts: {'lint:publish': 'publint'},
|
|
502
|
+
badges: defineBadges(packageName, visibility),
|
|
503
|
+
devDependencies: ['publint']
|
|
504
|
+
},
|
|
505
|
+
detailsForBuild
|
|
506
|
+
]);
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
async function lifter$1 ({projectRoot}) {
|
|
510
|
+
await javascriptCore.mergeIntoExistingPackageJson({projectRoot, config: {publishConfig: {provenance: true}}});
|
|
511
|
+
|
|
512
|
+
return {
|
|
513
|
+
devDependencies: ['publint'],
|
|
514
|
+
scripts: {'lint:publish': 'publint'}
|
|
515
|
+
};
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
async function tester$1 ({projectRoot}) {
|
|
519
|
+
const {exports, publishConfig} = JSON.parse(await node_fs.promises.readFile(`${projectRoot}/package.json`, 'utf-8'));
|
|
520
|
+
|
|
521
|
+
return !!exports || !!publishConfig;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
var projectTypes = /*#__PURE__*/Object.freeze({
|
|
525
|
+
__proto__: null,
|
|
526
|
+
scaffold: scaffoldPackageType,
|
|
527
|
+
lift: lifter$1,
|
|
528
|
+
test: tester$1
|
|
529
|
+
});
|
|
530
|
+
|
|
283
531
|
function write ({projectRoot, config}) {
|
|
284
532
|
return configFile.write({path: projectRoot, name: 'babel', format: core.fileTypes.JSON, config});
|
|
285
533
|
}
|
|
@@ -603,7 +851,15 @@ async function lift ({projectRoot, vcs, results}) {
|
|
|
603
851
|
|
|
604
852
|
const enhancerResults = await core.applyEnhancers({
|
|
605
853
|
results,
|
|
606
|
-
enhancers: [
|
|
854
|
+
enhancers: [
|
|
855
|
+
huskyPlugin__namespace,
|
|
856
|
+
enginesEnhancer,
|
|
857
|
+
coveragePlugin,
|
|
858
|
+
commitConventionPlugin__namespace,
|
|
859
|
+
dialects,
|
|
860
|
+
codeStylePlugin,
|
|
861
|
+
projectTypes
|
|
862
|
+
],
|
|
607
863
|
options: {packageManager, projectRoot, vcs}
|
|
608
864
|
});
|
|
609
865
|
|
|
@@ -926,16 +1182,6 @@ async function scaffoldNpmConfig ({
|
|
|
926
1182
|
return {scripts: {'lint:peer': 'npm ls >/dev/null'}};
|
|
927
1183
|
}
|
|
928
1184
|
|
|
929
|
-
function buildDocumentationCommand (packageManager) {
|
|
930
|
-
if (javascriptCore.packageManagers.NPM === packageManager) return 'npm run generate:md';
|
|
931
|
-
if (javascriptCore.packageManagers.YARN === packageManager) return 'yarn generate:md';
|
|
932
|
-
|
|
933
|
-
throw new Error(
|
|
934
|
-
`The ${packageManager} package manager is currently not supported. `
|
|
935
|
-
+ `Only ${Object.values(javascriptCore.packageManagers).join(' and ')} are currently supported.`
|
|
936
|
-
);
|
|
937
|
-
}
|
|
938
|
-
|
|
939
1185
|
function scaffoldDocumentation ({projectTypeResults, packageManager}) {
|
|
940
1186
|
return {
|
|
941
1187
|
toc: `Run \`${buildDocumentationCommand(packageManager)}\` to generate a table of contents`,
|
|
@@ -1014,221 +1260,6 @@ function buildPackageName (projectName, scope) {
|
|
|
1014
1260
|
throw new Error(`The package name ${name} is invalid:${os.EOL}\t* ${errors.join(`${os.EOL}\t* `)}`);
|
|
1015
1261
|
}
|
|
1016
1262
|
|
|
1017
|
-
function getInstallationCommand(packageManager) {
|
|
1018
|
-
if (javascriptCore.packageManagers.NPM === packageManager) return 'npm install';
|
|
1019
|
-
if (javascriptCore.packageManagers.YARN === packageManager) return 'yarn add';
|
|
1020
|
-
|
|
1021
|
-
throw new Error(
|
|
1022
|
-
`The ${packageManager} package manager is currently not supported. `
|
|
1023
|
-
+ `Only ${Object.values(javascriptCore.packageManagers).join(' and ')} are currently supported.`
|
|
1024
|
-
);
|
|
1025
|
-
}
|
|
1026
|
-
|
|
1027
|
-
function scaffoldPackageDocumentation ({scope, packageName, packageManager, visibility, provideExample}) {
|
|
1028
|
-
return {
|
|
1029
|
-
usage: `### Installation
|
|
1030
|
-
${'Private' === visibility ? `
|
|
1031
|
-
:warning: this is a private package, so you will need to use an npm token with
|
|
1032
|
-
access to private packages under \`@${scope}\`
|
|
1033
|
-
` : ''
|
|
1034
|
-
}
|
|
1035
|
-
\`\`\`sh
|
|
1036
|
-
$ ${getInstallationCommand(packageManager)} ${packageName}
|
|
1037
|
-
\`\`\`${provideExample
|
|
1038
|
-
? `
|
|
1039
|
-
|
|
1040
|
-
### Example
|
|
1041
|
-
|
|
1042
|
-
run \`${buildDocumentationCommand(packageManager)}\` to inject the usage example`
|
|
1043
|
-
: ''
|
|
1044
|
-
}`
|
|
1045
|
-
};
|
|
1046
|
-
}
|
|
1047
|
-
|
|
1048
|
-
function defineBadges (packageName, visibility) {
|
|
1049
|
-
return {
|
|
1050
|
-
consumer: {
|
|
1051
|
-
...'Public' === visibility && {
|
|
1052
|
-
npm: {
|
|
1053
|
-
img: `https://img.shields.io/npm/v/${packageName}?logo=npm`,
|
|
1054
|
-
text: 'npm',
|
|
1055
|
-
link: `https://www.npmjs.com/package/${packageName}`
|
|
1056
|
-
}
|
|
1057
|
-
}
|
|
1058
|
-
},
|
|
1059
|
-
status: {}
|
|
1060
|
-
};
|
|
1061
|
-
}
|
|
1062
|
-
|
|
1063
|
-
async function chooseBundler ({bundlers, decisions}) {
|
|
1064
|
-
if (!Object.keys(bundlers).length) return 'Other';
|
|
1065
|
-
|
|
1066
|
-
const answers = await overridablePrompts.prompt([{
|
|
1067
|
-
name: questionNames$1.PACKAGE_BUNDLER,
|
|
1068
|
-
type: 'list',
|
|
1069
|
-
message: 'Which bundler should be used?',
|
|
1070
|
-
choices: [...Object.keys(bundlers), new overridablePrompts.Separator(), 'Other']
|
|
1071
|
-
}], decisions);
|
|
1072
|
-
|
|
1073
|
-
return answers[questionNames$1.PACKAGE_BUNDLER];
|
|
1074
|
-
}
|
|
1075
|
-
|
|
1076
|
-
function determinePathToTemplateFile (fileName) {
|
|
1077
|
-
const [, __dirname] = filedirname__default["default"]();
|
|
1078
|
-
|
|
1079
|
-
return path.resolve(__dirname, '..', 'templates', fileName);
|
|
1080
|
-
}
|
|
1081
|
-
|
|
1082
|
-
const defaultBuildDirectory$2 = 'lib';
|
|
1083
|
-
|
|
1084
|
-
async function createExample(projectRoot, projectName) {
|
|
1085
|
-
return fs.promises.writeFile(
|
|
1086
|
-
`${projectRoot}/example.js`,
|
|
1087
|
-
mustache__default["default"].render(
|
|
1088
|
-
await fs.promises.readFile(determinePathToTemplateFile('example.mustache'), 'utf8'),
|
|
1089
|
-
{projectName: camelcase__default["default"](projectName)}
|
|
1090
|
-
)
|
|
1091
|
-
);
|
|
1092
|
-
}
|
|
1093
|
-
|
|
1094
|
-
async function buildDetailsForCommonJsProject({projectRoot, projectName, provideExample}) {
|
|
1095
|
-
await Promise.all([
|
|
1096
|
-
touch__default["default"](`${projectRoot}/index.js`),
|
|
1097
|
-
provideExample
|
|
1098
|
-
? fs.promises.writeFile(`${projectRoot}/example.js`, `const ${camelcase__default["default"](projectName)} = require('.');\n`)
|
|
1099
|
-
: Promise.resolve()
|
|
1100
|
-
]);
|
|
1101
|
-
|
|
1102
|
-
return {};
|
|
1103
|
-
}
|
|
1104
|
-
|
|
1105
|
-
async function buildDetails ({
|
|
1106
|
-
projectRoot,
|
|
1107
|
-
projectName,
|
|
1108
|
-
visibility,
|
|
1109
|
-
packageName,
|
|
1110
|
-
packageBundlers,
|
|
1111
|
-
dialect,
|
|
1112
|
-
provideExample,
|
|
1113
|
-
decisions
|
|
1114
|
-
}) {
|
|
1115
|
-
if (javascriptCore.dialects.COMMON_JS === dialect) return buildDetailsForCommonJsProject({projectRoot, projectName, provideExample});
|
|
1116
|
-
|
|
1117
|
-
const chosenBundler = await chooseBundler({bundlers: packageBundlers, decisions});
|
|
1118
|
-
|
|
1119
|
-
const pathToCreatedSrcDirectory = await makeDir__default["default"](`${projectRoot}/src`);
|
|
1120
|
-
const [bundlerResults] = await Promise.all([
|
|
1121
|
-
javascriptCore.scaffoldChoice(packageBundlers, chosenBundler, {projectRoot, dialect, projectType: javascriptCore.projectTypes.PACKAGE}),
|
|
1122
|
-
provideExample ? await createExample(projectRoot, projectName) : Promise.resolve,
|
|
1123
|
-
touch__default["default"](`${pathToCreatedSrcDirectory}/index.js`)
|
|
1124
|
-
]);
|
|
1125
|
-
|
|
1126
|
-
return deepmerge__default["default"](
|
|
1127
|
-
bundlerResults,
|
|
1128
|
-
{
|
|
1129
|
-
devDependencies: ['rimraf'],
|
|
1130
|
-
scripts: {
|
|
1131
|
-
clean: `rimraf ./${defaultBuildDirectory$2}`,
|
|
1132
|
-
prebuild: 'run-s clean',
|
|
1133
|
-
build: 'npm-run-all --print-label --parallel build:*',
|
|
1134
|
-
prepack: 'run-s build',
|
|
1135
|
-
...provideExample && {'pregenerate:md': 'run-s build'}
|
|
1136
|
-
},
|
|
1137
|
-
vcsIgnore: {directories: [`/${defaultBuildDirectory$2}/`]},
|
|
1138
|
-
buildDirectory: defaultBuildDirectory$2,
|
|
1139
|
-
badges: {
|
|
1140
|
-
consumer: {
|
|
1141
|
-
...'Public' === visibility && {
|
|
1142
|
-
runkit: {
|
|
1143
|
-
img: `https://badge.runkitcdn.com/${packageName}.svg`,
|
|
1144
|
-
text: `Try ${packageName} on RunKit`,
|
|
1145
|
-
link: `https://npm.runkit.com/${packageName}`
|
|
1146
|
-
}
|
|
1147
|
-
}
|
|
1148
|
-
}
|
|
1149
|
-
}
|
|
1150
|
-
}
|
|
1151
|
-
);
|
|
1152
|
-
}
|
|
1153
|
-
|
|
1154
|
-
async function scaffoldPackageType ({
|
|
1155
|
-
projectRoot,
|
|
1156
|
-
projectName,
|
|
1157
|
-
packageName,
|
|
1158
|
-
packageManager,
|
|
1159
|
-
visibility,
|
|
1160
|
-
scope,
|
|
1161
|
-
packageBundlers,
|
|
1162
|
-
decisions,
|
|
1163
|
-
dialect,
|
|
1164
|
-
provideExample,
|
|
1165
|
-
publishRegistry
|
|
1166
|
-
}) {
|
|
1167
|
-
cliMessages.info('Scaffolding Package Details');
|
|
1168
|
-
|
|
1169
|
-
const [detailsForBuild] = await Promise.all([
|
|
1170
|
-
buildDetails({
|
|
1171
|
-
projectRoot,
|
|
1172
|
-
projectName,
|
|
1173
|
-
packageBundlers,
|
|
1174
|
-
visibility,
|
|
1175
|
-
packageName,
|
|
1176
|
-
dialect,
|
|
1177
|
-
provideExample,
|
|
1178
|
-
decisions
|
|
1179
|
-
}),
|
|
1180
|
-
javascriptCore.mergeIntoExistingPackageJson({
|
|
1181
|
-
projectRoot,
|
|
1182
|
-
config: {
|
|
1183
|
-
files: ['example.js', ...javascriptCore.dialects.COMMON_JS === dialect ? ['index.js'] : ['lib/']],
|
|
1184
|
-
publishConfig: {
|
|
1185
|
-
access: 'Public' === visibility ? 'public' : 'restricted',
|
|
1186
|
-
provenance: true,
|
|
1187
|
-
...publishRegistry && {registry: publishRegistry}
|
|
1188
|
-
},
|
|
1189
|
-
sideEffects: false,
|
|
1190
|
-
...'Public' === visibility && {runkitExampleFilename: './example.js'},
|
|
1191
|
-
...javascriptCore.dialects.BABEL === dialect && {
|
|
1192
|
-
main: './lib/index.js',
|
|
1193
|
-
module: './lib/index.mjs',
|
|
1194
|
-
exports: {
|
|
1195
|
-
require: './lib/index.js',
|
|
1196
|
-
import: './lib/index.mjs'
|
|
1197
|
-
}
|
|
1198
|
-
},
|
|
1199
|
-
...javascriptCore.dialects.ESM === dialect && {
|
|
1200
|
-
main: './lib/index.mjs',
|
|
1201
|
-
exports: './lib/index.mjs'
|
|
1202
|
-
},
|
|
1203
|
-
...javascriptCore.dialects.TYPESCRIPT === dialect && {
|
|
1204
|
-
main: './lib/index.js',
|
|
1205
|
-
module: './lib/index.mjs',
|
|
1206
|
-
types: './lib/index.d.ts',
|
|
1207
|
-
exports: {
|
|
1208
|
-
types: './lib/index.d.ts',
|
|
1209
|
-
require: './lib/index.js',
|
|
1210
|
-
import: './lib/index.mjs'
|
|
1211
|
-
}
|
|
1212
|
-
}
|
|
1213
|
-
}
|
|
1214
|
-
})
|
|
1215
|
-
]);
|
|
1216
|
-
|
|
1217
|
-
return deepmerge__default["default"].all([
|
|
1218
|
-
{
|
|
1219
|
-
documentation: scaffoldPackageDocumentation({packageName, visibility, scope, packageManager, provideExample}),
|
|
1220
|
-
nextSteps: [
|
|
1221
|
-
{summary: 'Add the appropriate `save` flag to the installation instructions in the README'},
|
|
1222
|
-
{summary: 'Publish pre-release versions to npm until package is stable enough to publish v1.0.0'}
|
|
1223
|
-
],
|
|
1224
|
-
scripts: {'lint:publish': 'publint'},
|
|
1225
|
-
badges: defineBadges(packageName, visibility),
|
|
1226
|
-
devDependencies: ['publint']
|
|
1227
|
-
},
|
|
1228
|
-
detailsForBuild
|
|
1229
|
-
]);
|
|
1230
|
-
}
|
|
1231
|
-
|
|
1232
1263
|
const defaultBuildDirectory$1 = 'public';
|
|
1233
1264
|
|
|
1234
1265
|
async function scaffoldApplicationType ({projectRoot}) {
|
|
@@ -1649,7 +1680,7 @@ async function scaffolder (options) {
|
|
|
1649
1680
|
};
|
|
1650
1681
|
}
|
|
1651
1682
|
|
|
1652
|
-
async function
|
|
1683
|
+
async function tester ({projectRoot}) {
|
|
1653
1684
|
const [nvmIsConfigured, packageLockExists, yarnLockExists] = await Promise.all([
|
|
1654
1685
|
core.fileExists(`${projectRoot}/.nvmrc`),
|
|
1655
1686
|
core.fileExists(`${projectRoot}/package-lock.json`),
|
|
@@ -1665,5 +1696,5 @@ exports.lift = lift;
|
|
|
1665
1696
|
exports.questionNames = questionNames;
|
|
1666
1697
|
exports.scaffold = scaffolder;
|
|
1667
1698
|
exports.scaffoldUnitTesting = scaffoldUnitTesting;
|
|
1668
|
-
exports.test =
|
|
1699
|
+
exports.test = tester;
|
|
1669
1700
|
//# sourceMappingURL=index.js.map
|