@adbayb/stack 2.6.1 → 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 +9 -3
  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)