@adbayb/stack 0.0.0-next-2ad39fd → 0.0.0-next-84ccbde
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.
- package/README.md +20 -20
- package/config/eslint/README.md +5 -2
- package/config/eslint/index.mjs +9 -38
- package/config/prettier/README.md +63 -2
- package/config/prettier/index.mjs +11 -0
- package/config/typescript/README.md +3 -3
- package/dist/index.mjs +5 -5
- package/package.json +5 -5
- package/template/.github/ISSUE_TEMPLATE/config.yml +2 -2
- package/template/.github/workflows/continuous_delivery.yml +46 -46
- package/template/.github/workflows/continuous_integration.yml +4 -4
- package/template/.github/workflows/conventional_commit.yml +43 -43
- package/template/.github/workflows/dependency_changelog.yml +112 -112
- package/template/.github/workflows/workflow.yml +91 -91
- package/template/applications/README.md +2 -2
- package/template/examples/README.md +2 -2
- package/template/libraries/README.md +2 -2
package/README.md
CHANGED
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
|
|
10
10
|
`Stack` allows creating an NPM project in a **quick**, **easy** and **opinionated** way with:
|
|
11
11
|
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
12
|
+
- A unified monorepo-driven and git-driven approach for all kinds of projects (single-purpose library, multiple libraries, application(s), ...)
|
|
13
|
+
- Support for several application templates (for now, only a default template is available, but others can be added later)
|
|
14
|
+
- Standardized file structure including optional folder creation such as `examples`, `packages`, ...
|
|
15
|
+
- Enable all project lifecycle steps with commands from the setup, check, fix, build, and test to the versioning and release
|
|
16
|
+
- Built-in configuration preset setup (including Node/NPM runtime, Git ignore/hooks, TypeScript, ESLint, Prettier, EditorConfig, Renovate, Changesets, and VSCode)
|
|
17
|
+
- A welcoming environment for users and contributors with the continuous integration setup, and the creation of `README.md`, `CONTRIBUTING.md`, and GitHub template files (including issue and pull request ones), ...
|
|
18
|
+
- An optimized development environment with command caching (no build needed if nothing changes)
|
|
19
19
|
|
|
20
20
|
<br>
|
|
21
21
|
|
|
@@ -75,27 +75,27 @@ flowchart TD
|
|
|
75
75
|
|
|
76
76
|
### Used technologies
|
|
77
77
|
|
|
78
|
-
-
|
|
79
|
-
-
|
|
80
|
-
-
|
|
81
|
-
-
|
|
82
|
-
-
|
|
78
|
+
- **Static code analysis**: ESLint, Prettier
|
|
79
|
+
- **Node package manager**: PNPM
|
|
80
|
+
- **Task orchestration**: Turborepo
|
|
81
|
+
- **Release**: Changesets
|
|
82
|
+
- **Testing**: Vitest
|
|
83
83
|
|
|
84
84
|
### Used conventions
|
|
85
85
|
|
|
86
|
-
-
|
|
87
|
-
-
|
|
88
|
-
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
86
|
+
- [Commits](https://www.conventionalcommits.org/)
|
|
87
|
+
- [Scripts](https://conventionalscripts.org/)
|
|
88
|
+
- [File Structure](https://nx.dev/concepts/more-concepts/folder-structure)
|
|
89
|
+
- Monorepo-first structure to:
|
|
90
|
+
- Keep a consistent file structure pattern across templates (ease template familiarity and onboarding)
|
|
91
|
+
- Ease examples setup
|
|
92
|
+
- Not clutter the published package with development-related context, metadata, and artifacts
|
|
93
93
|
|
|
94
94
|
<br>
|
|
95
95
|
|
|
96
96
|
## 👣 Roadmap
|
|
97
97
|
|
|
98
|
-
-
|
|
98
|
+
- [ ] `stack check`: Lint packages (caret range for dependencies and strict ones for dev dependencies)
|
|
99
99
|
|
|
100
100
|
<br>
|
|
101
101
|
|
package/config/eslint/README.md
CHANGED
package/config/eslint/index.mjs
CHANGED
|
@@ -193,10 +193,7 @@ export default tseslint.config(
|
|
|
193
193
|
"valid-typeof": "error",
|
|
194
194
|
//#endregion
|
|
195
195
|
//#region import
|
|
196
|
-
"import/consistent-type-specifier-style": [
|
|
197
|
-
"error",
|
|
198
|
-
"prefer-top-level",
|
|
199
|
-
],
|
|
196
|
+
"import/consistent-type-specifier-style": ["error", "prefer-top-level"],
|
|
200
197
|
"import/export": "error",
|
|
201
198
|
"import/first": "error",
|
|
202
199
|
"import/newline-after-import": "error",
|
|
@@ -530,27 +527,13 @@ export default tseslint.config(
|
|
|
530
527
|
"sort-keys-custom-order/object-keys": [
|
|
531
528
|
"error",
|
|
532
529
|
{
|
|
533
|
-
orderedKeys: [
|
|
534
|
-
"id",
|
|
535
|
-
"key",
|
|
536
|
-
"name",
|
|
537
|
-
"title",
|
|
538
|
-
"label",
|
|
539
|
-
"description",
|
|
540
|
-
],
|
|
530
|
+
orderedKeys: ["id", "key", "name", "title", "label", "description"],
|
|
541
531
|
},
|
|
542
532
|
],
|
|
543
533
|
"sort-keys-custom-order/type-keys": [
|
|
544
534
|
"error",
|
|
545
535
|
{
|
|
546
|
-
orderedKeys: [
|
|
547
|
-
"id",
|
|
548
|
-
"key",
|
|
549
|
-
"name",
|
|
550
|
-
"title",
|
|
551
|
-
"label",
|
|
552
|
-
"description",
|
|
553
|
-
],
|
|
536
|
+
orderedKeys: ["id", "key", "name", "title", "label", "description"],
|
|
554
537
|
},
|
|
555
538
|
],
|
|
556
539
|
//#endregion
|
|
@@ -572,18 +555,12 @@ export default tseslint.config(
|
|
|
572
555
|
"ts-nocheck": "allow-with-description",
|
|
573
556
|
},
|
|
574
557
|
],
|
|
575
|
-
"@typescript-eslint/class-literal-property-style": [
|
|
576
|
-
"error",
|
|
577
|
-
"fields",
|
|
578
|
-
],
|
|
558
|
+
"@typescript-eslint/class-literal-property-style": ["error", "fields"],
|
|
579
559
|
"@typescript-eslint/consistent-generic-constructors": [
|
|
580
560
|
"error",
|
|
581
561
|
"constructor",
|
|
582
562
|
],
|
|
583
|
-
"@typescript-eslint/consistent-indexed-object-style": [
|
|
584
|
-
"error",
|
|
585
|
-
"record",
|
|
586
|
-
],
|
|
563
|
+
"@typescript-eslint/consistent-indexed-object-style": ["error", "record"],
|
|
587
564
|
"@typescript-eslint/consistent-type-assertions": [
|
|
588
565
|
"error",
|
|
589
566
|
{
|
|
@@ -633,14 +610,12 @@ export default tseslint.config(
|
|
|
633
610
|
"@typescript-eslint/no-misused-promises": "error",
|
|
634
611
|
"@typescript-eslint/no-mixed-enums": "error",
|
|
635
612
|
"@typescript-eslint/no-namespace": "error",
|
|
636
|
-
"@typescript-eslint/no-non-null-asserted-nullish-coalescing":
|
|
637
|
-
"error",
|
|
613
|
+
"@typescript-eslint/no-non-null-asserted-nullish-coalescing": "error",
|
|
638
614
|
"@typescript-eslint/no-non-null-asserted-optional-chain": "error",
|
|
639
615
|
"@typescript-eslint/no-non-null-assertion": "error",
|
|
640
616
|
"@typescript-eslint/no-require-imports": "error",
|
|
641
617
|
"@typescript-eslint/no-this-alias": "error",
|
|
642
|
-
"@typescript-eslint/no-unnecessary-boolean-literal-compare":
|
|
643
|
-
"error",
|
|
618
|
+
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "error",
|
|
644
619
|
"@typescript-eslint/no-unnecessary-condition": "error",
|
|
645
620
|
"@typescript-eslint/no-unnecessary-qualifier": "error",
|
|
646
621
|
"@typescript-eslint/no-unnecessary-type-arguments": "error",
|
|
@@ -822,16 +797,12 @@ export default tseslint.config(
|
|
|
822
797
|
"vitest/prefer-to-have-length": "error",
|
|
823
798
|
"vitest/prefer-todo": "error",
|
|
824
799
|
"vitest/require-hook": "error",
|
|
825
|
-
"vitest/require-local-test-context-for-concurrent-snapshots":
|
|
826
|
-
"error",
|
|
800
|
+
"vitest/require-local-test-context-for-concurrent-snapshots": "error",
|
|
827
801
|
"vitest/require-to-throw-message": "error",
|
|
828
802
|
"vitest/require-top-level-describe": "error",
|
|
829
803
|
"vitest/valid-describe-callback": "error",
|
|
830
804
|
"vitest/valid-expect": "error",
|
|
831
|
-
"vitest/valid-title": [
|
|
832
|
-
"error",
|
|
833
|
-
{ mustMatch: { test: ["^should "] } },
|
|
834
|
-
],
|
|
805
|
+
"vitest/valid-title": ["error", { mustMatch: { test: ["^should "] } }],
|
|
835
806
|
},
|
|
836
807
|
},
|
|
837
808
|
...new FlatCompat().extends("plugin:mdx/recommended").map((config) => ({
|
|
@@ -1,4 +1,65 @@
|
|
|
1
|
+
<br>
|
|
1
2
|
<div align="center">
|
|
2
|
-
<h1
|
|
3
|
-
<strong>My opinionated
|
|
3
|
+
<h1>@adbayb/stack/prettier</h1>
|
|
4
|
+
<strong>My opinionated formatting standards</strong>
|
|
4
5
|
</div>
|
|
6
|
+
<br>
|
|
7
|
+
<br>
|
|
8
|
+
|
|
9
|
+
## ✨ Features
|
|
10
|
+
|
|
11
|
+
This package offers an opinionated but extensible **[Prettier](https://prettier.io/)** configurations to align formatting rules and standards across my projects.
|
|
12
|
+
|
|
13
|
+
It allows to:
|
|
14
|
+
|
|
15
|
+
- Make collaboration across my projects effective (including onboarding with a consistent look and writing patterns).
|
|
16
|
+
- Include a minimum viable and required set of rules to foster maintainable, testable, secure, and green code over time.
|
|
17
|
+
- Accelerate development by reusing common configuration and convention defaults.
|
|
18
|
+
|
|
19
|
+
<br />
|
|
20
|
+
|
|
21
|
+
## 🚀 Quick Start
|
|
22
|
+
|
|
23
|
+
### 1️⃣ Installation
|
|
24
|
+
|
|
25
|
+
At the root level of your project, run the following command:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pnpm add @adbayb/stack --save-dev --workspace-root
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### 2️⃣ Usage
|
|
32
|
+
|
|
33
|
+
Edit the root `package.json` file to include the following:
|
|
34
|
+
|
|
35
|
+
```jsonc
|
|
36
|
+
{
|
|
37
|
+
"scripts": {
|
|
38
|
+
"check:format": "prettier \"**/!(pnpm-lock.yaml)\" --check --ignore-unknown --ignore-path .gitignore --log-level warn",
|
|
39
|
+
"fix:format": "pnpm check:format --write",
|
|
40
|
+
// ...
|
|
41
|
+
},
|
|
42
|
+
"prettier": "@adbayb/stack/prettier",
|
|
43
|
+
// ...
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
<br />
|
|
48
|
+
|
|
49
|
+
## 🤷♂️ Questions
|
|
50
|
+
|
|
51
|
+
### The tab size takes too much space, how to reduce it?
|
|
52
|
+
|
|
53
|
+
If you feel that tabbed indentation rendered on the GitHub web interface takes up too much (by default, most browsers display a tab character as 8 spaces), you can either:
|
|
54
|
+
|
|
55
|
+
- Edit your [GitHub profile appearance settings](https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-user-account-settings/managing-your-tab-size-rendering-preference).
|
|
56
|
+
- Add (or update) a `.editorconfig` file at the root level to customize the tab size display on the GitHub interface.
|
|
57
|
+
|
|
58
|
+
```yaml
|
|
59
|
+
root = true
|
|
60
|
+
|
|
61
|
+
[*]
|
|
62
|
+
indent_size = 2 # Depending on your tab indentation size preference.
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
<br />
|
|
@@ -3,12 +3,23 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export default {
|
|
5
5
|
arrowParens: "always",
|
|
6
|
+
bracketSameLine: false,
|
|
6
7
|
bracketSpacing: true,
|
|
8
|
+
embeddedLanguageFormatting: "auto",
|
|
7
9
|
endOfLine: "lf",
|
|
10
|
+
htmlWhitespaceSensitivity: "css",
|
|
11
|
+
insertPragma: false,
|
|
12
|
+
jsxSingleQuote: false,
|
|
13
|
+
plugins: [],
|
|
8
14
|
printWidth: 80,
|
|
15
|
+
proseWrap: "preserve",
|
|
16
|
+
quoteProps: "as-needed",
|
|
17
|
+
requirePragma: false,
|
|
9
18
|
semi: true,
|
|
10
19
|
singleAttributePerLine: true,
|
|
11
20
|
singleQuote: false,
|
|
21
|
+
tabWidth: 2,
|
|
12
22
|
trailingComma: "all",
|
|
13
23
|
useTabs: true,
|
|
24
|
+
vueIndentScriptAndStyle: false,
|
|
14
25
|
};
|
|
@@ -12,9 +12,9 @@ This package offers an opinionated but extensible **[TSConfigs](https://www.type
|
|
|
12
12
|
|
|
13
13
|
It allows to:
|
|
14
14
|
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
15
|
+
- Make collaboration across my projects effective (including onboarding with a consistent look and writing patterns).
|
|
16
|
+
- Include a minimum viable and required set of rules to foster maintainable, testable, secure, and green code over time.
|
|
17
|
+
- Accelerate development by reusing common configuration and convention defaults.
|
|
18
18
|
|
|
19
19
|
<br />
|
|
20
20
|
|
package/dist/index.mjs
CHANGED
|
@@ -327,7 +327,7 @@ const PRESERVE_FILES = [
|
|
|
327
327
|
];
|
|
328
328
|
|
|
329
329
|
var name = "@adbayb/stack";
|
|
330
|
-
var version = "0.0.0-next-
|
|
330
|
+
var version = "0.0.0-next-84ccbde";
|
|
331
331
|
var description = "My opinionated JavaScript-based toolchain";
|
|
332
332
|
var publishConfig = {
|
|
333
333
|
access: "public"
|
|
@@ -390,9 +390,9 @@ var dependencies = {
|
|
|
390
390
|
"@eslint/eslintrc": "^3.1.0",
|
|
391
391
|
"@vitest/eslint-plugin": "^1.1.7",
|
|
392
392
|
eslint: "^9.13.0",
|
|
393
|
-
"eslint-plugin-react": "^7.37.
|
|
393
|
+
"eslint-plugin-react": "^7.37.2",
|
|
394
394
|
globals: "^15.11.0",
|
|
395
|
-
"typescript-eslint": "^8.
|
|
395
|
+
"typescript-eslint": "^8.11.0",
|
|
396
396
|
"eslint-config-prettier": "^9.1.0",
|
|
397
397
|
"eslint-import-resolver-typescript": "^3.6.3",
|
|
398
398
|
"eslint-plugin-import": "^2.31.0",
|
|
@@ -402,11 +402,11 @@ var dependencies = {
|
|
|
402
402
|
"eslint-plugin-prettier": "^5.2.1",
|
|
403
403
|
"eslint-plugin-react-hooks": "^5.0.0",
|
|
404
404
|
"eslint-plugin-sonarjs": "^2.0.4",
|
|
405
|
-
"eslint-plugin-sort-keys-custom-order": "^2.
|
|
405
|
+
"eslint-plugin-sort-keys-custom-order": "^2.2.0",
|
|
406
406
|
fdir: "^6.4.2",
|
|
407
407
|
prettier: "^3.3.3",
|
|
408
408
|
termost: "^0.17.0",
|
|
409
|
-
turbo: "^2.2.
|
|
409
|
+
turbo: "^2.2.3",
|
|
410
410
|
typescript: "^5.6.3"
|
|
411
411
|
};
|
|
412
412
|
var pkg = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adbayb/stack",
|
|
3
|
-
"version": "0.0.0-next-
|
|
3
|
+
"version": "0.0.0-next-84ccbde",
|
|
4
4
|
"description": "My opinionated JavaScript-based toolchain",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -56,9 +56,9 @@
|
|
|
56
56
|
"@eslint/eslintrc": "^3.1.0",
|
|
57
57
|
"@vitest/eslint-plugin": "^1.1.7",
|
|
58
58
|
"eslint": "^9.13.0",
|
|
59
|
-
"eslint-plugin-react": "^7.37.
|
|
59
|
+
"eslint-plugin-react": "^7.37.2",
|
|
60
60
|
"globals": "^15.11.0",
|
|
61
|
-
"typescript-eslint": "^8.
|
|
61
|
+
"typescript-eslint": "^8.11.0",
|
|
62
62
|
"eslint-config-prettier": "^9.1.0",
|
|
63
63
|
"eslint-import-resolver-typescript": "^3.6.3",
|
|
64
64
|
"eslint-plugin-import": "^2.31.0",
|
|
@@ -68,11 +68,11 @@
|
|
|
68
68
|
"eslint-plugin-prettier": "^5.2.1",
|
|
69
69
|
"eslint-plugin-react-hooks": "^5.0.0",
|
|
70
70
|
"eslint-plugin-sonarjs": "^2.0.4",
|
|
71
|
-
"eslint-plugin-sort-keys-custom-order": "^2.
|
|
71
|
+
"eslint-plugin-sort-keys-custom-order": "^2.2.0",
|
|
72
72
|
"fdir": "^6.4.2",
|
|
73
73
|
"prettier": "^3.3.3",
|
|
74
74
|
"termost": "^0.17.0",
|
|
75
|
-
"turbo": "^2.2.
|
|
75
|
+
"turbo": "^2.2.3",
|
|
76
76
|
"typescript": "^5.6.3"
|
|
77
77
|
},
|
|
78
78
|
"scripts": {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
blank_issues_enabled: false
|
|
2
2
|
contact_links:
|
|
3
|
-
|
|
4
|
-
|
|
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,53 +1,53 @@
|
|
|
1
1
|
name: Continous delivery
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
7
|
|
|
8
8
|
concurrency: ${{ github.workflow }}-${{ github.ref }}
|
|
9
9
|
|
|
10
10
|
jobs:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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
|
+
run: |
|
|
42
|
+
pnpm --recursive exec pnpm version "$(pnpm show ./ version)-next-${GITHUB_SHA::7}"
|
|
43
|
+
pnpm --recursive exec pnpm publish --tag next --no-git-checks
|
|
44
|
+
- name: Prepare or Publish stable version(s)
|
|
45
|
+
uses: changesets/action@v1
|
|
46
|
+
with:
|
|
47
|
+
commit: "chore: release package(s)"
|
|
48
|
+
title: "chore: release package(s)"
|
|
49
|
+
version: pnpm release:version
|
|
50
|
+
publish: pnpm release:publish
|
|
51
|
+
env:
|
|
52
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
53
|
+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
@@ -1,48 +1,48 @@
|
|
|
1
1
|
name: Conventional commit
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
pull_request:
|
|
5
|
+
types: [opened, edited]
|
|
6
6
|
|
|
7
7
|
jobs:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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
|
|
@@ -1,117 +1,117 @@
|
|
|
1
1
|
name: Dependency changelog
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
pull_request_target:
|
|
5
|
+
paths:
|
|
6
|
+
- "**/pnpm-lock.yaml"
|
|
7
7
|
|
|
8
8
|
jobs:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
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,96 +1,96 @@
|
|
|
1
1
|
name: Main shareable workflow
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
|
-
|
|
4
|
+
workflow_call:
|
|
5
5
|
|
|
6
6
|
jobs:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
7
|
+
install:
|
|
8
|
+
timeout-minutes: 5
|
|
9
|
+
name: Install
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- name: Checkout the code
|
|
13
|
+
uses: actions/checkout@v4
|
|
14
|
+
- uses: pnpm/action-setup@v4
|
|
15
|
+
- name: Get node version
|
|
16
|
+
run: echo "version=$(cat .nvmrc)" >> $GITHUB_OUTPUT
|
|
17
|
+
id: node
|
|
18
|
+
- name: Setup node ${{ steps.node.outputs.version }}
|
|
19
|
+
uses: actions/setup-node@v4
|
|
20
|
+
with:
|
|
21
|
+
node-version: ${{ steps.node.outputs.version }}
|
|
22
|
+
cache: pnpm
|
|
23
|
+
- name: Setup cache
|
|
24
|
+
id: cache
|
|
25
|
+
uses: actions/cache@v4
|
|
26
|
+
with:
|
|
27
|
+
path: |
|
|
28
|
+
./node_modules
|
|
29
|
+
./turbo
|
|
30
|
+
key: ${{ runner.os }}-cache-${{ github.sha }}
|
|
31
|
+
restore-keys: |
|
|
32
|
+
${{ runner.os }}-cache-
|
|
33
|
+
- name: Install dependencies
|
|
34
|
+
run: pnpm install --frozen-lockfile
|
|
35
|
+
build:
|
|
36
|
+
timeout-minutes: 5
|
|
37
|
+
needs: install
|
|
38
|
+
name: Build
|
|
39
|
+
runs-on: ubuntu-latest
|
|
40
|
+
steps:
|
|
41
|
+
- name: Checkout code
|
|
42
|
+
uses: actions/checkout@v4
|
|
43
|
+
- uses: pnpm/action-setup@v4
|
|
44
|
+
- name: Get node version
|
|
45
|
+
run: echo "version=$(cat .nvmrc)" >> $GITHUB_OUTPUT
|
|
46
|
+
id: node
|
|
47
|
+
- name: Setup node ${{ steps.node.outputs.version }}
|
|
48
|
+
uses: actions/setup-node@v4
|
|
49
|
+
with:
|
|
50
|
+
node-version: ${{ steps.node.outputs.version }}
|
|
51
|
+
cache: pnpm
|
|
52
|
+
- name: Setup cache
|
|
53
|
+
id: cache
|
|
54
|
+
uses: actions/cache@v4
|
|
55
|
+
with:
|
|
56
|
+
path: |
|
|
57
|
+
./node_modules
|
|
58
|
+
./turbo
|
|
59
|
+
key: ${{ runner.os }}-cache-${{ github.sha }}
|
|
60
|
+
restore-keys: |
|
|
61
|
+
${{ runner.os }}-cache-
|
|
62
|
+
- name: Install dependencies
|
|
63
|
+
run: pnpm install --frozen-lockfile
|
|
64
|
+
- name: Build
|
|
65
|
+
run: pnpm build
|
|
66
|
+
check:
|
|
67
|
+
timeout-minutes: 5
|
|
68
|
+
needs: build
|
|
69
|
+
name: Check
|
|
70
|
+
runs-on: ubuntu-latest
|
|
71
|
+
steps:
|
|
72
|
+
- name: Checkout the code
|
|
73
|
+
uses: actions/checkout@v4
|
|
74
|
+
- uses: pnpm/action-setup@v4
|
|
75
|
+
- name: Get node version
|
|
76
|
+
run: echo "version=$(cat .nvmrc)" >> $GITHUB_OUTPUT
|
|
77
|
+
id: node
|
|
78
|
+
- name: Setup node ${{ steps.node.outputs.version }}
|
|
79
|
+
uses: actions/setup-node@v4
|
|
80
|
+
with:
|
|
81
|
+
node-version: ${{ steps.node.outputs.version }}
|
|
82
|
+
cache: pnpm
|
|
83
|
+
- name: Setup cache
|
|
84
|
+
id: cache
|
|
85
|
+
uses: actions/cache@v4
|
|
86
|
+
with:
|
|
87
|
+
path: |
|
|
88
|
+
./node_modules
|
|
89
|
+
./turbo
|
|
90
|
+
key: ${{ runner.os }}-cache-${{ github.sha }}
|
|
91
|
+
restore-keys: |
|
|
92
|
+
${{ runner.os }}-cache-
|
|
93
|
+
- name: Install dependencies
|
|
94
|
+
run: pnpm install --frozen-lockfile
|
|
95
|
+
- name: Check (static analysis including linters, types, and commit message)
|
|
96
|
+
run: pnpm check
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
> [!note]
|
|
4
4
|
> Optional folder that can be either:
|
|
5
5
|
>
|
|
6
|
-
> -
|
|
7
|
-
> -
|
|
6
|
+
> - Kept if the root package needs to be moved into it (when several package types (applications, libraries, ...) need to be created and the root package is by its nature an application)
|
|
7
|
+
> - Otherwise, removed if no planned use case
|
|
8
8
|
|
|
9
9
|
A collection of application-like projects. An application is a runnable program (a command-line interface, a mobile/web application, ...).
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
> [!note]
|
|
4
4
|
> Optional folder that can be either:
|
|
5
5
|
>
|
|
6
|
-
> -
|
|
7
|
-
> -
|
|
6
|
+
> - Kept if the root package needs to be moved into it (when several package types (applications, libraries, ...) need to be created and the root package is by its nature a library)
|
|
7
|
+
> - Otherwise, removed if no planned use case
|
|
8
8
|
|
|
9
9
|
A collection of internal and/or publishable libraries (referred to as packages in the Node ecosystem) that are leveraged during software development to implement/share a specific aspect/functionality. A library generally encapsulates highly cohesive modules together.
|