@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.cjs.js
CHANGED
|
@@ -257,14 +257,16 @@ async function scaffoldUnitTesting ({
|
|
|
257
257
|
decisions,
|
|
258
258
|
visibility,
|
|
259
259
|
vcs,
|
|
260
|
-
pathWithinParent
|
|
260
|
+
pathWithinParent,
|
|
261
|
+
dialect
|
|
261
262
|
}) {
|
|
262
263
|
const validatedFrameworks = javascriptCore.validateOptions(unitTestFrameworksSchema, frameworks);
|
|
263
264
|
const [framework, coverage] = await Promise.all([chooseFramework({
|
|
264
265
|
frameworks: validatedFrameworks,
|
|
265
266
|
decisions
|
|
266
267
|
}).then(chosenFramework => javascriptCore.scaffoldChoice(validatedFrameworks, chosenFramework, {
|
|
267
|
-
projectRoot
|
|
268
|
+
projectRoot,
|
|
269
|
+
dialect
|
|
268
270
|
})), scaffoldCoverage({
|
|
269
271
|
projectRoot,
|
|
270
272
|
vcs,
|
|
@@ -468,7 +470,7 @@ function validate(options) {
|
|
|
468
470
|
}).keys({
|
|
469
471
|
unitTestFrameworks: unitTestFrameworksSchema
|
|
470
472
|
}).keys({
|
|
471
|
-
registries: joi__namespace.object().pattern(joi__namespace.string(), joi__namespace.string().uri())
|
|
473
|
+
registries: joi__namespace.object().pattern(joi__namespace.string(), joi__namespace.string().uri()).default({})
|
|
472
474
|
});
|
|
473
475
|
const {
|
|
474
476
|
error,
|
|
@@ -796,7 +798,7 @@ async function scaffoldNpmConfig ({
|
|
|
796
798
|
'update-notifier': false
|
|
797
799
|
}, projectWillNotBeConsumed(projectType) && {
|
|
798
800
|
'save-exact': true
|
|
799
|
-
}),
|
|
801
|
+
}), Object.fromEntries(Object.entries(registries).filter(([scope]) => 'publish' !== scope).map(([scope, url]) => {
|
|
800
802
|
if ('registry' === scope) return ['registry', url];
|
|
801
803
|
return [`@${scope}:registry`, url];
|
|
802
804
|
})))));
|
|
@@ -1102,7 +1104,8 @@ async function scaffoldPackageType ({
|
|
|
1102
1104
|
packageTypes,
|
|
1103
1105
|
tests,
|
|
1104
1106
|
decisions,
|
|
1105
|
-
dialect
|
|
1107
|
+
dialect,
|
|
1108
|
+
publishRegistry
|
|
1106
1109
|
}) {
|
|
1107
1110
|
cliMessages.info('Scaffolding Package Details');
|
|
1108
1111
|
const detailsForBuild = await buildDetails({
|
|
@@ -1154,9 +1157,11 @@ async function scaffoldPackageType ({
|
|
|
1154
1157
|
return deepmerge__default["default"].all([{
|
|
1155
1158
|
packageProperties: _objectSpread2({
|
|
1156
1159
|
files: ['example.js'],
|
|
1157
|
-
publishConfig: {
|
|
1160
|
+
publishConfig: _objectSpread2({
|
|
1158
1161
|
access: 'Public' === visibility ? 'public' : 'restricted'
|
|
1159
|
-
}
|
|
1162
|
+
}, publishRegistry && {
|
|
1163
|
+
registry: publishRegistry
|
|
1164
|
+
})
|
|
1160
1165
|
}, 'Public' === visibility && {
|
|
1161
1166
|
runkitExampleFilename: './example.js'
|
|
1162
1167
|
}),
|
|
@@ -1255,7 +1260,8 @@ async function scaffoldCliType ({
|
|
|
1255
1260
|
packageName,
|
|
1256
1261
|
visibility,
|
|
1257
1262
|
projectRoot,
|
|
1258
|
-
dialect
|
|
1263
|
+
dialect,
|
|
1264
|
+
publishRegistry
|
|
1259
1265
|
}) {
|
|
1260
1266
|
const rollupResults = await rollup.scaffold({
|
|
1261
1267
|
projectRoot,
|
|
@@ -1281,9 +1287,11 @@ async function scaffoldCliType ({
|
|
|
1281
1287
|
version: '0.0.0-semantically-released',
|
|
1282
1288
|
bin: {},
|
|
1283
1289
|
files: [`${defaultBuildDirectory}/`],
|
|
1284
|
-
publishConfig: {
|
|
1290
|
+
publishConfig: _objectSpread2({
|
|
1285
1291
|
access: 'Public' === visibility ? 'public' : 'restricted'
|
|
1286
|
-
}
|
|
1292
|
+
}, publishRegistry && {
|
|
1293
|
+
registry: publishRegistry
|
|
1294
|
+
})
|
|
1287
1295
|
},
|
|
1288
1296
|
eslintConfigs: [],
|
|
1289
1297
|
nextSteps: []
|
|
@@ -1304,7 +1312,8 @@ async function scaffoldProjectType ({
|
|
|
1304
1312
|
tests,
|
|
1305
1313
|
vcs,
|
|
1306
1314
|
decisions,
|
|
1307
|
-
dialect
|
|
1315
|
+
dialect,
|
|
1316
|
+
publishRegistry
|
|
1308
1317
|
}) {
|
|
1309
1318
|
switch (projectType) {
|
|
1310
1319
|
case javascriptCore.projectTypes.PACKAGE:
|
|
@@ -1319,7 +1328,8 @@ async function scaffoldProjectType ({
|
|
|
1319
1328
|
tests,
|
|
1320
1329
|
vcs,
|
|
1321
1330
|
decisions,
|
|
1322
|
-
dialect
|
|
1331
|
+
dialect,
|
|
1332
|
+
publishRegistry
|
|
1323
1333
|
});
|
|
1324
1334
|
|
|
1325
1335
|
case javascriptCore.projectTypes.APPLICATION:
|
|
@@ -1338,7 +1348,8 @@ async function scaffoldProjectType ({
|
|
|
1338
1348
|
packageName,
|
|
1339
1349
|
visibility,
|
|
1340
1350
|
projectRoot,
|
|
1341
|
-
dialect
|
|
1351
|
+
dialect,
|
|
1352
|
+
publishRegistry
|
|
1342
1353
|
});
|
|
1343
1354
|
|
|
1344
1355
|
case javascriptCore.projectTypes.MONOREPO:
|
|
@@ -1463,13 +1474,21 @@ function buildAllowedHostsList ({
|
|
|
1463
1474
|
packageManager,
|
|
1464
1475
|
registries
|
|
1465
1476
|
}) {
|
|
1466
|
-
return [...(!registries || registries && !registries.registry ? [packageManager] : []), ...
|
|
1477
|
+
return [...(!registries || registries && !registries.registry ? [packageManager] : []), ...Object.values(Object.fromEntries(Object.entries(registries).filter(([scope]) => 'publish' !== scope)))];
|
|
1467
1478
|
}
|
|
1468
1479
|
|
|
1480
|
+
const lockfileLintSupportedPackageManagers = [javascriptCore.packageManagers.NPM, javascriptCore.packageManagers.YARN];
|
|
1481
|
+
|
|
1469
1482
|
function determineLockfilePathFor(packageManager) {
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1483
|
+
const lockfilePaths = {
|
|
1484
|
+
[javascriptCore.packageManagers.NPM]: 'package-lock.json',
|
|
1485
|
+
[javascriptCore.packageManagers.YARN]: 'yarn.lock'
|
|
1486
|
+
};
|
|
1487
|
+
return lockfilePaths[packageManager];
|
|
1488
|
+
}
|
|
1489
|
+
|
|
1490
|
+
function lockfileLintSupports(packageManager) {
|
|
1491
|
+
return lockfileLintSupportedPackageManagers.includes(packageManager);
|
|
1473
1492
|
}
|
|
1474
1493
|
|
|
1475
1494
|
async function scaffoldLockfileLint ({
|
|
@@ -1477,6 +1496,10 @@ async function scaffoldLockfileLint ({
|
|
|
1477
1496
|
packageManager,
|
|
1478
1497
|
registries
|
|
1479
1498
|
}) {
|
|
1499
|
+
if (!lockfileLintSupports(packageManager)) {
|
|
1500
|
+
throw new Error(`The ${packageManager} package manager is currently not supported by lockfile-lint. ` + `Only ${lockfileLintSupportedPackageManagers.join(' and ')} are currently supported.`);
|
|
1501
|
+
}
|
|
1502
|
+
|
|
1480
1503
|
await fs.promises.writeFile(`${projectRoot}/.lockfile-lintrc.json`, JSON.stringify({
|
|
1481
1504
|
path: determineLockfilePathFor(packageManager),
|
|
1482
1505
|
type: packageManager,
|
|
@@ -1552,7 +1575,8 @@ async function scaffoldVerification({
|
|
|
1552
1575
|
pathWithinParent
|
|
1553
1576
|
}), huskyPlugin.scaffold({
|
|
1554
1577
|
projectRoot,
|
|
1555
|
-
packageManager
|
|
1578
|
+
packageManager,
|
|
1579
|
+
pathWithinParent
|
|
1556
1580
|
})]);
|
|
1557
1581
|
const lintingResults = await scaffoldLinting({
|
|
1558
1582
|
projectRoot,
|
|
@@ -1624,7 +1648,8 @@ async function scaffolder (options) {
|
|
|
1624
1648
|
tests,
|
|
1625
1649
|
vcs,
|
|
1626
1650
|
decisions,
|
|
1627
|
-
dialect
|
|
1651
|
+
dialect,
|
|
1652
|
+
publishRegistry: registries.publish
|
|
1628
1653
|
});
|
|
1629
1654
|
const verificationResults = await scaffoldVerification({
|
|
1630
1655
|
projectRoot,
|