@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.cjs.js
CHANGED
|
@@ -468,7 +468,7 @@ function validate(options) {
|
|
|
468
468
|
}).keys({
|
|
469
469
|
unitTestFrameworks: unitTestFrameworksSchema
|
|
470
470
|
}).keys({
|
|
471
|
-
registries: joi__namespace.object().pattern(joi__namespace.string(), joi__namespace.string().uri())
|
|
471
|
+
registries: joi__namespace.object().pattern(joi__namespace.string(), joi__namespace.string().uri()).default({})
|
|
472
472
|
});
|
|
473
473
|
const {
|
|
474
474
|
error,
|
|
@@ -796,7 +796,7 @@ async function scaffoldNpmConfig ({
|
|
|
796
796
|
'update-notifier': false
|
|
797
797
|
}, projectWillNotBeConsumed(projectType) && {
|
|
798
798
|
'save-exact': true
|
|
799
|
-
}),
|
|
799
|
+
}), Object.fromEntries(Object.entries(registries).filter(([scope]) => 'publish' !== scope).map(([scope, url]) => {
|
|
800
800
|
if ('registry' === scope) return ['registry', url];
|
|
801
801
|
return [`@${scope}:registry`, url];
|
|
802
802
|
})))));
|
|
@@ -1102,7 +1102,8 @@ async function scaffoldPackageType ({
|
|
|
1102
1102
|
packageTypes,
|
|
1103
1103
|
tests,
|
|
1104
1104
|
decisions,
|
|
1105
|
-
dialect
|
|
1105
|
+
dialect,
|
|
1106
|
+
publishRegistry
|
|
1106
1107
|
}) {
|
|
1107
1108
|
cliMessages.info('Scaffolding Package Details');
|
|
1108
1109
|
const detailsForBuild = await buildDetails({
|
|
@@ -1154,9 +1155,11 @@ async function scaffoldPackageType ({
|
|
|
1154
1155
|
return deepmerge__default["default"].all([{
|
|
1155
1156
|
packageProperties: _objectSpread2({
|
|
1156
1157
|
files: ['example.js'],
|
|
1157
|
-
publishConfig: {
|
|
1158
|
+
publishConfig: _objectSpread2({
|
|
1158
1159
|
access: 'Public' === visibility ? 'public' : 'restricted'
|
|
1159
|
-
}
|
|
1160
|
+
}, publishRegistry && {
|
|
1161
|
+
registry: publishRegistry
|
|
1162
|
+
})
|
|
1160
1163
|
}, 'Public' === visibility && {
|
|
1161
1164
|
runkitExampleFilename: './example.js'
|
|
1162
1165
|
}),
|
|
@@ -1255,7 +1258,8 @@ async function scaffoldCliType ({
|
|
|
1255
1258
|
packageName,
|
|
1256
1259
|
visibility,
|
|
1257
1260
|
projectRoot,
|
|
1258
|
-
dialect
|
|
1261
|
+
dialect,
|
|
1262
|
+
publishRegistry
|
|
1259
1263
|
}) {
|
|
1260
1264
|
const rollupResults = await rollup.scaffold({
|
|
1261
1265
|
projectRoot,
|
|
@@ -1281,9 +1285,11 @@ async function scaffoldCliType ({
|
|
|
1281
1285
|
version: '0.0.0-semantically-released',
|
|
1282
1286
|
bin: {},
|
|
1283
1287
|
files: [`${defaultBuildDirectory}/`],
|
|
1284
|
-
publishConfig: {
|
|
1288
|
+
publishConfig: _objectSpread2({
|
|
1285
1289
|
access: 'Public' === visibility ? 'public' : 'restricted'
|
|
1286
|
-
}
|
|
1290
|
+
}, publishRegistry && {
|
|
1291
|
+
registry: publishRegistry
|
|
1292
|
+
})
|
|
1287
1293
|
},
|
|
1288
1294
|
eslintConfigs: [],
|
|
1289
1295
|
nextSteps: []
|
|
@@ -1304,7 +1310,8 @@ async function scaffoldProjectType ({
|
|
|
1304
1310
|
tests,
|
|
1305
1311
|
vcs,
|
|
1306
1312
|
decisions,
|
|
1307
|
-
dialect
|
|
1313
|
+
dialect,
|
|
1314
|
+
publishRegistry
|
|
1308
1315
|
}) {
|
|
1309
1316
|
switch (projectType) {
|
|
1310
1317
|
case javascriptCore.projectTypes.PACKAGE:
|
|
@@ -1319,7 +1326,8 @@ async function scaffoldProjectType ({
|
|
|
1319
1326
|
tests,
|
|
1320
1327
|
vcs,
|
|
1321
1328
|
decisions,
|
|
1322
|
-
dialect
|
|
1329
|
+
dialect,
|
|
1330
|
+
publishRegistry
|
|
1323
1331
|
});
|
|
1324
1332
|
|
|
1325
1333
|
case javascriptCore.projectTypes.APPLICATION:
|
|
@@ -1338,7 +1346,8 @@ async function scaffoldProjectType ({
|
|
|
1338
1346
|
packageName,
|
|
1339
1347
|
visibility,
|
|
1340
1348
|
projectRoot,
|
|
1341
|
-
dialect
|
|
1349
|
+
dialect,
|
|
1350
|
+
publishRegistry
|
|
1342
1351
|
});
|
|
1343
1352
|
|
|
1344
1353
|
case javascriptCore.projectTypes.MONOREPO:
|
|
@@ -1463,13 +1472,21 @@ function buildAllowedHostsList ({
|
|
|
1463
1472
|
packageManager,
|
|
1464
1473
|
registries
|
|
1465
1474
|
}) {
|
|
1466
|
-
return [...(!registries || registries && !registries.registry ? [packageManager] : []), ...
|
|
1475
|
+
return [...(!registries || registries && !registries.registry ? [packageManager] : []), ...Object.values(Object.fromEntries(Object.entries(registries).filter(([scope]) => 'publish' !== scope)))];
|
|
1467
1476
|
}
|
|
1468
1477
|
|
|
1478
|
+
const lockfileLintSupportedPackageManagers = [javascriptCore.packageManagers.NPM, javascriptCore.packageManagers.YARN];
|
|
1479
|
+
|
|
1469
1480
|
function determineLockfilePathFor(packageManager) {
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1481
|
+
const lockfilePaths = {
|
|
1482
|
+
[javascriptCore.packageManagers.NPM]: 'package-lock.json',
|
|
1483
|
+
[javascriptCore.packageManagers.YARN]: 'yarn.lock'
|
|
1484
|
+
};
|
|
1485
|
+
return lockfilePaths[packageManager];
|
|
1486
|
+
}
|
|
1487
|
+
|
|
1488
|
+
function lockfileLintSupports(packageManager) {
|
|
1489
|
+
return lockfileLintSupportedPackageManagers.includes(packageManager);
|
|
1473
1490
|
}
|
|
1474
1491
|
|
|
1475
1492
|
async function scaffoldLockfileLint ({
|
|
@@ -1477,6 +1494,10 @@ async function scaffoldLockfileLint ({
|
|
|
1477
1494
|
packageManager,
|
|
1478
1495
|
registries
|
|
1479
1496
|
}) {
|
|
1497
|
+
if (!lockfileLintSupports(packageManager)) {
|
|
1498
|
+
throw new Error(`The ${packageManager} package manager is currently not supported by lockfile-lint. ` + `Only ${lockfileLintSupportedPackageManagers.join(' and ')} are currently supported.`);
|
|
1499
|
+
}
|
|
1500
|
+
|
|
1480
1501
|
await fs.promises.writeFile(`${projectRoot}/.lockfile-lintrc.json`, JSON.stringify({
|
|
1481
1502
|
path: determineLockfilePathFor(packageManager),
|
|
1482
1503
|
type: packageManager,
|
|
@@ -1624,7 +1645,8 @@ async function scaffolder (options) {
|
|
|
1624
1645
|
tests,
|
|
1625
1646
|
vcs,
|
|
1626
1647
|
decisions,
|
|
1627
|
-
dialect
|
|
1648
|
+
dialect,
|
|
1649
|
+
publishRegistry: registries.publish
|
|
1628
1650
|
});
|
|
1629
1651
|
const verificationResults = await scaffoldVerification({
|
|
1630
1652
|
projectRoot,
|