@adbayb/stack 2.6.2 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/README.md +22 -22
  2. package/configs/eslint/README.md +3 -3
  3. package/configs/eslint/presets/import.js +4 -1
  4. package/configs/eslint/presets/react.js +2 -1
  5. package/configs/eslint/presets/test.js +6 -2
  6. package/configs/eslint/presets/typescript.js +14 -5
  7. package/configs/eslint/presets/uncategorized.js +16 -2
  8. package/configs/eslint/presets/unicorn.js +4 -1
  9. package/configs/prettier/README.md +5 -5
  10. package/configs/prettier/index.js +1 -1
  11. package/configs/typescript/README.md +3 -3
  12. package/dist/index.js +1 -1
  13. package/package.json +1 -1
  14. package/templates/multi-projects/.editorconfig +1 -1
  15. package/templates/multi-projects/.github/ISSUE_TEMPLATE/config.yml +2 -2
  16. package/templates/multi-projects/.github/workflows/continuous_delivery.yml +54 -54
  17. package/templates/multi-projects/.github/workflows/continuous_integration.yml +4 -4
  18. package/templates/multi-projects/.github/workflows/conventional_commit.yml +43 -43
  19. package/templates/multi-projects/.github/workflows/dependency_changelog.yml +112 -112
  20. package/templates/multi-projects/.github/workflows/workflow.yml +34 -34
  21. package/templates/multi-projects/examples/README.md +2 -2
  22. package/templates/single-project/.editorconfig +1 -1
  23. package/templates/single-project/.github/ISSUE_TEMPLATE/config.yml +2 -2
  24. package/templates/single-project/.github/workflows/continuous_delivery.yml +54 -54
  25. package/templates/single-project/.github/workflows/continuous_integration.yml +4 -4
  26. package/templates/single-project/.github/workflows/conventional_commit.yml +43 -43
  27. package/templates/single-project/.github/workflows/dependency_changelog.yml +112 -112
  28. package/templates/single-project/.github/workflows/workflow.yml +34 -34
  29. package/templates/single-project/examples/README.md +2 -2
@@ -1,117 +1,117 @@
1
1
  name: Dependency changelog
2
2
 
3
3
  on:
4
- pull_request_target:
5
- paths:
6
- - "**/pnpm-lock.yaml"
4
+ pull_request_target:
5
+ paths:
6
+ - "**/pnpm-lock.yaml"
7
7
 
8
8
  jobs:
9
- main:
10
- timeout-minutes: 5
11
- runs-on: ubuntu-latest
12
- if: github.actor == 'renovate[bot]'
13
- steps:
14
- - name: Checkout
15
- uses: actions/checkout@v4
16
- with:
17
- fetch-depth: 2
18
- ref: ${{ github.head_ref }}
19
- - name: Configure Git
20
- run: |
21
- git config --global user.email adbayb@gmail.com
22
- git config --global user.name 'Ayoub Adib'
23
- - name: Create changelog entry
24
- uses: actions/github-script@v7
25
- # Credits to https://github.com/backstage/backstage/blob/bcc11651add5a2589898dfb9d665ebb9d412201b/.github/workflows/sync_renovate-changesets.yml
26
- with:
27
- script: |
28
- const { promises: fs } = require("fs");
29
-
30
- async function getPackagesNames(files) {
31
- const names = [];
32
-
33
- for (const file of files) {
34
- const data = JSON.parse(await fs.readFile(file, "utf8"));
35
-
36
- if (!data.private) {
37
- names.push(data.name);
38
- }
39
- }
40
-
41
- return names;
42
- }
43
-
44
- async function createChangeset(fileName, packageBumps, packages) {
45
- let message = "";
46
-
47
- for (const [pkg, bump] of packageBumps) {
48
- message = message + `Updated dependency \`${pkg}\` to \`${bump}\`.\n`;
49
- }
50
-
51
- const pkgs = packages.map((pkg) => `"${pkg}": minor`).join("\n");
52
- const body = `---\n${pkgs}\n---\n\n${message.trim()}\n`;
53
-
54
- await fs.writeFile(fileName, body);
55
- }
56
-
57
- async function getBumps(files) {
58
- const bumps = new Map();
59
-
60
- for (const file of files) {
61
- const { stdout: changes } = await exec.getExecOutput("git", [
62
- "show",
63
- file,
64
- ]);
65
-
66
- for (const change of changes.split("\n")) {
67
- if (!change.match(/^\+\s/)) {
68
- continue;
69
- }
70
-
71
- const match = change.match(/"(.*?)"/g);
72
-
73
- bumps.set(match[0].replace(/"/g, ""), match[1].replace(/"/g, ""));
74
- }
75
- }
76
-
77
- return bumps;
78
- }
79
-
80
- const branch = await exec.getExecOutput("git branch --show-current");
81
-
82
- if (!branch.stdout.startsWith("renovate/")) {
83
- console.log("Not a renovate branch, skipping");
84
-
85
- return;
86
- }
87
-
88
- const diffOutput = await exec.getExecOutput("git diff --name-only HEAD~1");
89
- const diffFiles = diffOutput.stdout.split("\n");
90
-
91
- if (diffFiles.find((f) => f.startsWith(".changeset"))) {
92
- console.log("Changeset already exists, skipping");
93
-
94
- return;
95
- }
96
-
97
- const files = diffFiles
98
- .filter((file) => file !== "package.json") // skip root package.json
99
- .filter((file) => file.includes("package.json"));
100
- const packageNames = await getPackagesNames(files);
101
-
102
- if (!packageNames.length) {
103
- console.log("No package.json changes to published packages, skipping");
104
-
105
- return;
106
- }
107
-
108
- const { stdout: shortHash } = await exec.getExecOutput(
109
- "git rev-parse --short HEAD"
110
- );
111
- const fileName = `.changeset/renovate-${shortHash.trim()}.md`;
112
- const packageBumps = await getBumps(files);
113
-
114
- await createChangeset(fileName, packageBumps, packageNames);
115
- await exec.exec("git", ["add", fileName]);
116
- await exec.exec("git commit -C HEAD --amend --no-edit");
117
- await exec.exec("git push --force");
9
+ main:
10
+ timeout-minutes: 5
11
+ runs-on: ubuntu-latest
12
+ if: github.actor == 'renovate[bot]'
13
+ steps:
14
+ - name: Checkout
15
+ uses: actions/checkout@v4
16
+ with:
17
+ fetch-depth: 2
18
+ ref: ${{ github.head_ref }}
19
+ - name: Configure Git
20
+ run: |
21
+ git config --global user.email adbayb@gmail.com
22
+ git config --global user.name 'Ayoub Adib'
23
+ - name: Create changelog entry
24
+ uses: actions/github-script@v7
25
+ # Credits to https://github.com/backstage/backstage/blob/bcc11651add5a2589898dfb9d665ebb9d412201b/.github/workflows/sync_renovate-changesets.yml
26
+ with:
27
+ script: |
28
+ const { promises: fs } = require("fs");
29
+
30
+ async function getPackagesNames(files) {
31
+ const names = [];
32
+
33
+ for (const file of files) {
34
+ const data = JSON.parse(await fs.readFile(file, "utf8"));
35
+
36
+ if (!data.private) {
37
+ names.push(data.name);
38
+ }
39
+ }
40
+
41
+ return names;
42
+ }
43
+
44
+ async function createChangeset(fileName, packageBumps, packages) {
45
+ let message = "";
46
+
47
+ for (const [pkg, bump] of packageBumps) {
48
+ message = message + `Updated dependency \`${pkg}\` to \`${bump}\`.\n`;
49
+ }
50
+
51
+ const pkgs = packages.map((pkg) => `"${pkg}": minor`).join("\n");
52
+ const body = `---\n${pkgs}\n---\n\n${message.trim()}\n`;
53
+
54
+ await fs.writeFile(fileName, body);
55
+ }
56
+
57
+ async function getBumps(files) {
58
+ const bumps = new Map();
59
+
60
+ for (const file of files) {
61
+ const { stdout: changes } = await exec.getExecOutput("git", [
62
+ "show",
63
+ file,
64
+ ]);
65
+
66
+ for (const change of changes.split("\n")) {
67
+ if (!change.match(/^\+\s/)) {
68
+ continue;
69
+ }
70
+
71
+ const match = change.match(/"(.*?)"/g);
72
+
73
+ bumps.set(match[0].replace(/"/g, ""), match[1].replace(/"/g, ""));
74
+ }
75
+ }
76
+
77
+ return bumps;
78
+ }
79
+
80
+ const branch = await exec.getExecOutput("git branch --show-current");
81
+
82
+ if (!branch.stdout.startsWith("renovate/")) {
83
+ console.log("Not a renovate branch, skipping");
84
+
85
+ return;
86
+ }
87
+
88
+ const diffOutput = await exec.getExecOutput("git diff --name-only HEAD~1");
89
+ const diffFiles = diffOutput.stdout.split("\n");
90
+
91
+ if (diffFiles.find((f) => f.startsWith(".changeset"))) {
92
+ console.log("Changeset already exists, skipping");
93
+
94
+ return;
95
+ }
96
+
97
+ const files = diffFiles
98
+ .filter((file) => file !== "package.json") // skip root package.json
99
+ .filter((file) => file.includes("package.json"));
100
+ const packageNames = await getPackagesNames(files);
101
+
102
+ if (!packageNames.length) {
103
+ console.log("No package.json changes to published packages, skipping");
104
+
105
+ return;
106
+ }
107
+
108
+ const { stdout: shortHash } = await exec.getExecOutput(
109
+ "git rev-parse --short HEAD"
110
+ );
111
+ const fileName = `.changeset/renovate-${shortHash.trim()}.md`;
112
+ const packageBumps = await getBumps(files);
113
+
114
+ await createChangeset(fileName, packageBumps, packageNames);
115
+ await exec.exec("git", ["add", fileName]);
116
+ await exec.exec("git commit -C HEAD --amend --no-edit");
117
+ await exec.exec("git push --force");
@@ -1,39 +1,39 @@
1
1
  name: Main shareable workflow
2
2
 
3
3
  on:
4
- workflow_call:
4
+ workflow_call:
5
5
 
6
6
  jobs:
7
- main:
8
- timeout-minutes: 5
9
- runs-on: ubuntu-latest
10
- steps:
11
- - name: Checkout the code
12
- uses: actions/checkout@v4
13
- - uses: pnpm/action-setup@v4
14
- - name: Get node version
15
- run: echo "version=$(cat .nvmrc)" >> $GITHUB_OUTPUT
16
- id: node
17
- - name: Setup node ${{ steps.node.outputs.version }}
18
- uses: actions/setup-node@v4
19
- with:
20
- node-version: ${{ steps.node.outputs.version }}
21
- cache: pnpm
22
- - name: Setup cache
23
- id: cache
24
- uses: actions/cache@v4
25
- with:
26
- path: |
27
- ./node_modules
28
- ./turbo
29
- key: ${{ runner.os }}-cache-${{ github.sha }}
30
- restore-keys: |
31
- ${{ runner.os }}-cache-
32
- - name: Install dependencies
33
- run: pnpm install --frozen-lockfile
34
- - name: Build
35
- run: pnpm build
36
- - name: Check (static analysis including linters, types, and commit message)
37
- run: pnpm check
38
- - name: Test
39
- run: pnpm test
7
+ main:
8
+ timeout-minutes: 5
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - name: Checkout the code
12
+ uses: actions/checkout@v4
13
+ - uses: pnpm/action-setup@v4
14
+ - name: Get node version
15
+ run: echo "version=$(cat .nvmrc)" >> $GITHUB_OUTPUT
16
+ id: node
17
+ - name: Setup node ${{ steps.node.outputs.version }}
18
+ uses: actions/setup-node@v4
19
+ with:
20
+ node-version: ${{ steps.node.outputs.version }}
21
+ cache: pnpm
22
+ - name: Setup cache
23
+ id: cache
24
+ uses: actions/cache@v4
25
+ with:
26
+ path: |
27
+ ./node_modules
28
+ ./turbo
29
+ key: ${{ runner.os }}-cache-${{ github.sha }}
30
+ restore-keys: |
31
+ ${{ runner.os }}-cache-
32
+ - name: Install dependencies
33
+ run: pnpm install --frozen-lockfile
34
+ - name: Build
35
+ run: pnpm build
36
+ - name: Check (static analysis including linters, types, and commit message)
37
+ run: pnpm check
38
+ - name: Test
39
+ run: pnpm test
@@ -2,5 +2,5 @@
2
2
 
3
3
  A collection of examples to:
4
4
 
5
- - Showcase the artifacts' usage (mainly for libraries)
6
- - Source some scenarios for testing purposes (test cases)
5
+ - Showcase the artifacts' usage (mainly for libraries)
6
+ - Source some scenarios for testing purposes (test cases)
@@ -1,4 +1,4 @@
1
1
  root = true
2
2
 
3
3
  [*]
4
- indent_size = 2
4
+ indent_size = 4
@@ -1,4 +1,4 @@
1
1
  blank_issues_enabled: false
2
2
  contact_links:
3
- - name: 🤔 Questions and Help
4
- about: Issues are dedicated to bugs, if you have any question, please use the dedicated GitHub discussion category.
3
+ - name: 🤔 Questions and Help
4
+ about: Issues are dedicated to bugs, if you have any question, please use the dedicated GitHub discussion category.
@@ -1,61 +1,61 @@
1
1
  name: Continous delivery
2
2
 
3
3
  on:
4
- push:
5
- branches:
6
- - main
4
+ push:
5
+ branches:
6
+ - main
7
7
 
8
8
  concurrency: ${{ github.workflow }}-${{ github.ref }}
9
9
 
10
10
  jobs:
11
- integrate:
12
- uses: ./.github/workflows/workflow.yml
13
- release:
14
- timeout-minutes: 5
15
- needs: integrate
16
- runs-on: ubuntu-latest
17
- permissions:
18
- contents: write
19
- pull-requests: write
20
- steps:
21
- - uses: actions/checkout@v4
22
- - uses: pnpm/action-setup@v4
23
- - name: Get node version
24
- run: echo "version=$(cat .nvmrc)" >> $GITHUB_OUTPUT
25
- id: node
26
- - name: Setup node ${{ steps.node.outputs.version }}
27
- uses: actions/setup-node@v4
28
- with:
29
- node-version: ${{ steps.node.outputs.version }}
30
- cache: pnpm
31
- - name: Setup .npmrc
32
- run: |
33
- cat << EOF > "$HOME/.npmrc"
34
- //registry.npmjs.org/:_authToken=$NPM_TOKEN
35
- EOF
36
- env:
37
- NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
38
- - name: Install dependencies
39
- run: pnpm install --frozen-lockfile
40
- - name: Publish pre-release version(s)
41
- if: "!contains(github.event.head_commit.message, 'chore: release package(s)')"
42
- run: |
43
- pnpm --filter=\!@examples/\* --recursive exec pnpm version "$(pnpm show ./ version)-next-${GITHUB_SHA::7}"
44
- pnpm --filter=\!@examples/\* --recursive exec pnpm publish --tag next --no-git-checks
45
- - name: Create release pull request
46
- if: "!contains(github.event.head_commit.message, 'chore: release package(s)')"
47
- uses: changesets/action@v1
48
- with:
49
- commit: "chore: release package(s)"
50
- title: "chore: release package(s)"
51
- env:
52
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53
- - name: Publish stable version(s)
54
- if: "contains(github.event.head_commit.message, 'chore: release package(s)')"
55
- uses: changesets/action@v1
56
- with:
57
- version: pnpm release:version
58
- publish: pnpm release:publish
59
- env:
60
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61
- NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
11
+ integrate:
12
+ uses: ./.github/workflows/workflow.yml
13
+ release:
14
+ timeout-minutes: 5
15
+ needs: integrate
16
+ runs-on: ubuntu-latest
17
+ permissions:
18
+ contents: write
19
+ pull-requests: write
20
+ steps:
21
+ - uses: actions/checkout@v4
22
+ - uses: pnpm/action-setup@v4
23
+ - name: Get node version
24
+ run: echo "version=$(cat .nvmrc)" >> $GITHUB_OUTPUT
25
+ id: node
26
+ - name: Setup node ${{ steps.node.outputs.version }}
27
+ uses: actions/setup-node@v4
28
+ with:
29
+ node-version: ${{ steps.node.outputs.version }}
30
+ cache: pnpm
31
+ - name: Setup .npmrc
32
+ run: |
33
+ cat << EOF > "$HOME/.npmrc"
34
+ //registry.npmjs.org/:_authToken=$NPM_TOKEN
35
+ EOF
36
+ env:
37
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
38
+ - name: Install dependencies
39
+ run: pnpm install --frozen-lockfile
40
+ - name: Publish pre-release version(s)
41
+ if: "!contains(github.event.head_commit.message, 'chore: release package(s)')"
42
+ run: |
43
+ pnpm --filter=\!@examples/\* --recursive exec pnpm version "$(pnpm show ./ version)-next-${GITHUB_SHA::7}"
44
+ pnpm --filter=\!@examples/\* --recursive exec pnpm publish --tag next --no-git-checks
45
+ - name: Create release pull request
46
+ if: "!contains(github.event.head_commit.message, 'chore: release package(s)')"
47
+ uses: changesets/action@v1
48
+ with:
49
+ commit: "chore: release package(s)"
50
+ title: "chore: release package(s)"
51
+ env:
52
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53
+ - name: Publish stable version(s)
54
+ if: "contains(github.event.head_commit.message, 'chore: release package(s)')"
55
+ uses: changesets/action@v1
56
+ with:
57
+ version: pnpm release:version
58
+ publish: pnpm release:publish
59
+ env:
60
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -1,9 +1,9 @@
1
1
  name: Continuous integration
2
2
 
3
3
  on:
4
- push:
5
- branches-ignore: main
4
+ push:
5
+ branches-ignore: main
6
6
 
7
7
  jobs:
8
- main:
9
- uses: ./.github/workflows/workflow.yml
8
+ main:
9
+ uses: ./.github/workflows/workflow.yml
@@ -1,48 +1,48 @@
1
1
  name: Conventional commit
2
2
 
3
3
  on:
4
- pull_request:
5
- types: [opened, edited]
4
+ pull_request:
5
+ types: [opened, edited]
6
6
 
7
7
  jobs:
8
- main:
9
- timeout-minutes: 5
10
- runs-on: ubuntu-latest
11
- steps:
12
- - uses: amannn/action-semantic-pull-request@v5
13
- id: check_pr_rule
14
- env:
15
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16
- with:
17
- types: |
18
- build
19
- chore
20
- ci
21
- docs
22
- feat
23
- fix
24
- perf
25
- refactor
26
- revert
27
- style
28
- test
29
- requireScope: false
30
- subjectPattern: ^(?![A-Z]).+$
31
- subjectPatternError: The subject must start with a lowercase character
32
- # Create a sticky comment to display the detailed error
33
- - uses: marocchino/sticky-pull-request-comment@v2
34
- if: always() && (steps.check_pr_rule.outputs.error_message != null)
35
- with:
36
- header: check_pr_comment
37
- message: |
38
- Pull request titles must follow the [Conventional Commits specification](https://www.conventionalcommits.org/).
39
- Please adjust your title following:
40
- ```
41
- ${{ steps.check_pr_rule.outputs.error_message }}
42
- ```
43
- # Delete a previous comment when the issue has been resolved
44
- - if: ${{ steps.check_pr_rule.outputs.error_message == null }}
45
- uses: marocchino/sticky-pull-request-comment@v2
46
- with:
47
- header: check_pr_comment
48
- delete: true
8
+ main:
9
+ timeout-minutes: 5
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: amannn/action-semantic-pull-request@v5
13
+ id: check_pr_rule
14
+ env:
15
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16
+ with:
17
+ types: |
18
+ build
19
+ chore
20
+ ci
21
+ docs
22
+ feat
23
+ fix
24
+ perf
25
+ refactor
26
+ revert
27
+ style
28
+ test
29
+ requireScope: false
30
+ subjectPattern: ^(?![A-Z]).+$
31
+ subjectPatternError: The subject must start with a lowercase character
32
+ # Create a sticky comment to display the detailed error
33
+ - uses: marocchino/sticky-pull-request-comment@v2
34
+ if: always() && (steps.check_pr_rule.outputs.error_message != null)
35
+ with:
36
+ header: check_pr_comment
37
+ message: |
38
+ Pull request titles must follow the [Conventional Commits specification](https://www.conventionalcommits.org/).
39
+ Please adjust your title following:
40
+ ```
41
+ ${{ steps.check_pr_rule.outputs.error_message }}
42
+ ```
43
+ # Delete a previous comment when the issue has been resolved
44
+ - if: ${{ steps.check_pr_rule.outputs.error_message == null }}
45
+ uses: marocchino/sticky-pull-request-comment@v2
46
+ with:
47
+ header: check_pr_comment
48
+ delete: true