Skip to content

Commit

Permalink
chore: rename "master" to "main" (#361)
Browse files Browse the repository at this point in the history
* chore: rename "master" to "main"

* fix: not a valid object name affected:e2e

* fix: not a valid object name affected:e2e

* fix: run all e2e tests

* fix: run lint, test and build on affected files

* ci: handle e2e by running them always

Co-authored-by: Jefiozie <jefiozie.bosch@gmail.com>
  • Loading branch information
manekinekko and Jefiozie committed Sep 16, 2020
1 parent f6671d8 commit 1c738ef
Show file tree
Hide file tree
Showing 9 changed files with 106 additions and 93 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/pr_on_development.yml
Expand Up @@ -3,7 +3,7 @@ name: affected_on_development
on:
pull_request:
branches:
- master
- main
types: [opened, reopened, synchronize]

jobs:
Expand All @@ -23,7 +23,7 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
- name: Fetch other branches
run: git fetch --no-tags --prune --depth=5 origin master
run: git fetch --no-tags --prune --depth=5 origin main

- name: Cache node modules
uses: actions/cache@v1
Expand All @@ -41,13 +41,13 @@ jobs:
- name: Install environment
run: npm install
- name: Run lint
run: npm run affected:lint -- --base=origin/master --head= ${{ github.event.pull_request.head.ref }}
run: npm run affected:lint -- --base=remotes/origin/main --head=${{ github.event.pull_request.head.ref }}
- name: Tests coverage
run: npm run affected:test -- --base=origin/master --head= ${{ github.event.pull_request.head.ref }} --codeCoverage
run: npm run affected:test -- --base=remotes/origin/main --head=${{ github.event.pull_request.head.ref }} --codeCoverage
- name: Tests E2e
run: npm run nx affected:e2e --base=origin/master~1 --head= ${{ github.event.pull_request.head.ref }} --parallel=true --with-deps=true
run: npm run nx e2e
- name: Build
run: npm run affected:build -- --base=origin/master --head= ${{ github.event.pull_request.head.ref }}
run: npm run affected:build -- --base=remotes/origin/main --head=${{ github.event.pull_request.head.ref }}
- name: Stamp
run: npm run stamp

8 changes: 4 additions & 4 deletions .github/workflows/push_on_master.yml
Expand Up @@ -2,7 +2,7 @@ name: mainworkflow

on:
push:
branches: [ master ]
branches: [ main ]

jobs:
build:
Expand Down Expand Up @@ -35,9 +35,9 @@ jobs:
- name: Tests coverage
run: npm run nx run-many -- --target=test --all --codeCoverage
- name: Tests E2e
run: npm run nx affected:e2e --base=origin/master~1 --head=origin/master --parallel=true --with-deps=true
run: npm run nx e2e
- name: Build
run: npm run nx affected:build --base=origin/master~1 --head=origin/master --parallel=true --with-deps=true --prod
run: npm run nx affected:build --base=origin/main~1 --head=origin/main --parallel=true --with-deps=true --prod
- name: Stamp
run: npm run stamp

165 changes: 89 additions & 76 deletions CONTRIBUTING.md
Expand Up @@ -4,14 +4,15 @@ We would love for you to contribute to xLayers and help make it even better
than it is today! As a contributor, here are the guidelines we would like you
to follow:

- [Code of Conduct](#coc)
- [Issues and Bugs](#issue)
- [Feature Requests](#feature)
- [Submission Guidelines](#submit)
- [Coding Rules](#rules)
- [Commit Message Guidelines](#commit)
- [Code of Conduct](#coc)
- [Issues and Bugs](#issue)
- [Feature Requests](#feature)
- [Submission Guidelines](#submit)
- [Coding Rules](#rules)
- [Commit Message Guidelines](#commit)

## <a name="coc"></a> Code of Conduct

xLayers follows the same Code of Condut as Angular. You can read it [here](https://github.com/angular/code-of-conduct/blob/master/CODE_OF_CONDUCT.md).

## <a name="question"></a> Got a Question or Problem?
Expand All @@ -27,13 +28,15 @@ Stack Overflow is a much better place to ask questions since:
To save your and our time, we will systematically close all issues that are requests for general support and redirect people to Stack Overflow.

## <a name="issue"></a> Found an Issue?

If you find a bug in the source code or a mistake in the documentation, you can help us by
[submitting an issue](#submit-issue) to our [GitHub Repository][github]. Even better, you can
[submit a Pull Request](#submit-pr) with a fix.

## <a name="feature"></a> Want a Feature?
You can *request* a new feature by [submitting an issue](#submit-issue) to our [GitHub
Repository][github]. If you would like to *implement* a new feature, please submit an issue with

You can _request_ a new feature by [submitting an issue](#submit-issue) to our [GitHub
Repository][github]. If you would like to _implement_ a new feature, please submit an issue with
a proposal for your work first, to be sure that we can use it.

## <a name="submit"></a> Submission Guidelines
Expand All @@ -57,45 +60,47 @@ Unfortunately we are not able to investigate / fix bugs without a minimal reprod

You can file new issues by filling out our [new issue form](https://github.com/xlayers/xlayers/issues/new).


### <a name="submit-pr"></a> Submitting a Pull Request (PR)

Before you submit your Pull Request (PR) consider the following guidelines:

* Search [GitHub](https://github.com/xlayers/xlayers/pulls) for an open or closed PR
- Search [GitHub](https://github.com/xlayers/xlayers/pulls) for an open or closed PR
that relates to your submission. You don't want to duplicate effort.
* Make your changes in a new git branch:
- Make your changes in a new git branch:

```shell
git checkout -b my-fix-branch master
```
```shell
git checkout -b my-fix-branch main
```

* Create your patch, **including appropriate test cases**.
* Follow our [Coding Rules](#rules).
* Run the full test suite, as described in the [developer documentation][dev-doc],
- Create your patch, **including appropriate test cases**.
- Follow our [Coding Rules](#rules).
- Run the full test suite, as described in the [developer documentation][dev-doc],
and ensure that all tests pass (if applicable).
* Commit your changes using a descriptive commit message that follows our
- Commit your changes using a descriptive commit message that follows our
[commit message conventions](#commit). Adherence to these conventions
is necessary because release notes are automatically generated from these messages.

```shell
git commit -a
```
```shell
git commit -a
```

Note: the optional commit `-a` command line option will automatically "add" and "rm" edited files.

* Push your branch to GitHub:
- Push your branch to GitHub:

```shell
git push origin my-fix-branch
```
```shell
git push origin my-fix-branch
```

- In GitHub, send a pull request to `xlayers:main`.
- If we suggest changes then:

* In GitHub, send a pull request to `xlayers:master`.
* If we suggest changes then:
* Make the required updates.
* Re-run the test suites to ensure tests are still passing.
* Rebase your branch and force push to your GitHub repository (this will update your Pull Request):
- Make the required updates.
- Re-run the test suites to ensure tests are still passing.
- Rebase your branch and force push to your GitHub repository (this will update your Pull Request):

```shell
git rebase master -i
git rebase main -i
git push -f
```

Expand All @@ -106,46 +111,48 @@ That's it! Thank you for your contribution!
After your pull request is merged, you can safely delete your branch and pull the changes
from the main (upstream) repository:

* Delete the remote branch on GitHub either through the GitHub web UI or your local shell as follows:
- Delete the remote branch on GitHub either through the GitHub web UI or your local shell as follows:

```shell
git push origin --delete my-fix-branch
```
```shell
git push origin --delete my-fix-branch
```

* Check out the master branch:
- Check out the main branch:

```shell
git checkout master -f
```
```shell
git checkout main -f
```

* Delete the local branch:
- Delete the local branch:

```shell
git branch -D my-fix-branch
```
```shell
git branch -D my-fix-branch
```

* Update your master with the latest upstream version:
- Update your main with the latest upstream version:

```shell
git pull --ff upstream master
```
```shell
git pull --ff upstream main
```

## <a name="rules"></a> Coding Rules

To ensure consistency throughout the source code, keep these rules in mind as you are working:

* All features or bug fixes **must be tested** by one or more specs (unit-tests or e2e-tests).
* All public API methods **must be documented**.
* We follow [Google's JavaScript Style Guide][js-style-guide], but wrap all code at
- All features or bug fixes **must be tested** by one or more specs (unit-tests or e2e-tests).
- All public API methods **must be documented**.
- We follow [Google's JavaScript Style Guide][js-style-guide], but wrap all code at
**100 characters**.

## <a name="commit"></a> Commit Message Guidelines

We have very precise rules over how our git commit messages can be formatted. This leads to **more
readable messages** that are easy to follow when looking through the **project history**. But also,
We have very precise rules over how our git commit messages can be formatted. This leads to **more
readable messages** that are easy to follow when looking through the **project history**. But also,
we use the git commit messages to **generate the xLayers change log**.

### Commit Message Format
Each commit message consists of a **header**, a **body** and a **footer**. The header has a special

Each commit message consists of a **header**, a **body** and a **footer**. The header has a special
format that includes a **type**, a **scope** and a **subject**:

```
Expand All @@ -162,52 +169,58 @@ Any line of the commit message cannot be longer 100 characters! This allows the
to read on GitHub as well as in various git tools.

### Revert
If the commit reverts a previous commit, it should begin with `revert: `, followed by the header of the reverted commit. In the body it should say: `This reverts commit <hash>.`, where the hash is the SHA of the commit being reverted.

If the commit reverts a previous commit, it should begin with `revert:`, followed by the header of the reverted commit. In the body it should say: `This reverts commit <hash>.`, where the hash is the SHA of the commit being reverted.

### Type

Must be one of the following:

* **build**: Changes that affect the build system or external dependencies
* **ci**: Changes to our CI configuration files and scripts
* **docs**: Documentation only changes
* **feat**: A new feature
* **fix**: A bug fix
* **perf**: A code change that improves performance
* **refactor**: A code change that neither fixes a bug nor adds a feature
* **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing
- **build**: Changes that affect the build system or external dependencies
- **ci**: Changes to our CI configuration files and scripts
- **docs**: Documentation only changes
- **feat**: A new feature
- **fix**: A bug fix
- **perf**: A code change that improves performance
- **refactor**: A code change that neither fixes a bug nor adds a feature
- **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing
semi-colons, etc)
* **test**: Adding missing tests or correcting existing tests
- **test**: Adding missing tests or correcting existing tests

### Scope

The scope should be the name of the module affected as perceived by the person reading changelog generated from the commit messages.

The following is the list of supported scopes (there might be more added in the fututre):

* **core**
* **editor**
* **home**
* **upload**
* **codegen**
* **parser**
- **core**
- **editor**
- **home**
- **upload**
- **codegen**
- **parser**

There are currently a few exceptions to the "use package name" rule:

* **packaging**: used for changes that change the npm package layout in all of our packages, e.g. public path changes, package.json changes done to all packages, d.ts file/format changes, changes to bundles, etc.
* **changelog**: used for updating the release notes in CHANGELOG.md
* none/empty string: useful for `style`, `test` and `refactor` changes that are done across all packages (e.g. `style: add missing semicolons`)
- **packaging**: used for changes that change the npm package layout in all of our packages, e.g. public path changes, package.json changes done to all packages, d.ts file/format changes, changes to bundles, etc.
- **changelog**: used for updating the release notes in CHANGELOG.md
- none/empty string: useful for `style`, `test` and `refactor` changes that are done across all packages (e.g. `style: add missing semicolons`)

### Subject

The subject contains succinct description of the change:

* use the imperative, present tense: "change" not "changed" nor "changes"
* don't capitalize first letter
* no dot (.) at the end
- use the imperative, present tense: "change" not "changed" nor "changes"
- don't capitalize first letter
- no dot (.) at the end

### Body

Just as in the **subject**, use the imperative, present tense: "change" not "changed" nor "changes".
The body should include the motivation for the change and contrast this with previous behavior.

### Footer

The footer should contain any information about **Breaking Changes** and is also the place to
reference GitHub issues that this commit **Closes**.

Expand All @@ -218,6 +231,6 @@ A detailed explanation can be found in this [document][commit-message-format].
[coc]: https://github.com/angular/code-of-conduct/blob/master/CODE_OF_CONDUCT.md
[commit-message-format]: https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit#
[dev-doc]: https://github.com/angular/angular-cli#development-hints-for-working-on-angular-cli
[GitHub]: https://github.com/xlayers/xlayers
[github]: https://github.com/xlayers/xlayers
[js-style-guide]: https://google.github.io/styleguide/jsguide.html
[stackoverflow]: http://stackoverflow.com/questions/tagged/xlayers
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -59,7 +59,7 @@ The xLayers project is driven by community contributions. Please send us your Pu

## Want to help? [![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/xlayers/xlayers/issues)

Want to file a bug, contribute some code, or improve the documentation? Excellent! Read up on our guidelines for [contributing](https://github.com/xlayers/xlayers/blob/master/CONTRIBUTING.md) and then check out one of our issues in the hotlist: [community-help](https://github.com/xlayers/xlayers/issues).
Want to file a bug, contribute some code, or improve the documentation? Excellent! Read up on our guidelines for [contributing](https://github.com/xlayers/xlayers/blob/main/CONTRIBUTING.md) and then check out one of our issues in the hotlist: [community-help](https://github.com/xlayers/xlayers/issues).

## Contributors

Expand Down
2 changes: 1 addition & 1 deletion apps/xlayers/src/app/core/preview-badge.service.ts
Expand Up @@ -23,7 +23,7 @@ export class PreviewBadgeService {
) {
return this.translateService.instant('BADGE_SERVICE.LOCAL');
} else if (hostname.startsWith('next.')) {
return this.translateService.instant('BADGE_SERVICE.MASTER');
return this.translateService.instant('BADGE_SERVICE.MAIN');
} else if (hostname.includes('netlify')) {
return this.translateService.instant('BADGE_SERVICE.PR');
}
Expand Down
4 changes: 2 additions & 2 deletions apps/xlayers/src/app/editor/preview-badge.service.spec.ts
Expand Up @@ -26,13 +26,13 @@ describe('PreviewBadgeService', () => {
expect(badge).toBe('BADGE_SERVICE.LOCAL');
});

it('should set badge to MASTER PREVIEW when running on next', () => {
it('should set badge to MAIN PREVIEW when running on next', () => {
TestBed.overrideProvider(WINDOW, {
useValue: { location: { hostname: 'next.' } },
});
const service: PreviewBadgeService = TestBed.inject(PreviewBadgeService);
const badge = service.computeBadge();
expect(badge).toBe('BADGE_SERVICE.MASTER');
expect(badge).toBe('BADGE_SERVICE.MAIN');
});

it('should set badge to PR PREVIEW when running on netlify', () => {
Expand Down
2 changes: 1 addition & 1 deletion apps/xlayers/src/assets/i18n/en.json
Expand Up @@ -51,7 +51,7 @@
},
"BADGE_SERVICE": {
"LOCAL": "LOCAL PREVIEW",
"MASTER": "MASTER PREVIEW",
"MAIN": "MAIN PREVIEW",
"PR": "PR PREVIEW"
},
"PREVIEW": {
Expand Down
2 changes: 1 addition & 1 deletion apps/xlayers/src/assets/i18n/nl.json
Expand Up @@ -51,7 +51,7 @@
},
"BADGE_SERVICE": {
"LOCAL": "LOKAAL PREVIEW",
"MASTER": "MASTER PREVIEW",
"MAIN": "MAIN PREVIEW",
"PR": "PR PREVIEW"
},
"PREVIEW": {
Expand Down
2 changes: 1 addition & 1 deletion nx.json
Expand Up @@ -73,6 +73,6 @@
}
},
"affected": {
"defaultBase": "master"
"defaultBase": "main"
}
}

0 comments on commit 1c738ef

Please sign in to comment.