@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.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,10 @@ 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]) => {
|
|
802
|
+
if ('registry' === scope) return ['registry', url];
|
|
803
|
+
return [`@${scope}:registry`, url];
|
|
804
|
+
})))));
|
|
800
805
|
return {
|
|
801
806
|
scripts: {
|
|
802
807
|
'lint:peer': 'npm ls >/dev/null'
|
|
@@ -1099,7 +1104,8 @@ async function scaffoldPackageType ({
|
|
|
1099
1104
|
packageTypes,
|
|
1100
1105
|
tests,
|
|
1101
1106
|
decisions,
|
|
1102
|
-
dialect
|
|
1107
|
+
dialect,
|
|
1108
|
+
publishRegistry
|
|
1103
1109
|
}) {
|
|
1104
1110
|
cliMessages.info('Scaffolding Package Details');
|
|
1105
1111
|
const detailsForBuild = await buildDetails({
|
|
@@ -1151,9 +1157,11 @@ async function scaffoldPackageType ({
|
|
|
1151
1157
|
return deepmerge__default["default"].all([{
|
|
1152
1158
|
packageProperties: _objectSpread2({
|
|
1153
1159
|
files: ['example.js'],
|
|
1154
|
-
publishConfig: {
|
|
1160
|
+
publishConfig: _objectSpread2({
|
|
1155
1161
|
access: 'Public' === visibility ? 'public' : 'restricted'
|
|
1156
|
-
}
|
|
1162
|
+
}, publishRegistry && {
|
|
1163
|
+
registry: publishRegistry
|
|
1164
|
+
})
|
|
1157
1165
|
}, 'Public' === visibility && {
|
|
1158
1166
|
runkitExampleFilename: './example.js'
|
|
1159
1167
|
}),
|
|
@@ -1252,7 +1260,8 @@ async function scaffoldCliType ({
|
|
|
1252
1260
|
packageName,
|
|
1253
1261
|
visibility,
|
|
1254
1262
|
projectRoot,
|
|
1255
|
-
dialect
|
|
1263
|
+
dialect,
|
|
1264
|
+
publishRegistry
|
|
1256
1265
|
}) {
|
|
1257
1266
|
const rollupResults = await rollup.scaffold({
|
|
1258
1267
|
projectRoot,
|
|
@@ -1278,9 +1287,11 @@ async function scaffoldCliType ({
|
|
|
1278
1287
|
version: '0.0.0-semantically-released',
|
|
1279
1288
|
bin: {},
|
|
1280
1289
|
files: [`${defaultBuildDirectory}/`],
|
|
1281
|
-
publishConfig: {
|
|
1290
|
+
publishConfig: _objectSpread2({
|
|
1282
1291
|
access: 'Public' === visibility ? 'public' : 'restricted'
|
|
1283
|
-
}
|
|
1292
|
+
}, publishRegistry && {
|
|
1293
|
+
registry: publishRegistry
|
|
1294
|
+
})
|
|
1284
1295
|
},
|
|
1285
1296
|
eslintConfigs: [],
|
|
1286
1297
|
nextSteps: []
|
|
@@ -1301,7 +1312,8 @@ async function scaffoldProjectType ({
|
|
|
1301
1312
|
tests,
|
|
1302
1313
|
vcs,
|
|
1303
1314
|
decisions,
|
|
1304
|
-
dialect
|
|
1315
|
+
dialect,
|
|
1316
|
+
publishRegistry
|
|
1305
1317
|
}) {
|
|
1306
1318
|
switch (projectType) {
|
|
1307
1319
|
case javascriptCore.projectTypes.PACKAGE:
|
|
@@ -1316,7 +1328,8 @@ async function scaffoldProjectType ({
|
|
|
1316
1328
|
tests,
|
|
1317
1329
|
vcs,
|
|
1318
1330
|
decisions,
|
|
1319
|
-
dialect
|
|
1331
|
+
dialect,
|
|
1332
|
+
publishRegistry
|
|
1320
1333
|
});
|
|
1321
1334
|
|
|
1322
1335
|
case javascriptCore.projectTypes.APPLICATION:
|
|
@@ -1335,7 +1348,8 @@ async function scaffoldProjectType ({
|
|
|
1335
1348
|
packageName,
|
|
1336
1349
|
visibility,
|
|
1337
1350
|
projectRoot,
|
|
1338
|
-
dialect
|
|
1351
|
+
dialect,
|
|
1352
|
+
publishRegistry
|
|
1339
1353
|
});
|
|
1340
1354
|
|
|
1341
1355
|
case javascriptCore.projectTypes.MONOREPO:
|
|
@@ -1456,10 +1470,25 @@ function scaffoldBanSensitiveFiles () {
|
|
|
1456
1470
|
};
|
|
1457
1471
|
}
|
|
1458
1472
|
|
|
1473
|
+
function buildAllowedHostsList ({
|
|
1474
|
+
packageManager,
|
|
1475
|
+
registries
|
|
1476
|
+
}) {
|
|
1477
|
+
return [...(!registries || registries && !registries.registry ? [packageManager] : []), ...Object.values(Object.fromEntries(Object.entries(registries).filter(([scope]) => 'publish' !== scope)))];
|
|
1478
|
+
}
|
|
1479
|
+
|
|
1480
|
+
const lockfileLintSupportedPackageManagers = [javascriptCore.packageManagers.NPM, javascriptCore.packageManagers.YARN];
|
|
1481
|
+
|
|
1459
1482
|
function determineLockfilePathFor(packageManager) {
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
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);
|
|
1463
1492
|
}
|
|
1464
1493
|
|
|
1465
1494
|
async function scaffoldLockfileLint ({
|
|
@@ -1467,11 +1496,18 @@ async function scaffoldLockfileLint ({
|
|
|
1467
1496
|
packageManager,
|
|
1468
1497
|
registries
|
|
1469
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
|
+
|
|
1470
1503
|
await fs.promises.writeFile(`${projectRoot}/.lockfile-lintrc.json`, JSON.stringify({
|
|
1471
1504
|
path: determineLockfilePathFor(packageManager),
|
|
1472
1505
|
type: packageManager,
|
|
1473
1506
|
'validate-https': true,
|
|
1474
|
-
'allowed-hosts':
|
|
1507
|
+
'allowed-hosts': buildAllowedHostsList({
|
|
1508
|
+
packageManager,
|
|
1509
|
+
registries
|
|
1510
|
+
})
|
|
1475
1511
|
}));
|
|
1476
1512
|
return {
|
|
1477
1513
|
devDependencies: ['lockfile-lint'],
|
|
@@ -1611,7 +1647,8 @@ async function scaffolder (options) {
|
|
|
1611
1647
|
tests,
|
|
1612
1648
|
vcs,
|
|
1613
1649
|
decisions,
|
|
1614
|
-
dialect
|
|
1650
|
+
dialect,
|
|
1651
|
+
publishRegistry: registries.publish
|
|
1615
1652
|
});
|
|
1616
1653
|
const verificationResults = await scaffoldVerification({
|
|
1617
1654
|
projectRoot,
|