@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.es.js CHANGED
@@ -20,8 +20,9 @@ import camelcase from 'camelcase';
20
20
  import makeDir from 'make-dir';
21
21
  import touch from 'touch';
22
22
  import { resolve } from 'path';
23
- import { test as test$2, lift as lift$3, scaffold as scaffold$3 } from '@form8ion/husky';
24
- import { lift as lift$4, scaffold as scaffold$2 } from '@form8ion/eslint';
23
+ import * as huskyPlugin from '@form8ion/husky';
24
+ import { scaffold as scaffold$3 } from '@form8ion/husky';
25
+ import { lift as lift$3, scaffold as scaffold$2 } from '@form8ion/eslint';
25
26
 
26
27
  function ownKeys(object, enumerableOnly) {
27
28
  var keys = Object.keys(object);
@@ -122,17 +123,29 @@ function nycIsConfigured ({
122
123
  return fileExists(`${projectRoot}/.nycrc`);
123
124
  }
124
125
 
126
+ async function removeDependencies ({
127
+ packageManager,
128
+ dependencies
129
+ }) {
130
+ await execa(packageManager, ['remove', ...dependencies]);
131
+ }
132
+
125
133
  async function removeNyc ({
126
- projectRoot
134
+ projectRoot,
135
+ packageManager
127
136
  }) {
128
137
  await Promise.all([promises.unlink(`${projectRoot}/.nycrc`), promises.rmdir(`${projectRoot}/.nyc_output`, {
129
138
  recursive: true,
130
139
  force: true
140
+ }), removeDependencies({
141
+ packageManager,
142
+ dependencies: ['nyc', '@istanbuljs/nyc-config-babel']
131
143
  })]);
132
144
  }
133
145
 
134
146
  async function lift$2({
135
- projectRoot
147
+ projectRoot,
148
+ packageManager
136
149
  }) {
137
150
  if (await nycIsConfigured({
138
151
  projectRoot
@@ -140,7 +153,8 @@ async function lift$2({
140
153
  const [c8Results] = await Promise.all([scaffoldC8({
141
154
  projectRoot
142
155
  }), removeNyc({
143
- projectRoot
156
+ projectRoot,
157
+ packageManager
144
158
  })]);
145
159
  return c8Results;
146
160
  }
@@ -203,18 +217,15 @@ async function scaffoldUnitTesting ({
203
217
  async function applyEnhancers ({
204
218
  results,
205
219
  enhancers = {},
206
- projectRoot
220
+ options
207
221
  }) {
208
222
  info('Applying Enhancers');
209
223
  return Object.values(enhancers).reduce(async (acc, enhancer) => {
210
- if (await enhancer.test({
211
- projectRoot
212
- })) {
224
+ if (await enhancer.test(options)) {
213
225
  const previousResults = await acc;
214
- return deepmerge(previousResults, await enhancer.lift({
215
- results: previousResults,
216
- projectRoot
217
- }));
226
+ return deepmerge(previousResults, await enhancer.lift(_objectSpread2({
227
+ results: previousResults
228
+ }, options)));
218
229
  }
219
230
 
220
231
  return acc;
@@ -257,20 +268,6 @@ var enginesEnhancer = /*#__PURE__*/Object.freeze({
257
268
  lift: lift$1
258
269
  });
259
270
 
260
- function enhanceHuskyEnhancer(packageManager) {
261
- return {
262
- test: test$2,
263
- lift: ({
264
- projectRoot,
265
- results
266
- }) => lift$3({
267
- projectRoot,
268
- results,
269
- packageManager
270
- })
271
- };
272
- }
273
-
274
271
  async function liftPackage ({
275
272
  projectRoot,
276
273
  scripts,
@@ -331,14 +328,17 @@ async function lift ({
331
328
  projectRoot,
332
329
  packageManager: manager
333
330
  });
334
- const eslintResults = await lift$4({
331
+ const eslintResults = await lift$3({
335
332
  projectRoot,
336
333
  configs: eslintConfigs
337
334
  });
338
335
  const enhancerResults = await applyEnhancers({
339
336
  results,
340
- enhancers: [enhanceHuskyEnhancer(packageManager), enginesEnhancer, coveragePlugin],
341
- projectRoot
337
+ enhancers: [huskyPlugin, enginesEnhancer, coveragePlugin],
338
+ options: {
339
+ packageManager,
340
+ projectRoot
341
+ }
342
342
  });
343
343
  await liftPackage(deepmerge.all([{
344
344
  projectRoot,