@form8ion/javascript 3.0.1 → 3.1.0-alpha.1

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
@@ -1,15 +1,13 @@
1
1
  import { questionNames as questionNames$2, questions } from '@travi/language-scaffolder-prompts';
2
2
  import deepmerge from 'deepmerge';
3
3
  import { validateOptions, scaffoldChoice, installDependencies, PROD_DEPENDENCY_TYPE, DEV_DEPENDENCY_TYPE, packageManagers, dialects, projectTypes } from '@form8ion/javascript-core';
4
- import { scaffold } from '@form8ion/codecov';
5
- import { promises } from 'fs';
6
4
  import * as joi from 'joi';
7
5
  import { Separator } from 'inquirer';
8
6
  import { prompt as prompt$1 } from '@form8ion/overridable-prompts';
9
- import { info, warn } from '@travi/cli-messages';
10
- import { lift as lift$3, scaffold as scaffold$2 } from '@form8ion/eslint';
7
+ import { scaffold } from '@form8ion/codecov';
8
+ import { promises } from 'fs';
11
9
  import { fileExists } from '@form8ion/core';
12
- import { test as test$2, lift as lift$2, scaffold as scaffold$3 } from '@form8ion/husky';
10
+ import { info, warn } from '@travi/cli-messages';
13
11
  import { scaffold as scaffold$4 } from '@form8ion/commit-convention';
14
12
  import hoek from '@hapi/hoek';
15
13
  import execa from 'execa';
@@ -22,6 +20,8 @@ import camelcase from 'camelcase';
22
20
  import makeDir from 'make-dir';
23
21
  import touch from 'touch';
24
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';
25
25
 
26
26
  function ownKeys(object, enumerableOnly) {
27
27
  var keys = Object.keys(object);
@@ -116,6 +116,42 @@ async function scaffoldCoverage ({
116
116
  }));
117
117
  }
118
118
 
119
+ function nycIsConfigured ({
120
+ projectRoot
121
+ }) {
122
+ return fileExists(`${projectRoot}/.nycrc`);
123
+ }
124
+
125
+ async function removeNyc ({
126
+ projectRoot
127
+ }) {
128
+ await promises.unlink(`${projectRoot}/.nycrc`);
129
+ }
130
+
131
+ async function lift$2({
132
+ projectRoot
133
+ }) {
134
+ if (await nycIsConfigured({
135
+ projectRoot
136
+ })) {
137
+ const [c8Results] = await Promise.all([scaffoldC8({
138
+ projectRoot
139
+ }), removeNyc({
140
+ projectRoot
141
+ })]);
142
+ return c8Results;
143
+ }
144
+
145
+ return {};
146
+ }
147
+
148
+ var coveragePlugin = /*#__PURE__*/Object.freeze({
149
+ __proto__: null,
150
+ scaffold: scaffoldCoverage,
151
+ lift: lift$2,
152
+ test: nycIsConfigured
153
+ });
154
+
119
155
  const unitTestFrameworksSchema = joi.object().required().pattern(/^/, joi.object({
120
156
  scaffolder: joi.func().arity(1).required()
121
157
  }));
@@ -218,6 +254,20 @@ var enginesEnhancer = /*#__PURE__*/Object.freeze({
218
254
  lift: lift$1
219
255
  });
220
256
 
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
+
221
271
  async function liftPackage ({
222
272
  projectRoot,
223
273
  scripts,
@@ -261,20 +311,6 @@ async function resolvePackageManager ({
261
311
  throw new Error('Package-manager could not be determined');
262
312
  }
263
313
 
264
- function enhanceHuskyEnhancer(packageManager) {
265
- return {
266
- test: test$2,
267
- lift: ({
268
- projectRoot,
269
- results
270
- }) => lift$2({
271
- projectRoot,
272
- results,
273
- packageManager
274
- })
275
- };
276
- }
277
-
278
314
  async function lift ({
279
315
  projectRoot,
280
316
  results
@@ -292,13 +328,13 @@ async function lift ({
292
328
  projectRoot,
293
329
  packageManager: manager
294
330
  });
295
- const eslintResults = await lift$3({
331
+ const eslintResults = await lift$4({
296
332
  projectRoot,
297
333
  configs: eslintConfigs
298
334
  });
299
335
  const enhancerResults = await applyEnhancers({
300
336
  results,
301
- enhancers: [enhanceHuskyEnhancer(packageManager), enginesEnhancer],
337
+ enhancers: [enhanceHuskyEnhancer(packageManager), enginesEnhancer, coveragePlugin],
302
338
  projectRoot
303
339
  });
304
340
  await liftPackage(deepmerge.all([{