Skip to content

Commit

Permalink
refactor: rework internals and external api
Browse files Browse the repository at this point in the history
This is a large rework of how the d2-style tool works in order to
simplify usage and allow for more flexible usage.

Notable changes:

- Removes lint-staged and removes automatically staging formatted files.

- Only runs checks when commiting by default to ensure consistency.

- Includes recommended ESLint rules in the default ESLint config.

- Includes a React project.

- Renames `setup` to `install` and adds a `--list-groups` option.
`install` is preferred to be able to pair it with an `uninstall` command
in the future.

- Adds command to use Prettier to format structured text files (html,
yaml, markdown, etc.).

- Uses `npx` internally to execute command binaries instead of relying
on the NodeJS API, this makes the entire code base a lot simpler to work
with and to add new commands.

- `check` and `apply` commands now accept a `--pattern` to match files.

- Uses `fast-glob` to grab all files that match a pattern, then filters
them against other parameters, e.g. if they are staged or if only a
single file is given.

BREAKING CHANGE: Removes LintStaged, renames `setup` to `install`,
removes `validate` command. Uses a different way to match files and
filters out results instead.
  • Loading branch information
varl committed Nov 22, 2019
1 parent 651eea6 commit 4d1a4eb
Show file tree
Hide file tree
Showing 51 changed files with 1,203 additions and 2,110 deletions.
2 changes: 1 addition & 1 deletion .browserslistrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
> 0.5%
last 2 versions
Firefox ESR
ie 11
not ie 11
not dead
26 changes: 13 additions & 13 deletions .dependabot/config.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
version: 1

update_configs:
- package_manager: "javascript"
directory: "/"
update_schedule: "daily"
version_requirement_updates: "increase_versions"
target_branch: "master"
automerged_updates:
- match:
dependency_name: "@dhis2/*"
dependency_type: "all"
update_type: "semver:minor"
- match:
dependency_type: "all"
update_type: "security:patch"
- package_manager: 'javascript'
directory: '/'
update_schedule: 'daily'
version_requirement_updates: 'increase_versions'
target_branch: 'master'
automerged_updates:
- match:
dependency_name: '@dhis2/*'
dependency_type: 'all'
update_type: 'semver:minor'
- match:
dependency_type: 'all'
update_type: 'security:patch'
4 changes: 4 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@ const { config } = require('./index.js')

module.exports = {
extends: [config.eslint],

env: {
es6: true,
},
}
9 changes: 7 additions & 2 deletions .huskyrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
const tasks = arr => arr.join(' && ')

module.exports = {
hooks: {
'commit-msg': './bin/d2-style commit check',
'pre-commit':
'yarn test && ./bin/d2-style validate --lint-staged-config .lint-stagedrc.js',
'pre-commit': tasks([
'./bin/d2-style js check --staged',
'./bin/d2-style text check --staged',
]),
'pre-push': 'yarn test',
},
}
10 changes: 0 additions & 10 deletions .lint-stagedrc.js

This file was deleted.

164 changes: 66 additions & 98 deletions CHANGELOG.md

Large diffs are not rendered by default.

Loading

0 comments on commit 4d1a4eb

Please sign in to comment.