@form8ion/javascript 3.1.0-alpha.2 → 3.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/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,9 +153,17 @@ 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
- return c8Results;
159
+ return deepmerge.all([c8Results, {
160
+ scripts: {
161
+ 'test:unit': 'cross-env NODE_ENV=test c8 run-s test:unit:base'
162
+ },
163
+ nextSteps: [{
164
+ summary: 'Remove use of `@istanbuljs/nyc-config-babel` from your babel config, if present,' + ' after the migration away from `nyc`'
165
+ }]
166
+ }]);
146
167
  }
147
168
 
148
169
  return {};
@@ -203,18 +224,15 @@ async function scaffoldUnitTesting ({
203
224
  async function applyEnhancers ({
204
225
  results,
205
226
  enhancers = {},
206
- projectRoot
227
+ options
207
228
  }) {
208
229
  info('Applying Enhancers');
209
230
  return Object.values(enhancers).reduce(async (acc, enhancer) => {
210
- if (await enhancer.test({
211
- projectRoot
212
- })) {
231
+ if (await enhancer.test(options)) {
213
232
  const previousResults = await acc;
214
- return deepmerge(previousResults, await enhancer.lift({
215
- results: previousResults,
216
- projectRoot
217
- }));
233
+ return deepmerge(previousResults, await enhancer.lift(_objectSpread2({
234
+ results: previousResults
235
+ }, options)));
218
236
  }
219
237
 
220
238
  return acc;
@@ -257,20 +275,6 @@ var enginesEnhancer = /*#__PURE__*/Object.freeze({
257
275
  lift: lift$1
258
276
  });
259
277
 
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
278
  async function liftPackage ({
275
279
  projectRoot,
276
280
  scripts,
@@ -331,14 +335,17 @@ async function lift ({
331
335
  projectRoot,
332
336
  packageManager: manager
333
337
  });
334
- const eslintResults = await lift$4({
338
+ const eslintResults = await lift$3({
335
339
  projectRoot,
336
340
  configs: eslintConfigs
337
341
  });
338
342
  const enhancerResults = await applyEnhancers({
339
343
  results,
340
- enhancers: [enhanceHuskyEnhancer(packageManager), enginesEnhancer, coveragePlugin],
341
- projectRoot
344
+ enhancers: [huskyPlugin, enginesEnhancer, coveragePlugin],
345
+ options: {
346
+ packageManager,
347
+ projectRoot
348
+ }
342
349
  });
343
350
  await liftPackage(deepmerge.all([{
344
351
  projectRoot,