@form8ion/javascript 6.0.0-alpha.5 → 6.0.2
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 +116 -122
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +118 -124
- package/lib/index.mjs.map +1 -1
- package/package.json +11 -11
package/lib/index.mjs
CHANGED
|
@@ -22,9 +22,9 @@ import makeDir from 'make-dir';
|
|
|
22
22
|
import touch from 'touch';
|
|
23
23
|
import { resolve } from 'path';
|
|
24
24
|
import * as huskyPlugin from '@form8ion/husky';
|
|
25
|
-
import { scaffold as scaffold$
|
|
26
|
-
import { lift as lift$4, scaffold as scaffold$2 } from '@form8ion/eslint';
|
|
25
|
+
import { scaffold as scaffold$2 } from '@form8ion/husky';
|
|
27
26
|
import { write } from '@form8ion/config-file';
|
|
27
|
+
import { lift as lift$4, scaffold as scaffold$3 } from '@form8ion/eslint';
|
|
28
28
|
|
|
29
29
|
function ownKeys(object, enumerableOnly) {
|
|
30
30
|
var keys = Object.keys(object);
|
|
@@ -437,6 +437,7 @@ async function lift ({
|
|
|
437
437
|
scripts,
|
|
438
438
|
tags,
|
|
439
439
|
eslintConfigs,
|
|
440
|
+
eslint,
|
|
440
441
|
dependencies,
|
|
441
442
|
devDependencies,
|
|
442
443
|
packageManager: manager
|
|
@@ -447,7 +448,7 @@ async function lift ({
|
|
|
447
448
|
});
|
|
448
449
|
const eslintResults = await lift$4({
|
|
449
450
|
projectRoot,
|
|
450
|
-
configs: eslintConfigs
|
|
451
|
+
configs: [...(eslintConfigs || []), ...((eslint === null || eslint === void 0 ? void 0 : eslint.configs) || [])]
|
|
451
452
|
});
|
|
452
453
|
const enhancerResults = await applyEnhancers({
|
|
453
454
|
results,
|
|
@@ -1387,78 +1388,10 @@ async function scaffoldTesting ({
|
|
|
1387
1388
|
}) : {};
|
|
1388
1389
|
return deepmerge({
|
|
1389
1390
|
devDependencies: [...(unit || integration ? ['@travi/any'] : [])],
|
|
1390
|
-
eslint:
|
|
1391
|
-
eslintConfigs: []
|
|
1391
|
+
eslint: {}
|
|
1392
1392
|
}, unitResults);
|
|
1393
1393
|
}
|
|
1394
1394
|
|
|
1395
|
-
async function scaffoldEslint ({
|
|
1396
|
-
config,
|
|
1397
|
-
projectRoot,
|
|
1398
|
-
buildDirectory,
|
|
1399
|
-
additionalConfiguration
|
|
1400
|
-
}) {
|
|
1401
|
-
const {
|
|
1402
|
-
scope
|
|
1403
|
-
} = config;
|
|
1404
|
-
const {
|
|
1405
|
-
ignore
|
|
1406
|
-
} = additionalConfiguration;
|
|
1407
|
-
const ignores = deepmerge(ignore, {
|
|
1408
|
-
directories: [`/${buildDirectory}/`]
|
|
1409
|
-
});
|
|
1410
|
-
return scaffold$2({
|
|
1411
|
-
scope,
|
|
1412
|
-
projectRoot,
|
|
1413
|
-
ignore: {
|
|
1414
|
-
directories: ignores.directories
|
|
1415
|
-
}
|
|
1416
|
-
});
|
|
1417
|
-
}
|
|
1418
|
-
|
|
1419
|
-
async function scaffoldRemark ({
|
|
1420
|
-
config,
|
|
1421
|
-
projectRoot,
|
|
1422
|
-
projectType,
|
|
1423
|
-
vcs,
|
|
1424
|
-
dialect
|
|
1425
|
-
}) {
|
|
1426
|
-
await write({
|
|
1427
|
-
format: fileTypes.JSON,
|
|
1428
|
-
path: projectRoot,
|
|
1429
|
-
name: 'remark',
|
|
1430
|
-
config: {
|
|
1431
|
-
settings: {
|
|
1432
|
-
listItemIndent: 1,
|
|
1433
|
-
emphasis: '_',
|
|
1434
|
-
strong: '_',
|
|
1435
|
-
bullet: '*',
|
|
1436
|
-
incrementListMarker: false
|
|
1437
|
-
},
|
|
1438
|
-
plugins: [config, ['remark-toc', {
|
|
1439
|
-
tight: true
|
|
1440
|
-
}], ...(projectTypes.PACKAGE === projectType ? [['remark-usage', {
|
|
1441
|
-
heading: 'example'
|
|
1442
|
-
}]] : []), ...(!vcs ? [['validate-links', {
|
|
1443
|
-
repository: false
|
|
1444
|
-
}]] : [])]
|
|
1445
|
-
}
|
|
1446
|
-
});
|
|
1447
|
-
return deepmerge({
|
|
1448
|
-
devDependencies: [config, 'remark-cli', 'remark-toc'],
|
|
1449
|
-
scripts: {
|
|
1450
|
-
'lint:md': 'remark . --frail',
|
|
1451
|
-
'generate:md': 'remark . --output'
|
|
1452
|
-
}
|
|
1453
|
-
}, _objectSpread2({}, projectTypes.PACKAGE === projectType && _objectSpread2({
|
|
1454
|
-
devDependencies: ['remark-usage']
|
|
1455
|
-
}, dialects.COMMON_JS !== dialect && {
|
|
1456
|
-
scripts: {
|
|
1457
|
-
'pregenerate:md': 'run-s build'
|
|
1458
|
-
}
|
|
1459
|
-
})));
|
|
1460
|
-
}
|
|
1461
|
-
|
|
1462
1395
|
function scaffoldBanSensitiveFiles ({
|
|
1463
1396
|
pathWithinParent
|
|
1464
1397
|
}) {
|
|
@@ -1520,32 +1453,15 @@ async function scaffoldLockfileLint ({
|
|
|
1520
1453
|
|
|
1521
1454
|
async function scaffoldLinting ({
|
|
1522
1455
|
projectRoot,
|
|
1523
|
-
projectType,
|
|
1524
1456
|
packageManager,
|
|
1525
|
-
dialect,
|
|
1526
1457
|
registries,
|
|
1527
|
-
configs,
|
|
1528
1458
|
vcs,
|
|
1529
|
-
|
|
1530
|
-
buildDirectory,
|
|
1531
|
-
pathWithinParent,
|
|
1532
|
-
eslint
|
|
1459
|
+
pathWithinParent
|
|
1533
1460
|
}) {
|
|
1534
1461
|
return deepmerge.all(await Promise.all([scaffoldLockfileLint({
|
|
1535
1462
|
projectRoot,
|
|
1536
1463
|
packageManager,
|
|
1537
1464
|
registries
|
|
1538
|
-
}), configs.eslint && configureLinting ? scaffoldEslint({
|
|
1539
|
-
projectRoot,
|
|
1540
|
-
config: configs.eslint,
|
|
1541
|
-
buildDirectory,
|
|
1542
|
-
additionalConfiguration: eslint
|
|
1543
|
-
}) : {}, scaffoldRemark({
|
|
1544
|
-
projectRoot,
|
|
1545
|
-
projectType,
|
|
1546
|
-
dialect,
|
|
1547
|
-
vcs,
|
|
1548
|
-
config: configs.remark || '@form8ion/remark-lint-preset'
|
|
1549
1465
|
}), vcs ? scaffoldBanSensitiveFiles({
|
|
1550
1466
|
pathWithinParent
|
|
1551
1467
|
}) : {}]));
|
|
@@ -1553,22 +1469,17 @@ async function scaffoldLinting ({
|
|
|
1553
1469
|
|
|
1554
1470
|
async function scaffoldVerification({
|
|
1555
1471
|
projectRoot,
|
|
1556
|
-
projectType,
|
|
1557
1472
|
dialect,
|
|
1558
1473
|
visibility,
|
|
1559
1474
|
packageManager,
|
|
1560
1475
|
vcs,
|
|
1561
|
-
configs,
|
|
1562
1476
|
registries,
|
|
1563
|
-
configureLinting,
|
|
1564
1477
|
tests,
|
|
1565
1478
|
unitTestFrameworks,
|
|
1566
1479
|
decisions,
|
|
1567
|
-
buildDirectory,
|
|
1568
|
-
eslintConfigs,
|
|
1569
1480
|
pathWithinParent
|
|
1570
1481
|
}) {
|
|
1571
|
-
const [testingResults, huskyResults] = await Promise.all([scaffoldTesting({
|
|
1482
|
+
const [testingResults, lintingResults, huskyResults] = await Promise.all([scaffoldTesting({
|
|
1572
1483
|
projectRoot,
|
|
1573
1484
|
tests,
|
|
1574
1485
|
visibility,
|
|
@@ -1577,29 +1488,109 @@ async function scaffoldVerification({
|
|
|
1577
1488
|
decisions,
|
|
1578
1489
|
dialect,
|
|
1579
1490
|
pathWithinParent
|
|
1580
|
-
}),
|
|
1491
|
+
}), scaffoldLinting({
|
|
1492
|
+
projectRoot,
|
|
1493
|
+
packageManager,
|
|
1494
|
+
registries,
|
|
1495
|
+
vcs,
|
|
1496
|
+
pathWithinParent
|
|
1497
|
+
}), scaffold$2({
|
|
1581
1498
|
projectRoot,
|
|
1582
1499
|
packageManager,
|
|
1583
1500
|
pathWithinParent
|
|
1584
1501
|
})]);
|
|
1585
|
-
|
|
1502
|
+
return deepmerge.all([testingResults, lintingResults, huskyResults]);
|
|
1503
|
+
}
|
|
1504
|
+
|
|
1505
|
+
async function scaffoldEslint ({
|
|
1506
|
+
config,
|
|
1507
|
+
projectRoot,
|
|
1508
|
+
buildDirectory,
|
|
1509
|
+
additionalConfiguration
|
|
1510
|
+
}) {
|
|
1511
|
+
const {
|
|
1512
|
+
scope
|
|
1513
|
+
} = config;
|
|
1514
|
+
const {
|
|
1515
|
+
ignore
|
|
1516
|
+
} = additionalConfiguration;
|
|
1517
|
+
const ignores = deepmerge(ignore, {
|
|
1518
|
+
directories: [`/${buildDirectory}/`]
|
|
1519
|
+
});
|
|
1520
|
+
return scaffold$3({
|
|
1521
|
+
scope,
|
|
1522
|
+
projectRoot,
|
|
1523
|
+
ignore: {
|
|
1524
|
+
directories: ignores.directories
|
|
1525
|
+
}
|
|
1526
|
+
});
|
|
1527
|
+
}
|
|
1528
|
+
|
|
1529
|
+
async function scaffoldRemark ({
|
|
1530
|
+
config,
|
|
1531
|
+
projectRoot,
|
|
1532
|
+
projectType,
|
|
1533
|
+
vcs,
|
|
1534
|
+
dialect
|
|
1535
|
+
}) {
|
|
1536
|
+
await write({
|
|
1537
|
+
format: fileTypes.JSON,
|
|
1538
|
+
path: projectRoot,
|
|
1539
|
+
name: 'remark',
|
|
1540
|
+
config: {
|
|
1541
|
+
settings: {
|
|
1542
|
+
listItemIndent: 1,
|
|
1543
|
+
emphasis: '_',
|
|
1544
|
+
strong: '_',
|
|
1545
|
+
bullet: '*',
|
|
1546
|
+
incrementListMarker: false
|
|
1547
|
+
},
|
|
1548
|
+
plugins: [config, ['remark-toc', {
|
|
1549
|
+
tight: true
|
|
1550
|
+
}], ...(projectTypes.PACKAGE === projectType ? [['remark-usage', {
|
|
1551
|
+
heading: 'example'
|
|
1552
|
+
}]] : []), ...(!vcs ? [['validate-links', {
|
|
1553
|
+
repository: false
|
|
1554
|
+
}]] : [])]
|
|
1555
|
+
}
|
|
1556
|
+
});
|
|
1557
|
+
return deepmerge({
|
|
1558
|
+
devDependencies: [config, 'remark-cli', 'remark-toc'],
|
|
1559
|
+
scripts: {
|
|
1560
|
+
'lint:md': 'remark . --frail',
|
|
1561
|
+
'generate:md': 'remark . --output'
|
|
1562
|
+
}
|
|
1563
|
+
}, _objectSpread2({}, projectTypes.PACKAGE === projectType && _objectSpread2({
|
|
1564
|
+
devDependencies: ['remark-usage']
|
|
1565
|
+
}, dialects.COMMON_JS !== dialect && {
|
|
1566
|
+
scripts: {
|
|
1567
|
+
'pregenerate:md': 'run-s build'
|
|
1568
|
+
}
|
|
1569
|
+
})));
|
|
1570
|
+
}
|
|
1571
|
+
|
|
1572
|
+
async function scaffoldCodeStyle ({
|
|
1573
|
+
projectRoot,
|
|
1574
|
+
projectType,
|
|
1575
|
+
dialect,
|
|
1576
|
+
configs,
|
|
1577
|
+
vcs,
|
|
1578
|
+
configureLinting,
|
|
1579
|
+
buildDirectory,
|
|
1580
|
+
eslint
|
|
1581
|
+
}) {
|
|
1582
|
+
return deepmerge.all(await Promise.all([configs.eslint && configureLinting ? scaffoldEslint({
|
|
1583
|
+
projectRoot,
|
|
1584
|
+
config: configs.eslint,
|
|
1585
|
+
buildDirectory,
|
|
1586
|
+
additionalConfiguration: eslint
|
|
1587
|
+
}) : {}, scaffoldRemark({
|
|
1586
1588
|
projectRoot,
|
|
1587
1589
|
projectType,
|
|
1588
|
-
packageManager,
|
|
1589
1590
|
dialect,
|
|
1590
|
-
configs,
|
|
1591
|
-
registries,
|
|
1592
1591
|
vcs,
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
pathWithinParent,
|
|
1596
|
-
eslint: deepmerge.all([testingResults.eslint, {
|
|
1597
|
-
configs: testingResults.eslintConfigs
|
|
1598
|
-
}, {
|
|
1599
|
-
configs: eslintConfigs
|
|
1600
|
-
}])
|
|
1601
|
-
});
|
|
1602
|
-
return deepmerge.all([testingResults, lintingResults, huskyResults]);
|
|
1592
|
+
config: configs.remark || '@form8ion/remark-lint-preset'
|
|
1593
|
+
})]));
|
|
1603
1594
|
}
|
|
1604
1595
|
|
|
1605
1596
|
async function scaffolder (options) {
|
|
@@ -1653,7 +1644,7 @@ async function scaffolder (options) {
|
|
|
1653
1644
|
description,
|
|
1654
1645
|
pathWithinParent
|
|
1655
1646
|
});
|
|
1656
|
-
const projectTypeResults = await scaffoldProjectType({
|
|
1647
|
+
const [projectTypeResults, verificationResults] = await Promise.all([scaffoldProjectType({
|
|
1657
1648
|
projectType,
|
|
1658
1649
|
projectRoot,
|
|
1659
1650
|
projectName,
|
|
@@ -1670,25 +1661,19 @@ async function scaffolder (options) {
|
|
|
1670
1661
|
decisions,
|
|
1671
1662
|
dialect,
|
|
1672
1663
|
publishRegistry: registries.publish
|
|
1673
|
-
})
|
|
1674
|
-
const verificationResults = await scaffoldVerification({
|
|
1664
|
+
}), scaffoldVerification({
|
|
1675
1665
|
projectRoot,
|
|
1676
|
-
projectType,
|
|
1677
1666
|
dialect,
|
|
1678
|
-
packageManager,
|
|
1679
1667
|
visibility,
|
|
1668
|
+
packageManager,
|
|
1680
1669
|
vcs,
|
|
1681
|
-
configs,
|
|
1682
1670
|
registries,
|
|
1683
|
-
configureLinting,
|
|
1684
1671
|
tests,
|
|
1685
1672
|
unitTestFrameworks,
|
|
1686
1673
|
decisions,
|
|
1687
|
-
pathWithinParent
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
});
|
|
1691
|
-
const [nodeVersion, npmResults, dialectResults] = await Promise.all([scaffoldNodeVersion({
|
|
1674
|
+
pathWithinParent
|
|
1675
|
+
})]);
|
|
1676
|
+
const [nodeVersion, npmResults, dialectResults, codeStyleResults] = await Promise.all([scaffoldNodeVersion({
|
|
1692
1677
|
projectRoot,
|
|
1693
1678
|
nodeVersionCategory
|
|
1694
1679
|
}), scaffoldNpmConfig({
|
|
@@ -1702,6 +1687,15 @@ async function scaffolder (options) {
|
|
|
1702
1687
|
projectType,
|
|
1703
1688
|
buildDirectory: projectTypeResults.buildDirectory,
|
|
1704
1689
|
testFilenamePattern: verificationResults.testFilenamePattern
|
|
1690
|
+
}), scaffoldCodeStyle({
|
|
1691
|
+
projectRoot,
|
|
1692
|
+
projectType,
|
|
1693
|
+
dialect,
|
|
1694
|
+
configs,
|
|
1695
|
+
vcs,
|
|
1696
|
+
configureLinting,
|
|
1697
|
+
buildDirectory: projectTypeResults.buildDirectory,
|
|
1698
|
+
eslint: verificationResults.eslint
|
|
1705
1699
|
})]);
|
|
1706
1700
|
const mergedContributions = deepmerge.all([...(await Promise.all([scaffoldChoice(hosts, chosenHost, {
|
|
1707
1701
|
buildDirectory: `./${projectTypeResults.buildDirectory}`,
|
|
@@ -1721,7 +1715,7 @@ async function scaffolder (options) {
|
|
|
1721
1715
|
projectType,
|
|
1722
1716
|
configs,
|
|
1723
1717
|
pathWithinParent
|
|
1724
|
-
})])), projectTypeResults, verificationResults, npmResults, dialectResults]);
|
|
1718
|
+
})])), projectTypeResults, verificationResults, codeStyleResults, npmResults, dialectResults]);
|
|
1725
1719
|
const liftResults = await lift({
|
|
1726
1720
|
results: deepmerge({
|
|
1727
1721
|
devDependencies: ['npm-run-all'],
|