@form8ion/javascript 11.7.3 → 11.9.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/README.md +4 -1
- package/lib/index.js +69 -34
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +69 -34
- package/lib/index.mjs.map +1 -1
- package/package.json +14 -13
package/README.md
CHANGED
|
@@ -8,6 +8,7 @@ toolset
|
|
|
8
8
|
[![Node CI Workflow Status][github-actions-ci-badge]][github-actions-ci-link]
|
|
9
9
|
[![Codecov][coverage-badge]][coverage-link]
|
|
10
10
|
[](https://securityscorecards.dev/viewer/?uri=github.com/form8ion/javascript)
|
|
11
|
+
![SLSA Level 2][slsa-badge]
|
|
11
12
|
|
|
12
13
|
<!--status-badges end -->
|
|
13
14
|
|
|
@@ -181,7 +182,7 @@ $ npm test
|
|
|
181
182
|
|
|
182
183
|
[npm-badge]: https://img.shields.io/npm/v/@form8ion/javascript.svg?logo=npm
|
|
183
184
|
|
|
184
|
-
[node-badge]: https://img.shields.io/node/v/@form8ion/javascript
|
|
185
|
+
[node-badge]: https://img.shields.io/node/v/@form8ion/javascript?logo=node.js
|
|
185
186
|
|
|
186
187
|
[runkit-link]: https://npm.runkit.com/@form8ion/javascript
|
|
187
188
|
|
|
@@ -190,3 +191,5 @@ $ npm test
|
|
|
190
191
|
[coverage-link]: https://codecov.io/github/form8ion/javascript
|
|
191
192
|
|
|
192
193
|
[coverage-badge]: https://img.shields.io/codecov/c/github/form8ion/javascript.svg?logo=codecov
|
|
194
|
+
|
|
195
|
+
[slsa-badge]: https://slsa.dev/images/gh-badge-level2.svg
|
package/lib/index.js
CHANGED
|
@@ -14,11 +14,10 @@ var cliMessages = require('@travi/cli-messages');
|
|
|
14
14
|
var commitConventionPlugin = require('@form8ion/commit-convention');
|
|
15
15
|
var execa = require('@form8ion/execa-wrapper');
|
|
16
16
|
var npmConf = require('npm-conf');
|
|
17
|
-
var fs = require('fs');
|
|
18
|
-
var ini = require('ini');
|
|
19
17
|
var os = require('os');
|
|
20
18
|
var validatePackageName = require('validate-npm-package-name');
|
|
21
19
|
var rollup = require('@form8ion/rollup');
|
|
20
|
+
var fs = require('fs');
|
|
22
21
|
var mustache = require('mustache');
|
|
23
22
|
var mkdir = require('make-dir');
|
|
24
23
|
var touch = require('touch');
|
|
@@ -26,6 +25,7 @@ var camelcase = require('camelcase');
|
|
|
26
25
|
var path = require('path');
|
|
27
26
|
var filedirname = require('filedirname');
|
|
28
27
|
var huskyPlugin = require('@form8ion/husky');
|
|
28
|
+
var ini = require('ini');
|
|
29
29
|
var prettier = require('@form8ion/prettier');
|
|
30
30
|
var eslint = require('@form8ion/eslint');
|
|
31
31
|
var node_fs = require('node:fs');
|
|
@@ -150,7 +150,7 @@ function c8IsConfigured ({projectRoot}) {
|
|
|
150
150
|
return core.fileExists(`${projectRoot}/.c8rc.json`);
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
async function tester$
|
|
153
|
+
async function tester$4 ({projectRoot}) {
|
|
154
154
|
const [c8Exists, nycExists] = await Promise.all([c8IsConfigured({projectRoot}), nycIsConfigured({projectRoot})]);
|
|
155
155
|
|
|
156
156
|
return c8Exists || nycExists;
|
|
@@ -160,7 +160,7 @@ var coveragePlugin = /*#__PURE__*/Object.freeze({
|
|
|
160
160
|
__proto__: null,
|
|
161
161
|
scaffold: scaffoldCoverage,
|
|
162
162
|
lift: lift$2,
|
|
163
|
-
test: tester$
|
|
163
|
+
test: tester$4
|
|
164
164
|
});
|
|
165
165
|
|
|
166
166
|
const unitTestFrameworksSchema = joi__default["default"].object().required().pattern(/^/, joi__default["default"].object({
|
|
@@ -250,11 +250,71 @@ async function scaffoldCodeStyle ({
|
|
|
250
250
|
].filter(Boolean)));
|
|
251
251
|
}
|
|
252
252
|
|
|
253
|
+
function lifter$3 (options) {
|
|
254
|
+
return eslint.lift(options);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
function tester$3 (options) {
|
|
258
|
+
return eslint.test(options);
|
|
259
|
+
}
|
|
260
|
+
|
|
253
261
|
var codeStylePlugin = /*#__PURE__*/Object.freeze({
|
|
254
262
|
__proto__: null,
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
263
|
+
scaffold: scaffoldCodeStyle,
|
|
264
|
+
lift: lifter$3,
|
|
265
|
+
test: tester$3
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
function projectWillNotBeConsumed(projectType) {
|
|
269
|
+
return javascriptCore.projectTypes.APPLICATION === projectType || javascriptCore.projectTypes.CLI === projectType;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
async function scaffoldNpmConfig ({
|
|
273
|
+
projectRoot,
|
|
274
|
+
projectType,
|
|
275
|
+
registries
|
|
276
|
+
}) {
|
|
277
|
+
await fs.promises.writeFile(
|
|
278
|
+
`${projectRoot}/.npmrc`,
|
|
279
|
+
ini.stringify({
|
|
280
|
+
'update-notifier': false,
|
|
281
|
+
...projectWillNotBeConsumed(projectType) && {'save-exact': true},
|
|
282
|
+
...Object.fromEntries(Object.entries(registries)
|
|
283
|
+
.filter(([scope]) => 'publish' !== scope)
|
|
284
|
+
.map(([scope, url]) => {
|
|
285
|
+
if ('registry' === scope) return ['registry', url];
|
|
286
|
+
|
|
287
|
+
return [`@${scope}:registry`, url];
|
|
288
|
+
}))
|
|
289
|
+
})
|
|
290
|
+
);
|
|
291
|
+
|
|
292
|
+
return {scripts: {'lint:peer': 'npm ls >/dev/null'}};
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
function tester$2 ({projectRoot}) {
|
|
296
|
+
return core.fileExists(`${projectRoot}/.npmrc`);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
async function lifter$2 ({projectRoot}) {
|
|
300
|
+
const pathToConfig = `${projectRoot}/.npmrc`;
|
|
301
|
+
|
|
302
|
+
const {
|
|
303
|
+
provenance,
|
|
304
|
+
'engines-strict': enginesStrict,
|
|
305
|
+
...remainingProperties
|
|
306
|
+
} = ini.parse(await node_fs.promises.readFile(pathToConfig, 'utf-8'));
|
|
307
|
+
|
|
308
|
+
await node_fs.promises.writeFile(pathToConfig, ini.stringify(remainingProperties));
|
|
309
|
+
|
|
310
|
+
return {};
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
var npmConfigPlugin = /*#__PURE__*/Object.freeze({
|
|
314
|
+
__proto__: null,
|
|
315
|
+
scaffold: scaffoldNpmConfig,
|
|
316
|
+
test: tester$2,
|
|
317
|
+
lift: lifter$2
|
|
258
318
|
});
|
|
259
319
|
|
|
260
320
|
async function test({projectRoot}) {
|
|
@@ -468,6 +528,7 @@ async function scaffoldPackageType ({
|
|
|
468
528
|
main: './lib/index.js',
|
|
469
529
|
module: './lib/index.mjs',
|
|
470
530
|
exports: {
|
|
531
|
+
module: './lib/index.mjs',
|
|
471
532
|
require: './lib/index.js',
|
|
472
533
|
import: './lib/index.mjs'
|
|
473
534
|
}
|
|
@@ -1026,6 +1087,7 @@ async function lift ({projectRoot, vcs, results}) {
|
|
|
1026
1087
|
commitConventionPlugin__namespace,
|
|
1027
1088
|
dialects,
|
|
1028
1089
|
codeStylePlugin,
|
|
1090
|
+
npmConfigPlugin,
|
|
1029
1091
|
projectTypes
|
|
1030
1092
|
],
|
|
1031
1093
|
options: {packageManager, projectRoot, vcs, packageDetails: JSON.parse(packageContents)}
|
|
@@ -1321,33 +1383,6 @@ async function prompt(
|
|
|
1321
1383
|
};
|
|
1322
1384
|
}
|
|
1323
1385
|
|
|
1324
|
-
function projectWillNotBeConsumed(projectType) {
|
|
1325
|
-
return javascriptCore.projectTypes.APPLICATION === projectType || javascriptCore.projectTypes.CLI === projectType;
|
|
1326
|
-
}
|
|
1327
|
-
|
|
1328
|
-
async function scaffoldNpmConfig ({
|
|
1329
|
-
projectRoot,
|
|
1330
|
-
projectType,
|
|
1331
|
-
registries
|
|
1332
|
-
}) {
|
|
1333
|
-
await fs.promises.writeFile(
|
|
1334
|
-
`${projectRoot}/.npmrc`,
|
|
1335
|
-
ini.stringify({
|
|
1336
|
-
'update-notifier': false,
|
|
1337
|
-
...projectWillNotBeConsumed(projectType) && {'save-exact': true},
|
|
1338
|
-
...Object.fromEntries(Object.entries(registries)
|
|
1339
|
-
.filter(([scope]) => 'publish' !== scope)
|
|
1340
|
-
.map(([scope, url]) => {
|
|
1341
|
-
if ('registry' === scope) return ['registry', url];
|
|
1342
|
-
|
|
1343
|
-
return [`@${scope}:registry`, url];
|
|
1344
|
-
}))
|
|
1345
|
-
})
|
|
1346
|
-
);
|
|
1347
|
-
|
|
1348
|
-
return {scripts: {'lint:peer': 'npm ls >/dev/null'}};
|
|
1349
|
-
}
|
|
1350
|
-
|
|
1351
1386
|
function scaffoldDocumentation ({projectTypeResults, packageManager}) {
|
|
1352
1387
|
return {
|
|
1353
1388
|
toc: `Run \`${buildDocumentationCommand(packageManager)}\` to generate a table of contents`,
|