@form8ion/javascript 6.0.0-alpha.4 → 6.0.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.js CHANGED
@@ -25,8 +25,8 @@ var makeDir = require('make-dir');
25
25
  var touch = require('touch');
26
26
  var path = require('path');
27
27
  var huskyPlugin = require('@form8ion/husky');
28
- var eslint = require('@form8ion/eslint');
29
28
  var configFile = require('@form8ion/config-file');
29
+ var eslint = require('@form8ion/eslint');
30
30
 
31
31
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
32
32
 
@@ -471,6 +471,7 @@ async function lift ({
471
471
  scripts,
472
472
  tags,
473
473
  eslintConfigs,
474
+ eslint: eslint$1,
474
475
  dependencies,
475
476
  devDependencies,
476
477
  packageManager: manager
@@ -481,7 +482,7 @@ async function lift ({
481
482
  });
482
483
  const eslintResults = await eslint.lift({
483
484
  projectRoot,
484
- configs: eslintConfigs
485
+ configs: [...(eslintConfigs || []), ...((eslint$1 === null || eslint$1 === void 0 ? void 0 : eslint$1.configs) || [])]
485
486
  });
486
487
  const enhancerResults = await core.applyEnhancers({
487
488
  results,
@@ -1421,78 +1422,10 @@ async function scaffoldTesting ({
1421
1422
  }) : {};
1422
1423
  return deepmerge__default["default"]({
1423
1424
  devDependencies: [...(unit || integration ? ['@travi/any'] : [])],
1424
- eslint: [],
1425
- eslintConfigs: []
1425
+ eslint: {}
1426
1426
  }, unitResults);
1427
1427
  }
1428
1428
 
1429
- async function scaffoldEslint ({
1430
- config,
1431
- projectRoot,
1432
- buildDirectory,
1433
- additionalConfiguration
1434
- }) {
1435
- const {
1436
- scope
1437
- } = config;
1438
- const {
1439
- ignore
1440
- } = additionalConfiguration;
1441
- const ignores = deepmerge__default["default"](ignore, {
1442
- directories: [`/${buildDirectory}/`]
1443
- });
1444
- return eslint.scaffold({
1445
- scope,
1446
- projectRoot,
1447
- ignore: {
1448
- directories: ignores.directories
1449
- }
1450
- });
1451
- }
1452
-
1453
- async function scaffoldRemark ({
1454
- config,
1455
- projectRoot,
1456
- projectType,
1457
- vcs,
1458
- dialect
1459
- }) {
1460
- await configFile.write({
1461
- format: core.fileTypes.JSON,
1462
- path: projectRoot,
1463
- name: 'remark',
1464
- config: {
1465
- settings: {
1466
- listItemIndent: 1,
1467
- emphasis: '_',
1468
- strong: '_',
1469
- bullet: '*',
1470
- incrementListMarker: false
1471
- },
1472
- plugins: [config, ['remark-toc', {
1473
- tight: true
1474
- }], ...(javascriptCore.projectTypes.PACKAGE === projectType ? [['remark-usage', {
1475
- heading: 'example'
1476
- }]] : []), ...(!vcs ? [['validate-links', {
1477
- repository: false
1478
- }]] : [])]
1479
- }
1480
- });
1481
- return deepmerge__default["default"]({
1482
- devDependencies: [config, 'remark-cli', 'remark-toc'],
1483
- scripts: {
1484
- 'lint:md': 'remark . --frail',
1485
- 'generate:md': 'remark . --output'
1486
- }
1487
- }, _objectSpread2({}, javascriptCore.projectTypes.PACKAGE === projectType && _objectSpread2({
1488
- devDependencies: ['remark-usage']
1489
- }, javascriptCore.dialects.COMMON_JS !== dialect && {
1490
- scripts: {
1491
- 'pregenerate:md': 'run-s build'
1492
- }
1493
- })));
1494
- }
1495
-
1496
1429
  function scaffoldBanSensitiveFiles ({
1497
1430
  pathWithinParent
1498
1431
  }) {
@@ -1554,32 +1487,15 @@ async function scaffoldLockfileLint ({
1554
1487
 
1555
1488
  async function scaffoldLinting ({
1556
1489
  projectRoot,
1557
- projectType,
1558
1490
  packageManager,
1559
- dialect,
1560
1491
  registries,
1561
- configs,
1562
1492
  vcs,
1563
- configureLinting,
1564
- buildDirectory,
1565
- pathWithinParent,
1566
- eslint
1493
+ pathWithinParent
1567
1494
  }) {
1568
1495
  return deepmerge__default["default"].all(await Promise.all([scaffoldLockfileLint({
1569
1496
  projectRoot,
1570
1497
  packageManager,
1571
1498
  registries
1572
- }), configs.eslint && configureLinting ? scaffoldEslint({
1573
- projectRoot,
1574
- config: configs.eslint,
1575
- buildDirectory,
1576
- additionalConfiguration: eslint
1577
- }) : {}, scaffoldRemark({
1578
- projectRoot,
1579
- projectType,
1580
- dialect,
1581
- vcs,
1582
- config: configs.remark || '@form8ion/remark-lint-preset'
1583
1499
  }), vcs ? scaffoldBanSensitiveFiles({
1584
1500
  pathWithinParent
1585
1501
  }) : {}]));
@@ -1587,22 +1503,17 @@ async function scaffoldLinting ({
1587
1503
 
1588
1504
  async function scaffoldVerification({
1589
1505
  projectRoot,
1590
- projectType,
1591
1506
  dialect,
1592
1507
  visibility,
1593
1508
  packageManager,
1594
1509
  vcs,
1595
- configs,
1596
1510
  registries,
1597
- configureLinting,
1598
1511
  tests,
1599
1512
  unitTestFrameworks,
1600
1513
  decisions,
1601
- buildDirectory,
1602
- eslintConfigs,
1603
1514
  pathWithinParent
1604
1515
  }) {
1605
- const [testingResults, huskyResults] = await Promise.all([scaffoldTesting({
1516
+ const [testingResults, lintingResults, huskyResults] = await Promise.all([scaffoldTesting({
1606
1517
  projectRoot,
1607
1518
  tests,
1608
1519
  visibility,
@@ -1611,29 +1522,109 @@ async function scaffoldVerification({
1611
1522
  decisions,
1612
1523
  dialect,
1613
1524
  pathWithinParent
1525
+ }), scaffoldLinting({
1526
+ projectRoot,
1527
+ packageManager,
1528
+ registries,
1529
+ vcs,
1530
+ pathWithinParent
1614
1531
  }), huskyPlugin.scaffold({
1615
1532
  projectRoot,
1616
1533
  packageManager,
1617
1534
  pathWithinParent
1618
1535
  })]);
1619
- const lintingResults = await scaffoldLinting({
1536
+ return deepmerge__default["default"].all([testingResults, lintingResults, huskyResults]);
1537
+ }
1538
+
1539
+ async function scaffoldEslint ({
1540
+ config,
1541
+ projectRoot,
1542
+ buildDirectory,
1543
+ additionalConfiguration
1544
+ }) {
1545
+ const {
1546
+ scope
1547
+ } = config;
1548
+ const {
1549
+ ignore
1550
+ } = additionalConfiguration;
1551
+ const ignores = deepmerge__default["default"](ignore, {
1552
+ directories: [`/${buildDirectory}/`]
1553
+ });
1554
+ return eslint.scaffold({
1555
+ scope,
1556
+ projectRoot,
1557
+ ignore: {
1558
+ directories: ignores.directories
1559
+ }
1560
+ });
1561
+ }
1562
+
1563
+ async function scaffoldRemark ({
1564
+ config,
1565
+ projectRoot,
1566
+ projectType,
1567
+ vcs,
1568
+ dialect
1569
+ }) {
1570
+ await configFile.write({
1571
+ format: core.fileTypes.JSON,
1572
+ path: projectRoot,
1573
+ name: 'remark',
1574
+ config: {
1575
+ settings: {
1576
+ listItemIndent: 1,
1577
+ emphasis: '_',
1578
+ strong: '_',
1579
+ bullet: '*',
1580
+ incrementListMarker: false
1581
+ },
1582
+ plugins: [config, ['remark-toc', {
1583
+ tight: true
1584
+ }], ...(javascriptCore.projectTypes.PACKAGE === projectType ? [['remark-usage', {
1585
+ heading: 'example'
1586
+ }]] : []), ...(!vcs ? [['validate-links', {
1587
+ repository: false
1588
+ }]] : [])]
1589
+ }
1590
+ });
1591
+ return deepmerge__default["default"]({
1592
+ devDependencies: [config, 'remark-cli', 'remark-toc'],
1593
+ scripts: {
1594
+ 'lint:md': 'remark . --frail',
1595
+ 'generate:md': 'remark . --output'
1596
+ }
1597
+ }, _objectSpread2({}, javascriptCore.projectTypes.PACKAGE === projectType && _objectSpread2({
1598
+ devDependencies: ['remark-usage']
1599
+ }, javascriptCore.dialects.COMMON_JS !== dialect && {
1600
+ scripts: {
1601
+ 'pregenerate:md': 'run-s build'
1602
+ }
1603
+ })));
1604
+ }
1605
+
1606
+ async function scaffoldCodeStyle ({
1607
+ projectRoot,
1608
+ projectType,
1609
+ dialect,
1610
+ configs,
1611
+ vcs,
1612
+ configureLinting,
1613
+ buildDirectory,
1614
+ eslint
1615
+ }) {
1616
+ return deepmerge__default["default"].all(await Promise.all([configs.eslint && configureLinting ? scaffoldEslint({
1617
+ projectRoot,
1618
+ config: configs.eslint,
1619
+ buildDirectory,
1620
+ additionalConfiguration: eslint
1621
+ }) : {}, scaffoldRemark({
1620
1622
  projectRoot,
1621
1623
  projectType,
1622
- packageManager,
1623
1624
  dialect,
1624
- configs,
1625
- registries,
1626
1625
  vcs,
1627
- configureLinting,
1628
- buildDirectory,
1629
- pathWithinParent,
1630
- eslint: deepmerge__default["default"].all([testingResults.eslint, {
1631
- configs: testingResults.eslintConfigs
1632
- }, {
1633
- configs: eslintConfigs
1634
- }])
1635
- });
1636
- return deepmerge__default["default"].all([testingResults, lintingResults, huskyResults]);
1626
+ config: configs.remark || '@form8ion/remark-lint-preset'
1627
+ })]));
1637
1628
  }
1638
1629
 
1639
1630
  async function scaffolder (options) {
@@ -1687,7 +1678,7 @@ async function scaffolder (options) {
1687
1678
  description,
1688
1679
  pathWithinParent
1689
1680
  });
1690
- const projectTypeResults = await scaffoldProjectType({
1681
+ const [projectTypeResults, verificationResults] = await Promise.all([scaffoldProjectType({
1691
1682
  projectType,
1692
1683
  projectRoot,
1693
1684
  projectName,
@@ -1704,25 +1695,19 @@ async function scaffolder (options) {
1704
1695
  decisions,
1705
1696
  dialect,
1706
1697
  publishRegistry: registries.publish
1707
- });
1708
- const verificationResults = await scaffoldVerification({
1698
+ }), scaffoldVerification({
1709
1699
  projectRoot,
1710
- projectType,
1711
1700
  dialect,
1712
- packageManager,
1713
1701
  visibility,
1702
+ packageManager,
1714
1703
  vcs,
1715
- configs,
1716
1704
  registries,
1717
- configureLinting,
1718
1705
  tests,
1719
1706
  unitTestFrameworks,
1720
1707
  decisions,
1721
- pathWithinParent,
1722
- buildDirectory: projectTypeResults.buildDirectory,
1723
- eslintConfigs: projectTypeResults.eslintConfigs
1724
- });
1725
- const [nodeVersion, npmResults, dialectResults] = await Promise.all([scaffoldNodeVersion({
1708
+ pathWithinParent
1709
+ })]);
1710
+ const [nodeVersion, npmResults, dialectResults, codeStyleResults] = await Promise.all([scaffoldNodeVersion({
1726
1711
  projectRoot,
1727
1712
  nodeVersionCategory
1728
1713
  }), scaffoldNpmConfig({
@@ -1736,6 +1721,15 @@ async function scaffolder (options) {
1736
1721
  projectType,
1737
1722
  buildDirectory: projectTypeResults.buildDirectory,
1738
1723
  testFilenamePattern: verificationResults.testFilenamePattern
1724
+ }), scaffoldCodeStyle({
1725
+ projectRoot,
1726
+ projectType,
1727
+ dialect,
1728
+ configs,
1729
+ vcs,
1730
+ configureLinting,
1731
+ buildDirectory: projectTypeResults.buildDirectory,
1732
+ eslint: verificationResults.eslint
1739
1733
  })]);
1740
1734
  const mergedContributions = deepmerge__default["default"].all([...(await Promise.all([javascriptCore.scaffoldChoice(hosts, chosenHost, {
1741
1735
  buildDirectory: `./${projectTypeResults.buildDirectory}`,
@@ -1755,7 +1749,7 @@ async function scaffolder (options) {
1755
1749
  projectType,
1756
1750
  configs,
1757
1751
  pathWithinParent
1758
- })])), projectTypeResults, verificationResults, npmResults, dialectResults]);
1752
+ })])), projectTypeResults, verificationResults, codeStyleResults, npmResults, dialectResults]);
1759
1753
  const liftResults = await lift({
1760
1754
  results: deepmerge__default["default"]({
1761
1755
  devDependencies: ['npm-run-all'],