@form8ion/javascript 12.5.0 → 12.6.1
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 +12 -8
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +17 -13
- package/lib/index.mjs.map +1 -1
- package/package.json +22 -22
- package/templates/example.mustache +1 -1
package/lib/index.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { scaffoldChoice, projectTypes as projectTypes$1, packageManagers as pack
|
|
|
5
5
|
import joi from 'joi';
|
|
6
6
|
import { prompt as prompt$1, Separator } from '@form8ion/overridable-prompts';
|
|
7
7
|
import { scaffold, lift as lift$3 } from '@form8ion/codecov';
|
|
8
|
-
import { write as write$
|
|
8
|
+
import { write as write$2 } from '@form8ion/config-file';
|
|
9
9
|
import { info, warn, error } from '@travi/cli-messages';
|
|
10
10
|
import * as commitConventionPlugin from '@form8ion/commit-convention';
|
|
11
11
|
import { scaffold as scaffold$4 } from '@form8ion/commit-convention';
|
|
@@ -48,7 +48,7 @@ const questionNames$1 = {
|
|
|
48
48
|
};
|
|
49
49
|
|
|
50
50
|
async function scaffoldC8 ({projectRoot}) {
|
|
51
|
-
await write$
|
|
51
|
+
await write$2({
|
|
52
52
|
name: 'c8',
|
|
53
53
|
format: fileTypes.JSON,
|
|
54
54
|
path: projectRoot,
|
|
@@ -160,7 +160,7 @@ async function scaffoldUnitTesting ({projectRoot, frameworks, decisions, visibil
|
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
async function scaffoldRemark ({config, projectRoot, projectType, vcs}) {
|
|
163
|
-
await write$
|
|
163
|
+
await write$2({
|
|
164
164
|
format: fileTypes.JSON,
|
|
165
165
|
path: projectRoot,
|
|
166
166
|
name: 'remark',
|
|
@@ -229,6 +229,10 @@ var codeStylePlugin = /*#__PURE__*/Object.freeze({
|
|
|
229
229
|
test: tester$3
|
|
230
230
|
});
|
|
231
231
|
|
|
232
|
+
async function write$1 ({projectRoot, config}) {
|
|
233
|
+
await promises$1.writeFile(`${projectRoot}/.npmrc`, stringify(config));
|
|
234
|
+
}
|
|
235
|
+
|
|
232
236
|
function projectWillNotBeConsumed(projectType) {
|
|
233
237
|
return projectTypes$1.APPLICATION === projectType || projectTypes$1.CLI === projectType;
|
|
234
238
|
}
|
|
@@ -238,9 +242,9 @@ async function scaffoldNpmConfig ({
|
|
|
238
242
|
projectType,
|
|
239
243
|
registries
|
|
240
244
|
}) {
|
|
241
|
-
await
|
|
242
|
-
|
|
243
|
-
|
|
245
|
+
await write$1({
|
|
246
|
+
projectRoot,
|
|
247
|
+
config: {
|
|
244
248
|
'update-notifier': false,
|
|
245
249
|
...projectWillNotBeConsumed(projectType) && {'save-exact': true},
|
|
246
250
|
...Object.fromEntries(Object.entries(registries)
|
|
@@ -250,8 +254,8 @@ async function scaffoldNpmConfig ({
|
|
|
250
254
|
|
|
251
255
|
return [`@${scope}:registry`, url];
|
|
252
256
|
}))
|
|
253
|
-
}
|
|
254
|
-
);
|
|
257
|
+
}
|
|
258
|
+
});
|
|
255
259
|
|
|
256
260
|
return {scripts: {'lint:peer': 'npm ls >/dev/null'}};
|
|
257
261
|
}
|
|
@@ -441,12 +445,12 @@ function determinePathToTemplateFile (fileName) {
|
|
|
441
445
|
|
|
442
446
|
const defaultBuildDirectory$2 = 'lib';
|
|
443
447
|
|
|
444
|
-
async function createExample(projectRoot, projectName) {
|
|
448
|
+
async function createExample(projectRoot, projectName, dialect) {
|
|
445
449
|
return promises.writeFile(
|
|
446
450
|
`${projectRoot}/example.js`,
|
|
447
451
|
mustache.render(
|
|
448
452
|
await promises.readFile(determinePathToTemplateFile('example.mustache'), 'utf8'),
|
|
449
|
-
{projectName: camelcase(projectName)}
|
|
453
|
+
{projectName: camelcase(projectName), esm: dialect === dialects$1.ESM}
|
|
450
454
|
)
|
|
451
455
|
);
|
|
452
456
|
}
|
|
@@ -477,7 +481,7 @@ async function buildDetails ({
|
|
|
477
481
|
const pathToCreatedSrcDirectory = await mkdir(`${projectRoot}/src`);
|
|
478
482
|
const [bundlerResults] = await Promise.all([
|
|
479
483
|
scaffoldBundler({bundlers: packageBundlers, projectRoot, dialect, decisions, projectType: projectTypes$1.PACKAGE}),
|
|
480
|
-
provideExample ? await createExample(projectRoot, projectName) : Promise.resolve,
|
|
484
|
+
provideExample ? await createExample(projectRoot, projectName, dialect) : Promise.resolve,
|
|
481
485
|
touch(`${pathToCreatedSrcDirectory}/index.js`)
|
|
482
486
|
]);
|
|
483
487
|
|
|
@@ -774,7 +778,7 @@ var projectTypes = /*#__PURE__*/Object.freeze({
|
|
|
774
778
|
});
|
|
775
779
|
|
|
776
780
|
function write ({projectRoot, config}) {
|
|
777
|
-
return write$
|
|
781
|
+
return write$2({path: projectRoot, name: 'babel', format: fileTypes.JSON, config});
|
|
778
782
|
}
|
|
779
783
|
|
|
780
784
|
async function addIgnore ({projectRoot, ignore}) {
|
|
@@ -1604,7 +1608,7 @@ async function scaffoldLockfileLint ({projectRoot, packageManager, registries})
|
|
|
1604
1608
|
);
|
|
1605
1609
|
}
|
|
1606
1610
|
|
|
1607
|
-
await write$
|
|
1611
|
+
await write$2({
|
|
1608
1612
|
name: 'lockfile-lint',
|
|
1609
1613
|
format: fileTypes.JSON,
|
|
1610
1614
|
path: projectRoot,
|