Skip to content

Commit 943c13a

Browse files
authored
ci: add prettier check
2 parents b8dbf6b + 5242486 commit 943c13a

File tree

16 files changed

+132
-91
lines changed

16 files changed

+132
-91
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,32 @@
11
---
22
name: 🐞 Bug report
33
about: Create a report to help us improve
4-
title: "[BUG] "
4+
title: '[BUG] '
55
labels: ''
6-
76
---
87

98
# 🐞 Bug report
109

1110
### Description
12-
<!-- A clear and concise description of what the bug is -->
1311

12+
<!-- A clear and concise description of what the bug is -->
1413

1514
### Reproduction
15+
1616
<!-- Steps to reproduce or, preferably, a demo on StackBlitz or similar service -->
17+
1718
http://www.stackblitz.com/...
1819

1920
### Expected behavior
21+
2022
<!-- A clear and concise description of what you expected to happen -->
2123

2224
### Versions
23-
- OS: [e.g. iOS]
24-
- Browser [e.g. chrome, safari]
25-
- Angular [e.g. 8]
25+
26+
- OS: [e.g. iOS]
27+
- Browser [e.g. chrome, safari]
28+
- Angular [e.g. 8]
2629

2730
### Additional context
31+
2832
<!-- Add any other context about the problem here -->
+5-2
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,28 @@
11
---
22
name: 🚀 Feature request
33
about: Suggest an idea for this project
4-
title: "[FEATURE]"
4+
title: '[FEATURE]'
55
labels: ''
6-
76
---
87

98
# 🚀 Feature request
109

1110
### Is your feature request related to a problem?
11+
1212
<!-- A clear and concise description of what the problem is. Ex. -->
1313
<!-- ✍️edit: --> I'm always frustrated when...
1414

1515
### Describe the solution you'd like
16+
1617
<!-- A clear and concise description of what you want to happen -->
1718
<!-- ✍️edit: -->
1819

1920
### Describe alternatives you've considered
21+
2022
<!-- A clear and concise description of any alternative solutions or features you've considered -->
2123
<!-- ✍️edit: -->
2224

2325
### Additional context
26+
2427
<!-- Add any other context or screenshots about the feature request here -->
2528
<!-- ✍️edit: -->

.github/PULL_REQUEST_TEMPLATE.md

+12-15
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,35 @@
11
## PR Checklist
2-
Please check if your PR fulfills the following requirements:
32

4-
- [ ] The commit message follows [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0-beta.4/)
5-
- [ ] Tests for the changes have been added (for bug fixes / features)
6-
- [ ] Docs have been added / updated (for bug fixes / features)
3+
Please check if your PR fulfills the following requirements:
74

5+
- [ ] The commit message follows [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0-beta.4/)
6+
- [ ] Tests for the changes have been added (for bug fixes / features)
7+
- [ ] Docs have been added / updated (for bug fixes / features)
88

99
## PR Type
10+
1011
What kind of change does this PR introduce?
1112

1213
<!-- Please check the one that applies to this PR using "x". -->
1314

14-
- [ ] Bugfix
15-
- [ ] Feature
16-
- [ ] Refactoring (no functional changes, no api changes)
17-
- [ ] Other... Please describe:
18-
15+
- [ ] Bugfix
16+
- [ ] Feature
17+
- [ ] Refactoring (no functional changes, no api changes)
18+
- [ ] Other... Please describe:
1919

2020
## What is the current behavior?
21+
2122
<!-- Please describe the current behavior that you are modifying, or link to a relevant issue. -->
2223

2324
Issue Number: N/A
2425

25-
2626
## What is the new behavior?
2727

28-
2928
## Does this PR introduce a breaking change?
3029

31-
- [ ] Yes
32-
- [ ] No
33-
30+
- [ ] Yes
31+
- [ ] No
3432

3533
<!-- If this PR contains a breaking change, please describe the impact and migration path for existing applications below. -->
3634

37-
3835
## Other information

.github/actions/nodejs/action.yml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Action for Node.js
2+
description: Node.js setup cache
3+
4+
inputs:
5+
node-version:
6+
description: Node.js version
7+
required: false
8+
default: 16.x
9+
10+
runs:
11+
using: composite
12+
steps:
13+
- name: Use Node.js ${{ inputs.node-version }}
14+
uses: actions/setup-node@v3
15+
with:
16+
node-version: ${{ inputs.node-version }}
17+
registry-url: 'https://registry.npmjs.org'
18+
19+
- name: Restore node_modules from cache
20+
id: cache-node-modules
21+
uses: actions/cache@v3
22+
with:
23+
path: |
24+
node_modules
25+
*/*/node_modules/
26+
!node_modules/.cache
27+
!*/*/node_modules/.cache
28+
key: modules-cache__nodejs-${{ inputs.node-version }}__${{ hashfiles('**/package-lock.json') }}
29+
30+
- name: Restore from cache of builds
31+
id: build-cache
32+
if: steps.cache-node-modules.outputs.cache-hit == 'true'
33+
uses: actions/cache@v3
34+
with:
35+
path: |
36+
node_modules/.cache
37+
*/*/node_modules/.cache
38+
key: builds-cache-hash__${{ hashFiles('**/package-lock.json') }}-${{ github.ref }}
39+
restore-keys: builds-cache__nodejs-${{ inputs.node-version }}__${{ hashFiles('**/package-lock.json') }}
40+
41+
- name: Restore from global NPM cache
42+
if: steps.cache-node-modules.outputs.cache-hit != 'true'
43+
uses: actions/cache@v3
44+
with:
45+
path: ~/.npm
46+
key: npm-cache__nodejs-${{ inputs.node-version }}__${{ hashFiles('**/package-lock.json') }}
47+
restore-keys: npm-cache-hash__
48+
49+
- run: npm ci
50+
if: steps.cache-node-modules.outputs.cache-hit != 'true'
51+
shell: bash

.github/workflows/ci.yml

+19-28
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,23 @@
11
name: CI of all packages
2-
32
on: push
43

54
jobs:
6-
build:
7-
runs-on: ubuntu-latest
8-
steps:
9-
- uses: actions/checkout@v2
10-
- name: Use Node.js
11-
uses: actions/setup-node@v1
12-
with:
13-
node-version: '12.x'
14-
- name: Cache Node.js modules
15-
uses: actions/cache@v2
16-
with:
17-
path: ~/.npm
18-
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
19-
restore-keys: |
20-
${{ runner.OS }}-node-
21-
${{ runner.OS }}-
22-
- name: Install dependencies
23-
run: npm ci
24-
- name: CI checks
25-
run: |
26-
npm run build
27-
npm run lint
28-
npm run test
29-
- name: Coveralls
30-
uses: coverallsapp/github-action@master
31-
with:
32-
github-token: ${{ secrets.GITHUB_TOKEN }}
5+
build:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v2
9+
- name: Setup Node.js and Cache
10+
uses: ./.github/actions/nodejs
11+
12+
- name: Install dependencies
13+
run: npm ci
14+
- name: CI checks
15+
run: |
16+
npm run build
17+
npm run format -- --check
18+
npm run lint
19+
npm run test
20+
- name: Coveralls
21+
uses: coverallsapp/github-action@master
22+
with:
23+
github-token: ${{ secrets.GITHUB_TOKEN }}

.prettierignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
**/dist/**
2+
**/coverage/**
3+
**/schematics/*/files/**/*
4+
package-lock.json

CODE_OF_CONDUCT.md

+13-13
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,22 @@ appearance, race, religion, or sexual identity and orientation.
1414
Examples of behavior that contributes to creating a positive environment
1515
include:
1616

17-
* Using welcoming and inclusive language
18-
* Being respectful of differing viewpoints and experiences
19-
* Gracefully accepting constructive criticism
20-
* Focusing on what is best for the community
21-
* Showing empathy towards other community members
17+
- Using welcoming and inclusive language
18+
- Being respectful of differing viewpoints and experiences
19+
- Gracefully accepting constructive criticism
20+
- Focusing on what is best for the community
21+
- Showing empathy towards other community members
2222

2323
Examples of unacceptable behavior by participants include:
2424

25-
* The use of sexualized language or imagery and unwelcome sexual attention or
26-
advances
27-
* Trolling, insulting/derogatory comments, and personal or political attacks
28-
* Public or private harassment
29-
* Publishing others' private information, such as a physical or electronic
30-
address, without explicit permission
31-
* Other conduct which could reasonably be considered inappropriate in a
32-
professional setting
25+
- The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
- Trolling, insulting/derogatory comments, and personal or political attacks
28+
- Public or private harassment
29+
- Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
- Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
3333

3434
## Our Responsibilities
3535

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"add": "schematics ./schematics/collection.json:library-starter --debug=false",
1818
"postadd": "git add ./projects",
1919
"lint": "ng lint",
20+
"format": "prettier '**/*.{svg,yml,js,ts,html,md,less,json}'",
2021
"lint:less": "stylelint '**/*.less'",
2122
"typecheck": "tsc --noEmit --skipLibCheck",
2223
"release": "standard-version",

projects/demo/src/app/app.component.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<blockquote>
2-
Import from your library in this demo project as if you were using it as an NPM package
2+
Import from your library in this demo project as if you were using it as an NPM
3+
package
34
</blockquote>
45
<blockquote>
56
<a routerLink="." style="margin-right: 16px">Static component</a>

projects/demo/src/app/modules/lazy/lazy.module.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ export const routes: Routes = [
1010
];
1111

1212
@NgModule({
13-
imports: [
14-
RouterModule.forChild(routes),
15-
],
13+
imports: [RouterModule.forChild(routes)],
1614
declarations: [LazyComponent],
1715
exports: [LazyComponent],
1816
})
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
<p>
2-
This is a lazy route
3-
</p>
1+
<p>This is a lazy route</p>
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import {NgModule} from '@angular/core';
22
import {StaticComponent} from './static.component';
33

4-
@NgModule({declarations: [StaticComponent],
5-
exports: [StaticComponent],
6-
})
4+
@NgModule({declarations: [StaticComponent], exports: [StaticComponent]})
75
export class StaticModule {}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
<p>
2-
This is a static route
3-
</p>
1+
<p>This is a static route</p>

projects/demo/src/index.html

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
<html>
2-
<head>
3-
<title>Library demo</title>
4-
</head>
5-
<body>
6-
<my-app>loading</my-app>
7-
</body>
2+
<head>
3+
<title>Library demo</title>
4+
</head>
5+
<body>
6+
<my-app>loading</my-app>
7+
</body>
88
</html>
9-

schematics/library-starter/files/projects/__name@dasherize__/karma.conf.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Karma configuration file, see link for more information
22
// https://karma-runner.github.io/1.0/config/configuration-file.html
33

4-
module.exports = function(config) {
4+
module.exports = function (config) {
55
config.set({
66
basePath: '',
77
frameworks: ['jasmine', '@angular-devkit/build-angular'],
@@ -34,9 +34,9 @@ module.exports = function(config) {
3434
'--no-sandbox',
3535
'--headless',
3636
'--disable-gpu',
37-
'--remote-debugging-port=9222'
38-
]
39-
}
37+
'--remote-debugging-port=9222',
38+
],
39+
},
4040
},
4141
});
4242
};

schematics/library-starter/schema.json

+1-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,5 @@
1515
"x-prompt": "What is the name of your library?"
1616
}
1717
},
18-
"required": [
19-
"name"
20-
]
18+
"required": ["name"]
2119
}

0 commit comments

Comments
 (0)