@form8ion/javascript 11.5.5 → 11.6.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 +25 -28
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +25 -27
- package/lib/index.mjs.map +1 -1
- package/package.json +10 -10
package/lib/index.mjs
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { questionNames as questionNames$2, questions } from '@travi/language-scaffolder-prompts';
|
|
2
2
|
import deepmerge from 'deepmerge';
|
|
3
|
-
import {
|
|
3
|
+
import { fileTypes, fileExists, validateOptions, writeConfigFile, applyEnhancers } from '@form8ion/core';
|
|
4
|
+
import { scaffoldChoice, projectTypes as projectTypes$1, packageManagers, dialects as dialects$1, mergeIntoExistingPackageJson, writePackageJson, DEV_DEPENDENCY_TYPE, PROD_DEPENDENCY_TYPE } from '@form8ion/javascript-core';
|
|
4
5
|
import joi from 'joi';
|
|
5
6
|
import { prompt as prompt$1, Separator } from '@form8ion/overridable-prompts';
|
|
6
7
|
import { scaffold, lift as lift$3 } from '@form8ion/codecov';
|
|
7
8
|
import { write as write$1 } from '@form8ion/config-file';
|
|
8
|
-
import { fileTypes, fileExists, writeConfigFile, applyEnhancers } from '@form8ion/core';
|
|
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$5 } from '@form8ion/commit-convention';
|
|
12
|
-
import * as hoek from '@hapi/hoek';
|
|
13
12
|
import execa from '@form8ion/execa-wrapper';
|
|
14
13
|
import npmConf from 'npm-conf';
|
|
15
14
|
import { promises } from 'fs';
|
|
@@ -228,9 +227,7 @@ async function test({projectRoot}) {
|
|
|
228
227
|
return !!engines?.node;
|
|
229
228
|
}
|
|
230
229
|
|
|
231
|
-
async function lift$1({
|
|
232
|
-
const {name} = JSON.parse(await promises.readFile(`${projectRoot}/package.json`, 'utf8'));
|
|
233
|
-
|
|
230
|
+
async function lift$1({packageDetails: {name}}) {
|
|
234
231
|
return {
|
|
235
232
|
devDependencies: ['ls-engines'],
|
|
236
233
|
scripts: {'lint:engines': 'ls-engines'},
|
|
@@ -617,9 +614,9 @@ async function scaffoldProjectType ({
|
|
|
617
614
|
}
|
|
618
615
|
}
|
|
619
616
|
|
|
620
|
-
async function lifter$1 ({projectRoot}) {
|
|
621
|
-
if (await isPackage({projectRoot})) return liftPackage$1({projectRoot});
|
|
622
|
-
if (await isCli({projectRoot})) return liftCli({projectRoot});
|
|
617
|
+
async function lifter$1 ({projectRoot, packageDetails}) {
|
|
618
|
+
if (await isPackage({projectRoot})) return liftPackage$1({projectRoot, packageDetails});
|
|
619
|
+
if (await isCli({projectRoot})) return liftCli({projectRoot, packageDetails});
|
|
623
620
|
|
|
624
621
|
return {};
|
|
625
622
|
}
|
|
@@ -955,7 +952,10 @@ async function lift ({projectRoot, vcs, results}) {
|
|
|
955
952
|
packageManager: manager
|
|
956
953
|
} = results;
|
|
957
954
|
|
|
958
|
-
const packageManager = await
|
|
955
|
+
const [packageManager, packageContents] = await Promise.all([
|
|
956
|
+
resolvePackageManager({projectRoot, packageManager: manager}),
|
|
957
|
+
promises$1.readFile(`${projectRoot}/package.json`, 'utf8')
|
|
958
|
+
]);
|
|
959
959
|
|
|
960
960
|
const enhancerResults = await applyEnhancers({
|
|
961
961
|
results,
|
|
@@ -968,7 +968,7 @@ async function lift ({projectRoot, vcs, results}) {
|
|
|
968
968
|
codeStylePlugin,
|
|
969
969
|
projectTypes
|
|
970
970
|
],
|
|
971
|
-
options: {packageManager, projectRoot, vcs}
|
|
971
|
+
options: {packageManager, projectRoot, vcs, packageDetails: JSON.parse(packageContents)}
|
|
972
972
|
});
|
|
973
973
|
|
|
974
974
|
await liftPackage(
|
|
@@ -981,9 +981,16 @@ async function lift ({projectRoot, vcs, results}) {
|
|
|
981
981
|
return enhancerResults;
|
|
982
982
|
}
|
|
983
983
|
|
|
984
|
-
const
|
|
985
|
-
|
|
986
|
-
|
|
984
|
+
const pluginSchema = joi.object({scaffolder: joi.func().arity(1).required()});
|
|
985
|
+
const pluginMapSchema = joi.object().pattern(/^/, pluginSchema);
|
|
986
|
+
|
|
987
|
+
const packageBundlersSchema = pluginMapSchema.default({});
|
|
988
|
+
|
|
989
|
+
const applicationTypesSchema = pluginMapSchema.default({});
|
|
990
|
+
|
|
991
|
+
const packageTypesSchema = pluginMapSchema.default({});
|
|
992
|
+
|
|
993
|
+
const monorepoTypesSchema = pluginMapSchema.default({});
|
|
987
994
|
|
|
988
995
|
function validate(options) {
|
|
989
996
|
const schema = joi.object().required()
|
|
@@ -1042,15 +1049,9 @@ function validate(options) {
|
|
|
1042
1049
|
})).default({})
|
|
1043
1050
|
})
|
|
1044
1051
|
.keys({
|
|
1045
|
-
applicationTypes:
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
packageTypes: joi.object().pattern(/^/, joi.object({
|
|
1049
|
-
scaffolder: joi.func().arity(1).required()
|
|
1050
|
-
})).default({}),
|
|
1051
|
-
monorepoTypes: joi.object().pattern(/^/, joi.object({
|
|
1052
|
-
scaffolder: joi.func().arity(1).required()
|
|
1053
|
-
}))
|
|
1052
|
+
applicationTypes: applicationTypesSchema,
|
|
1053
|
+
packageTypes: packageTypesSchema,
|
|
1054
|
+
monorepoTypes: monorepoTypesSchema
|
|
1054
1055
|
})
|
|
1055
1056
|
.keys({
|
|
1056
1057
|
unitTestFrameworks: unitTestFrameworksSchema,
|
|
@@ -1060,11 +1061,8 @@ function validate(options) {
|
|
|
1060
1061
|
decisions: joi.object()
|
|
1061
1062
|
})
|
|
1062
1063
|
.keys({registries: joi.object().pattern(joi.string(), joi.string().uri()).default({})});
|
|
1063
|
-
const {error, value} = schema.validate(options);
|
|
1064
|
-
|
|
1065
|
-
hoek.assert(!error, error);
|
|
1066
1064
|
|
|
1067
|
-
return
|
|
1065
|
+
return validateOptions(schema, options);
|
|
1068
1066
|
}
|
|
1069
1067
|
|
|
1070
1068
|
function buildDialectChoices ({babelPreset, typescript}) {
|