@form8ion/javascript 7.2.4 → 7.2.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.js +94 -90
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +100 -96
- package/lib/index.mjs.map +1 -1
- package/package.json +2 -2
package/lib/index.mjs
CHANGED
|
@@ -15,7 +15,7 @@ import npmConf from 'npm-conf';
|
|
|
15
15
|
import { stringify } from 'ini';
|
|
16
16
|
import { EOL } from 'os';
|
|
17
17
|
import validatePackageName from 'validate-npm-package-name';
|
|
18
|
-
import { scaffold as scaffold$
|
|
18
|
+
import { scaffold as scaffold$3 } from '@form8ion/rollup';
|
|
19
19
|
import mustache from 'mustache';
|
|
20
20
|
import camelcase from 'camelcase';
|
|
21
21
|
import makeDir from 'make-dir';
|
|
@@ -23,10 +23,10 @@ import touch from 'touch';
|
|
|
23
23
|
import { resolve } from 'path';
|
|
24
24
|
import filedirname from 'filedirname';
|
|
25
25
|
import * as huskyPlugin from '@form8ion/husky';
|
|
26
|
-
import { scaffold as scaffold$
|
|
26
|
+
import { scaffold as scaffold$4 } from '@form8ion/husky';
|
|
27
27
|
import { write as write$1 } from '@form8ion/config-file';
|
|
28
|
-
import { scaffold as scaffold$
|
|
29
|
-
import { lift as lift$4,
|
|
28
|
+
import { scaffold as scaffold$2 } from '@form8ion/prettier';
|
|
29
|
+
import { scaffold as scaffold$1, lift as lift$4, test as test$2 } from '@form8ion/eslint';
|
|
30
30
|
|
|
31
31
|
const questionNames$1 = {
|
|
32
32
|
UNIT_TEST_FRAMEWORK: 'unitTestFramework',
|
|
@@ -155,6 +155,87 @@ async function scaffoldUnitTesting ({projectRoot, frameworks, decisions, visibil
|
|
|
155
155
|
]);
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
+
async function scaffoldEslint ({config, projectRoot, additionalConfiguration}) {
|
|
159
|
+
const {scope} = config;
|
|
160
|
+
const {ignore} = additionalConfiguration;
|
|
161
|
+
|
|
162
|
+
return scaffold$1({scope, projectRoot, ignore});
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function lifter$1 ({results: {buildDirectory, eslintConfigs, eslint}, projectRoot}) {
|
|
166
|
+
return lift$4({projectRoot, configs: [...eslintConfigs || [], ...eslint?.configs || []], buildDirectory});
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
async function scaffoldRemark ({config, projectRoot, projectType, vcs, dialect}) {
|
|
170
|
+
await write$1({
|
|
171
|
+
format: fileTypes.JSON,
|
|
172
|
+
path: projectRoot,
|
|
173
|
+
name: 'remark',
|
|
174
|
+
config: {
|
|
175
|
+
settings: {
|
|
176
|
+
listItemIndent: 1,
|
|
177
|
+
emphasis: '_',
|
|
178
|
+
strong: '_',
|
|
179
|
+
bullet: '*',
|
|
180
|
+
incrementListMarker: false
|
|
181
|
+
},
|
|
182
|
+
plugins: [
|
|
183
|
+
config,
|
|
184
|
+
['remark-toc', {tight: true}],
|
|
185
|
+
...projectTypes.PACKAGE === projectType ? [['remark-usage', {heading: 'example'}]] : [],
|
|
186
|
+
...!vcs ? [['validate-links', {repository: false}]] : []
|
|
187
|
+
]
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
return deepmerge(
|
|
192
|
+
{
|
|
193
|
+
devDependencies: [config, 'remark-cli', 'remark-toc'],
|
|
194
|
+
scripts: {
|
|
195
|
+
'lint:md': 'remark . --frail',
|
|
196
|
+
'generate:md': 'remark . --output'
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
...projectTypes.PACKAGE === projectType && {
|
|
201
|
+
devDependencies: ['remark-usage'],
|
|
202
|
+
...dialects$1.COMMON_JS !== dialect && {scripts: {'pregenerate:md': 'run-s build'}}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
async function scaffoldCodeStyle ({
|
|
209
|
+
projectRoot,
|
|
210
|
+
projectType,
|
|
211
|
+
dialect,
|
|
212
|
+
configs,
|
|
213
|
+
vcs,
|
|
214
|
+
configureLinting,
|
|
215
|
+
eslint
|
|
216
|
+
}) {
|
|
217
|
+
return deepmerge.all(await Promise.all([
|
|
218
|
+
configs.eslint
|
|
219
|
+
&& configureLinting
|
|
220
|
+
&& scaffoldEslint({projectRoot, config: configs.eslint, additionalConfiguration: eslint}),
|
|
221
|
+
scaffoldRemark({
|
|
222
|
+
projectRoot,
|
|
223
|
+
projectType,
|
|
224
|
+
dialect,
|
|
225
|
+
vcs,
|
|
226
|
+
config: configs.remark || '@form8ion/remark-lint-preset'
|
|
227
|
+
}),
|
|
228
|
+
scaffold$2({projectRoot, config: configs.prettier})
|
|
229
|
+
].filter(Boolean)));
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
var codeStylePlugin = /*#__PURE__*/Object.freeze({
|
|
233
|
+
__proto__: null,
|
|
234
|
+
scaffold: scaffoldCodeStyle,
|
|
235
|
+
lift: lifter$1,
|
|
236
|
+
test: test$2
|
|
237
|
+
});
|
|
238
|
+
|
|
158
239
|
async function test$1({projectRoot}) {
|
|
159
240
|
const {engines} = JSON.parse(await promises.readFile(`${projectRoot}/package.json`, 'utf8'));
|
|
160
241
|
|
|
@@ -202,8 +283,8 @@ async function scaffoldBabel ({projectRoot, preset}) {
|
|
|
202
283
|
};
|
|
203
284
|
}
|
|
204
285
|
|
|
205
|
-
async function lifter ({
|
|
206
|
-
await addIgnore({ignore: buildDirectory, projectRoot});
|
|
286
|
+
async function lifter ({results, projectRoot}) {
|
|
287
|
+
await addIgnore({ignore: results.buildDirectory, projectRoot});
|
|
207
288
|
|
|
208
289
|
return {};
|
|
209
290
|
}
|
|
@@ -457,32 +538,23 @@ async function lift ({projectRoot, vcs, results}) {
|
|
|
457
538
|
const {
|
|
458
539
|
scripts,
|
|
459
540
|
tags,
|
|
460
|
-
eslintConfigs,
|
|
461
|
-
eslint,
|
|
462
541
|
dependencies,
|
|
463
542
|
devDependencies,
|
|
464
|
-
packageManager: manager
|
|
465
|
-
buildDirectory
|
|
543
|
+
packageManager: manager
|
|
466
544
|
} = results;
|
|
467
545
|
|
|
468
546
|
const packageManager = await resolvePackageManager({projectRoot, packageManager: manager});
|
|
469
547
|
|
|
470
|
-
const eslintResults = await lift$4({
|
|
471
|
-
projectRoot,
|
|
472
|
-
configs: [...eslintConfigs || [], ...eslint?.configs || []],
|
|
473
|
-
buildDirectory
|
|
474
|
-
});
|
|
475
548
|
const enhancerResults = await applyEnhancers({
|
|
476
549
|
results,
|
|
477
|
-
enhancers: [huskyPlugin, enginesEnhancer, coveragePlugin, commitConventionPlugin, dialects],
|
|
478
|
-
options: {packageManager, projectRoot, vcs
|
|
550
|
+
enhancers: [huskyPlugin, enginesEnhancer, coveragePlugin, commitConventionPlugin, dialects, codeStylePlugin],
|
|
551
|
+
options: {packageManager, projectRoot, vcs}
|
|
479
552
|
});
|
|
480
553
|
|
|
481
554
|
await liftPackage(
|
|
482
555
|
deepmerge.all([
|
|
483
556
|
{projectRoot, scripts, tags, dependencies, devDependencies, packageManager},
|
|
484
|
-
enhancerResults
|
|
485
|
-
eslintResults
|
|
557
|
+
enhancerResults
|
|
486
558
|
])
|
|
487
559
|
);
|
|
488
560
|
|
|
@@ -1118,7 +1190,7 @@ const defaultBuildDirectory = 'bin';
|
|
|
1118
1190
|
|
|
1119
1191
|
async function scaffoldCliType ({packageName, visibility, projectRoot, dialect, publishRegistry}) {
|
|
1120
1192
|
const [rollupResults] = await Promise.all([
|
|
1121
|
-
scaffold$
|
|
1193
|
+
scaffold$3({projectRoot, dialect, projectType: projectTypes.CLI}),
|
|
1122
1194
|
mergeIntoExistingPackageJson({
|
|
1123
1195
|
projectRoot,
|
|
1124
1196
|
config: {
|
|
@@ -1295,15 +1367,17 @@ async function scaffoldLockfileLint ({projectRoot, packageManager, registries})
|
|
|
1295
1367
|
);
|
|
1296
1368
|
}
|
|
1297
1369
|
|
|
1298
|
-
await
|
|
1299
|
-
|
|
1300
|
-
JSON
|
|
1370
|
+
await write$1({
|
|
1371
|
+
name: 'lockfile-lint',
|
|
1372
|
+
format: fileTypes.JSON,
|
|
1373
|
+
path: projectRoot,
|
|
1374
|
+
config: {
|
|
1301
1375
|
path: determineLockfilePathFor(packageManager),
|
|
1302
1376
|
type: packageManager,
|
|
1303
1377
|
'validate-https': true,
|
|
1304
1378
|
'allowed-hosts': buildAllowedHostsList({packageManager, registries})
|
|
1305
|
-
}
|
|
1306
|
-
);
|
|
1379
|
+
}
|
|
1380
|
+
});
|
|
1307
1381
|
|
|
1308
1382
|
return {
|
|
1309
1383
|
devDependencies: ['lockfile-lint'],
|
|
@@ -1342,82 +1416,12 @@ async function scaffoldVerification({
|
|
|
1342
1416
|
pathWithinParent
|
|
1343
1417
|
}),
|
|
1344
1418
|
scaffoldLinting({projectRoot, packageManager, registries, vcs, pathWithinParent}),
|
|
1345
|
-
scaffold$
|
|
1419
|
+
scaffold$4({projectRoot, packageManager, pathWithinParent})
|
|
1346
1420
|
]);
|
|
1347
1421
|
|
|
1348
1422
|
return deepmerge.all([testingResults, lintingResults, huskyResults]);
|
|
1349
1423
|
}
|
|
1350
1424
|
|
|
1351
|
-
async function scaffoldEslint ({config, projectRoot, additionalConfiguration}) {
|
|
1352
|
-
const {scope} = config;
|
|
1353
|
-
const {ignore} = additionalConfiguration;
|
|
1354
|
-
|
|
1355
|
-
return scaffold$3({scope, projectRoot, ignore});
|
|
1356
|
-
}
|
|
1357
|
-
|
|
1358
|
-
async function scaffoldRemark ({config, projectRoot, projectType, vcs, dialect}) {
|
|
1359
|
-
await write$1({
|
|
1360
|
-
format: fileTypes.JSON,
|
|
1361
|
-
path: projectRoot,
|
|
1362
|
-
name: 'remark',
|
|
1363
|
-
config: {
|
|
1364
|
-
settings: {
|
|
1365
|
-
listItemIndent: 1,
|
|
1366
|
-
emphasis: '_',
|
|
1367
|
-
strong: '_',
|
|
1368
|
-
bullet: '*',
|
|
1369
|
-
incrementListMarker: false
|
|
1370
|
-
},
|
|
1371
|
-
plugins: [
|
|
1372
|
-
config,
|
|
1373
|
-
['remark-toc', {tight: true}],
|
|
1374
|
-
...projectTypes.PACKAGE === projectType ? [['remark-usage', {heading: 'example'}]] : [],
|
|
1375
|
-
...!vcs ? [['validate-links', {repository: false}]] : []
|
|
1376
|
-
]
|
|
1377
|
-
}
|
|
1378
|
-
});
|
|
1379
|
-
|
|
1380
|
-
return deepmerge(
|
|
1381
|
-
{
|
|
1382
|
-
devDependencies: [config, 'remark-cli', 'remark-toc'],
|
|
1383
|
-
scripts: {
|
|
1384
|
-
'lint:md': 'remark . --frail',
|
|
1385
|
-
'generate:md': 'remark . --output'
|
|
1386
|
-
}
|
|
1387
|
-
},
|
|
1388
|
-
{
|
|
1389
|
-
...projectTypes.PACKAGE === projectType && {
|
|
1390
|
-
devDependencies: ['remark-usage'],
|
|
1391
|
-
...dialects$1.COMMON_JS !== dialect && {scripts: {'pregenerate:md': 'run-s build'}}
|
|
1392
|
-
}
|
|
1393
|
-
}
|
|
1394
|
-
);
|
|
1395
|
-
}
|
|
1396
|
-
|
|
1397
|
-
async function scaffoldCodeStyle ({
|
|
1398
|
-
projectRoot,
|
|
1399
|
-
projectType,
|
|
1400
|
-
dialect,
|
|
1401
|
-
configs,
|
|
1402
|
-
vcs,
|
|
1403
|
-
configureLinting,
|
|
1404
|
-
eslint
|
|
1405
|
-
}) {
|
|
1406
|
-
return deepmerge.all(await Promise.all([
|
|
1407
|
-
configs.eslint
|
|
1408
|
-
&& configureLinting
|
|
1409
|
-
&& scaffoldEslint({projectRoot, config: configs.eslint, additionalConfiguration: eslint}),
|
|
1410
|
-
scaffoldRemark({
|
|
1411
|
-
projectRoot,
|
|
1412
|
-
projectType,
|
|
1413
|
-
dialect,
|
|
1414
|
-
vcs,
|
|
1415
|
-
config: configs.remark || '@form8ion/remark-lint-preset'
|
|
1416
|
-
}),
|
|
1417
|
-
scaffold$4({projectRoot, config: configs.prettier})
|
|
1418
|
-
].filter(Boolean)));
|
|
1419
|
-
}
|
|
1420
|
-
|
|
1421
1425
|
async function scaffolder (options) {
|
|
1422
1426
|
info('Initializing JavaScript project');
|
|
1423
1427
|
|