@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.cjs.js
CHANGED
|
@@ -409,7 +409,7 @@ async function lift ({
|
|
|
409
409
|
|
|
410
410
|
const packageBundlersSchema = joi__namespace.object().pattern(/^/, joi__namespace.object({
|
|
411
411
|
scaffolder: joi__namespace.func().arity(1).required()
|
|
412
|
-
}));
|
|
412
|
+
})).default({});
|
|
413
413
|
|
|
414
414
|
function validate(options) {
|
|
415
415
|
const schema = joi__namespace.object().required().keys({
|
|
@@ -1044,6 +1044,20 @@ function defineBadges (packageName, visibility) {
|
|
|
1044
1044
|
};
|
|
1045
1045
|
}
|
|
1046
1046
|
|
|
1047
|
+
async function chooseBundler ({
|
|
1048
|
+
bundlers,
|
|
1049
|
+
decisions
|
|
1050
|
+
}) {
|
|
1051
|
+
if (!Object.keys(bundlers).length) return 'Other';
|
|
1052
|
+
const answers = await overridablePrompts.prompt([{
|
|
1053
|
+
name: questionNames$1.PACKAGE_BUNDLER,
|
|
1054
|
+
type: 'list',
|
|
1055
|
+
message: 'Which bundler should be used?',
|
|
1056
|
+
choices: [...Object.keys(bundlers), new inquirer.Separator(), 'Other']
|
|
1057
|
+
}], decisions);
|
|
1058
|
+
return answers[questionNames$1.PACKAGE_BUNDLER];
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1047
1061
|
function determinePathToTemplateFile (fileName) {
|
|
1048
1062
|
return path.resolve(__dirname, '..', 'templates', fileName);
|
|
1049
1063
|
}
|
|
@@ -1069,19 +1083,25 @@ async function buildDetails ({
|
|
|
1069
1083
|
projectName,
|
|
1070
1084
|
visibility,
|
|
1071
1085
|
packageName,
|
|
1072
|
-
|
|
1086
|
+
packageBundlers,
|
|
1087
|
+
dialect,
|
|
1088
|
+
decisions
|
|
1073
1089
|
}) {
|
|
1074
1090
|
if (javascriptCore.dialects.COMMON_JS === dialect) return buildDetailsForCommonJsProject({
|
|
1075
1091
|
projectRoot,
|
|
1076
1092
|
projectName
|
|
1077
1093
|
});
|
|
1094
|
+
const chosenBundler = await chooseBundler({
|
|
1095
|
+
bundlers: packageBundlers,
|
|
1096
|
+
decisions
|
|
1097
|
+
});
|
|
1078
1098
|
const pathToCreatedSrcDirectory = await makeDir__default["default"](`${projectRoot}/src`);
|
|
1079
|
-
const [
|
|
1099
|
+
const [bundlerResults] = await Promise.all([javascriptCore.scaffoldChoice(packageBundlers, chosenBundler, {
|
|
1080
1100
|
projectRoot,
|
|
1081
1101
|
dialect,
|
|
1082
1102
|
projectType: javascriptCore.projectTypes.PACKAGE
|
|
1083
1103
|
}), await createExample(projectRoot, projectName), touch__default["default"](`${pathToCreatedSrcDirectory}/index.js`)]);
|
|
1084
|
-
return deepmerge__default["default"](
|
|
1104
|
+
return deepmerge__default["default"](bundlerResults, {
|
|
1085
1105
|
devDependencies: ['rimraf'],
|
|
1086
1106
|
scripts: {
|
|
1087
1107
|
clean: `rimraf ./${defaultBuildDirectory$2}`,
|
|
@@ -1113,6 +1133,7 @@ async function scaffoldPackageType ({
|
|
|
1113
1133
|
visibility,
|
|
1114
1134
|
scope,
|
|
1115
1135
|
packageTypes,
|
|
1136
|
+
packageBundlers,
|
|
1116
1137
|
tests,
|
|
1117
1138
|
decisions,
|
|
1118
1139
|
dialect,
|
|
@@ -1122,9 +1143,11 @@ async function scaffoldPackageType ({
|
|
|
1122
1143
|
const detailsForBuild = await buildDetails({
|
|
1123
1144
|
projectRoot,
|
|
1124
1145
|
projectName,
|
|
1146
|
+
packageBundlers,
|
|
1125
1147
|
visibility,
|
|
1126
1148
|
packageName,
|
|
1127
|
-
dialect
|
|
1149
|
+
dialect,
|
|
1150
|
+
decisions
|
|
1128
1151
|
});
|
|
1129
1152
|
|
|
1130
1153
|
const details = _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, javascriptCore.dialects.BABEL === dialect && _objectSpread2({
|
|
@@ -1318,6 +1341,7 @@ async function scaffoldProjectType ({
|
|
|
1318
1341
|
visibility,
|
|
1319
1342
|
applicationTypes,
|
|
1320
1343
|
packageTypes,
|
|
1344
|
+
packageBundlers,
|
|
1321
1345
|
monorepoTypes,
|
|
1322
1346
|
scope,
|
|
1323
1347
|
tests,
|
|
@@ -1336,6 +1360,7 @@ async function scaffoldProjectType ({
|
|
|
1336
1360
|
visibility,
|
|
1337
1361
|
scope,
|
|
1338
1362
|
packageTypes,
|
|
1363
|
+
packageBundlers,
|
|
1339
1364
|
tests,
|
|
1340
1365
|
vcs,
|
|
1341
1366
|
decisions,
|
|
@@ -1630,6 +1655,7 @@ async function scaffolder (options) {
|
|
|
1630
1655
|
hosts,
|
|
1631
1656
|
applicationTypes,
|
|
1632
1657
|
packageTypes,
|
|
1658
|
+
packageBundlers,
|
|
1633
1659
|
monorepoTypes,
|
|
1634
1660
|
decisions,
|
|
1635
1661
|
unitTestFrameworks,
|
|
@@ -1661,6 +1687,7 @@ async function scaffolder (options) {
|
|
|
1661
1687
|
visibility,
|
|
1662
1688
|
applicationTypes,
|
|
1663
1689
|
packageTypes,
|
|
1690
|
+
packageBundlers,
|
|
1664
1691
|
monorepoTypes,
|
|
1665
1692
|
scope,
|
|
1666
1693
|
tests,
|