Skip to content

Commit

Permalink
cleanup monorepo template
Browse files Browse the repository at this point in the history
  • Loading branch information
IMax153 committed Sep 10, 2024
1 parent 8ef99bc commit 44c7123
Show file tree
Hide file tree
Showing 16 changed files with 249 additions and 6,307 deletions.
3 changes: 3 additions & 0 deletions templates/basic/.github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ jobs:
- uses: actions/checkout@v4
- name: Install dependencies
uses: ./.github/actions/setup
- run: pnpm codegen
- name: Check source state
run: git add packages/*/src && git diff-index --cached HEAD --exit-code packages/*/src

types:
name: Types
Expand Down
2 changes: 1 addition & 1 deletion templates/basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"eslint-import-resolver-typescript": "^3.6.3",
"eslint-plugin-codegen": "^0.28.0",
"eslint-plugin-deprecation": "^3.0.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-import": "^2.30.0",
"eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-sort-destructure-keys": "^2.0.0",
"fast-check": "^3.21.0",
Expand Down
16 changes: 16 additions & 0 deletions templates/monorepo/.changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": [
"@changesets/changelog-github",
{
"repo": "REPLACE_ME"
}
],
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
21 changes: 21 additions & 0 deletions templates/monorepo/.github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Setup
description: Perform standard setup and install dependencies using pnpm.
inputs:
node-version:
description: The version of Node.js to install
required: true
default: 20.14.0

runs:
using: composite
steps:
- name: Install pnpm
uses: pnpm/action-setup@v3
- name: Install node
uses: actions/setup-node@v4
with:
cache: pnpm
node-version: ${{ inputs.node-version }}
- name: Install dependencies
shell: bash
run: pnpm install
58 changes: 58 additions & 0 deletions templates/monorepo/.github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Check
on:
workflow_dispatch:
pull_request:
branches: [main]
push:
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions: {}

jobs:
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Install dependencies
uses: ./.github/actions/setup
- run: pnpm codegen
- name: Check source state
run: git add packages/*/src && git diff-index --cached HEAD --exit-code packages/*/src

types:
name: Types
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Install dependencies
uses: ./.github/actions/setup
- run: pnpm check

lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Install dependencies
uses: ./.github/actions/setup
- run: pnpm lint

test:
name: Test
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Install dependencies
uses: ./.github/actions/setup
- run: pnpm vitest
env:
NODE_OPTIONS: --max_old_space_size=8192
31 changes: 31 additions & 0 deletions templates/monorepo/.github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Release
on:
push:
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}

permissions: {}

jobs:
release:
name: Release
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: write
id-token: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Install dependencies
uses: ./.github/actions/setup
- name: Create Release Pull Request or Publish
uses: changesets/action@v1
with:
version: pnpm changeset-version
publish: pnpm changeset-publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
22 changes: 22 additions & 0 deletions templates/monorepo/.github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Snapshot
on:
pull_request:
branches: [main]
workflow_dispatch:

permissions: {}

jobs:
snapshot:
name: Snapshot
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Install dependencies
uses: ./.github/actions/setup
- name: Build package
run: pnpm build
- name: Create snapshot
id: snapshot
run: pnpx [email protected] publish --pnpm --comment=off ./packages/*
7 changes: 0 additions & 7 deletions templates/monorepo/.madgerc

This file was deleted.

3 changes: 0 additions & 3 deletions templates/monorepo/deno.json

This file was deleted.

6 changes: 3 additions & 3 deletions templates/monorepo/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 19 additions & 14 deletions templates/monorepo/package.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
{
"private": true,
"type": "module",
"packageManager": "pnpm@9.9.0",
"packageManager": "pnpm@9.10.0",
"workspaces": [
"packages/*"
],
"scripts": {
"clean": "node scripts/clean.mjs",
"codegen": "pnpm --recursive --parallel run codegen",
"build": "tsc -b tsconfig.build.json && pnpm --recursive --parallel run build",
"circular": "node scripts/circular.mjs",
"test": "vitest",
"coverage": "vitest --coverage",
"check": "tsc -b tsconfig.json",
"check-recursive": "pnpm --recursive exec tsc -b tsconfig.json",
"lint": "eslint \"**/{src,test,examples,scripts,dtslint}/**/*.{ts,mjs}\"",
"lint-fix": "pnpm lint --fix"
"lint-fix": "pnpm lint --fix",
"test": "vitest",
"coverage": "vitest --coverage",
"changeset-version": "changeset version && node scripts/version.mjs",
"changeset-publish": "pnpm build && TEST_DIST= pnpm vitest && changeset publish"
},
"resolutions": {
"dependency-tree": "^10.0.9",
Expand All @@ -27,29 +28,32 @@
"detective-sass": "^5.0.3",
"detective-scss": "^4.0.3",
"detective-stylus": "^4.0.0",
"detective-typescript": "^11.1.0"
"detective-typescript": "^11.1.0",
"@types/node": "^22.5.4"
},
"devDependencies": {
"@babel/cli": "^7.24.8",
"@babel/core": "^7.25.2",
"@babel/plugin-transform-export-namespace-from": "^7.24.7",
"@babel/plugin-transform-modules-commonjs": "^7.24.8",
"@changesets/changelog-github": "^0.5.0",
"@changesets/cli": "2.27.7",
"@edge-runtime/vm": "^4.0.0",
"@effect/build-utils": "^0.7.7",
"@effect/eslint-plugin": "^0.2.0",
"@effect/language-service": "^0.1.0",
"@eslint/compat": "1.1.1",
"@eslint/eslintrc": "3.1.0",
"@eslint/js": "9.9.1",
"@types/node": "^20.14.10",
"@typescript-eslint/eslint-plugin": "^7.16.0",
"@typescript-eslint/parser": "^7.16.0",
"@eslint/js": "9.10.0",
"@types/node": "^22.5.2",
"@typescript-eslint/eslint-plugin": "^8.4.0",
"@typescript-eslint/parser": "^8.4.0",
"@vitest/browser": "^2.0.5",
"@vitest/coverage-v8": "^2.0.5",
"@vitest/expect": "^2.0.5",
"@vitest/web-worker": "^2.0.5",
"babel-plugin-annotate-pure-calls": "^0.4.0",
"eslint": "^9.9.1",
"eslint": "^9.10.0",
"eslint-import-resolver-typescript": "^3.6.3",
"eslint-plugin-codegen": "^0.28.0",
"eslint-plugin-deprecation": "^3.0.0",
Expand All @@ -58,20 +62,21 @@
"eslint-plugin-sort-destructure-keys": "^2.0.0",
"fast-check": "^3.21.0",
"glob": "^11.0.0",
"madge": "^8.0.0",
"playwright": "^1.46.0",
"prettier": "^3.3.3",
"rimraf": "^6.0.1",
"tsx": "^4.17.0",
"typescript": "^5.5.4",
"vite": "^5.4.0",
"typescript": "^5.6.2",
"vite": "^5.4.3",
"vitest": "^2.0.5"
},
"pnpm": {
"overrides": {
"vitest": "^2.0.5"
},
"patchedDependencies": {
"@changesets/[email protected]": "patches/@[email protected]",
"@changesets/[email protected]": "patches/@[email protected]",
"[email protected]": "patches/[email protected]"
}
}
Expand Down
26 changes: 26 additions & 0 deletions templates/monorepo/patches/@[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/dist/changesets-assemble-release-plan.cjs.js b/dist/changesets-assemble-release-plan.cjs.js
index 60427457c887f2d72168fecec83d79088c68e3a4..b48899c83ca2bc5bfa0cbb65e0c098d5bb65fe3d 100644
--- a/dist/changesets-assemble-release-plan.cjs.js
+++ b/dist/changesets-assemble-release-plan.cjs.js
@@ -189,7 +189,7 @@ function determineDependents({
preInfo,
onlyUpdatePeerDependentsWhenOutOfRange: config.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.onlyUpdatePeerDependentsWhenOutOfRange
})) {
- type = "major";
+ type = "minor";
} else if ((!releases.has(dependent) || releases.get(dependent).type === "none") && (config.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.updateInternalDependents === "always" || !semverSatisfies__default["default"](incrementVersion(nextRelease, preInfo), versionRange))) {
switch (depType) {
case "dependencies":
diff --git a/dist/changesets-assemble-release-plan.esm.js b/dist/changesets-assemble-release-plan.esm.js
index f6583cf3f639e1fe4df764a015689dea74127236..2b9dca9f460793596394484457a94a34bcc1d99a 100644
--- a/dist/changesets-assemble-release-plan.esm.js
+++ b/dist/changesets-assemble-release-plan.esm.js
@@ -178,7 +178,7 @@ function determineDependents({
preInfo,
onlyUpdatePeerDependentsWhenOutOfRange: config.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.onlyUpdatePeerDependentsWhenOutOfRange
})) {
- type = "major";
+ type = "minor";
} else if ((!releases.has(dependent) || releases.get(dependent).type === "none") && (config.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.updateInternalDependents === "always" || !semverSatisfies(incrementVersion(nextRelease, preInfo), versionRange))) {
switch (depType) {
case "dependencies":
48 changes: 48 additions & 0 deletions templates/monorepo/patches/@[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
diff --git a/dist/changesets-get-github-info.cjs.js b/dist/changesets-get-github-info.cjs.js
index a74df59f8a5988f458a3476087399f5e6dfe4818..ce5e60ef9916eb0cb76ab1e9dd422abcad752bf6 100644
--- a/dist/changesets-get-github-info.cjs.js
+++ b/dist/changesets-get-github-info.cjs.js
@@ -251,18 +251,13 @@ async function getInfo(request) {
b = new Date(b.mergedAt);
return a > b ? 1 : a < b ? -1 : 0;
})[0] : null;
-
- if (associatedPullRequest) {
- user = associatedPullRequest.author;
- }
-
return {
user: user ? user.login : null,
pull: associatedPullRequest ? associatedPullRequest.number : null,
links: {
commit: `[\`${request.commit.slice(0, 7)}\`](${data.commitUrl})`,
pull: associatedPullRequest ? `[#${associatedPullRequest.number}](${associatedPullRequest.url})` : null,
- user: user ? `[@${user.login}](${user.url})` : null
+ user: user ? `@${user.login}` : null
}
};
}
diff --git a/dist/changesets-get-github-info.esm.js b/dist/changesets-get-github-info.esm.js
index 27e5c972ab1202ff16f5124b471f4bbcc46be2b5..3940a8fe86e10cb46d8ff6436dea1103b1839927 100644
--- a/dist/changesets-get-github-info.esm.js
+++ b/dist/changesets-get-github-info.esm.js
@@ -242,18 +242,13 @@ async function getInfo(request) {
b = new Date(b.mergedAt);
return a > b ? 1 : a < b ? -1 : 0;
})[0] : null;
-
- if (associatedPullRequest) {
- user = associatedPullRequest.author;
- }
-
return {
user: user ? user.login : null,
pull: associatedPullRequest ? associatedPullRequest.number : null,
links: {
commit: `[\`${request.commit.slice(0, 7)}\`](${data.commitUrl})`,
pull: associatedPullRequest ? `[#${associatedPullRequest.number}](${associatedPullRequest.url})` : null,
- user: user ? `[@${user.login}](${user.url})` : null
+ user: user ? `@${user.login}` : null
}
};
}
Loading

0 comments on commit 44c7123

Please sign in to comment.