Skip to content

Commit

Permalink
chore: Migration to nrwl and lerna 7, update dependencies and node ve…
Browse files Browse the repository at this point in the history
…rsion to 16 (#18)

* ci: dependencies upgrade, add nx, new lerna version

- Change node version to 16.20.x
- Upgrade lerna to the newest version
- Add nx to project
- Upgrade angular and nextjs versions
- Update node setup on CI

* ci: puppeteer and jest upgrade

- Update puppeteer version
- Refactor puppeteer files to match type changes
- Update jest version
- Remove done callback functions from async/await tests

* ci: upgrade fastify versions

- Upgrade fastify versions

* ci: replace HoA commit-lint with commitlint

- Remove @house-of-angular/commit-lint package
- Add commitlint package
- Setup commitlint configs
- Install puppeteer during CI process
- Upgrade eslint version
  • Loading branch information
dawidkostka-va authored Jun 26, 2023
1 parent a1c50c1 commit af7f397
Show file tree
Hide file tree
Showing 18 changed files with 25,896 additions and 12,503 deletions.
44 changes: 34 additions & 10 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,37 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
node-version: [16.20.0]
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: npm i package lock
run: npm install --package-lock-only
- name: npm install puppeteer
run: npm install -g puppeteer --unsafe-perm
- name: npm install
run: npm ci && npm run lerna bootstrap
run: npm ci
- name: build
run: npm run lerna run build

test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
node-version: [16.20.0]
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: npm i package lock
run: npm install --package-lock-only
- name: npm install puppeteer
run: npm install -g puppeteer --unsafe-perm
- name: npm install
run: npm ci
- name: test
Expand All @@ -42,17 +50,33 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
node-version: [16.20.0]
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: checkout
run: git checkout master
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: npm i package lock
run: npm install --package-lock-only
- name: npm install puppeteer
run: npm install -g puppeteer --unsafe-perm
- name: npm install
run: npm ci
- name: Install commitlint
run: |
npm install conventional-changelog-conventionalcommits
npm install commitlint@latest
- name: Validate current commit (last commit) with commitlint
if: github.event_name == 'push'
run: npx commitlint --from HEAD~1 --to HEAD --verbose
- name: Validate PR commits with commitlint
if: github.event_name == 'pull_request'
run: npx commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose
- name: prettier check
run: npm run format:check
- name: lint
Expand Down
48 changes: 34 additions & 14 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,37 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
node-version: [16.20.0]
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: npm i package lock
run: npm install --package-lock-only
- name: npm install puppeteer
run: npm install -g puppeteer --unsafe-perm
- name: npm install
run: npm ci && npm run lerna bootstrap
run: npm ci
- name: build
run: npm run lerna run build

test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
node-version: [16.20.0]
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: npm i package lock
run: npm install --package-lock-only
- name: npm install puppeteer
run: npm install -g puppeteer --unsafe-perm
- name: npm install
run: npm ci
- name: test
Expand All @@ -39,18 +47,30 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
node-version: [16.20.0]
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: npm i package lock
run: npm install --package-lock-only
- name: npm install puppeteer
run: npm install -g puppeteer --unsafe-perm
- name: npm install
run: npm ci
- name: validate commits
run: node ./node_modules/@valueadd/dev validate-commit origin/master
- name: prettier check
run: node ./node_modules/@valueadd/dev prettier-check `git diff origin/master --cached --name-only --diff-filter=AM | tr '\r\n' ','`
- name: Install commitlint
run: |
npm install conventional-changelog-conventionalcommits
npm install commitlint@latest
- name: Validate current commit (last commit) with commitlint
if: github.event_name == 'push'
run: npx commitlint --from HEAD~1 --to HEAD --verbose
- name: Validate PR commits with commitlint
if: github.event_name == 'pull_request'
run: npx commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose
- name: lint
run: npm run lint
67 changes: 67 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
const Configuration = {
/*
* Resolve and load @commitlint/config-conventional from node_modules.
* Referenced packages must be installed
*/
extends: ['@commitlint/config-conventional'],
/*
* Resolve and load conventional-changelog-atom from node_modules.
* Referenced packages must be installed
*/
// parserPreset: 'conventional-changelog-atom',
/*
* Resolve and load @commitlint/format from node_modules.
* Referenced package must be installed
*/
formatter: '@commitlint/format',
/*
* Any rules defined here will override rules from @commitlint/config-conventional
*/
rules: {
'body-leading-blank': [2, 'always'],
'footer-leading-blank': [2, 'always'],
'header-max-length': [2, 'always', 72],
'body-max-line-length': [2, 'always', 72],
'footer-max-line-length': [2, 'always', 72],
'scope-case': [2, 'always', 'lower-case'],
'subject-case': [2, 'never', ['sentence-case', 'start-case', 'pascal-case', 'upper-case']],
'subject-empty': [2, 'never'],
'subject-full-stop': [2, 'never', '.'],
'type-case': [2, 'always', 'lower-case'],
'type-empty': [2, 'never'],
'type-enum': [
2,
'always',
['build', 'chore', 'ci', 'docs', 'deps', 'feat', 'fix', 'perf', 'refactor', 'style', 'test']
],
'scope-enum': [2, 'always', ['pdf-generator', 'release', 'streaming']]
},
/*
* Functions that return true if commitlint should ignore the given message.
*/
ignores: [(commit) => commit === ''],
/*
* Whether commitlint uses the default ignore rules.
*/
defaultIgnores: true,
/*
* Custom URL to show upon failure
*/
helpUrl:
'https://github.com/conventional-changelog/commitlint/#what-is-commitlint',
/*
* Custom prompt configs
*/
prompt: {
messages: {},
questions: {
type: {
description: 'please input type:',
},
},
},
};

module.exports = Configuration;

// module.exports = {extends: ['@commitlint/config-conventional']};
1 change: 1 addition & 0 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"packages": ["packages/*"],
"version": "independent",
"command": {
Expand Down
57 changes: 57 additions & 0 deletions nx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"tasksRunnerOptions": {
"default": {
"runner": "nx/tasks-runners/default",
"options": {
"cacheableOperations": [
"build",
"lint",
"test",
"preversion",
"prepare"
]
}
}
},
"targetDefaults": {
"build": {
"dependsOn": [
"^build"
],
"outputs": [
"{projectRoot}/build"
]
},
"lint": {
"dependsOn": [
"^lint"
]
},
"test": {
"dependsOn": [
"^test"
]
},
"preversion": {
"dependsOn": [
"^preversion"
]
},
"prepare": {
"dependsOn": [
"^prepare"
]
}
},
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"namedInputs": {
"default": [
"{projectRoot}/**/*",
"sharedGlobals"
],
"sharedGlobals": [],
"production": [
"default"
]
}
}
Loading

0 comments on commit af7f397

Please sign in to comment.