mirror of
https://github.com/joshdick/onedark.vim.git
synced 2025-11-17 23:43:40 -05:00
chore(build): Build/linting infrastructure updates. (#276)
* Move npm/linting config files to root directory * Apply prettier/eslint autofixes * Update CONTRIBUTING.md
This commit is contained in:
@@ -14,23 +14,22 @@ The basic idea is that these files are generated by a build tool that substitute
|
||||
|
||||
Here are the locations of the files that are generated by the build system, along with the locations of the corresponding templates they are generated from:
|
||||
|
||||
| Theme Location | Template Location |
|
||||
|----------------------------------------------|------------------------------------------|
|
||||
| `autoload/onedark.vim` | `build/templates/autoload.template.vim` |
|
||||
| `term/One Dark.Xresources` | `build/templates/One Dark.Xresources` |
|
||||
| `term/One Dark.itermcolors` | `build/templates/One Dark.itermcolors` |
|
||||
| `term/One Dark.terminal` | `build/templates/One Dark.terminal` |
|
||||
| `term/One Dark.alacritty` | `build/templates/One Dark.alacritty` |
|
||||
| `term/One Dark.colorscheme` | `build/templates/One Dark.colorscheme` |
|
||||
| Theme Location | Template Location |
|
||||
| --------------------------- | --------------------------------------- |
|
||||
| `autoload/onedark.vim` | `build/templates/autoload.template.vim` |
|
||||
| `term/One Dark.Xresources` | `build/templates/One Dark.Xresources` |
|
||||
| `term/One Dark.itermcolors` | `build/templates/One Dark.itermcolors` |
|
||||
| `term/One Dark.terminal` | `build/templates/One Dark.terminal` |
|
||||
| `term/One Dark.alacritty` | `build/templates/One Dark.alacritty` |
|
||||
| `term/One Dark.colorscheme` | `build/templates/One Dark.colorscheme` |
|
||||
|
||||
### Configure It
|
||||
|
||||
1) Install [Node.js](https://nodejs.org/en/) (Installing via [nvm](https://github.com/creationix/nvm) or [homebrew](https://brew.sh) are both better options than the official Node.js installer.)
|
||||
1. Install [Node.js](https://nodejs.org/en/) (Installing via [nvm](https://github.com/creationix/nvm) or [homebrew](https://brew.sh) are both better options than the official Node.js installer.)
|
||||
|
||||
2) Run the following from within the root of this repository. This will install the build system's dependencies and will automatically configure a Git pre-commit hook that runs `npm test` (see below).
|
||||
2. Run the following from within the root of this repository. This will install the build system's dependencies and will automatically configure a Git pre-commit hook that runs `npm test` (see below).
|
||||
|
||||
```bash
|
||||
> cd build
|
||||
> npm install
|
||||
```
|
||||
|
||||
@@ -38,16 +37,17 @@ That's it!
|
||||
|
||||
### Use It
|
||||
|
||||
The build system consists of a single Node.js script, `build.js`, which supports two commands:
|
||||
The build system consists of a single Node.js script, `build/build.js`, which supports two commands:
|
||||
|
||||
* Running `./build.js` or `npm run build` generates theme files from the templates, **overwriting changes to the theme files without confirmation.**
|
||||
* Running `./build.js check` or `npm test` checks that the theme files match the template-generated output, **without modifying theme files**. This command ensures that the theme files perfectly match the templates they are generated from, which is useful for detecting changes that were made to generated theme files but that should have been made in the templates. (In addition to running `./build.js check`, `npm test` also runs [eslint](http://eslint.org) linting on the build system code to catch and prevent simple problems with changes to that code.)
|
||||
- Running `./build/build.js` or `npm run build` generates theme files from the templates, **overwriting changes to the theme files without confirmation.**
|
||||
- Running `./build/build.js check` or `npm test` checks that the theme files match the template-generated output, **without modifying theme files**. This command ensures that the theme files perfectly match the templates they are generated from, which is useful for detecting changes that were made to generated theme files but that should have been made in the templates.
|
||||
- In addition to running `./build/build.js check`, `npm test` also runs linting and style checks on certain files to catch and prevent simple problems and stylistic inconsistency. If `npm test` reports any issues, many reported issues can be automatically fixed by running `npm run lint:fix`.)
|
||||
|
||||
The basic development workflow looks like this:
|
||||
|
||||
1. Make changes to the appropriate template files in `build/templates`, then run `npm run build` from inside the `build` directory.
|
||||
1. Make changes to the appropriate template files in `build/templates`, then run `npm run build`.
|
||||
|
||||
2. Commit your change in Git. `npm test` will automatically run before your commit is finalized. If the test fails, fix any inconsistencies between the template files and theme files (or linting errors in `build.js` if applicable), then try committing again.
|
||||
2. Commit your changes with Git. `npm test` will automatically run before your commit is finalized. If the test fails, fix any inconsistencies between the template files and theme files (or linting/style errors if applicable), then try committing again.
|
||||
|
||||
## Style Guidelines
|
||||
|
||||
@@ -55,7 +55,7 @@ Please match the existing comment and whitespace style in all template files.
|
||||
|
||||
For the "Language-Specific Highlighting" portion of onedark.vim, blocks for each language should be organized alphabetically ("Markdown" comes before "PHP").
|
||||
|
||||
Any changes to the JavaScript code in the build system should pass against the included eslint rules; you can manually check for linting errors by running `npm test` from inside the `build` directory.
|
||||
All code changes should pass against the included linting and style checks. These checks are run via [husky](https://www.npmjs.com/package/husky) and [lint-staged](https://www.npmjs.com/package/lint-staged) when you attempt to commit changes. You can manually check for linting and stylistic issues by running `npm test`, and many reported issues can be automatically fixed by running `npm run lint:fix`.
|
||||
|
||||
## Thanks!
|
||||
|
||||
|
||||
Reference in New Issue
Block a user