@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/lib/index.mjs
CHANGED
|
@@ -11,11 +11,10 @@ import * as commitConventionPlugin from '@form8ion/commit-convention';
|
|
|
11
11
|
import { scaffold as scaffold$5 } from '@form8ion/commit-convention';
|
|
12
12
|
import execa from '@form8ion/execa-wrapper';
|
|
13
13
|
import npmConf from 'npm-conf';
|
|
14
|
-
import { promises } from 'fs';
|
|
15
|
-
import { stringify } from 'ini';
|
|
16
14
|
import { EOL } from 'os';
|
|
17
15
|
import validatePackageName from 'validate-npm-package-name';
|
|
18
16
|
import { scaffold as scaffold$3 } from '@form8ion/rollup';
|
|
17
|
+
import { promises } from 'fs';
|
|
19
18
|
import mustache from 'mustache';
|
|
20
19
|
import mkdir from 'make-dir';
|
|
21
20
|
import touch from 'touch';
|
|
@@ -24,6 +23,7 @@ import { resolve } from 'path';
|
|
|
24
23
|
import filedirname from 'filedirname';
|
|
25
24
|
import * as huskyPlugin from '@form8ion/husky';
|
|
26
25
|
import { scaffold as scaffold$4 } from '@form8ion/husky';
|
|
26
|
+
import { stringify, parse } from 'ini';
|
|
27
27
|
import { scaffold as scaffold$2 } from '@form8ion/prettier';
|
|
28
28
|
import { scaffold as scaffold$1, lift as lift$4, test as test$1 } from '@form8ion/eslint';
|
|
29
29
|
import { promises as promises$1 } from 'node:fs';
|
|
@@ -114,7 +114,7 @@ function c8IsConfigured ({projectRoot}) {
|
|
|
114
114
|
return fileExists(`${projectRoot}/.c8rc.json`);
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
async function tester$
|
|
117
|
+
async function tester$4 ({projectRoot}) {
|
|
118
118
|
const [c8Exists, nycExists] = await Promise.all([c8IsConfigured({projectRoot}), nycIsConfigured({projectRoot})]);
|
|
119
119
|
|
|
120
120
|
return c8Exists || nycExists;
|
|
@@ -124,7 +124,7 @@ var coveragePlugin = /*#__PURE__*/Object.freeze({
|
|
|
124
124
|
__proto__: null,
|
|
125
125
|
scaffold: scaffoldCoverage,
|
|
126
126
|
lift: lift$2,
|
|
127
|
-
test: tester$
|
|
127
|
+
test: tester$4
|
|
128
128
|
});
|
|
129
129
|
|
|
130
130
|
const unitTestFrameworksSchema = joi.object().required().pattern(/^/, joi.object({
|
|
@@ -214,11 +214,71 @@ async function scaffoldCodeStyle ({
|
|
|
214
214
|
].filter(Boolean)));
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
+
function lifter$3 (options) {
|
|
218
|
+
return lift$4(options);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
function tester$3 (options) {
|
|
222
|
+
return test$1(options);
|
|
223
|
+
}
|
|
224
|
+
|
|
217
225
|
var codeStylePlugin = /*#__PURE__*/Object.freeze({
|
|
218
226
|
__proto__: null,
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
227
|
+
scaffold: scaffoldCodeStyle,
|
|
228
|
+
lift: lifter$3,
|
|
229
|
+
test: tester$3
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
function projectWillNotBeConsumed(projectType) {
|
|
233
|
+
return projectTypes$1.APPLICATION === projectType || projectTypes$1.CLI === projectType;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
async function scaffoldNpmConfig ({
|
|
237
|
+
projectRoot,
|
|
238
|
+
projectType,
|
|
239
|
+
registries
|
|
240
|
+
}) {
|
|
241
|
+
await promises.writeFile(
|
|
242
|
+
`${projectRoot}/.npmrc`,
|
|
243
|
+
stringify({
|
|
244
|
+
'update-notifier': false,
|
|
245
|
+
...projectWillNotBeConsumed(projectType) && {'save-exact': true},
|
|
246
|
+
...Object.fromEntries(Object.entries(registries)
|
|
247
|
+
.filter(([scope]) => 'publish' !== scope)
|
|
248
|
+
.map(([scope, url]) => {
|
|
249
|
+
if ('registry' === scope) return ['registry', url];
|
|
250
|
+
|
|
251
|
+
return [`@${scope}:registry`, url];
|
|
252
|
+
}))
|
|
253
|
+
})
|
|
254
|
+
);
|
|
255
|
+
|
|
256
|
+
return {scripts: {'lint:peer': 'npm ls >/dev/null'}};
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
function tester$2 ({projectRoot}) {
|
|
260
|
+
return fileExists(`${projectRoot}/.npmrc`);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
async function lifter$2 ({projectRoot}) {
|
|
264
|
+
const pathToConfig = `${projectRoot}/.npmrc`;
|
|
265
|
+
|
|
266
|
+
const {
|
|
267
|
+
provenance,
|
|
268
|
+
'engines-strict': enginesStrict,
|
|
269
|
+
...remainingProperties
|
|
270
|
+
} = parse(await promises$1.readFile(pathToConfig, 'utf-8'));
|
|
271
|
+
|
|
272
|
+
await promises$1.writeFile(pathToConfig, stringify(remainingProperties));
|
|
273
|
+
|
|
274
|
+
return {};
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
var npmConfigPlugin = /*#__PURE__*/Object.freeze({
|
|
278
|
+
__proto__: null,
|
|
279
|
+
scaffold: scaffoldNpmConfig,
|
|
280
|
+
test: tester$2,
|
|
281
|
+
lift: lifter$2
|
|
222
282
|
});
|
|
223
283
|
|
|
224
284
|
async function test({projectRoot}) {
|
|
@@ -432,6 +492,7 @@ async function scaffoldPackageType ({
|
|
|
432
492
|
main: './lib/index.js',
|
|
433
493
|
module: './lib/index.mjs',
|
|
434
494
|
exports: {
|
|
495
|
+
module: './lib/index.mjs',
|
|
435
496
|
require: './lib/index.js',
|
|
436
497
|
import: './lib/index.mjs'
|
|
437
498
|
}
|
|
@@ -990,6 +1051,7 @@ async function lift ({projectRoot, vcs, results}) {
|
|
|
990
1051
|
commitConventionPlugin,
|
|
991
1052
|
dialects,
|
|
992
1053
|
codeStylePlugin,
|
|
1054
|
+
npmConfigPlugin,
|
|
993
1055
|
projectTypes
|
|
994
1056
|
],
|
|
995
1057
|
options: {packageManager, projectRoot, vcs, packageDetails: JSON.parse(packageContents)}
|
|
@@ -1285,33 +1347,6 @@ async function prompt(
|
|
|
1285
1347
|
};
|
|
1286
1348
|
}
|
|
1287
1349
|
|
|
1288
|
-
function projectWillNotBeConsumed(projectType) {
|
|
1289
|
-
return projectTypes$1.APPLICATION === projectType || projectTypes$1.CLI === projectType;
|
|
1290
|
-
}
|
|
1291
|
-
|
|
1292
|
-
async function scaffoldNpmConfig ({
|
|
1293
|
-
projectRoot,
|
|
1294
|
-
projectType,
|
|
1295
|
-
registries
|
|
1296
|
-
}) {
|
|
1297
|
-
await promises.writeFile(
|
|
1298
|
-
`${projectRoot}/.npmrc`,
|
|
1299
|
-
stringify({
|
|
1300
|
-
'update-notifier': false,
|
|
1301
|
-
...projectWillNotBeConsumed(projectType) && {'save-exact': true},
|
|
1302
|
-
...Object.fromEntries(Object.entries(registries)
|
|
1303
|
-
.filter(([scope]) => 'publish' !== scope)
|
|
1304
|
-
.map(([scope, url]) => {
|
|
1305
|
-
if ('registry' === scope) return ['registry', url];
|
|
1306
|
-
|
|
1307
|
-
return [`@${scope}:registry`, url];
|
|
1308
|
-
}))
|
|
1309
|
-
})
|
|
1310
|
-
);
|
|
1311
|
-
|
|
1312
|
-
return {scripts: {'lint:peer': 'npm ls >/dev/null'}};
|
|
1313
|
-
}
|
|
1314
|
-
|
|
1315
1350
|
function scaffoldDocumentation ({projectTypeResults, packageManager}) {
|
|
1316
1351
|
return {
|
|
1317
1352
|
toc: `Run \`${buildDocumentationCommand(packageManager)}\` to generate a table of contents`,
|