@form8ion/javascript 4.8.0-alpha.1 → 5.1.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.cjs.js +44 -9
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.es.js +44 -9
- package/lib/index.es.js.map +1 -1
- package/package.json +8 -8
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,15 +1109,21 @@ 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({
|
|
1097
1120
|
packageProperties: {
|
|
1098
|
-
main: 'lib/index.cjs.js',
|
|
1099
|
-
module: 'lib/index.es.js',
|
|
1121
|
+
main: './lib/index.cjs.js',
|
|
1122
|
+
module: './lib/index.es.js',
|
|
1123
|
+
exports: {
|
|
1124
|
+
require: './lib/index.cjs.js',
|
|
1125
|
+
import: './lib/index.es.js'
|
|
1126
|
+
},
|
|
1100
1127
|
sideEffects: false,
|
|
1101
1128
|
files: ['lib/']
|
|
1102
1129
|
}
|
|
@@ -1108,8 +1135,12 @@ async function scaffoldPackageType ({
|
|
|
1108
1135
|
}
|
|
1109
1136
|
}, detailsForBuild)), dialects.TYPESCRIPT === dialect && _objectSpread2({
|
|
1110
1137
|
packageProperties: {
|
|
1111
|
-
main: 'lib/index.cjs.js',
|
|
1112
|
-
module: 'lib/index.es.js',
|
|
1138
|
+
main: './lib/index.cjs.js',
|
|
1139
|
+
module: './lib/index.es.js',
|
|
1140
|
+
exports: {
|
|
1141
|
+
require: './lib/index.cjs.js',
|
|
1142
|
+
import: './lib/index.es.js'
|
|
1143
|
+
},
|
|
1113
1144
|
sideEffects: false,
|
|
1114
1145
|
files: ['lib/']
|
|
1115
1146
|
}
|
|
@@ -1284,6 +1315,7 @@ async function scaffoldProjectType ({
|
|
|
1284
1315
|
visibility,
|
|
1285
1316
|
applicationTypes,
|
|
1286
1317
|
packageTypes,
|
|
1318
|
+
packageBundlers,
|
|
1287
1319
|
monorepoTypes,
|
|
1288
1320
|
scope,
|
|
1289
1321
|
tests,
|
|
@@ -1302,6 +1334,7 @@ async function scaffoldProjectType ({
|
|
|
1302
1334
|
visibility,
|
|
1303
1335
|
scope,
|
|
1304
1336
|
packageTypes,
|
|
1337
|
+
packageBundlers,
|
|
1305
1338
|
tests,
|
|
1306
1339
|
vcs,
|
|
1307
1340
|
decisions,
|
|
@@ -1596,6 +1629,7 @@ async function scaffolder (options) {
|
|
|
1596
1629
|
hosts,
|
|
1597
1630
|
applicationTypes,
|
|
1598
1631
|
packageTypes,
|
|
1632
|
+
packageBundlers,
|
|
1599
1633
|
monorepoTypes,
|
|
1600
1634
|
decisions,
|
|
1601
1635
|
unitTestFrameworks,
|
|
@@ -1627,6 +1661,7 @@ async function scaffolder (options) {
|
|
|
1627
1661
|
visibility,
|
|
1628
1662
|
applicationTypes,
|
|
1629
1663
|
packageTypes,
|
|
1664
|
+
packageBundlers,
|
|
1630
1665
|
monorepoTypes,
|
|
1631
1666
|
scope,
|
|
1632
1667
|
tests,
|