@form8ion/javascript 11.8.0 → 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/lib/index.js +68 -34
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +68 -34
- package/lib/index.mjs.map +1 -1
- package/package.json +8 -8
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}) {
|
|
@@ -991,6 +1051,7 @@ async function lift ({projectRoot, vcs, results}) {
|
|
|
991
1051
|
commitConventionPlugin,
|
|
992
1052
|
dialects,
|
|
993
1053
|
codeStylePlugin,
|
|
1054
|
+
npmConfigPlugin,
|
|
994
1055
|
projectTypes
|
|
995
1056
|
],
|
|
996
1057
|
options: {packageManager, projectRoot, vcs, packageDetails: JSON.parse(packageContents)}
|
|
@@ -1286,33 +1347,6 @@ async function prompt(
|
|
|
1286
1347
|
};
|
|
1287
1348
|
}
|
|
1288
1349
|
|
|
1289
|
-
function projectWillNotBeConsumed(projectType) {
|
|
1290
|
-
return projectTypes$1.APPLICATION === projectType || projectTypes$1.CLI === projectType;
|
|
1291
|
-
}
|
|
1292
|
-
|
|
1293
|
-
async function scaffoldNpmConfig ({
|
|
1294
|
-
projectRoot,
|
|
1295
|
-
projectType,
|
|
1296
|
-
registries
|
|
1297
|
-
}) {
|
|
1298
|
-
await promises.writeFile(
|
|
1299
|
-
`${projectRoot}/.npmrc`,
|
|
1300
|
-
stringify({
|
|
1301
|
-
'update-notifier': false,
|
|
1302
|
-
...projectWillNotBeConsumed(projectType) && {'save-exact': true},
|
|
1303
|
-
...Object.fromEntries(Object.entries(registries)
|
|
1304
|
-
.filter(([scope]) => 'publish' !== scope)
|
|
1305
|
-
.map(([scope, url]) => {
|
|
1306
|
-
if ('registry' === scope) return ['registry', url];
|
|
1307
|
-
|
|
1308
|
-
return [`@${scope}:registry`, url];
|
|
1309
|
-
}))
|
|
1310
|
-
})
|
|
1311
|
-
);
|
|
1312
|
-
|
|
1313
|
-
return {scripts: {'lint:peer': 'npm ls >/dev/null'}};
|
|
1314
|
-
}
|
|
1315
|
-
|
|
1316
1350
|
function scaffoldDocumentation ({projectTypeResults, packageManager}) {
|
|
1317
1351
|
return {
|
|
1318
1352
|
toc: `Run \`${buildDocumentationCommand(packageManager)}\` to generate a table of contents`,
|