@form8ion/javascript 3.1.0-alpha.2 → 3.1.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.cjs.js +29 -29
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.es.js +30 -30
- package/lib/index.es.js.map +1 -1
- package/package.json +1 -1
package/lib/index.cjs.js
CHANGED
|
@@ -24,7 +24,7 @@ var camelcase = require('camelcase');
|
|
|
24
24
|
var makeDir = require('make-dir');
|
|
25
25
|
var touch = require('touch');
|
|
26
26
|
var path = require('path');
|
|
27
|
-
var
|
|
27
|
+
var huskyPlugin = require('@form8ion/husky');
|
|
28
28
|
var eslint = require('@form8ion/eslint');
|
|
29
29
|
|
|
30
30
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -56,6 +56,7 @@ var mustache__default = /*#__PURE__*/_interopDefaultLegacy(mustache);
|
|
|
56
56
|
var camelcase__default = /*#__PURE__*/_interopDefaultLegacy(camelcase);
|
|
57
57
|
var makeDir__default = /*#__PURE__*/_interopDefaultLegacy(makeDir);
|
|
58
58
|
var touch__default = /*#__PURE__*/_interopDefaultLegacy(touch);
|
|
59
|
+
var huskyPlugin__namespace = /*#__PURE__*/_interopNamespace(huskyPlugin);
|
|
59
60
|
|
|
60
61
|
function ownKeys(object, enumerableOnly) {
|
|
61
62
|
var keys = Object.keys(object);
|
|
@@ -156,17 +157,29 @@ function nycIsConfigured ({
|
|
|
156
157
|
return core.fileExists(`${projectRoot}/.nycrc`);
|
|
157
158
|
}
|
|
158
159
|
|
|
160
|
+
async function removeDependencies ({
|
|
161
|
+
packageManager,
|
|
162
|
+
dependencies
|
|
163
|
+
}) {
|
|
164
|
+
await execa__default["default"](packageManager, ['remove', ...dependencies]);
|
|
165
|
+
}
|
|
166
|
+
|
|
159
167
|
async function removeNyc ({
|
|
160
|
-
projectRoot
|
|
168
|
+
projectRoot,
|
|
169
|
+
packageManager
|
|
161
170
|
}) {
|
|
162
171
|
await Promise.all([fs.promises.unlink(`${projectRoot}/.nycrc`), fs.promises.rmdir(`${projectRoot}/.nyc_output`, {
|
|
163
172
|
recursive: true,
|
|
164
173
|
force: true
|
|
174
|
+
}), removeDependencies({
|
|
175
|
+
packageManager,
|
|
176
|
+
dependencies: ['nyc', '@istanbuljs/nyc-config-babel']
|
|
165
177
|
})]);
|
|
166
178
|
}
|
|
167
179
|
|
|
168
180
|
async function lift$2({
|
|
169
|
-
projectRoot
|
|
181
|
+
projectRoot,
|
|
182
|
+
packageManager
|
|
170
183
|
}) {
|
|
171
184
|
if (await nycIsConfigured({
|
|
172
185
|
projectRoot
|
|
@@ -174,7 +187,8 @@ async function lift$2({
|
|
|
174
187
|
const [c8Results] = await Promise.all([scaffoldC8({
|
|
175
188
|
projectRoot
|
|
176
189
|
}), removeNyc({
|
|
177
|
-
projectRoot
|
|
190
|
+
projectRoot,
|
|
191
|
+
packageManager
|
|
178
192
|
})]);
|
|
179
193
|
return c8Results;
|
|
180
194
|
}
|
|
@@ -237,18 +251,15 @@ async function scaffoldUnitTesting ({
|
|
|
237
251
|
async function applyEnhancers ({
|
|
238
252
|
results,
|
|
239
253
|
enhancers = {},
|
|
240
|
-
|
|
254
|
+
options
|
|
241
255
|
}) {
|
|
242
256
|
cliMessages.info('Applying Enhancers');
|
|
243
257
|
return Object.values(enhancers).reduce(async (acc, enhancer) => {
|
|
244
|
-
if (await enhancer.test({
|
|
245
|
-
projectRoot
|
|
246
|
-
})) {
|
|
258
|
+
if (await enhancer.test(options)) {
|
|
247
259
|
const previousResults = await acc;
|
|
248
|
-
return deepmerge__default["default"](previousResults, await enhancer.lift({
|
|
249
|
-
results: previousResults
|
|
250
|
-
|
|
251
|
-
}));
|
|
260
|
+
return deepmerge__default["default"](previousResults, await enhancer.lift(_objectSpread2({
|
|
261
|
+
results: previousResults
|
|
262
|
+
}, options)));
|
|
252
263
|
}
|
|
253
264
|
|
|
254
265
|
return acc;
|
|
@@ -291,20 +302,6 @@ var enginesEnhancer = /*#__PURE__*/Object.freeze({
|
|
|
291
302
|
lift: lift$1
|
|
292
303
|
});
|
|
293
304
|
|
|
294
|
-
function enhanceHuskyEnhancer(packageManager) {
|
|
295
|
-
return {
|
|
296
|
-
test: husky.test,
|
|
297
|
-
lift: ({
|
|
298
|
-
projectRoot,
|
|
299
|
-
results
|
|
300
|
-
}) => husky.lift({
|
|
301
|
-
projectRoot,
|
|
302
|
-
results,
|
|
303
|
-
packageManager
|
|
304
|
-
})
|
|
305
|
-
};
|
|
306
|
-
}
|
|
307
|
-
|
|
308
305
|
async function liftPackage ({
|
|
309
306
|
projectRoot,
|
|
310
307
|
scripts,
|
|
@@ -371,8 +368,11 @@ async function lift ({
|
|
|
371
368
|
});
|
|
372
369
|
const enhancerResults = await applyEnhancers({
|
|
373
370
|
results,
|
|
374
|
-
enhancers: [
|
|
375
|
-
|
|
371
|
+
enhancers: [huskyPlugin__namespace, enginesEnhancer, coveragePlugin],
|
|
372
|
+
options: {
|
|
373
|
+
packageManager,
|
|
374
|
+
projectRoot
|
|
375
|
+
}
|
|
376
376
|
});
|
|
377
377
|
await liftPackage(deepmerge__default["default"].all([{
|
|
378
378
|
projectRoot,
|
|
@@ -1524,7 +1524,7 @@ async function scaffoldVerification({
|
|
|
1524
1524
|
decisions,
|
|
1525
1525
|
dialect,
|
|
1526
1526
|
pathWithinParent
|
|
1527
|
-
}),
|
|
1527
|
+
}), huskyPlugin.scaffold({
|
|
1528
1528
|
projectRoot,
|
|
1529
1529
|
packageManager
|
|
1530
1530
|
})]);
|