@form8ion/javascript 4.8.0-alpha.1 → 5.0.0-alpha.1
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.cjs.js +32 -5
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.es.js +32 -5
- package/lib/index.es.js.map +1 -1
- package/package.json +1 -1
package/lib/index.es.js
CHANGED
|
@@ -375,7 +375,7 @@ async function lift ({
|
|
|
375
375
|
|
|
376
376
|
const packageBundlersSchema = joi.object().pattern(/^/, joi.object({
|
|
377
377
|
scaffolder: joi.func().arity(1).required()
|
|
378
|
-
}));
|
|
378
|
+
})).default({});
|
|
379
379
|
|
|
380
380
|
function validate(options) {
|
|
381
381
|
const schema = joi.object().required().keys({
|
|
@@ -1010,6 +1010,20 @@ function defineBadges (packageName, visibility) {
|
|
|
1010
1010
|
};
|
|
1011
1011
|
}
|
|
1012
1012
|
|
|
1013
|
+
async function chooseBundler ({
|
|
1014
|
+
bundlers,
|
|
1015
|
+
decisions
|
|
1016
|
+
}) {
|
|
1017
|
+
if (!Object.keys(bundlers).length) return 'Other';
|
|
1018
|
+
const answers = await prompt$1([{
|
|
1019
|
+
name: questionNames$1.PACKAGE_BUNDLER,
|
|
1020
|
+
type: 'list',
|
|
1021
|
+
message: 'Which bundler should be used?',
|
|
1022
|
+
choices: [...Object.keys(bundlers), new Separator(), 'Other']
|
|
1023
|
+
}], decisions);
|
|
1024
|
+
return answers[questionNames$1.PACKAGE_BUNDLER];
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1013
1027
|
function determinePathToTemplateFile (fileName) {
|
|
1014
1028
|
return resolve(__dirname, '..', 'templates', fileName);
|
|
1015
1029
|
}
|
|
@@ -1035,19 +1049,25 @@ async function buildDetails ({
|
|
|
1035
1049
|
projectName,
|
|
1036
1050
|
visibility,
|
|
1037
1051
|
packageName,
|
|
1038
|
-
|
|
1052
|
+
packageBundlers,
|
|
1053
|
+
dialect,
|
|
1054
|
+
decisions
|
|
1039
1055
|
}) {
|
|
1040
1056
|
if (dialects.COMMON_JS === dialect) return buildDetailsForCommonJsProject({
|
|
1041
1057
|
projectRoot,
|
|
1042
1058
|
projectName
|
|
1043
1059
|
});
|
|
1060
|
+
const chosenBundler = await chooseBundler({
|
|
1061
|
+
bundlers: packageBundlers,
|
|
1062
|
+
decisions
|
|
1063
|
+
});
|
|
1044
1064
|
const pathToCreatedSrcDirectory = await makeDir(`${projectRoot}/src`);
|
|
1045
|
-
const [
|
|
1065
|
+
const [bundlerResults] = await Promise.all([scaffoldChoice(packageBundlers, chosenBundler, {
|
|
1046
1066
|
projectRoot,
|
|
1047
1067
|
dialect,
|
|
1048
1068
|
projectType: projectTypes.PACKAGE
|
|
1049
1069
|
}), await createExample(projectRoot, projectName), touch(`${pathToCreatedSrcDirectory}/index.js`)]);
|
|
1050
|
-
return deepmerge(
|
|
1070
|
+
return deepmerge(bundlerResults, {
|
|
1051
1071
|
devDependencies: ['rimraf'],
|
|
1052
1072
|
scripts: {
|
|
1053
1073
|
clean: `rimraf ./${defaultBuildDirectory$2}`,
|
|
@@ -1079,6 +1099,7 @@ async function scaffoldPackageType ({
|
|
|
1079
1099
|
visibility,
|
|
1080
1100
|
scope,
|
|
1081
1101
|
packageTypes,
|
|
1102
|
+
packageBundlers,
|
|
1082
1103
|
tests,
|
|
1083
1104
|
decisions,
|
|
1084
1105
|
dialect,
|
|
@@ -1088,9 +1109,11 @@ async function scaffoldPackageType ({
|
|
|
1088
1109
|
const detailsForBuild = await buildDetails({
|
|
1089
1110
|
projectRoot,
|
|
1090
1111
|
projectName,
|
|
1112
|
+
packageBundlers,
|
|
1091
1113
|
visibility,
|
|
1092
1114
|
packageName,
|
|
1093
|
-
dialect
|
|
1115
|
+
dialect,
|
|
1116
|
+
decisions
|
|
1094
1117
|
});
|
|
1095
1118
|
|
|
1096
1119
|
const details = _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, dialects.BABEL === dialect && _objectSpread2({
|
|
@@ -1284,6 +1307,7 @@ async function scaffoldProjectType ({
|
|
|
1284
1307
|
visibility,
|
|
1285
1308
|
applicationTypes,
|
|
1286
1309
|
packageTypes,
|
|
1310
|
+
packageBundlers,
|
|
1287
1311
|
monorepoTypes,
|
|
1288
1312
|
scope,
|
|
1289
1313
|
tests,
|
|
@@ -1302,6 +1326,7 @@ async function scaffoldProjectType ({
|
|
|
1302
1326
|
visibility,
|
|
1303
1327
|
scope,
|
|
1304
1328
|
packageTypes,
|
|
1329
|
+
packageBundlers,
|
|
1305
1330
|
tests,
|
|
1306
1331
|
vcs,
|
|
1307
1332
|
decisions,
|
|
@@ -1596,6 +1621,7 @@ async function scaffolder (options) {
|
|
|
1596
1621
|
hosts,
|
|
1597
1622
|
applicationTypes,
|
|
1598
1623
|
packageTypes,
|
|
1624
|
+
packageBundlers,
|
|
1599
1625
|
monorepoTypes,
|
|
1600
1626
|
decisions,
|
|
1601
1627
|
unitTestFrameworks,
|
|
@@ -1627,6 +1653,7 @@ async function scaffolder (options) {
|
|
|
1627
1653
|
visibility,
|
|
1628
1654
|
applicationTypes,
|
|
1629
1655
|
packageTypes,
|
|
1656
|
+
packageBundlers,
|
|
1630
1657
|
monorepoTypes,
|
|
1631
1658
|
scope,
|
|
1632
1659
|
tests,
|