You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Problem
Want to add [`prettier`](https://prettier.io/) support mainly to make development easier so that code auto-formats on save. But if we have `prettier,` we might as well integrate it into CI somehow.
## Solution
The solution is multi-pronged:
- Added `.prettierrc.json` and `.vscode/settings.json` in order to have code formatting on save. This applies to all file times `.ts`, `.js`, `.json`, `.md`, etc
- Added a `.github/workflows/format.yml` workflow that runs the `prettier` CLI and overwrites the files with the changes. If there are file changes, it pushes a new auto-commit to the branch with new changes. That way any changes that were missed will get caught by CI. As a result of the push, CI will run _again_ and we can make sure that running `prettier` didn't break any test with malformed files. Since this was the first run of `prettier`, **lots** of files were updated
- Added `prettier` check as part of linting with [`@typescript-eslint/eslint-plugin`](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin). This will fail `benmvp test` if there are malformed files, but most should be fixable when running `benmvp start`
- `benmvp integrate` runs `benmvp test` within the `integration-tests/` project, but it needs the same `.prettierrc.json` so those are copied over as part of the script that runs the integration test
In the end, it'll be the responsibility of `benmvp start` to create a new project with prettier configs. They will be something that each library can change themselves, allowing a bit of configuration, but the idea is that they wouldn't be. I had to make the file part of the host library instead of within `benmvp-cli` in order to make the dev environment work properly.
BREAKING CHANGE: Although CI will auto-format, `benmvp test` will fail because prettier now runs on all the files
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,12 +4,12 @@ Thank you for your interest in contributing to my CLI!
4
4
5
5
## Table of Contents
6
6
7
-
*[Setup](#setup)
8
-
*[Branches](#using-branches-to-submit-changes)
9
-
*[Keeping up to date](#keeping-your-local-repo-up-to-date)
10
-
*[Creating issues](#creating-issues)
11
-
*[Working on and submitting changes](#working-on-and-submitting-changes)
12
-
*[Steps to submit](#steps-to-submit)
7
+
-[Setup](#setup)
8
+
-[Branches](#using-branches-to-submit-changes)
9
+
-[Keeping up to date](#keeping-your-local-repo-up-to-date)
10
+
-[Creating issues](#creating-issues)
11
+
-[Working on and submitting changes](#working-on-and-submitting-changes)
12
+
-[Steps to submit](#steps-to-submit)
13
13
14
14
## Setup
15
15
@@ -61,4 +61,4 @@ Please try to conform to the coding style of the code base.
61
61
1. Check to make sure that your changes are documented properly (inline comments for interesting lines, READMEs, etc.)
62
62
1. Run `npm test` to ensure that all tests pass, the linter is satisfied and your changes are typescript compliant.
63
63
1. PR titles must be prefixed by the type of changes the PR contains followed by the scope of what the PR touches. We are following the [angular commit guidelines](https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#-git-commit-guidelines). Please use one of `feat, fix, docs, style, refactor, perf, test, chore` as the prefix. The " is the the direct product your changes affect. Example: `chore(build): Add encrypted ssh key for semantic-release` because its a chore and it touches the build. For multiple scope items, you can comma separate 2 or 3 but if there are more than that please use a `*` instead.
64
-
1.Please use a [closing issue keyword](https://help.github.com/articles/closing-issues-using-keywords/) to indicate the issue that your fix addresses in the description section of the pull request template. Example: `fixes #32` to close issue #32
64
+
1. Please use a [closing issue keyword](https://help.github.com/articles/closing-issues-using-keywords/) to indicate the issue that your fix addresses in the description section of the pull request template. Example: `fixes #32` to close issue #32
Copy file name to clipboardExpand all lines: docs/api/create.md
+13-8Lines changed: 13 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,12 +2,16 @@
2
2
3
3
> NOTE: `create()` is still under development
4
4
5
-
6
5
Creates a new library with the specified name set up with infrastructure using `@benmvp/cli`, returning a `Promise` indicating whether the creation succeeded or failed.
7
6
7
+
It will:
8
+
8
9
- Add `"test"`, `"start"`, `"build"` and `"integrate"` scripts in the `package.json` to call [`benmvp test`](test.md), [`benmvp start`](start.md), [`benmvp build`](build.md), and [`benmvp integrate`](integrate.md), respectively
9
10
- After the `package.json` is created (or updated), it will install `@benmvp/cli` as a dev dependency, using [Yarn](https://yarnpkg.com/) if available. If Yarn is unavailable, it will fallback to [npm](https://docs.npmjs.com/)
10
-
- Will add (or overwrite) a `.travis.yml` file w/ [build stages](https://docs.travis-ci.com/user/build-stages/) for testing and deploying the library
11
+
- Add (or overwrite) `.prettierrc.json`, `.prettierignore` & `.vscode/settings.json` files to format all code
12
+
- Add (or overwrite) a `.github/workflows/ci.yml`[Github workflow](https://help.github.com/en/actions) for testing your code when a branch is pushed to or a PR is updated.
13
+
- Add (or overwrite) a `.github/workflows/format.yml`[Github workflow](https://help.github.com/en/actions) for formatting your files when a non-`master` branch is pushed to. Formatted code will be pushed as a new commit to the branch.
14
+
- Add (or overwrite) a `.github/workflows/release.yml`[Github workflow](https://help.github.com/en/actions) for release a new version of your package with new commits to `master`.
11
15
12
16
Looking for CLI docs? View companion [`benmvp create` documentation](../cli/create.md).
0 commit comments