@form8ion/javascript 3.1.0-alpha.1 → 3.1.0-alpha.5

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,14 +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
- await promises.unlink(`${projectRoot}/.nycrc`);
137
+ await Promise.all([promises.unlink(`${projectRoot}/.nycrc`), promises.rmdir(`${projectRoot}/.nyc_output`, {
138
+ recursive: true,
139
+ force: true
140
+ }), removeDependencies({
141
+ packageManager,
142
+ dependencies: ['nyc', '@istanbuljs/nyc-config-babel']
143
+ })]);
129
144
  }
130
145
 
131
146
  async function lift$2({
132
- projectRoot
147
+ projectRoot,
148
+ packageManager
133
149
  }) {
134
150
  if (await nycIsConfigured({
135
151
  projectRoot
@@ -137,9 +153,17 @@ async function lift$2({
137
153
  const [c8Results] = await Promise.all([scaffoldC8({
138
154
  projectRoot
139
155
  }), removeNyc({
140
- projectRoot
156
+ projectRoot,
157
+ packageManager
141
158
  })]);
142
- 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
+ }]);
143
167
  }
144
168
 
145
169
  return {};
@@ -200,18 +224,15 @@ async function scaffoldUnitTesting ({
200
224
  async function applyEnhancers ({
201
225
  results,
202
226
  enhancers = {},
203
- projectRoot
227
+ options
204
228
  }) {
205
229
  info('Applying Enhancers');
206
230
  return Object.values(enhancers).reduce(async (acc, enhancer) => {
207
- if (await enhancer.test({
208
- projectRoot
209
- })) {
231
+ if (await enhancer.test(options)) {
210
232
  const previousResults = await acc;
211
- return deepmerge(previousResults, await enhancer.lift({
212
- results: previousResults,
213
- projectRoot
214
- }));
233
+ return deepmerge(previousResults, await enhancer.lift(_objectSpread2({
234
+ results: previousResults
235
+ }, options)));
215
236
  }
216
237
 
217
238
  return acc;
@@ -254,20 +275,6 @@ var enginesEnhancer = /*#__PURE__*/Object.freeze({
254
275
  lift: lift$1
255
276
  });
256
277
 
257
- function enhanceHuskyEnhancer(packageManager) {
258
- return {
259
- test: test$2,
260
- lift: ({
261
- projectRoot,
262
- results
263
- }) => lift$3({
264
- projectRoot,
265
- results,
266
- packageManager
267
- })
268
- };
269
- }
270
-
271
278
  async function liftPackage ({
272
279
  projectRoot,
273
280
  scripts,
@@ -328,14 +335,17 @@ async function lift ({
328
335
  projectRoot,
329
336
  packageManager: manager
330
337
  });
331
- const eslintResults = await lift$4({
338
+ const eslintResults = await lift$3({
332
339
  projectRoot,
333
340
  configs: eslintConfigs
334
341
  });
335
342
  const enhancerResults = await applyEnhancers({
336
343
  results,
337
- enhancers: [enhanceHuskyEnhancer(packageManager), enginesEnhancer, coveragePlugin],
338
- projectRoot
344
+ enhancers: [huskyPlugin, enginesEnhancer, coveragePlugin],
345
+ options: {
346
+ packageManager,
347
+ projectRoot
348
+ }
339
349
  });
340
350
  await liftPackage(deepmerge.all([{
341
351
  projectRoot,