Skip to content

Commit

Permalink
Merge pull request #65 from Spence-S/master
Browse files Browse the repository at this point in the history
Upgrade deps + husky
  • Loading branch information
spence-s authored Jul 9, 2021
2 parents 7d1cd6a + 110504a commit 65298bc
Show file tree
Hide file tree
Showing 14 changed files with 1,399 additions and 741 deletions.
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn commitlint --edit $1
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn lint-staged
6 changes: 0 additions & 6 deletions .huskyrc

This file was deleted.

2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ language: node_js
node_js:
- 10
- 12
- 14
- 15
script:
- npm run test-coverage
after_success:
Expand Down
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,13 @@ We highly recommend to use the tools [np][] and [release][] to version bump and

## Contributors

| Name | Website |
| ---------------- | ------------------------------ |
| **Nick Baugh** | <http://niftylettuce.com> |
| **Pablo Varela** | <http://pablo.life> |
| **Shaun Warman** | <http://shaunwarman.com> |
| **Imed Jaberi** | <https://www.3imed-jaberi.com> |
| Name | Website |
| ------------------ | ------------------------------ |
| **Nick Baugh** | <http://niftylettuce.com> |
| **Pablo Varela** | <http://pablo.life> |
| **Shaun Warman** | <http://shaunwarman.com> |
| **Imed Jaberi** | <https://www.3imed-jaberi.com> |
| **Spencer Snyder** | <https://spencersnyder.io> |


## Trademark Notice
Expand Down
45 changes: 23 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,44 +29,45 @@
"Nick Baugh <niftylettuce@gmail.com> (http://niftylettuce.com)",
"Pablo Varela (http://pablo.life)",
"Shaun Warman <shaunwarman1@gmail.com> (http://shaunwarman.com)",
"Imed Jaberi <imed_jebari@hotmail.fr> (https://www.3imed-jaberi.com)"
"Imed Jaberi <imed_jebari@hotmail.fr> (https://www.3imed-jaberi.com)",
"Spencer Snyder <sasnyde2@gmail.com> (https://spencersnyder.io)"
],
"dependencies": {
"cac": "^6.6.1",
"camelcase": "^6.1.0",
"cac": "^6.7.3",
"camelcase": "^6.2.0",
"cross-spawn": "^7.0.3",
"debug": "^4.2.0",
"execa": "^4.0.3",
"fixpack": "^3.0.6",
"github-username": "^5.0.1",
"debug": "^4.3.2",
"execa": "^5.1.1",
"fixpack": "^4.0.0",
"github-username": "^6.0.0",
"github-username-regex": "^1.0.0",
"global": "^4.4.0",
"is-email": "^1.0.0",
"is-email": "^1.0.1",
"is-url": "^1.2.4",
"is-valid-npm-name": "^0.0.5",
"npm-conf": "^1.1.3",
"sao": "0.x",
"semver": "^7.3.2",
"sao": "0",
"semver": "^7.3.5",
"shelljs": "^0.8.4",
"spdx-license-list": "^6.3.0",
"spdx-license-list": "^6.4.0",
"speakingurl": "^14.0.1",
"superb": "^4.0.0",
"update-notifier": "^5.0.0",
"update-notifier": "^5.1.0",
"uppercamelcase": "^3.0.0"
},
"devDependencies": {
"@commitlint/cli": "^11.0.0",
"@commitlint/config-conventional": "^11.0.0",
"ava": "^3.13.0",
"codecov": "^3.8.0",
"cross-env": "^7.0.2",
"eslint-config-xo-lass": "^1.0.4",
"husky": "^4.3.0",
"lint-staged": "^10.4.2",
"@commitlint/cli": "^12.1.4",
"@commitlint/config-conventional": "^12.1.4",
"ava": "^3.15.0",
"codecov": "^3.8.2",
"cross-env": "^7.0.3",
"eslint-config-xo-lass": "^1.0.5",
"husky": "^7.0.1",
"lint-staged": "^11.0.0",
"nyc": "^15.1.0",
"remark-cli": "^9.0.0",
"remark-preset-github": "^3.0.3",
"xo": "^0.34.0"
"remark-preset-github": "^4.0.1",
"xo": "^0.38.2"
},
"engines": {
"node": ">= 10"
Expand Down
58 changes: 55 additions & 3 deletions sao.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,13 @@ module.exports = {
'Select code coverage threshold required to pass (across lines/functions/branches)',
choices: ['100', '90', '80', '70', '60', '50', '40', '30', '20', '10'],
store: true
},
linter: {
message: 'Choose a linter.',
choices: ['eslint', 'xo'],
type: 'list',
default: 'xo',
store: true
}
},
move: {
Expand All @@ -164,7 +171,8 @@ module.exports = {
LICENSE: 'license === "MIT"',
// Until this issue is resolved we need this line:
// <https://github.com/saojs/sao/issues/59>
'node_modules/**': false
'node_modules/**': false,
'.eslintrc': 'linter === "eslint"'
},
post: async (ctx) => {
ctx.gitInit();
Expand Down Expand Up @@ -218,12 +226,56 @@ module.exports = {
if (ctx.answers.pm === 'yarn') ctx.yarnInstall();
else ctx.npmInstall();

// Format code with xo
await execa('./node_modules/.bin/xo', ['--fix'], {
// add husky hooks
await execa('./node_modules/.bin/husky', ['install'], {
cwd: ctx.folderPath,
stdio: 'inherit'
});

await Promise.all([
execa(
'./node_modules/.bin/husky',
[
'add',
'.husky/commit-msg',
`${
ctx.answers.pm === 'yarn' ? 'yarn' : 'npx --no-install'
} commitlint --edit $1`
],
{
cwd: ctx.folderPath,
stdio: 'inherit'
}
),
execa(
'./node_modules/.bin/husky',
[
'add',
'.husky/pre-commit',
`${
ctx.answers.pm === 'yarn' ? 'yarn' : 'npx --no-install'
} lint-staged`
],
{
cwd: ctx.folderPath,
stdio: 'inherit'
}
)
]);

// Format code with xo
if (ctx.answers.linter === 'eslint') {
await execa('./node_modules/.bin/eslint', ['.', '--fix'], {
cwd: ctx.folderPath,
stdio: 'inherit'
});
} else {
await execa('./node_modules/.bin/xo', ['--fix'], {
cwd: ctx.folderPath,
stdio: 'inherit'
});
}

// Run tests
await execa(which(ctx.answers.pm).stdout, ['test'], {
cwd: ctx.folderPath,
Expand Down
16 changes: 16 additions & 0 deletions template/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"root": true,
"extends": [
"plugin:node/recommended",
"plugin:import/recommended",
"plugin:promise/recommended",
"plugin:unicorn/recommended",
"plugin:ava/recommended",
"xo",
"plugin:prettier/recommended"
],
"rules": {
"node/no-unpublished-require": "off",
"unicorn/prefer-module": "off"
}
}
6 changes: 0 additions & 6 deletions template/.huskyrc

This file was deleted.

21 changes: 19 additions & 2 deletions template/package
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"contributors": ["<%- author %> <<%- email %>> (<%- website%>)"],
"license": "MIT",
"scripts": {
"lint:js": "xo",
"lint:js": "<%- linter %> <% if (linter === 'eslint') { %>.<% } %>",
"lint:md": "remark . -qfo",
"lint": "<%- pm %> run lint:js && <%- pm %> run lint:md",
"pretest": "<%- pm %> run lint",
Expand All @@ -27,6 +27,19 @@
"@commitlint/config-conventional": "latest",
"ava": "latest",
"codecov": "latest",
<% if (linter === 'eslint') { %>
"eslint": "latest",
"eslint-config-prettier": "latest",
"eslint-config-xo": "latest",
"eslint-plugin-ava": "latest",
"eslint-plugin-compat": "latest",
"eslint-plugin-import": "latest",
"eslint-plugin-node": "latest",
"eslint-plugin-prettier": "latest",
"eslint-plugin-promise": "latest",
"eslint-plugin-unicorn": "latest",
"prettier": "latest",
<% } %>
"cross-env": "latest",
"eslint": "latest",
"fixpack": "latest",
Expand All @@ -35,16 +48,20 @@
"nyc": "latest",
"remark-cli": "latest",
"remark-preset-github": "latest",
<% if (linter==='xo') {%>
"eslint-config-xo-lass": "latest",
"xo": "latest"
"xo": "^0.39.1"
<% } %>
},
<% if (linter === 'xo') { %>
"xo": {
"prettier": true,
"space": true,
"extends": [
"xo-lass"
]
},
<% } %>
"engines": {
"node": ">= 10"
},
Expand Down
1 change: 0 additions & 1 deletion test/snapshots/test.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ Generated by [AVA](https://avajs.dev).
'.editorconfig',
'.gitattributes',
'.gitignore',
'.huskyrc',
'.lintstagedrc.js',
'.npmignore',
'.nycrc',
Expand Down
Binary file modified test/snapshots/test.js.snap
Binary file not shown.
Loading

0 comments on commit 65298bc

Please sign in to comment.