@form8ion/javascript 8.0.0 → 8.1.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 +1 -1
- package/example.js +1 -1
- package/lib/index.js +31 -30
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +30 -30
- package/lib/index.mjs.map +1 -1
- package/package.json +7 -6
package/lib/index.mjs
CHANGED
|
@@ -27,6 +27,7 @@ import * as huskyPlugin from '@form8ion/husky';
|
|
|
27
27
|
import { scaffold as scaffold$4 } from '@form8ion/husky';
|
|
28
28
|
import { scaffold as scaffold$2 } from '@form8ion/prettier';
|
|
29
29
|
import { scaffold as scaffold$1, lift as lift$4, test as test$2 } from '@form8ion/eslint';
|
|
30
|
+
import sortObjectKeys from 'sort-object-keys';
|
|
30
31
|
|
|
31
32
|
const questionNames$1 = {
|
|
32
33
|
UNIT_TEST_FRAMEWORK: 'unitTestFramework',
|
|
@@ -284,7 +285,6 @@ function predicate ({projectRoot}) {
|
|
|
284
285
|
}
|
|
285
286
|
|
|
286
287
|
async function scaffoldTypescript ({config, projectType, projectRoot, testFilenamePattern}) {
|
|
287
|
-
const eslintConfigs = ['typescript'];
|
|
288
288
|
const shareableTsConfigPackage = `${config.scope}/tsconfig`;
|
|
289
289
|
|
|
290
290
|
await writeConfigFile({
|
|
@@ -307,8 +307,7 @@ async function scaffoldTypescript ({config, projectType, projectRoot, testFilena
|
|
|
307
307
|
});
|
|
308
308
|
|
|
309
309
|
return {
|
|
310
|
-
eslint: {configs:
|
|
311
|
-
eslintConfigs,
|
|
310
|
+
eslint: {configs: ['typescript']},
|
|
312
311
|
devDependencies: ['typescript', shareableTsConfigPackage],
|
|
313
312
|
vcsIgnore: {files: ['tsconfig.tsbuildinfo']}
|
|
314
313
|
};
|
|
@@ -425,6 +424,13 @@ async function scaffoldPackage ({
|
|
|
425
424
|
return {homepage: packageData.homepage};
|
|
426
425
|
}
|
|
427
426
|
|
|
427
|
+
function sortPackageProperties (packageContents) {
|
|
428
|
+
return sortObjectKeys(
|
|
429
|
+
packageContents,
|
|
430
|
+
['name', 'keywords', 'engines', 'scripts', 'dependencies', 'devDependencies', 'peerDependencies']
|
|
431
|
+
);
|
|
432
|
+
}
|
|
433
|
+
|
|
428
434
|
const details = {
|
|
429
435
|
[packageManagers.NPM]: {
|
|
430
436
|
installationCommand: 'install',
|
|
@@ -488,13 +494,13 @@ async function liftPackage ({
|
|
|
488
494
|
|
|
489
495
|
await writePackageJson({
|
|
490
496
|
projectRoot,
|
|
491
|
-
config: {
|
|
497
|
+
config: sortPackageProperties({
|
|
492
498
|
...existingPackageJsonContents,
|
|
493
499
|
scripts: liftScripts({existingScripts: existingPackageJsonContents.scripts, scripts}),
|
|
494
500
|
...tags && {
|
|
495
501
|
keywords: existingPackageJsonContents.keywords ? [...existingPackageJsonContents.keywords, ...tags] : tags
|
|
496
502
|
}
|
|
497
|
-
}
|
|
503
|
+
})
|
|
498
504
|
});
|
|
499
505
|
}
|
|
500
506
|
|
|
@@ -1125,7 +1131,6 @@ async function scaffoldPackageType ({
|
|
|
1125
1131
|
return deepmerge.all([
|
|
1126
1132
|
{
|
|
1127
1133
|
documentation: scaffoldPackageDocumentation({packageName, visibility, scope, packageManager}),
|
|
1128
|
-
eslintConfigs: [],
|
|
1129
1134
|
nextSteps: [
|
|
1130
1135
|
{summary: 'Add the appropriate `save` flag to the installation instructions in the README'},
|
|
1131
1136
|
{summary: 'Publish pre-release versions to npm until package is stable enough to publish v1.0.0'}
|
|
@@ -1156,7 +1161,6 @@ async function scaffoldApplicationType ({projectRoot}) {
|
|
|
1156
1161
|
devDependencies: ['rimraf'],
|
|
1157
1162
|
vcsIgnore: {files: ['.env'], directories: [`/${buildDirectory}/`]},
|
|
1158
1163
|
buildDirectory,
|
|
1159
|
-
eslintConfigs: [],
|
|
1160
1164
|
nextSteps: []
|
|
1161
1165
|
};
|
|
1162
1166
|
}
|
|
@@ -1167,7 +1171,6 @@ async function scaffoldMonorepoType ({projectRoot}) {
|
|
|
1167
1171
|
await mergeIntoExistingPackageJson({projectRoot, config: {private: true}});
|
|
1168
1172
|
|
|
1169
1173
|
return {
|
|
1170
|
-
eslintConfigs: [],
|
|
1171
1174
|
nextSteps: [{
|
|
1172
1175
|
summary: 'Add packages to your new monorepo',
|
|
1173
1176
|
description: 'Leverage [@form8ion/add-package-to-monorepo](https://npm.im/@form8ion/add-package-to-monorepo)'
|
|
@@ -1208,7 +1211,6 @@ async function scaffoldCliType ({packageName, visibility, projectRoot, dialect,
|
|
|
1208
1211
|
vcsIgnore: {files: [], directories: [`/${defaultBuildDirectory}/`]},
|
|
1209
1212
|
buildDirectory: defaultBuildDirectory,
|
|
1210
1213
|
badges: defineBadges(packageName, visibility),
|
|
1211
|
-
eslintConfigs: [],
|
|
1212
1214
|
nextSteps: []
|
|
1213
1215
|
}
|
|
1214
1216
|
);
|
|
@@ -1250,9 +1252,7 @@ async function scaffoldProjectType ({
|
|
|
1250
1252
|
case projectTypes.MONOREPO:
|
|
1251
1253
|
return scaffoldMonorepoType({projectRoot});
|
|
1252
1254
|
case 'Other':
|
|
1253
|
-
return {
|
|
1254
|
-
eslintConfigs: []
|
|
1255
|
-
};
|
|
1255
|
+
return {};
|
|
1256
1256
|
default:
|
|
1257
1257
|
throw new Error(`The project-type of ${projectType} is invalid`);
|
|
1258
1258
|
}
|
|
@@ -1493,7 +1493,7 @@ async function scaffolder (options) {
|
|
|
1493
1493
|
decisions,
|
|
1494
1494
|
pathWithinParent
|
|
1495
1495
|
});
|
|
1496
|
-
const [nodeVersion, npmResults, dialectResults, codeStyleResults
|
|
1496
|
+
const [nodeVersion, npmResults, dialectResults, codeStyleResults] = await Promise.all([
|
|
1497
1497
|
scaffoldNodeVersion({projectRoot, nodeVersionCategory}),
|
|
1498
1498
|
scaffoldNpmConfig({projectType, projectRoot, registries}),
|
|
1499
1499
|
scaffoldDialect({
|
|
@@ -1503,24 +1503,24 @@ async function scaffolder (options) {
|
|
|
1503
1503
|
projectType,
|
|
1504
1504
|
testFilenamePattern: verificationResults.testFilenamePattern
|
|
1505
1505
|
}),
|
|
1506
|
-
scaffoldCodeStyle({projectRoot, projectType, dialect, configs, vcs, configureLinting})
|
|
1507
|
-
scaffoldProjectTypePlugin({
|
|
1508
|
-
projectRoot,
|
|
1509
|
-
projectType,
|
|
1510
|
-
projectName,
|
|
1511
|
-
packageName,
|
|
1512
|
-
packageManager,
|
|
1513
|
-
scope,
|
|
1514
|
-
dialect,
|
|
1515
|
-
tests,
|
|
1516
|
-
decisions,
|
|
1517
|
-
plugins: {
|
|
1518
|
-
[projectTypes.PACKAGE]: packageTypes,
|
|
1519
|
-
[projectTypes.APPLICATION]: applicationTypes,
|
|
1520
|
-
[projectTypes.MONOREPO]: monorepoTypes
|
|
1521
|
-
}
|
|
1522
|
-
})
|
|
1506
|
+
scaffoldCodeStyle({projectRoot, projectType, dialect, configs, vcs, configureLinting})
|
|
1523
1507
|
]);
|
|
1508
|
+
const projectTypePluginResults = await scaffoldProjectTypePlugin({
|
|
1509
|
+
projectRoot,
|
|
1510
|
+
projectType,
|
|
1511
|
+
projectName,
|
|
1512
|
+
packageName,
|
|
1513
|
+
packageManager,
|
|
1514
|
+
scope,
|
|
1515
|
+
dialect,
|
|
1516
|
+
tests,
|
|
1517
|
+
decisions,
|
|
1518
|
+
plugins: {
|
|
1519
|
+
[projectTypes.PACKAGE]: packageTypes,
|
|
1520
|
+
[projectTypes.APPLICATION]: applicationTypes,
|
|
1521
|
+
[projectTypes.MONOREPO]: monorepoTypes
|
|
1522
|
+
}
|
|
1523
|
+
});
|
|
1524
1524
|
const mergedContributions = deepmerge.all([
|
|
1525
1525
|
...(await Promise.all([
|
|
1526
1526
|
scaffoldChoice(
|