@form8ion/javascript 12.6.2 → 13.0.0-alpha.2
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/README.md +14 -4
- package/example.js +14 -4
- package/lib/index.js +30 -41
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +29 -40
- package/lib/index.mjs.map +1 -1
- package/package.json +3 -3
- package/templates/example.mustache +1 -1
package/lib/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { questionNames as questionNames$2, questions } from '@travi/language-scaffolder-prompts';
|
|
2
2
|
import deepmerge from 'deepmerge';
|
|
3
|
-
import { fileTypes, fileExists, validateOptions, applyEnhancers, writeConfigFile } from '@form8ion/core';
|
|
3
|
+
import { fileTypes, fileExists, optionsSchemas, validateOptions, applyEnhancers, writeConfigFile } from '@form8ion/core';
|
|
4
4
|
import { scaffoldChoice, projectTypes as projectTypes$1, packageManagers as packageManagers$1, mergeIntoExistingPackageJson, dialects as dialects$1, writePackageJson, DEV_DEPENDENCY_TYPE, PROD_DEPENDENCY_TYPE } from '@form8ion/javascript-core';
|
|
5
5
|
import joi from 'joi';
|
|
6
6
|
import { prompt as prompt$1, Separator } from '@form8ion/overridable-prompts';
|
|
@@ -127,9 +127,7 @@ var coveragePlugin = /*#__PURE__*/Object.freeze({
|
|
|
127
127
|
test: tester$4
|
|
128
128
|
});
|
|
129
129
|
|
|
130
|
-
const unitTestFrameworksSchema = joi.object().
|
|
131
|
-
scaffolder: joi.func().arity(1).required()
|
|
132
|
-
}));
|
|
130
|
+
const unitTestFrameworksSchema = joi.object().pattern(/^/, optionsSchemas.form8ionPlugin).default({});
|
|
133
131
|
|
|
134
132
|
async function chooseFramework ({frameworks, decisions}) {
|
|
135
133
|
if (!Object.keys(frameworks).length) return 'Other';
|
|
@@ -561,8 +559,8 @@ async function scaffoldPackageType ({
|
|
|
561
559
|
}
|
|
562
560
|
},
|
|
563
561
|
...dialects$1.ESM === dialect && {
|
|
564
|
-
main: './lib/index.
|
|
565
|
-
exports: './lib/index.
|
|
562
|
+
main: './lib/index.js',
|
|
563
|
+
exports: './lib/index.js'
|
|
566
564
|
},
|
|
567
565
|
...dialects$1.TYPESCRIPT === dialect && {
|
|
568
566
|
main: './lib/index.js',
|
|
@@ -584,6 +582,7 @@ async function scaffoldPackageType ({
|
|
|
584
582
|
documentation: scaffoldPackageDocumentation({packageName, visibility, scope, packageManager, provideExample}),
|
|
585
583
|
nextSteps: [
|
|
586
584
|
{summary: 'Add the appropriate `save` flag to the installation instructions in the README'},
|
|
585
|
+
{summary: 'Define supported node.js versions as `engines.node` in the `package.json` file'},
|
|
587
586
|
{summary: 'Publish pre-release versions to npm until package is stable enough to publish v1.0.0'}
|
|
588
587
|
]
|
|
589
588
|
},
|
|
@@ -682,7 +681,7 @@ async function scaffoldCliType ({
|
|
|
682
681
|
devDependencies: ['rimraf'],
|
|
683
682
|
vcsIgnore: {files: [], directories: [`/${defaultBuildDirectory}/`]},
|
|
684
683
|
buildDirectory: defaultBuildDirectory,
|
|
685
|
-
nextSteps: []
|
|
684
|
+
nextSteps: [{summary: 'Define supported node.js versions as `engines.node` in the `package.json` file'}]
|
|
686
685
|
}
|
|
687
686
|
]);
|
|
688
687
|
}
|
|
@@ -1120,7 +1119,7 @@ var packageManagers = /*#__PURE__*/Object.freeze({
|
|
|
1120
1119
|
defineLockfilePath: determineLockfilePathFor
|
|
1121
1120
|
});
|
|
1122
1121
|
|
|
1123
|
-
async function lift ({projectRoot, vcs, results, pathWithinParent}) {
|
|
1122
|
+
async function lift ({projectRoot, vcs, results, pathWithinParent, enhancers = {}}) {
|
|
1124
1123
|
info('Lifting JavaScript-specific details');
|
|
1125
1124
|
|
|
1126
1125
|
const {
|
|
@@ -1138,7 +1137,8 @@ async function lift ({projectRoot, vcs, results, pathWithinParent}) {
|
|
|
1138
1137
|
|
|
1139
1138
|
const enhancerResults = await applyEnhancers({
|
|
1140
1139
|
results,
|
|
1141
|
-
enhancers:
|
|
1140
|
+
enhancers: {
|
|
1141
|
+
...enhancers,
|
|
1142
1142
|
huskyPlugin,
|
|
1143
1143
|
enginesEnhancer,
|
|
1144
1144
|
coveragePlugin,
|
|
@@ -1148,7 +1148,7 @@ async function lift ({projectRoot, vcs, results, pathWithinParent}) {
|
|
|
1148
1148
|
npmConfigPlugin,
|
|
1149
1149
|
projectTypes,
|
|
1150
1150
|
packageManagers
|
|
1151
|
-
|
|
1151
|
+
},
|
|
1152
1152
|
options: {packageManager, projectRoot, vcs, packageDetails: JSON.parse(packageContents)}
|
|
1153
1153
|
});
|
|
1154
1154
|
|
|
@@ -1162,8 +1162,7 @@ async function lift ({projectRoot, vcs, results, pathWithinParent}) {
|
|
|
1162
1162
|
return enhancerResults;
|
|
1163
1163
|
}
|
|
1164
1164
|
|
|
1165
|
-
const
|
|
1166
|
-
const pluginMapSchema = joi.object().pattern(joi.string(), pluginSchema);
|
|
1165
|
+
const pluginMapSchema = joi.object().pattern(joi.string(), optionsSchemas.form8ionPlugin);
|
|
1167
1166
|
|
|
1168
1167
|
const packageBundlersSchema = pluginMapSchema.default({});
|
|
1169
1168
|
|
|
@@ -1206,16 +1205,6 @@ function validate(options) {
|
|
|
1206
1205
|
remark: joi.string()
|
|
1207
1206
|
}).default({})
|
|
1208
1207
|
})
|
|
1209
|
-
.keys({
|
|
1210
|
-
overrides: joi.object({
|
|
1211
|
-
npmAccount: joi.string(),
|
|
1212
|
-
author: joi.object({
|
|
1213
|
-
name: joi.string().required(),
|
|
1214
|
-
email: joi.string().email(),
|
|
1215
|
-
url: joi.string().uri()
|
|
1216
|
-
})
|
|
1217
|
-
}).default({})
|
|
1218
|
-
})
|
|
1219
1208
|
.keys({
|
|
1220
1209
|
ciServices: joi.object().pattern(/^/, joi.object({
|
|
1221
1210
|
scaffolder: joi.func().arity(1).required(),
|
|
@@ -1230,13 +1219,13 @@ function validate(options) {
|
|
|
1230
1219
|
})).default({})
|
|
1231
1220
|
})
|
|
1232
1221
|
.keys({
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1222
|
+
plugins: {
|
|
1223
|
+
unitTestFrameworks: unitTestFrameworksSchema,
|
|
1224
|
+
packageBundlers: packageBundlersSchema,
|
|
1225
|
+
applicationTypes: applicationTypesSchema,
|
|
1226
|
+
packageTypes: packageTypesSchema,
|
|
1227
|
+
monorepoTypes: monorepoTypesSchema
|
|
1228
|
+
}
|
|
1240
1229
|
})
|
|
1241
1230
|
.keys({
|
|
1242
1231
|
decisions: joi.object()
|
|
@@ -1321,7 +1310,6 @@ function authorQuestions({name, email, url}) {
|
|
|
1321
1310
|
}
|
|
1322
1311
|
|
|
1323
1312
|
async function prompt(
|
|
1324
|
-
{npmAccount, author},
|
|
1325
1313
|
ciServices,
|
|
1326
1314
|
hosts,
|
|
1327
1315
|
visibility,
|
|
@@ -1398,9 +1386,9 @@ async function prompt(
|
|
|
1398
1386
|
message: 'What is the scope?',
|
|
1399
1387
|
when: scopePromptShouldBePresentedFactory(visibility),
|
|
1400
1388
|
validate: scope(visibility),
|
|
1401
|
-
default:
|
|
1389
|
+
default: maybeLoggedInNpmUsername
|
|
1402
1390
|
},
|
|
1403
|
-
...authorQuestions(
|
|
1391
|
+
...authorQuestions({
|
|
1404
1392
|
name: npmConf$1.get('init.author.name'),
|
|
1405
1393
|
email: npmConf$1.get('init.author.email'),
|
|
1406
1394
|
url: npmConf$1.get('init.author.url')
|
|
@@ -1671,17 +1659,18 @@ async function scaffolder (options) {
|
|
|
1671
1659
|
vcs,
|
|
1672
1660
|
description,
|
|
1673
1661
|
configs,
|
|
1674
|
-
overrides,
|
|
1675
1662
|
ciServices,
|
|
1676
1663
|
hosts,
|
|
1677
|
-
applicationTypes,
|
|
1678
|
-
packageTypes,
|
|
1679
|
-
packageBundlers,
|
|
1680
|
-
monorepoTypes,
|
|
1681
1664
|
decisions,
|
|
1682
|
-
unitTestFrameworks,
|
|
1683
1665
|
pathWithinParent,
|
|
1684
|
-
registries
|
|
1666
|
+
registries,
|
|
1667
|
+
plugins: {
|
|
1668
|
+
applicationTypes,
|
|
1669
|
+
packageTypes,
|
|
1670
|
+
monorepoTypes,
|
|
1671
|
+
packageBundlers,
|
|
1672
|
+
unitTestFrameworks
|
|
1673
|
+
}
|
|
1685
1674
|
} = validate(options);
|
|
1686
1675
|
|
|
1687
1676
|
const {
|
|
@@ -1696,7 +1685,7 @@ async function scaffolder (options) {
|
|
|
1696
1685
|
provideExample,
|
|
1697
1686
|
packageManager,
|
|
1698
1687
|
dialect
|
|
1699
|
-
} = await prompt(
|
|
1688
|
+
} = await prompt(ciServices, hosts, visibility, vcs, decisions, configs, pathWithinParent);
|
|
1700
1689
|
|
|
1701
1690
|
info('Writing project files', {level: 'secondary'});
|
|
1702
1691
|
|