Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore/do 1587 migrate to yarn #1405

Merged
merged 25 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
d212860
chore: switch to yarn
TheOrangePuff Nov 5, 2024
acdbbe0
chore: update packages
TheOrangePuff Nov 5, 2024
4a9e571
chore: fix linting error
TheOrangePuff Nov 5, 2024
834650f
chore: update prettier rules to match old config
TheOrangePuff Nov 5, 2024
0c59621
chore: add nx to basic auth package
TheOrangePuff Nov 8, 2024
5cff049
chore: add nx top all constructs
TheOrangePuff Nov 14, 2024
a3cd4a9
chore: fix linting issue
TheOrangePuff Nov 14, 2024
faa6d7a
chore: run format fix
TheOrangePuff Nov 14, 2024
59d52fe
chore: convert build workflow to use yarn
TheOrangePuff Nov 14, 2024
778a970
chore: update release pipeline
TheOrangePuff Nov 15, 2024
025ddd5
chore: add missing packages to resolve warning
TheOrangePuff Nov 15, 2024
43610a9
chore: include jest preset
TheOrangePuff Nov 15, 2024
b1572b8
fix: resolve linting error
TheOrangePuff Nov 15, 2024
848637d
chore: ignore nx files in prettier check
TheOrangePuff Nov 15, 2024
6c5ba8d
chore: change to run commands through nx
TheOrangePuff Nov 19, 2024
a31b188
chore: run formatter
TheOrangePuff Nov 19, 2024
9b51794
chore: change to run lint over affected
TheOrangePuff Nov 19, 2024
31a200e
chore: fixing eslint errors
TheOrangePuff Nov 21, 2024
a1c30ae
chore: exclude handlers from tsconfig
TheOrangePuff Nov 21, 2024
2febddf
chore: update construct specific tsconfigs
TheOrangePuff Nov 21, 2024
d4bed47
chore: fetch destination branch
TheOrangePuff Nov 21, 2024
8203472
chore: point nx to origin
TheOrangePuff Nov 27, 2024
3651cbe
chore: update destination var
TheOrangePuff Nov 27, 2024
a4d1491
chore: integrate prettier with eslint
TheOrangePuff Nov 28, 2024
d435d0f
chore: run prettier
TheOrangePuff Nov 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .eslintignore

This file was deleted.

95 changes: 74 additions & 21 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,77 @@
{
"env": {
"node": true,
"commonjs": true,
"es2021": true
},
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"overrides": [],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest"
},
"plugins": ["@typescript-eslint", "prettier"],
"rules": {
"@typescript-eslint/no-unused-vars": [
"error",
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"caughtErrorsIgnorePattern": "^_"
"root": true,
"ignorePatterns": ["**/*"],
"plugins": ["@nx"],
"extends": ["eslint:recommended", "plugin:prettier/recommended"],
"overrides": [
{
"files": "*.json",
"parser": "jsonc-eslint-parser",
"rules": {}
},
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"@nx/enforce-module-boundaries": [
"error",
{
"enforceBuildableLibDependency": true,
"allow": [],
"depConstraints": [
{
"sourceTag": "*",
"onlyDependOnLibsWithTags": ["*"]
}
]
}
]
}
]
}
},
{
"files": ["*.ts", "*.tsx"],
"parserOptions": {
"project": ["./tsconfig.base.json"]
},
"extends": [
"plugin:@nx/typescript",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
],
"rules": {
"@typescript-eslint/ban-ts-comment": [
"error",
{
"ts-expect-error": "allow-with-description"
}
],
"no-return-await": "off",
"@typescript-eslint/return-await": "error",
"@typescript-eslint/no-unused-vars": [
"error",
{
"argsIgnorePattern": "^_"
}
],
"@nx/enforce-module-boundaries": [
"error",
{
"allow": ["@aligent/cdk-esbuild"]
}
]
}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nx/javascript"],
"rules": {}
},
{
"files": ["*.spec.ts", "*.spec.tsx", "*.spec.js", "*.spec.jsx"],
"env": {
"jest": true
},
"rules": {}
}
]
}
35 changes: 24 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,29 @@ on: [pull_request]

jobs:
build:
name: 🏭 Build all packages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.release.target_commitish }}
- name: Use Node.js 20
uses: actions/setup-node@v1
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm run lint:check && npm run format:check
- run: npm run build
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Fetch target
run: git fetch origin ${{ github.event.pull_request.base.ref }}

- name: Enable Corepack
run: corepack enable

- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "yarn"

- name: Install
run: yarn install

- name: Build all packages
run: yarn nx run-many -t build

- run: yarn nx affected:lint --base=origin/${{ github.event.pull_request.base.ref }} --parallel --max-parallel=3
66 changes: 32 additions & 34 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,41 @@ name: Publish to NPM

on:
release:
tags:
- '**-[0-9]+.[0-9]+.[0-9]+'
- '**-[0-9]+.[0-9]+.[0-9]+-*'
tags:
- "**-[0-9]+.[0-9]+.[0-9]+"
- "**-[0-9]+.[0-9]+.[0-9]+-*"
types: [published]

jobs:
build-and-publish:
name: 🚀 Publish to NPM
runs-on: ubuntu-latest
steps:
# Source checkout
- uses: actions/checkout@v2
with:
ref: ${{ github.event.release.target_commitish }}
# Setting Node environment
- name: Setting up Node environment
uses: actions/setup-node@v1
with:
node-version: 16
registry-url: https://registry.npmjs.org/
# Environment configuration
- name: Preparing environment for release
run: |
VERSION=$(echo $GITHUB_REF_NAME | sed 's/^.*[A-Za-z]-//g')
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "PACKAGE=$(echo $GITHUB_REF_NAME | sed "s/-${VERSION}//g")" >> $GITHUB_ENV
# Release process
- name: Release
run: |
npm ci
git config --global user.name "Automated NPM Release"
git config --global user.email "[email protected]"
npm version $VERSION --allow-same-version --workspace "@aligent/cdk-${{env.PACKAGE}}"
npm run build --workspace "@aligent/cdk-${{env.PACKAGE}}"
npm test --workspace "@aligent/cdk-${{env.PACKAGE}}" --if-present
npm publish --access public --workspace "@aligent/cdk-${{env.PACKAGE}}"
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: git push
env:
github-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v4
with:
ref: ${{ github.event.release.target_commitish }}

- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "yarn"
registry-url: https://registry.npmjs.org/

- name: Install
run: yarn install

- name: Preparing environment for release
run: |
VERSION=$(echo $GITHUB_REF_NAME | sed 's/^.*[A-Za-z]-//g')
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "PACKAGE=$(echo $GITHUB_REF_NAME | sed "s/-${VERSION}//g")" >> $GITHUB_ENV

- name: Release
run: |
git config --global user.name "Automated NPM Release"
git config --global user.email "[email protected]"
echo "Publishing $PACKAGE @ $VERSION"
yarn config set registry https://registry.npmjs.org/
yarn nx publish $PACKAGE --ver=$VERSION --tag=latest --verbose
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@
node_modules/
dist/

# Yarn (https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored)
.yarn/*
!.yarn/cache
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# Compiled Java class files
*.class

Expand Down Expand Up @@ -60,3 +69,9 @@ cdk.out

*.d.ts
*.js



.nx/cache
.nx/workspace-data
!jest.preset.js
5 changes: 4 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,7 @@ cdk.out
*.js

# Lock files
package-lock.json
package-lock.json

# Ignore nx files
.nx
3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"semi": true,
"singleQuote": false,
TheOrangePuff marked this conversation as resolved.
Show resolved Hide resolved
"arrowParens": "avoid"
"arrowParens": "avoid",
"trailingComma": "es5"
}
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
14 changes: 14 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { getJestProjects } from "@nx/jest";

export default {
projects: getJestProjects(),
modulePathIgnorePatterns: ["__data__"],
coverageThreshold: {
global: {
branches: 80,
functions: 80,
lines: 80,
statements: 80,
},
},
};
3 changes: 3 additions & 0 deletions jest.preset.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const nxPreset = require('@nx/jest/preset').default;

module.exports = { ...nxPreset };
26 changes: 26 additions & 0 deletions nx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"targetDefaults": {
"build": {
"cache": true
},
"test": {
"cache": true
}
},
"defaultBase": "main",
"plugins": [
{
"plugin": "@nx/eslint/plugin",
"options": {
"targetName": "lint"
}
},
{
"plugin": "@nx/jest/plugin",
"options": {
"targetName": "test"
}
}
]
}
Loading