@form8ion/javascript 13.0.0-alpha.2 → 13.0.0-alpha.3
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 -27
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +12 -27
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
package/lib/index.mjs
CHANGED
|
@@ -2,8 +2,8 @@ import { questionNames as questionNames$2, questions } from '@travi/language-sca
|
|
|
2
2
|
import deepmerge from 'deepmerge';
|
|
3
3
|
import { fileTypes, fileExists, optionsSchemas, validateOptions, applyEnhancers, writeConfigFile } from '@form8ion/core';
|
|
4
4
|
import { scaffoldChoice, projectTypes as projectTypes$1, packageManagers as packageManagers$1, mergeIntoExistingPackageJson, dialects as dialects$1, writePackageJson, DEV_DEPENDENCY_TYPE, PROD_DEPENDENCY_TYPE } from '@form8ion/javascript-core';
|
|
5
|
-
import joi from 'joi';
|
|
6
5
|
import { prompt as prompt$1, Separator } from '@form8ion/overridable-prompts';
|
|
6
|
+
import joi from 'joi';
|
|
7
7
|
import { scaffold, lift as lift$3 } from '@form8ion/codecov';
|
|
8
8
|
import { write as write$2 } from '@form8ion/config-file';
|
|
9
9
|
import { info, warn, error } from '@travi/cli-messages';
|
|
@@ -127,8 +127,6 @@ var coveragePlugin = /*#__PURE__*/Object.freeze({
|
|
|
127
127
|
test: tester$4
|
|
128
128
|
});
|
|
129
129
|
|
|
130
|
-
const unitTestFrameworksSchema = joi.object().pattern(/^/, optionsSchemas.form8ionPlugin).default({});
|
|
131
|
-
|
|
132
130
|
async function chooseFramework ({frameworks, decisions}) {
|
|
133
131
|
if (!Object.keys(frameworks).length) return 'Other';
|
|
134
132
|
|
|
@@ -142,8 +140,10 @@ async function chooseFramework ({frameworks, decisions}) {
|
|
|
142
140
|
return answers[questionNames$1.UNIT_TEST_FRAMEWORK];
|
|
143
141
|
}
|
|
144
142
|
|
|
143
|
+
const pluginsSchema = joi.object().pattern(/^/, optionsSchemas.form8ionPlugin).default({});
|
|
144
|
+
|
|
145
145
|
async function scaffoldUnitTesting ({projectRoot, frameworks, decisions, visibility, vcs, pathWithinParent, dialect}) {
|
|
146
|
-
const validatedFrameworks = validateOptions(
|
|
146
|
+
const validatedFrameworks = validateOptions(pluginsSchema, frameworks);
|
|
147
147
|
const [framework, coverage] = await Promise.all([
|
|
148
148
|
chooseFramework({frameworks: validatedFrameworks, decisions})
|
|
149
149
|
.then(chosenFramework => scaffoldChoice(validatedFrameworks, chosenFramework, {projectRoot, dialect})),
|
|
@@ -1162,16 +1162,6 @@ async function lift ({projectRoot, vcs, results, pathWithinParent, enhancers = {
|
|
|
1162
1162
|
return enhancerResults;
|
|
1163
1163
|
}
|
|
1164
1164
|
|
|
1165
|
-
const pluginMapSchema = joi.object().pattern(joi.string(), optionsSchemas.form8ionPlugin);
|
|
1166
|
-
|
|
1167
|
-
const packageBundlersSchema = pluginMapSchema.default({});
|
|
1168
|
-
|
|
1169
|
-
const applicationTypesSchema = pluginMapSchema.default({});
|
|
1170
|
-
|
|
1171
|
-
const packageTypesSchema = pluginMapSchema.default({});
|
|
1172
|
-
|
|
1173
|
-
const monorepoTypesSchema = pluginMapSchema.default({});
|
|
1174
|
-
|
|
1175
1165
|
function validate(options) {
|
|
1176
1166
|
const schema = joi.object().required()
|
|
1177
1167
|
.keys({
|
|
@@ -1212,19 +1202,14 @@ function validate(options) {
|
|
|
1212
1202
|
private: joi.boolean()
|
|
1213
1203
|
})).default({})
|
|
1214
1204
|
})
|
|
1215
|
-
.keys({
|
|
1216
|
-
hosts: joi.object().pattern(/^/, joi.object({
|
|
1217
|
-
scaffolder: joi.func().arity(1).required(),
|
|
1218
|
-
projectTypes: joi.array().items(joi.string().valid('static', 'node')).default([])
|
|
1219
|
-
})).default({})
|
|
1220
|
-
})
|
|
1221
1205
|
.keys({
|
|
1222
1206
|
plugins: {
|
|
1223
|
-
unitTestFrameworks:
|
|
1224
|
-
packageBundlers:
|
|
1225
|
-
applicationTypes:
|
|
1226
|
-
packageTypes:
|
|
1227
|
-
monorepoTypes:
|
|
1207
|
+
unitTestFrameworks: pluginsSchema,
|
|
1208
|
+
packageBundlers: pluginsSchema,
|
|
1209
|
+
applicationTypes: pluginsSchema,
|
|
1210
|
+
packageTypes: pluginsSchema,
|
|
1211
|
+
monorepoTypes: pluginsSchema,
|
|
1212
|
+
hosts: pluginsSchema
|
|
1228
1213
|
}
|
|
1229
1214
|
})
|
|
1230
1215
|
.keys({
|
|
@@ -1660,7 +1645,6 @@ async function scaffolder (options) {
|
|
|
1660
1645
|
description,
|
|
1661
1646
|
configs,
|
|
1662
1647
|
ciServices,
|
|
1663
|
-
hosts,
|
|
1664
1648
|
decisions,
|
|
1665
1649
|
pathWithinParent,
|
|
1666
1650
|
registries,
|
|
@@ -1669,7 +1653,8 @@ async function scaffolder (options) {
|
|
|
1669
1653
|
packageTypes,
|
|
1670
1654
|
monorepoTypes,
|
|
1671
1655
|
packageBundlers,
|
|
1672
|
-
unitTestFrameworks
|
|
1656
|
+
unitTestFrameworks,
|
|
1657
|
+
hosts
|
|
1673
1658
|
}
|
|
1674
1659
|
} = validate(options);
|
|
1675
1660
|
|