@form8ion/javascript 2.0.0-alpha.1 → 2.2.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
@@ -1,41 +1,36 @@
1
1
  import { questionNames as questionNames$2, questions } from '@travi/language-scaffolder-prompts';
2
2
  import deepmerge from 'deepmerge';
3
3
  import { validateOptions, scaffoldChoice, dialects, projectTypes, packageManagers } from '@form8ion/javascript-core';
4
- import { scaffold as scaffold$1 } from '@form8ion/codecov';
4
+ import { scaffold } from '@form8ion/codecov';
5
5
  import { promises } from 'fs';
6
- import * as joi from '@hapi/joi';
6
+ import * as joi from 'joi';
7
7
  import { Separator } from 'inquirer';
8
8
  import { prompt as prompt$1 } from '@form8ion/overridable-prompts';
9
9
  import { warn, info } from '@travi/cli-messages';
10
10
  import { lift } from '@form8ion/lift-javascript';
11
- import { scaffold as scaffold$5 } from '@form8ion/commit-convention';
11
+ import { scaffold as scaffold$4 } from '@form8ion/commit-convention';
12
12
  import hoek from '@hapi/hoek';
13
13
  import execa from 'execa';
14
14
  import { stringify } from 'ini';
15
15
  import { EOL } from 'os';
16
16
  import validatePackageName from 'validate-npm-package-name';
17
- import { scaffold as scaffold$2 } from '@form8ion/rollup';
17
+ import { scaffold as scaffold$1 } from '@form8ion/rollup';
18
18
  import mustache from 'mustache';
19
19
  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 { scaffold as scaffold$4 } from '@form8ion/husky';
24
- import { scaffold as scaffold$3 } from '@form8ion/eslint';
23
+ import { scaffold as scaffold$3 } from '@form8ion/husky';
24
+ import { scaffold as scaffold$2 } from '@form8ion/eslint';
25
25
 
26
26
  function ownKeys(object, enumerableOnly) {
27
27
  var keys = Object.keys(object);
28
28
 
29
29
  if (Object.getOwnPropertySymbols) {
30
30
  var symbols = Object.getOwnPropertySymbols(object);
31
-
32
- if (enumerableOnly) {
33
- symbols = symbols.filter(function (sym) {
34
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
35
- });
36
- }
37
-
38
- keys.push.apply(keys, symbols);
31
+ enumerableOnly && (symbols = symbols.filter(function (sym) {
32
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
33
+ })), keys.push.apply(keys, symbols);
39
34
  }
40
35
 
41
36
  return keys;
@@ -43,19 +38,12 @@ function ownKeys(object, enumerableOnly) {
43
38
 
44
39
  function _objectSpread2(target) {
45
40
  for (var i = 1; i < arguments.length; i++) {
46
- var source = arguments[i] != null ? arguments[i] : {};
47
-
48
- if (i % 2) {
49
- ownKeys(Object(source), true).forEach(function (key) {
50
- _defineProperty(target, key, source[key]);
51
- });
52
- } else if (Object.getOwnPropertyDescriptors) {
53
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
54
- } else {
55
- ownKeys(Object(source)).forEach(function (key) {
56
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
57
- });
58
- }
41
+ var source = null != arguments[i] ? arguments[i] : {};
42
+ i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
43
+ _defineProperty(target, key, source[key]);
44
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
45
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
46
+ });
59
47
  }
60
48
 
61
49
  return target;
@@ -116,13 +104,15 @@ async function scaffoldC8 ({
116
104
  async function scaffoldCoverage ({
117
105
  projectRoot,
118
106
  vcs,
119
- visibility
107
+ visibility,
108
+ pathWithinParent
120
109
  }) {
121
110
  return deepmerge(await scaffoldC8({
122
111
  projectRoot
123
- }), await scaffold$1({
112
+ }), await scaffold({
124
113
  vcs,
125
- visibility
114
+ visibility,
115
+ pathWithinParent
126
116
  }));
127
117
  }
128
118
 
@@ -149,7 +139,8 @@ async function scaffoldUnitTesting ({
149
139
  frameworks,
150
140
  decisions,
151
141
  visibility,
152
- vcs
142
+ vcs,
143
+ pathWithinParent
153
144
  }) {
154
145
  const validatedFrameworks = validateOptions(unitTestFrameworksSchema, frameworks);
155
146
  const [framework, coverage] = await Promise.all([chooseFramework({
@@ -160,7 +151,8 @@ async function scaffoldUnitTesting ({
160
151
  })), scaffoldCoverage({
161
152
  projectRoot,
162
153
  vcs,
163
- visibility
154
+ visibility,
155
+ pathWithinParent
164
156
  })]);
165
157
  return deepmerge.all([{
166
158
  scripts: {
@@ -790,7 +782,7 @@ function defineBadges (packageName, visibility) {
790
782
  return {
791
783
  consumer: _objectSpread2({}, 'Public' === visibility && {
792
784
  npm: {
793
- img: `https://img.shields.io/npm/v/${packageName}.svg`,
785
+ img: `https://img.shields.io/npm/v/${packageName}?logo=npm`,
794
786
  text: 'npm',
795
787
  link: `https://www.npmjs.com/package/${packageName}`
796
788
  }
@@ -831,7 +823,7 @@ async function buildDetails ({
831
823
  projectName
832
824
  });
833
825
  const pathToCreatedSrcDirectory = await makeDir(`${projectRoot}/src`);
834
- const [rollupResults] = await Promise.all([scaffold$2({
826
+ const [rollupResults] = await Promise.all([scaffold$1({
835
827
  projectRoot,
836
828
  dialect,
837
829
  projectType: projectTypes.PACKAGE
@@ -1025,7 +1017,7 @@ async function scaffoldCliType ({
1025
1017
  projectRoot,
1026
1018
  dialect
1027
1019
  }) {
1028
- const rollupResults = await scaffold$2({
1020
+ const rollupResults = await scaffold$1({
1029
1021
  projectRoot,
1030
1022
  dialect,
1031
1023
  projectType: projectTypes.CLI
@@ -1137,7 +1129,8 @@ async function scaffoldTesting ({
1137
1129
  vcs,
1138
1130
  unitTestFrameworks,
1139
1131
  decisions,
1140
- dialect
1132
+ dialect,
1133
+ pathWithinParent
1141
1134
  }) {
1142
1135
  const unitResults = unit ? await scaffoldUnitTesting({
1143
1136
  projectRoot,
@@ -1145,7 +1138,8 @@ async function scaffoldTesting ({
1145
1138
  vcs,
1146
1139
  frameworks: unitTestFrameworks,
1147
1140
  decisions,
1148
- dialect
1141
+ dialect,
1142
+ pathWithinParent
1149
1143
  }) : {};
1150
1144
  return deepmerge({
1151
1145
  devDependencies: [...(unit || integration ? ['@travi/any'] : [])],
@@ -1169,7 +1163,7 @@ async function scaffoldEslint ({
1169
1163
  const ignores = deepmerge(ignore, {
1170
1164
  directories: [`/${buildDirectory}/`]
1171
1165
  });
1172
- return scaffold$3({
1166
+ return scaffold$2({
1173
1167
  scope,
1174
1168
  projectRoot,
1175
1169
  ignore: {
@@ -1294,7 +1288,8 @@ async function scaffoldVerification({
1294
1288
  unitTestFrameworks,
1295
1289
  decisions,
1296
1290
  buildDirectory,
1297
- eslintConfigs
1291
+ eslintConfigs,
1292
+ pathWithinParent
1298
1293
  }) {
1299
1294
  const [testingResults, huskyResults] = await Promise.all([scaffoldTesting({
1300
1295
  projectRoot,
@@ -1303,8 +1298,9 @@ async function scaffoldVerification({
1303
1298
  vcs,
1304
1299
  unitTestFrameworks,
1305
1300
  decisions,
1306
- dialect
1307
- }), scaffold$4({
1301
+ dialect,
1302
+ pathWithinParent
1303
+ }), scaffold$3({
1308
1304
  projectRoot,
1309
1305
  packageManager
1310
1306
  })]);
@@ -1327,7 +1323,7 @@ async function scaffoldVerification({
1327
1323
  return deepmerge.all([testingResults, lintingResults, huskyResults]);
1328
1324
  }
1329
1325
 
1330
- async function scaffold(options) {
1326
+ async function scaffolder (options) {
1331
1327
  info('Initializing JavaScript project');
1332
1328
  const {
1333
1329
  projectRoot,
@@ -1393,6 +1389,7 @@ async function scaffold(options) {
1393
1389
  tests,
1394
1390
  unitTestFrameworks,
1395
1391
  decisions,
1392
+ pathWithinParent,
1396
1393
  buildDirectory: projectTypeResults.buildDirectory,
1397
1394
  eslintConfigs: projectTypeResults.eslintConfigs
1398
1395
  });
@@ -1425,7 +1422,7 @@ async function scaffold(options) {
1425
1422
  projectName,
1426
1423
  nodeVersion,
1427
1424
  tests
1428
- }), scaffold$5({
1425
+ }), scaffold$4({
1429
1426
  projectRoot,
1430
1427
  projectType,
1431
1428
  configs,
@@ -1472,5 +1469,5 @@ async function scaffold(options) {
1472
1469
 
1473
1470
  const questionNames = _objectSpread2(_objectSpread2({}, questionNames$2), questionNames$1);
1474
1471
 
1475
- export { questionNames, scaffold, scaffoldUnitTesting };
1472
+ export { questionNames, scaffolder as scaffold, scaffoldUnitTesting };
1476
1473
  //# sourceMappingURL=index.es.js.map