Skip to content

Commit 5a7f23a

Browse files
authored
add contributing docs (#24)
1 parent b43a75c commit 5a7f23a

File tree

4 files changed

+66
-15
lines changed

4 files changed

+66
-15
lines changed

CONTRIBUTING.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# How To Contribute
2+
3+
## Installation
4+
5+
- `git clone https://github.com/jelhan/create-github-actions-setup-for-ember-addon.git`
6+
- `cd create-github-actions-setup-for-ember-addon`
7+
- `yarn install`
8+
9+
## Architecture
10+
11+
GitHub Actions CI workflow is created based on a template writen in [EJS](https://ejs.co/).
12+
It's located in `templates/.github/workflows/ci.yml`.
13+
14+
A configuration object is used to generate a concrete workflow based on the
15+
template. It is defined by `ConfigurationInterface`.
16+
17+
The data used is extracted from existing configuration files in the project.
18+
The utility functions responsible for parsing existing configurations are
19+
called parser. They are located in `src/parser/`. So far only TravisCI
20+
configuration (`.travis.yml`) is supported.
21+
22+
If no configuration file supported by any available parser is found, default
23+
values are used.
24+
25+
## Running latest development
26+
27+
The project is written in TypeScript. To use latest development you must first
28+
compile the code to JavaScript. Run `yarn compile` to do so.
29+
30+
Afterwards you can run latest development on any project. To do so change
31+
current working directory to the project and afterwards execute the script
32+
using a local path:
33+
`/path/to/create-github-actions-setup-for-ember-addon/bin/create-github-actions-setup-for-ember-addon`
34+
35+
## Linting
36+
37+
The project uses ESLint for linting and Prettier for code formatting. Prettier
38+
is integrated as an ESLint plugin.
39+
40+
Execute `yarn lint` to run linting and `yarn lint --fix` to automatically fix
41+
linting issues. The latter is especially helpful to prettify the code.
42+
43+
## Running tests
44+
45+
The tests are executed with `yarn test`. The command also takes care of
46+
compiling the TypeScript to JavaScript before executing the script.
47+
48+
The Tests are written with [jest](https://jestjs.io/).
49+
50+
The tests use [snapshot testing](https://jestjs.io/docs/en/snapshot-testing).
51+
A snapshot of the created GitHub Actions CI workflow is created for each test
52+
scenario. It's compared against snapshots created before. The snapshots are
53+
checked into the repository and located at `tests/acceptance/__snapshots__`.
54+
55+
The snaphot-based tests are expected to fail whenever the created GitHub
56+
Actions CI workflow changes. In many cases that changes may be expected. If so
57+
the snapshots must be updated. Run `yarn test -u` to do so.
58+
59+
Please double check that all changes to snapshots are as expected by your
60+
change before committing the changes.

README.md

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,10 @@ Merge requests are very much appreciated. Parts that could be improved are:
2525
- Only a very limited subset of common customizations of the default TravisCI configuration is supported. Would love to support more common patterns.
2626
- The script could be extended to allow the user to set configuration variables with command line flags rather than extracting them from an existing TravisCI configuration.
2727

28-
### Running latest development
29-
30-
The script is written in TypeScript. Therefore development branch can not be directly executed unless using [ts-node](https://github.com/TypeStrong/ts-node).
31-
32-
1. Compile TypScript to Javascript: `yarn compile`
33-
2. Change current working directory to the root of the project you want to setup GitHub Actions on.
34-
3. Run the script: `/path/to/script/bin/create-github-actions-setup-for-ember-addon`
35-
36-
### Testing
37-
38-
Tests are written with [jest](https://jestjs.io/) using [Snapshots Testing](https://jestjs.io/docs/en/snapshot-testing). A test ist autogenerated for every file in `tests/fixtures`. Please double check that the generated snapshot is correct when adding an additional file. Snapshot tests are passing if no snapshot exists yet.
39-
40-
The tests are executed by `yarn test`.
28+
Contributing documentation is provided in [CONTRIBUTING.md](CONTRIBUTING.md)
29+
to lower entry barrier. In case you face additional questions do not hesitate
30+
to either open an issue or contact me (@jelhan) on
31+
[Ember Community Discord](https://discord.gg/emberjs).
4132

4233
## License
4334

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import debug from './utils/debug';
22
import ejs from 'ejs';
33
import fs from 'fs';
4-
import parseTravisCiConfig from './utils/parse-travis-ci-config';
4+
import parseTravisCiConfig from './parser/travis-ci';
55
import path from 'path';
66
import process from 'process';
77

src/utils/parse-travis-ci-config.ts renamed to src/parser/travis-ci.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ConfigurationInterface } from '../index';
2-
import debug from './debug';
2+
import debug from '../utils/debug';
33
import fs from 'fs';
44
import path from 'path';
55
import process from 'process';

0 commit comments

Comments
 (0)