@form8ion/javascript 4.1.2 → 4.3.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 +51 -16
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.es.js +51 -16
- package/lib/index.es.js.map +1 -1
- package/package.json +5 -5
package/lib/index.es.js
CHANGED
|
@@ -434,7 +434,7 @@ function validate(options) {
|
|
|
434
434
|
}).keys({
|
|
435
435
|
unitTestFrameworks: unitTestFrameworksSchema
|
|
436
436
|
}).keys({
|
|
437
|
-
registries: joi.object().pattern(joi.string(), joi.string().uri())
|
|
437
|
+
registries: joi.object().pattern(joi.string(), joi.string().uri()).default({})
|
|
438
438
|
});
|
|
439
439
|
const {
|
|
440
440
|
error,
|
|
@@ -762,7 +762,10 @@ async function scaffoldNpmConfig ({
|
|
|
762
762
|
'update-notifier': false
|
|
763
763
|
}, projectWillNotBeConsumed(projectType) && {
|
|
764
764
|
'save-exact': true
|
|
765
|
-
}),
|
|
765
|
+
}), Object.fromEntries(Object.entries(registries).filter(([scope]) => 'publish' !== scope).map(([scope, url]) => {
|
|
766
|
+
if ('registry' === scope) return ['registry', url];
|
|
767
|
+
return [`@${scope}:registry`, url];
|
|
768
|
+
})))));
|
|
766
769
|
return {
|
|
767
770
|
scripts: {
|
|
768
771
|
'lint:peer': 'npm ls >/dev/null'
|
|
@@ -1065,7 +1068,8 @@ async function scaffoldPackageType ({
|
|
|
1065
1068
|
packageTypes,
|
|
1066
1069
|
tests,
|
|
1067
1070
|
decisions,
|
|
1068
|
-
dialect
|
|
1071
|
+
dialect,
|
|
1072
|
+
publishRegistry
|
|
1069
1073
|
}) {
|
|
1070
1074
|
info('Scaffolding Package Details');
|
|
1071
1075
|
const detailsForBuild = await buildDetails({
|
|
@@ -1117,9 +1121,11 @@ async function scaffoldPackageType ({
|
|
|
1117
1121
|
return deepmerge.all([{
|
|
1118
1122
|
packageProperties: _objectSpread2({
|
|
1119
1123
|
files: ['example.js'],
|
|
1120
|
-
publishConfig: {
|
|
1124
|
+
publishConfig: _objectSpread2({
|
|
1121
1125
|
access: 'Public' === visibility ? 'public' : 'restricted'
|
|
1122
|
-
}
|
|
1126
|
+
}, publishRegistry && {
|
|
1127
|
+
registry: publishRegistry
|
|
1128
|
+
})
|
|
1123
1129
|
}, 'Public' === visibility && {
|
|
1124
1130
|
runkitExampleFilename: './example.js'
|
|
1125
1131
|
}),
|
|
@@ -1218,7 +1224,8 @@ async function scaffoldCliType ({
|
|
|
1218
1224
|
packageName,
|
|
1219
1225
|
visibility,
|
|
1220
1226
|
projectRoot,
|
|
1221
|
-
dialect
|
|
1227
|
+
dialect,
|
|
1228
|
+
publishRegistry
|
|
1222
1229
|
}) {
|
|
1223
1230
|
const rollupResults = await scaffold$1({
|
|
1224
1231
|
projectRoot,
|
|
@@ -1244,9 +1251,11 @@ async function scaffoldCliType ({
|
|
|
1244
1251
|
version: '0.0.0-semantically-released',
|
|
1245
1252
|
bin: {},
|
|
1246
1253
|
files: [`${defaultBuildDirectory}/`],
|
|
1247
|
-
publishConfig: {
|
|
1254
|
+
publishConfig: _objectSpread2({
|
|
1248
1255
|
access: 'Public' === visibility ? 'public' : 'restricted'
|
|
1249
|
-
}
|
|
1256
|
+
}, publishRegistry && {
|
|
1257
|
+
registry: publishRegistry
|
|
1258
|
+
})
|
|
1250
1259
|
},
|
|
1251
1260
|
eslintConfigs: [],
|
|
1252
1261
|
nextSteps: []
|
|
@@ -1267,7 +1276,8 @@ async function scaffoldProjectType ({
|
|
|
1267
1276
|
tests,
|
|
1268
1277
|
vcs,
|
|
1269
1278
|
decisions,
|
|
1270
|
-
dialect
|
|
1279
|
+
dialect,
|
|
1280
|
+
publishRegistry
|
|
1271
1281
|
}) {
|
|
1272
1282
|
switch (projectType) {
|
|
1273
1283
|
case projectTypes.PACKAGE:
|
|
@@ -1282,7 +1292,8 @@ async function scaffoldProjectType ({
|
|
|
1282
1292
|
tests,
|
|
1283
1293
|
vcs,
|
|
1284
1294
|
decisions,
|
|
1285
|
-
dialect
|
|
1295
|
+
dialect,
|
|
1296
|
+
publishRegistry
|
|
1286
1297
|
});
|
|
1287
1298
|
|
|
1288
1299
|
case projectTypes.APPLICATION:
|
|
@@ -1301,7 +1312,8 @@ async function scaffoldProjectType ({
|
|
|
1301
1312
|
packageName,
|
|
1302
1313
|
visibility,
|
|
1303
1314
|
projectRoot,
|
|
1304
|
-
dialect
|
|
1315
|
+
dialect,
|
|
1316
|
+
publishRegistry
|
|
1305
1317
|
});
|
|
1306
1318
|
|
|
1307
1319
|
case projectTypes.MONOREPO:
|
|
@@ -1422,10 +1434,25 @@ function scaffoldBanSensitiveFiles () {
|
|
|
1422
1434
|
};
|
|
1423
1435
|
}
|
|
1424
1436
|
|
|
1437
|
+
function buildAllowedHostsList ({
|
|
1438
|
+
packageManager,
|
|
1439
|
+
registries
|
|
1440
|
+
}) {
|
|
1441
|
+
return [...(!registries || registries && !registries.registry ? [packageManager] : []), ...Object.values(Object.fromEntries(Object.entries(registries).filter(([scope]) => 'publish' !== scope)))];
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
const lockfileLintSupportedPackageManagers = [packageManagers.NPM, packageManagers.YARN];
|
|
1445
|
+
|
|
1425
1446
|
function determineLockfilePathFor(packageManager) {
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1447
|
+
const lockfilePaths = {
|
|
1448
|
+
[packageManagers.NPM]: 'package-lock.json',
|
|
1449
|
+
[packageManagers.YARN]: 'yarn.lock'
|
|
1450
|
+
};
|
|
1451
|
+
return lockfilePaths[packageManager];
|
|
1452
|
+
}
|
|
1453
|
+
|
|
1454
|
+
function lockfileLintSupports(packageManager) {
|
|
1455
|
+
return lockfileLintSupportedPackageManagers.includes(packageManager);
|
|
1429
1456
|
}
|
|
1430
1457
|
|
|
1431
1458
|
async function scaffoldLockfileLint ({
|
|
@@ -1433,11 +1460,18 @@ async function scaffoldLockfileLint ({
|
|
|
1433
1460
|
packageManager,
|
|
1434
1461
|
registries
|
|
1435
1462
|
}) {
|
|
1463
|
+
if (!lockfileLintSupports(packageManager)) {
|
|
1464
|
+
throw new Error(`The ${packageManager} package manager is currently not supported by lockfile-lint. ` + `Only ${lockfileLintSupportedPackageManagers.join(' and ')} are currently supported.`);
|
|
1465
|
+
}
|
|
1466
|
+
|
|
1436
1467
|
await promises.writeFile(`${projectRoot}/.lockfile-lintrc.json`, JSON.stringify({
|
|
1437
1468
|
path: determineLockfilePathFor(packageManager),
|
|
1438
1469
|
type: packageManager,
|
|
1439
1470
|
'validate-https': true,
|
|
1440
|
-
'allowed-hosts':
|
|
1471
|
+
'allowed-hosts': buildAllowedHostsList({
|
|
1472
|
+
packageManager,
|
|
1473
|
+
registries
|
|
1474
|
+
})
|
|
1441
1475
|
}));
|
|
1442
1476
|
return {
|
|
1443
1477
|
devDependencies: ['lockfile-lint'],
|
|
@@ -1577,7 +1611,8 @@ async function scaffolder (options) {
|
|
|
1577
1611
|
tests,
|
|
1578
1612
|
vcs,
|
|
1579
1613
|
decisions,
|
|
1580
|
-
dialect
|
|
1614
|
+
dialect,
|
|
1615
|
+
publishRegistry: registries.publish
|
|
1581
1616
|
});
|
|
1582
1617
|
const verificationResults = await scaffoldVerification({
|
|
1583
1618
|
projectRoot,
|