@form8ion/javascript 4.2.0 → 4.5.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 -19
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.es.js +44 -19
- package/lib/index.es.js.map +1 -1
- package/package.json +6 -6
package/lib/index.es.js
CHANGED
|
@@ -223,14 +223,16 @@ async function scaffoldUnitTesting ({
|
|
|
223
223
|
decisions,
|
|
224
224
|
visibility,
|
|
225
225
|
vcs,
|
|
226
|
-
pathWithinParent
|
|
226
|
+
pathWithinParent,
|
|
227
|
+
dialect
|
|
227
228
|
}) {
|
|
228
229
|
const validatedFrameworks = validateOptions(unitTestFrameworksSchema, frameworks);
|
|
229
230
|
const [framework, coverage] = await Promise.all([chooseFramework({
|
|
230
231
|
frameworks: validatedFrameworks,
|
|
231
232
|
decisions
|
|
232
233
|
}).then(chosenFramework => scaffoldChoice(validatedFrameworks, chosenFramework, {
|
|
233
|
-
projectRoot
|
|
234
|
+
projectRoot,
|
|
235
|
+
dialect
|
|
234
236
|
})), scaffoldCoverage({
|
|
235
237
|
projectRoot,
|
|
236
238
|
vcs,
|
|
@@ -434,7 +436,7 @@ function validate(options) {
|
|
|
434
436
|
}).keys({
|
|
435
437
|
unitTestFrameworks: unitTestFrameworksSchema
|
|
436
438
|
}).keys({
|
|
437
|
-
registries: joi.object().pattern(joi.string(), joi.string().uri())
|
|
439
|
+
registries: joi.object().pattern(joi.string(), joi.string().uri()).default({})
|
|
438
440
|
});
|
|
439
441
|
const {
|
|
440
442
|
error,
|
|
@@ -762,7 +764,7 @@ async function scaffoldNpmConfig ({
|
|
|
762
764
|
'update-notifier': false
|
|
763
765
|
}, projectWillNotBeConsumed(projectType) && {
|
|
764
766
|
'save-exact': true
|
|
765
|
-
}),
|
|
767
|
+
}), Object.fromEntries(Object.entries(registries).filter(([scope]) => 'publish' !== scope).map(([scope, url]) => {
|
|
766
768
|
if ('registry' === scope) return ['registry', url];
|
|
767
769
|
return [`@${scope}:registry`, url];
|
|
768
770
|
})))));
|
|
@@ -1068,7 +1070,8 @@ async function scaffoldPackageType ({
|
|
|
1068
1070
|
packageTypes,
|
|
1069
1071
|
tests,
|
|
1070
1072
|
decisions,
|
|
1071
|
-
dialect
|
|
1073
|
+
dialect,
|
|
1074
|
+
publishRegistry
|
|
1072
1075
|
}) {
|
|
1073
1076
|
info('Scaffolding Package Details');
|
|
1074
1077
|
const detailsForBuild = await buildDetails({
|
|
@@ -1120,9 +1123,11 @@ async function scaffoldPackageType ({
|
|
|
1120
1123
|
return deepmerge.all([{
|
|
1121
1124
|
packageProperties: _objectSpread2({
|
|
1122
1125
|
files: ['example.js'],
|
|
1123
|
-
publishConfig: {
|
|
1126
|
+
publishConfig: _objectSpread2({
|
|
1124
1127
|
access: 'Public' === visibility ? 'public' : 'restricted'
|
|
1125
|
-
}
|
|
1128
|
+
}, publishRegistry && {
|
|
1129
|
+
registry: publishRegistry
|
|
1130
|
+
})
|
|
1126
1131
|
}, 'Public' === visibility && {
|
|
1127
1132
|
runkitExampleFilename: './example.js'
|
|
1128
1133
|
}),
|
|
@@ -1221,7 +1226,8 @@ async function scaffoldCliType ({
|
|
|
1221
1226
|
packageName,
|
|
1222
1227
|
visibility,
|
|
1223
1228
|
projectRoot,
|
|
1224
|
-
dialect
|
|
1229
|
+
dialect,
|
|
1230
|
+
publishRegistry
|
|
1225
1231
|
}) {
|
|
1226
1232
|
const rollupResults = await scaffold$1({
|
|
1227
1233
|
projectRoot,
|
|
@@ -1247,9 +1253,11 @@ async function scaffoldCliType ({
|
|
|
1247
1253
|
version: '0.0.0-semantically-released',
|
|
1248
1254
|
bin: {},
|
|
1249
1255
|
files: [`${defaultBuildDirectory}/`],
|
|
1250
|
-
publishConfig: {
|
|
1256
|
+
publishConfig: _objectSpread2({
|
|
1251
1257
|
access: 'Public' === visibility ? 'public' : 'restricted'
|
|
1252
|
-
}
|
|
1258
|
+
}, publishRegistry && {
|
|
1259
|
+
registry: publishRegistry
|
|
1260
|
+
})
|
|
1253
1261
|
},
|
|
1254
1262
|
eslintConfigs: [],
|
|
1255
1263
|
nextSteps: []
|
|
@@ -1270,7 +1278,8 @@ async function scaffoldProjectType ({
|
|
|
1270
1278
|
tests,
|
|
1271
1279
|
vcs,
|
|
1272
1280
|
decisions,
|
|
1273
|
-
dialect
|
|
1281
|
+
dialect,
|
|
1282
|
+
publishRegistry
|
|
1274
1283
|
}) {
|
|
1275
1284
|
switch (projectType) {
|
|
1276
1285
|
case projectTypes.PACKAGE:
|
|
@@ -1285,7 +1294,8 @@ async function scaffoldProjectType ({
|
|
|
1285
1294
|
tests,
|
|
1286
1295
|
vcs,
|
|
1287
1296
|
decisions,
|
|
1288
|
-
dialect
|
|
1297
|
+
dialect,
|
|
1298
|
+
publishRegistry
|
|
1289
1299
|
});
|
|
1290
1300
|
|
|
1291
1301
|
case projectTypes.APPLICATION:
|
|
@@ -1304,7 +1314,8 @@ async function scaffoldProjectType ({
|
|
|
1304
1314
|
packageName,
|
|
1305
1315
|
visibility,
|
|
1306
1316
|
projectRoot,
|
|
1307
|
-
dialect
|
|
1317
|
+
dialect,
|
|
1318
|
+
publishRegistry
|
|
1308
1319
|
});
|
|
1309
1320
|
|
|
1310
1321
|
case projectTypes.MONOREPO:
|
|
@@ -1429,13 +1440,21 @@ function buildAllowedHostsList ({
|
|
|
1429
1440
|
packageManager,
|
|
1430
1441
|
registries
|
|
1431
1442
|
}) {
|
|
1432
|
-
return [...(!registries || registries && !registries.registry ? [packageManager] : []), ...
|
|
1443
|
+
return [...(!registries || registries && !registries.registry ? [packageManager] : []), ...Object.values(Object.fromEntries(Object.entries(registries).filter(([scope]) => 'publish' !== scope)))];
|
|
1433
1444
|
}
|
|
1434
1445
|
|
|
1446
|
+
const lockfileLintSupportedPackageManagers = [packageManagers.NPM, packageManagers.YARN];
|
|
1447
|
+
|
|
1435
1448
|
function determineLockfilePathFor(packageManager) {
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1449
|
+
const lockfilePaths = {
|
|
1450
|
+
[packageManagers.NPM]: 'package-lock.json',
|
|
1451
|
+
[packageManagers.YARN]: 'yarn.lock'
|
|
1452
|
+
};
|
|
1453
|
+
return lockfilePaths[packageManager];
|
|
1454
|
+
}
|
|
1455
|
+
|
|
1456
|
+
function lockfileLintSupports(packageManager) {
|
|
1457
|
+
return lockfileLintSupportedPackageManagers.includes(packageManager);
|
|
1439
1458
|
}
|
|
1440
1459
|
|
|
1441
1460
|
async function scaffoldLockfileLint ({
|
|
@@ -1443,6 +1462,10 @@ async function scaffoldLockfileLint ({
|
|
|
1443
1462
|
packageManager,
|
|
1444
1463
|
registries
|
|
1445
1464
|
}) {
|
|
1465
|
+
if (!lockfileLintSupports(packageManager)) {
|
|
1466
|
+
throw new Error(`The ${packageManager} package manager is currently not supported by lockfile-lint. ` + `Only ${lockfileLintSupportedPackageManagers.join(' and ')} are currently supported.`);
|
|
1467
|
+
}
|
|
1468
|
+
|
|
1446
1469
|
await promises.writeFile(`${projectRoot}/.lockfile-lintrc.json`, JSON.stringify({
|
|
1447
1470
|
path: determineLockfilePathFor(packageManager),
|
|
1448
1471
|
type: packageManager,
|
|
@@ -1518,7 +1541,8 @@ async function scaffoldVerification({
|
|
|
1518
1541
|
pathWithinParent
|
|
1519
1542
|
}), scaffold$3({
|
|
1520
1543
|
projectRoot,
|
|
1521
|
-
packageManager
|
|
1544
|
+
packageManager,
|
|
1545
|
+
pathWithinParent
|
|
1522
1546
|
})]);
|
|
1523
1547
|
const lintingResults = await scaffoldLinting({
|
|
1524
1548
|
projectRoot,
|
|
@@ -1590,7 +1614,8 @@ async function scaffolder (options) {
|
|
|
1590
1614
|
tests,
|
|
1591
1615
|
vcs,
|
|
1592
1616
|
decisions,
|
|
1593
|
-
dialect
|
|
1617
|
+
dialect,
|
|
1618
|
+
publishRegistry: registries.publish
|
|
1594
1619
|
});
|
|
1595
1620
|
const verificationResults = await scaffoldVerification({
|
|
1596
1621
|
projectRoot,
|