@form8ion/javascript 4.1.3 → 4.4.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 +55 -18
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.es.js +55 -18
- package/lib/index.es.js.map +1 -1
- package/package.json +8 -8
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,10 @@ 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]) => {
|
|
768
|
+
if ('registry' === scope) return ['registry', url];
|
|
769
|
+
return [`@${scope}:registry`, url];
|
|
770
|
+
})))));
|
|
766
771
|
return {
|
|
767
772
|
scripts: {
|
|
768
773
|
'lint:peer': 'npm ls >/dev/null'
|
|
@@ -1065,7 +1070,8 @@ async function scaffoldPackageType ({
|
|
|
1065
1070
|
packageTypes,
|
|
1066
1071
|
tests,
|
|
1067
1072
|
decisions,
|
|
1068
|
-
dialect
|
|
1073
|
+
dialect,
|
|
1074
|
+
publishRegistry
|
|
1069
1075
|
}) {
|
|
1070
1076
|
info('Scaffolding Package Details');
|
|
1071
1077
|
const detailsForBuild = await buildDetails({
|
|
@@ -1117,9 +1123,11 @@ async function scaffoldPackageType ({
|
|
|
1117
1123
|
return deepmerge.all([{
|
|
1118
1124
|
packageProperties: _objectSpread2({
|
|
1119
1125
|
files: ['example.js'],
|
|
1120
|
-
publishConfig: {
|
|
1126
|
+
publishConfig: _objectSpread2({
|
|
1121
1127
|
access: 'Public' === visibility ? 'public' : 'restricted'
|
|
1122
|
-
}
|
|
1128
|
+
}, publishRegistry && {
|
|
1129
|
+
registry: publishRegistry
|
|
1130
|
+
})
|
|
1123
1131
|
}, 'Public' === visibility && {
|
|
1124
1132
|
runkitExampleFilename: './example.js'
|
|
1125
1133
|
}),
|
|
@@ -1218,7 +1226,8 @@ async function scaffoldCliType ({
|
|
|
1218
1226
|
packageName,
|
|
1219
1227
|
visibility,
|
|
1220
1228
|
projectRoot,
|
|
1221
|
-
dialect
|
|
1229
|
+
dialect,
|
|
1230
|
+
publishRegistry
|
|
1222
1231
|
}) {
|
|
1223
1232
|
const rollupResults = await scaffold$1({
|
|
1224
1233
|
projectRoot,
|
|
@@ -1244,9 +1253,11 @@ async function scaffoldCliType ({
|
|
|
1244
1253
|
version: '0.0.0-semantically-released',
|
|
1245
1254
|
bin: {},
|
|
1246
1255
|
files: [`${defaultBuildDirectory}/`],
|
|
1247
|
-
publishConfig: {
|
|
1256
|
+
publishConfig: _objectSpread2({
|
|
1248
1257
|
access: 'Public' === visibility ? 'public' : 'restricted'
|
|
1249
|
-
}
|
|
1258
|
+
}, publishRegistry && {
|
|
1259
|
+
registry: publishRegistry
|
|
1260
|
+
})
|
|
1250
1261
|
},
|
|
1251
1262
|
eslintConfigs: [],
|
|
1252
1263
|
nextSteps: []
|
|
@@ -1267,7 +1278,8 @@ async function scaffoldProjectType ({
|
|
|
1267
1278
|
tests,
|
|
1268
1279
|
vcs,
|
|
1269
1280
|
decisions,
|
|
1270
|
-
dialect
|
|
1281
|
+
dialect,
|
|
1282
|
+
publishRegistry
|
|
1271
1283
|
}) {
|
|
1272
1284
|
switch (projectType) {
|
|
1273
1285
|
case projectTypes.PACKAGE:
|
|
@@ -1282,7 +1294,8 @@ async function scaffoldProjectType ({
|
|
|
1282
1294
|
tests,
|
|
1283
1295
|
vcs,
|
|
1284
1296
|
decisions,
|
|
1285
|
-
dialect
|
|
1297
|
+
dialect,
|
|
1298
|
+
publishRegistry
|
|
1286
1299
|
});
|
|
1287
1300
|
|
|
1288
1301
|
case projectTypes.APPLICATION:
|
|
@@ -1301,7 +1314,8 @@ async function scaffoldProjectType ({
|
|
|
1301
1314
|
packageName,
|
|
1302
1315
|
visibility,
|
|
1303
1316
|
projectRoot,
|
|
1304
|
-
dialect
|
|
1317
|
+
dialect,
|
|
1318
|
+
publishRegistry
|
|
1305
1319
|
});
|
|
1306
1320
|
|
|
1307
1321
|
case projectTypes.MONOREPO:
|
|
@@ -1422,10 +1436,25 @@ function scaffoldBanSensitiveFiles () {
|
|
|
1422
1436
|
};
|
|
1423
1437
|
}
|
|
1424
1438
|
|
|
1439
|
+
function buildAllowedHostsList ({
|
|
1440
|
+
packageManager,
|
|
1441
|
+
registries
|
|
1442
|
+
}) {
|
|
1443
|
+
return [...(!registries || registries && !registries.registry ? [packageManager] : []), ...Object.values(Object.fromEntries(Object.entries(registries).filter(([scope]) => 'publish' !== scope)))];
|
|
1444
|
+
}
|
|
1445
|
+
|
|
1446
|
+
const lockfileLintSupportedPackageManagers = [packageManagers.NPM, packageManagers.YARN];
|
|
1447
|
+
|
|
1425
1448
|
function determineLockfilePathFor(packageManager) {
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
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);
|
|
1429
1458
|
}
|
|
1430
1459
|
|
|
1431
1460
|
async function scaffoldLockfileLint ({
|
|
@@ -1433,11 +1462,18 @@ async function scaffoldLockfileLint ({
|
|
|
1433
1462
|
packageManager,
|
|
1434
1463
|
registries
|
|
1435
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
|
+
|
|
1436
1469
|
await promises.writeFile(`${projectRoot}/.lockfile-lintrc.json`, JSON.stringify({
|
|
1437
1470
|
path: determineLockfilePathFor(packageManager),
|
|
1438
1471
|
type: packageManager,
|
|
1439
1472
|
'validate-https': true,
|
|
1440
|
-
'allowed-hosts':
|
|
1473
|
+
'allowed-hosts': buildAllowedHostsList({
|
|
1474
|
+
packageManager,
|
|
1475
|
+
registries
|
|
1476
|
+
})
|
|
1441
1477
|
}));
|
|
1442
1478
|
return {
|
|
1443
1479
|
devDependencies: ['lockfile-lint'],
|
|
@@ -1577,7 +1613,8 @@ async function scaffolder (options) {
|
|
|
1577
1613
|
tests,
|
|
1578
1614
|
vcs,
|
|
1579
1615
|
decisions,
|
|
1580
|
-
dialect
|
|
1616
|
+
dialect,
|
|
1617
|
+
publishRegistry: registries.publish
|
|
1581
1618
|
});
|
|
1582
1619
|
const verificationResults = await scaffoldVerification({
|
|
1583
1620
|
projectRoot,
|