@form8ion/javascript 4.2.0 → 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 +38 -16
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.es.js +38 -16
- package/lib/index.es.js.map +1 -1
- package/package.json +1 -1
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,7 @@ 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
766
|
if ('registry' === scope) return ['registry', url];
|
|
767
767
|
return [`@${scope}:registry`, url];
|
|
768
768
|
})))));
|
|
@@ -1068,7 +1068,8 @@ async function scaffoldPackageType ({
|
|
|
1068
1068
|
packageTypes,
|
|
1069
1069
|
tests,
|
|
1070
1070
|
decisions,
|
|
1071
|
-
dialect
|
|
1071
|
+
dialect,
|
|
1072
|
+
publishRegistry
|
|
1072
1073
|
}) {
|
|
1073
1074
|
info('Scaffolding Package Details');
|
|
1074
1075
|
const detailsForBuild = await buildDetails({
|
|
@@ -1120,9 +1121,11 @@ async function scaffoldPackageType ({
|
|
|
1120
1121
|
return deepmerge.all([{
|
|
1121
1122
|
packageProperties: _objectSpread2({
|
|
1122
1123
|
files: ['example.js'],
|
|
1123
|
-
publishConfig: {
|
|
1124
|
+
publishConfig: _objectSpread2({
|
|
1124
1125
|
access: 'Public' === visibility ? 'public' : 'restricted'
|
|
1125
|
-
}
|
|
1126
|
+
}, publishRegistry && {
|
|
1127
|
+
registry: publishRegistry
|
|
1128
|
+
})
|
|
1126
1129
|
}, 'Public' === visibility && {
|
|
1127
1130
|
runkitExampleFilename: './example.js'
|
|
1128
1131
|
}),
|
|
@@ -1221,7 +1224,8 @@ async function scaffoldCliType ({
|
|
|
1221
1224
|
packageName,
|
|
1222
1225
|
visibility,
|
|
1223
1226
|
projectRoot,
|
|
1224
|
-
dialect
|
|
1227
|
+
dialect,
|
|
1228
|
+
publishRegistry
|
|
1225
1229
|
}) {
|
|
1226
1230
|
const rollupResults = await scaffold$1({
|
|
1227
1231
|
projectRoot,
|
|
@@ -1247,9 +1251,11 @@ async function scaffoldCliType ({
|
|
|
1247
1251
|
version: '0.0.0-semantically-released',
|
|
1248
1252
|
bin: {},
|
|
1249
1253
|
files: [`${defaultBuildDirectory}/`],
|
|
1250
|
-
publishConfig: {
|
|
1254
|
+
publishConfig: _objectSpread2({
|
|
1251
1255
|
access: 'Public' === visibility ? 'public' : 'restricted'
|
|
1252
|
-
}
|
|
1256
|
+
}, publishRegistry && {
|
|
1257
|
+
registry: publishRegistry
|
|
1258
|
+
})
|
|
1253
1259
|
},
|
|
1254
1260
|
eslintConfigs: [],
|
|
1255
1261
|
nextSteps: []
|
|
@@ -1270,7 +1276,8 @@ async function scaffoldProjectType ({
|
|
|
1270
1276
|
tests,
|
|
1271
1277
|
vcs,
|
|
1272
1278
|
decisions,
|
|
1273
|
-
dialect
|
|
1279
|
+
dialect,
|
|
1280
|
+
publishRegistry
|
|
1274
1281
|
}) {
|
|
1275
1282
|
switch (projectType) {
|
|
1276
1283
|
case projectTypes.PACKAGE:
|
|
@@ -1285,7 +1292,8 @@ async function scaffoldProjectType ({
|
|
|
1285
1292
|
tests,
|
|
1286
1293
|
vcs,
|
|
1287
1294
|
decisions,
|
|
1288
|
-
dialect
|
|
1295
|
+
dialect,
|
|
1296
|
+
publishRegistry
|
|
1289
1297
|
});
|
|
1290
1298
|
|
|
1291
1299
|
case projectTypes.APPLICATION:
|
|
@@ -1304,7 +1312,8 @@ async function scaffoldProjectType ({
|
|
|
1304
1312
|
packageName,
|
|
1305
1313
|
visibility,
|
|
1306
1314
|
projectRoot,
|
|
1307
|
-
dialect
|
|
1315
|
+
dialect,
|
|
1316
|
+
publishRegistry
|
|
1308
1317
|
});
|
|
1309
1318
|
|
|
1310
1319
|
case projectTypes.MONOREPO:
|
|
@@ -1429,13 +1438,21 @@ function buildAllowedHostsList ({
|
|
|
1429
1438
|
packageManager,
|
|
1430
1439
|
registries
|
|
1431
1440
|
}) {
|
|
1432
|
-
return [...(!registries || registries && !registries.registry ? [packageManager] : []), ...
|
|
1441
|
+
return [...(!registries || registries && !registries.registry ? [packageManager] : []), ...Object.values(Object.fromEntries(Object.entries(registries).filter(([scope]) => 'publish' !== scope)))];
|
|
1433
1442
|
}
|
|
1434
1443
|
|
|
1444
|
+
const lockfileLintSupportedPackageManagers = [packageManagers.NPM, packageManagers.YARN];
|
|
1445
|
+
|
|
1435
1446
|
function determineLockfilePathFor(packageManager) {
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
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);
|
|
1439
1456
|
}
|
|
1440
1457
|
|
|
1441
1458
|
async function scaffoldLockfileLint ({
|
|
@@ -1443,6 +1460,10 @@ async function scaffoldLockfileLint ({
|
|
|
1443
1460
|
packageManager,
|
|
1444
1461
|
registries
|
|
1445
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
|
+
|
|
1446
1467
|
await promises.writeFile(`${projectRoot}/.lockfile-lintrc.json`, JSON.stringify({
|
|
1447
1468
|
path: determineLockfilePathFor(packageManager),
|
|
1448
1469
|
type: packageManager,
|
|
@@ -1590,7 +1611,8 @@ async function scaffolder (options) {
|
|
|
1590
1611
|
tests,
|
|
1591
1612
|
vcs,
|
|
1592
1613
|
decisions,
|
|
1593
|
-
dialect
|
|
1614
|
+
dialect,
|
|
1615
|
+
publishRegistry: registries.publish
|
|
1594
1616
|
});
|
|
1595
1617
|
const verificationResults = await scaffoldVerification({
|
|
1596
1618
|
projectRoot,
|