Skip to content

Commit a4f0e35

Browse files
authored
Merge pull request #1 from ember-codemods/zhanwang/add-transforms
Implement `setup-test-helpers` and `setup-cli-build` transforms
2 parents 57f0a3b + b394372 commit a4f0e35

36 files changed

Lines changed: 8434 additions & 0 deletions

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
!.*
2+
__testfixtures__

.eslintrc.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
module.exports = {
2+
parserOptions: {
3+
ecmaVersion: 2018,
4+
},
5+
6+
plugins: ['prettier', 'node'],
7+
extends: ['eslint:recommended', 'plugin:prettier/recommended', 'plugin:node/recommended'],
8+
env: {
9+
node: true,
10+
},
11+
rules: {},
12+
overrides: [
13+
{
14+
files: ['__tests__/**/*.js'],
15+
env: {
16+
jest: true,
17+
},
18+
},
19+
],
20+
};

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/node_modules
2+
/.eslintcache

.prettierrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"singleQuote": true,
3+
"trailingComma": "es5",
4+
"printWidth": 100
5+
}

README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# ember-cli-code-coverage-setup-codemod
2+
3+
4+
A collection of codemods for ember-cli-code-coverage-setup-codemod.
5+
6+
## Usage
7+
8+
To run a specific codemod from this project, you would run the following:
9+
10+
```
11+
npx ember-cli-code-coverage-setup-codemod <TRANSFORM NAME> path/of/files/ or/some**/*glob.js
12+
13+
# or
14+
15+
yarn global add ember-cli-code-coverage-setup-codemod
16+
ember-cli-code-coverage-setup-codemod <TRANSFORM NAME> path/of/files/ or/some**/*glob.js
17+
```
18+
19+
## Local Usage
20+
```
21+
node ./bin/cli.js <TRANSFORM NAME> path/of/files/ or/some**/*glob.js
22+
```
23+
24+
## Transforms
25+
26+
<!--TRANSFORMS_START-->
27+
* [setup-cli-build](transforms/setup-cli-build/README.md)
28+
* [setup-test-helpers](transforms/setup-test-helpers/README.md)
29+
<!--TRANSFORMS_END-->
30+
31+
## Contributing
32+
33+
### Installation
34+
35+
* clone the repo
36+
* change into the repo directory
37+
* `yarn`
38+
39+
### Running tests
40+
41+
* `yarn test`
42+
43+
### Update Documentation
44+
45+
* `yarn update-docs`

RELEASE.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Release Process
2+
3+
Releases are mostly automated using
4+
[release-it](https://github.com/release-it/release-it/) and
5+
[lerna-changelog](https://github.com/lerna/lerna-changelog/).
6+
7+
## Preparation
8+
9+
Since the majority of the actual release process is automated, the primary
10+
remaining task prior to releasing is confirming that all pull requests that
11+
have been merged since the last release have been labeled with the appropriate
12+
`lerna-changelog` labels and the titles have been updated to ensure they
13+
represent something that would make sense to our users. Some great information
14+
on why this is important can be found at
15+
[keepachangelog.com](https://keepachangelog.com/en/1.0.0/), but the overall
16+
guiding principle here is that changelogs are for humans, not machines.
17+
18+
When reviewing merged PR's the labels to be used are:
19+
20+
- breaking - Used when the PR is considered a breaking change.
21+
- enhancement - Used when the PR adds a new feature or enhancement.
22+
- bug - Used when the PR fixes a bug included in a previous release.
23+
- documentation - Used when the PR adds or updates documentation.
24+
- internal - Used for internal changes that still require a mention in the
25+
changelog/release notes.
26+
27+
## Release
28+
29+
Once the prep work is completed, the actual release is straight forward:
30+
31+
- First, ensure that you have installed your projects dependencies:
32+
33+
```sh
34+
yarn install
35+
```
36+
37+
- Second, ensure that you have obtained a
38+
[GitHub personal access token][generate-token] with the `repo` scope (no
39+
other permissions are needed). Make sure the token is available as the
40+
`GITHUB_AUTH` environment variable.
41+
42+
For instance:
43+
44+
```bash
45+
export GITHUB_AUTH=abc123def456
46+
```
47+
48+
[generate-token]: https://github.com/settings/tokens/new?scopes=repo&description=GITHUB_AUTH+env+variable
49+
50+
- And last (but not least 😁) do your release.
51+
52+
```sh
53+
npx release-it
54+
```
55+
56+
[release-it](https://github.com/release-it/release-it/) manages the actual
57+
release process. It will prompt you to to choose the version number after which
58+
you will have the chance to hand tweak the changelog to be used (for the
59+
`CHANGELOG.md` and GitHub release), then `release-it` continues on to tagging,
60+
pushing the tag and commits, etc.

bin/cli.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env node
2+
'use strict';
3+
4+
require('codemod-cli').runTransform(
5+
__dirname,
6+
process.argv[2] /* transform name */,
7+
process.argv.slice(3) /* paths or globs */
8+
);

package.json

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"name": "ember-cli-code-coverage-setup-codemod",
3+
"version": "0.1.0",
4+
"scripts": {
5+
"lint": "eslint --cache .",
6+
"test": "codemod-cli test",
7+
"test:coverage": "codemod-cli test --coverage",
8+
"update-docs": "codemod-cli update-docs",
9+
"coveralls": "cat ./coverage/lcov.info | node node_modules/.bin/coveralls"
10+
},
11+
"bin": "./bin/cli.js",
12+
"keywords": [
13+
"codemod-cli"
14+
],
15+
"dependencies": {
16+
"codemod-cli": "^3.1.2"
17+
},
18+
"devDependencies": {
19+
"coveralls": "^3.0.7",
20+
"eslint": "^7.20.0",
21+
"eslint-config-prettier": "^7.2.0",
22+
"eslint-plugin-node": "^11.1.0",
23+
"eslint-plugin-prettier": "^3.3.1",
24+
"jest": "^26.6.3",
25+
"prettier": "^2.4.1",
26+
"release-it": "^14.2.1",
27+
"release-it-lerna-changelog": "^3.1.0"
28+
},
29+
"engines": {
30+
"node": "12.* || >= 14"
31+
},
32+
"jest": {
33+
"testEnvironment": "node"
34+
},
35+
"publishConfig": {
36+
"registry": "https://registry.npmjs.org"
37+
},
38+
"release-it": {
39+
"plugins": {
40+
"release-it-lerna-changelog": {
41+
"infile": "CHANGELOG.md",
42+
"launchEditor": true
43+
}
44+
},
45+
"git": {
46+
"tagName": "v${version}"
47+
},
48+
"github": {
49+
"release": true,
50+
"tokenRef": "GITHUB_AUTH"
51+
}
52+
}
53+
}

transforms/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)