@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.js
CHANGED
|
@@ -265,6 +265,10 @@ var codeStylePlugin = /*#__PURE__*/Object.freeze({
|
|
|
265
265
|
test: tester$3
|
|
266
266
|
});
|
|
267
267
|
|
|
268
|
+
async function write$1 ({projectRoot, config}) {
|
|
269
|
+
await node_fs.promises.writeFile(`${projectRoot}/.npmrc`, ini.stringify(config));
|
|
270
|
+
}
|
|
271
|
+
|
|
268
272
|
function projectWillNotBeConsumed(projectType) {
|
|
269
273
|
return javascriptCore.projectTypes.APPLICATION === projectType || javascriptCore.projectTypes.CLI === projectType;
|
|
270
274
|
}
|
|
@@ -274,9 +278,9 @@ async function scaffoldNpmConfig ({
|
|
|
274
278
|
projectType,
|
|
275
279
|
registries
|
|
276
280
|
}) {
|
|
277
|
-
await
|
|
278
|
-
|
|
279
|
-
|
|
281
|
+
await write$1({
|
|
282
|
+
projectRoot,
|
|
283
|
+
config: {
|
|
280
284
|
'update-notifier': false,
|
|
281
285
|
...projectWillNotBeConsumed(projectType) && {'save-exact': true},
|
|
282
286
|
...Object.fromEntries(Object.entries(registries)
|
|
@@ -286,8 +290,8 @@ async function scaffoldNpmConfig ({
|
|
|
286
290
|
|
|
287
291
|
return [`@${scope}:registry`, url];
|
|
288
292
|
}))
|
|
289
|
-
}
|
|
290
|
-
);
|
|
293
|
+
}
|
|
294
|
+
});
|
|
291
295
|
|
|
292
296
|
return {scripts: {'lint:peer': 'npm ls >/dev/null'}};
|
|
293
297
|
}
|
|
@@ -477,12 +481,12 @@ function determinePathToTemplateFile (fileName) {
|
|
|
477
481
|
|
|
478
482
|
const defaultBuildDirectory$2 = 'lib';
|
|
479
483
|
|
|
480
|
-
async function createExample(projectRoot, projectName) {
|
|
484
|
+
async function createExample(projectRoot, projectName, dialect) {
|
|
481
485
|
return fs.promises.writeFile(
|
|
482
486
|
`${projectRoot}/example.js`,
|
|
483
487
|
mustache__default["default"].render(
|
|
484
488
|
await fs.promises.readFile(determinePathToTemplateFile('example.mustache'), 'utf8'),
|
|
485
|
-
{projectName: camelcase__default["default"](projectName)}
|
|
489
|
+
{projectName: camelcase__default["default"](projectName), esm: dialect === javascriptCore.dialects.ESM}
|
|
486
490
|
)
|
|
487
491
|
);
|
|
488
492
|
}
|
|
@@ -513,7 +517,7 @@ async function buildDetails ({
|
|
|
513
517
|
const pathToCreatedSrcDirectory = await mkdir__default["default"](`${projectRoot}/src`);
|
|
514
518
|
const [bundlerResults] = await Promise.all([
|
|
515
519
|
scaffoldBundler({bundlers: packageBundlers, projectRoot, dialect, decisions, projectType: javascriptCore.projectTypes.PACKAGE}),
|
|
516
|
-
provideExample ? await createExample(projectRoot, projectName) : Promise.resolve,
|
|
520
|
+
provideExample ? await createExample(projectRoot, projectName, dialect) : Promise.resolve,
|
|
517
521
|
touch__default["default"](`${pathToCreatedSrcDirectory}/index.js`)
|
|
518
522
|
]);
|
|
519
523
|
|