@zairakai/js-dev-tools 3.20.0 → 3.22.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.
- package/.editorconfig +11 -72
- package/.gitlab/ci/parts/base.yml +95 -0
- package/.gitlab/ci/parts/publish.yml +156 -0
- package/.gitlab/ci/parts/quality.yml +161 -0
- package/.gitlab/ci/parts/security.yml +40 -0
- package/.gitlab/ci/parts/updates.yml +60 -0
- package/.gitlab/ci/pipeline-js-app.yml +19 -38
- package/.gitlab/ci/pipeline-js-package.yml +23 -528
- package/README.md +92 -11
- package/config/.markdownlintignore +8 -1
- package/config/.prettierignore +13 -0
- package/config/.stylelintignore +13 -3
- package/config/eslint.config.js +7 -1
- package/config/knip.config.js +7 -3
- package/config/stylelint.config.js +1 -0
- package/package.json +46 -29
- package/scripts/build.sh +28 -28
- package/scripts/ci-quality.sh +6 -6
- package/scripts/config.sh +164 -148
- package/scripts/doctor.sh +12 -12
- package/scripts/eslint-fix.sh +8 -8
- package/scripts/eslint.sh +15 -15
- package/scripts/install-bats.sh +143 -146
- package/scripts/install-hooks.sh +108 -111
- package/scripts/install-markdownlint.sh +4 -4
- package/scripts/install-shellcheck.sh +135 -138
- package/scripts/knip.sh +7 -7
- package/scripts/markdownlint.sh +38 -38
- package/scripts/outdated.sh +30 -29
- package/scripts/prettier-fix.sh +13 -13
- package/scripts/prettier.sh +13 -13
- package/scripts/setup-project.sh +691 -629
- package/scripts/stylelint-fix.sh +26 -19
- package/scripts/stylelint.sh +27 -20
- package/scripts/test.sh +13 -11
- package/scripts/typecheck.sh +11 -11
- package/scripts/update-dependencies.mjs +552 -181
- package/scripts/validate-shellcheck.sh +18 -18
- package/stubs/githooks/commit-msg +24 -21
- package/stubs/githooks/pre-commit +19 -19
- package/stubs/githooks/pre-push +18 -18
- package/stubs/githooks/prepare-commit-msg +6 -6
- package/stubs/gitlab-ci/gitlab-ci.yml.stub +1 -1
- package/stubs/governance/CONTRIBUTING.md.stub +5 -3
- package/stubs/quality/eslint.config.js.stub +1 -1
- package/stubs/quality/knip.config.js.stub +1 -1
- package/stubs/style/prettier.config.js.stub +3 -3
- package/stubs/style/stylelint.config.js.stub +8 -1
- package/stubs/testing/vitest.config.js.stub +1 -1
- package/tools/make/bats.mk +3 -3
- package/tools/make/core.mk +3 -3
- package/tools/make/quality.mk +2 -1
- package/tools/make/variables.mk +1 -1
package/README.md
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://gitlab.com/zairakai/npm-packages/js-dev-tools/-/raw/main/assets/icon.png" alt="JS Dev Tools" width="160">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
# JS Dev Tools
|
|
2
6
|
|
|
3
7
|
[![Main][pipeline-main-badge]][pipeline-main-link]
|
|
4
8
|
[![Develop][pipeline-develop-badge]][pipeline-develop-link]
|
|
9
|
+
[![Coverage][coverage-badge]][pipeline-main-link]
|
|
5
10
|
|
|
6
11
|
[![npm][npm-badge]][npm-link]
|
|
12
|
+
[![Base][base-badge]][base]
|
|
7
13
|
[![Docs][docs-badge]][docs]
|
|
8
14
|
[![GitLab Release][gitlab-release-badge]][gitlab-release]
|
|
9
15
|
[![License][license-badge]][license]
|
|
@@ -12,8 +18,10 @@
|
|
|
12
18
|
[![ESLint][eslint-badge]][eslint]
|
|
13
19
|
[![Prettier][prettier-badge]][prettier]
|
|
14
20
|
[![Stylelint][stylelint-badge]][stylelint]
|
|
21
|
+
[![Vitest][vitest-badge]][vitest]
|
|
22
|
+
[![Knip][knip-badge]][knip]
|
|
15
23
|
|
|
16
|
-
One unified toolkit to set up JavaScript/TypeScript quality tooling. Context-aware by default
|
|
24
|
+
One unified toolkit to set up JavaScript/TypeScript quality tooling. Context-aware by default: it adapts to both standalone packages and full-stack applications.
|
|
17
25
|
|
|
18
26
|
**Documentation: [js-dev-tools-3fa149.gitlab.io][docs]**
|
|
19
27
|
|
|
@@ -37,14 +45,14 @@ One unified toolkit to set up JavaScript/TypeScript quality tooling. Context-awa
|
|
|
37
45
|
| Tool | Responsibility |
|
|
38
46
|
| :--- | :--- |
|
|
39
47
|
| **ESLint** | Flat config with TypeScript, Vue 3, and import rules. |
|
|
40
|
-
| **Prettier** |
|
|
41
|
-
| **Stylelint** | SCSS linting with
|
|
48
|
+
| **Prettier** | The defaults of Prettier (80 columns), with the PHP and Blade plugins and the sorting of the imports. |
|
|
49
|
+
| **Stylelint** | SCSS linting with the property order of the style guides, and `createStylelintConfig` to change it. |
|
|
42
50
|
| **Markdownlint** | Consistent Markdown across all documentation. |
|
|
43
|
-
| **Vitest** | Unit testing with v8 coverage. |
|
|
51
|
+
| **Vitest** | Unit testing with v8 coverage of every file of `src/`: 75 % required, 90 % as the good level. |
|
|
44
52
|
| **Knip** | Dead code and unused dependency detection. |
|
|
45
|
-
| **TypeScript** | Shared `tsconfig.base.json` for strict mode
|
|
53
|
+
| **TypeScript** | Shared `tsconfig.base.json` for TypeScript 6 and the web: strict mode, unchecked indexed access, isolated modules. |
|
|
46
54
|
| **GitLab CI** | Reusable pipeline templates for npm packages and Laravel full-stack. |
|
|
47
|
-
| **Git Hooks** | Automated quality checks and
|
|
55
|
+
| **Git Hooks** | Automated quality checks, ticket prefixing and a commit subject of 50 characters at most. |
|
|
48
56
|
| **Makefile** | Unified `make quality`, `make test`, `make ci` targets (delegated to core). |
|
|
49
57
|
| **Shell Scripts** | Automated setup and config publishing. |
|
|
50
58
|
|
|
@@ -93,12 +101,17 @@ make ci # full pipeline simulation
|
|
|
93
101
|
make doctor # environment diagnostics
|
|
94
102
|
```
|
|
95
103
|
|
|
104
|
+
The same checks are npm scripts, for the projects that prefer them: `npm run quality`, `npm run quality:fix`, and one per tool (`eslint`, `prettier`, `stylelint`, `markdownlint`, `knip`, each with `:fix` when the tool can fix). They run the same scripts as `make`.
|
|
105
|
+
|
|
96
106
|
---
|
|
97
107
|
|
|
98
108
|
## Configuration
|
|
99
109
|
|
|
100
110
|
Extend the shared configs in your project files:
|
|
101
111
|
|
|
112
|
+
<details>
|
|
113
|
+
<summary>Configuration examples for each tool</summary>
|
|
114
|
+
|
|
102
115
|
```js
|
|
103
116
|
// eslint.config.js
|
|
104
117
|
export { default } from '@zairakai/js-dev-tools/eslint'
|
|
@@ -120,11 +133,48 @@ export default defineConfig({ ...baseConfig, test: { ...baseConfig.test } })
|
|
|
120
133
|
{ "extends": "@zairakai/js-dev-tools/tsconfig" }
|
|
121
134
|
```
|
|
122
135
|
|
|
136
|
+
```js
|
|
137
|
+
// stylelint.config.js: to add, remove or move a property of the order
|
|
138
|
+
import { createStylelintConfig } from '@zairakai/js-dev-tools/stylelint'
|
|
139
|
+
|
|
140
|
+
export default createStylelintConfig({
|
|
141
|
+
properties: (list) => list.filter((property) => property !== 'float'),
|
|
142
|
+
})
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
</details>
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## Tests and coverage
|
|
150
|
+
|
|
151
|
+
`make test-coverage` and the job `js:test` of the pipeline run Vitest with coverage. The reports are in `coverage/`: the HTML report, `lcov.info`, `cobertura-coverage.xml` (the coverage of the merge request) and `junit.xml` (the test report of the merge request). The coverage counts **every file of `src/`**, tested or not: a file that no test imports lowers it. The base requires 75 % of the lines, functions, branches and statements, and shows 90 % as the good level.
|
|
152
|
+
|
|
153
|
+
<details>
|
|
154
|
+
<summary>Lowering a threshold in a project</summary>
|
|
155
|
+
|
|
156
|
+
A project that is below lowers the threshold in its own file, and raises it again as it adds tests:
|
|
157
|
+
|
|
158
|
+
```js
|
|
159
|
+
// vitest.config.js
|
|
160
|
+
import baseConfig from '@zairakai/js-dev-tools/vitest'
|
|
161
|
+
import { defineConfig, mergeConfig } from 'vitest/config'
|
|
162
|
+
|
|
163
|
+
export default mergeConfig(baseConfig, defineConfig({ test: { coverage: { thresholds: { lines: 60 } } } }))
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
</details>
|
|
167
|
+
|
|
168
|
+
The tests do not use globals: `describe`, `it` and `expect` are imported from `vitest`. `coverage/` is ignored by Git and by the tools.
|
|
169
|
+
|
|
123
170
|
---
|
|
124
171
|
|
|
125
172
|
## Publishing configs
|
|
126
173
|
|
|
127
|
-
Publish individual config files to `config/dev-tools/` (never overwritten unless `--force`)
|
|
174
|
+
Publish individual config files to `config/dev-tools/` (never overwritten unless `--force`). The setup also creates, at the root, the thin files that the editor extensions look for (`eslint.config.mjs`, `prettier.config.mjs`, `stylelint.config.mjs`, `vitest.config.mjs`, `.markdownlint.json`) and the copies of the ignore files; a file that the project already has is kept.
|
|
175
|
+
|
|
176
|
+
<details>
|
|
177
|
+
<summary>The publish commands</summary>
|
|
128
178
|
|
|
129
179
|
```bash
|
|
130
180
|
# All at once
|
|
@@ -146,6 +196,8 @@ bash node_modules/@zairakai/js-dev-tools/scripts/setup-project.sh --publish=vite
|
|
|
146
196
|
bash node_modules/@zairakai/js-dev-tools/scripts/setup-project.sh --publish=tsconfig
|
|
147
197
|
```
|
|
148
198
|
|
|
199
|
+
</details>
|
|
200
|
+
|
|
149
201
|
---
|
|
150
202
|
|
|
151
203
|
## GitLab CI pipeline templates
|
|
@@ -160,14 +212,29 @@ include:
|
|
|
160
212
|
file: '.gitlab/ci/pipeline-js-package.yml'
|
|
161
213
|
|
|
162
214
|
variables:
|
|
163
|
-
CACHE_KEY: "my-package-
|
|
215
|
+
CACHE_KEY: "my-package-v2"
|
|
164
216
|
NPM_PACKAGE_NAME: "@myorg/my-package"
|
|
165
217
|
```
|
|
166
218
|
|
|
167
219
|
Available templates:
|
|
168
220
|
|
|
169
|
-
- `.gitlab/ci/pipeline-js-package.yml
|
|
170
|
-
- `.gitlab/ci/pipeline-js-app.yml
|
|
221
|
+
- `.gitlab/ci/pipeline-js-package.yml`: security → install → validate → quality → test → build → publish → release
|
|
222
|
+
- `.gitlab/ci/pipeline-js-app.yml`: JS quality + test jobs for Laravel full-stack apps
|
|
223
|
+
|
|
224
|
+
Both files are entry points: the jobs are in `.gitlab/ci/parts/`, one file per role, and the application includes the parts it needs and none of what only a package does.
|
|
225
|
+
|
|
226
|
+
<details>
|
|
227
|
+
<summary>The parts of the pipelines</summary>
|
|
228
|
+
|
|
229
|
+
| Part | Jobs | Package | Application |
|
|
230
|
+
| :--- | :--- | :---: | :---: |
|
|
231
|
+
| `base.yml` | workflow, runner, variables, hidden jobs | yes | yes |
|
|
232
|
+
| `security.yml` | secret detection, check of the tag | yes | yes |
|
|
233
|
+
| `quality.yml` | install, validate, quality, test | yes | yes |
|
|
234
|
+
| `updates.yml` | `deps:update`, `deps:audit`, `deps:release`, `deps:tag` | yes | yes |
|
|
235
|
+
| `publish.yml` | build, publish, release, documentation, `deps:cascade` | yes | no |
|
|
236
|
+
|
|
237
|
+
</details>
|
|
171
238
|
|
|
172
239
|
---
|
|
173
240
|
|
|
@@ -175,6 +242,9 @@ Available templates:
|
|
|
175
242
|
|
|
176
243
|
The pipeline template updates the dependencies of a project by itself, and this package starts the update of the projects that use it. The rules are in the handbook (`policies/dependency-management.md` and `policies/versioning.md`).
|
|
177
244
|
|
|
245
|
+
<details>
|
|
246
|
+
<summary>The rules of the automatic updates</summary>
|
|
247
|
+
|
|
178
248
|
- A weekly schedule with the variable `UPDATE_DEPENDENCIES=true`, or a pipeline started by the cascade, runs `deps:update`: it takes the **minor and patch** updates after a cooling period, opens a merge request into `develop` and merges it **when its pipeline succeeds**. Major versions are never applied.
|
|
179
249
|
- `deps:release` brings `develop` into `main` after such an update, and `deps:tag` tags `main` when a published range (`dependencies`, `peerDependencies`) changed. A project that changed only its development dependencies is not tagged: its published archive is the same.
|
|
180
250
|
- After the publication of a tag, `deps:cascade` waits for the version to be on the registry, then starts the update of the projects that have a `.dependency-update.json`.
|
|
@@ -196,6 +266,10 @@ The exceptions of a project live in `.dependency-update.json` at its root (every
|
|
|
196
266
|
|
|
197
267
|
`tag.when` is `runtime` (default), `always` or `never`, and `tag.level` is `patch` (default) or `minor`. Only the projects that others depend on need a `cascade`. The group variable `GITLAB_TOKEN` is used to open the merge requests and to tag.
|
|
198
268
|
|
|
269
|
+
</details>
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
199
273
|
## Development
|
|
200
274
|
|
|
201
275
|
```bash
|
|
@@ -246,4 +320,11 @@ make doctor # environment diagnostics
|
|
|
246
320
|
[ecosystem]: https://gitlab.com/zairakai
|
|
247
321
|
[docs]: https://js-dev-tools-3fa149.gitlab.io
|
|
248
322
|
[docs-badge]: https://img.shields.io/badge/docs-online-blue
|
|
323
|
+
[coverage-badge]: https://gitlab.com/zairakai/npm-packages/js-dev-tools/badges/main/coverage.svg?job=js:test&key_text=Coverage
|
|
324
|
+
[base-badge]: https://img.shields.io/npm/dependency-version/@zairakai/js-dev-tools/@stanislas-poisson/js-dev-tools?label=base
|
|
325
|
+
[base]: https://github.com/Stanislas-Poisson/js-dev-tools
|
|
326
|
+
[vitest-badge]: https://img.shields.io/badge/test-vitest-6E9F18.svg?logo=vitest
|
|
327
|
+
[vitest]: https://vitest.dev
|
|
328
|
+
[knip-badge]: https://img.shields.io/badge/dead%20code-knip-EC4899.svg
|
|
329
|
+
[knip]: https://knip.dev
|
|
249
330
|
[stats-card]: https://gitlab.com/zairakai/gitlab-profile/-/raw/main/assets/projects/js-dev-tools.svg
|
package/config/.prettierignore
CHANGED
|
@@ -1,11 +1,24 @@
|
|
|
1
|
+
# Folders
|
|
2
|
+
.nuxt/
|
|
3
|
+
.output/
|
|
4
|
+
# Laravel: the cache is not source
|
|
5
|
+
bootstrap/cache/
|
|
1
6
|
build/
|
|
2
7
|
coverage/
|
|
3
8
|
dist/
|
|
9
|
+
docs/
|
|
4
10
|
node_modules/
|
|
5
11
|
public/
|
|
12
|
+
# Laravel: the runtime files are not source
|
|
13
|
+
storage/
|
|
14
|
+
storybook-static/
|
|
6
15
|
vendor/
|
|
16
|
+
|
|
17
|
+
# Files
|
|
7
18
|
*.lock
|
|
19
|
+
# Markdown is formatted by markdownlint
|
|
8
20
|
*.md
|
|
9
21
|
*.min.css
|
|
10
22
|
*.min.js
|
|
23
|
+
# Reports of GitLab
|
|
11
24
|
gl-*.json
|
package/config/.stylelintignore
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
# Folders
|
|
2
|
+
.nuxt/
|
|
3
|
+
.output/
|
|
4
|
+
# Laravel: the cache is not source
|
|
5
|
+
bootstrap/cache/
|
|
3
6
|
build/
|
|
4
7
|
coverage/
|
|
5
|
-
|
|
8
|
+
dist/
|
|
9
|
+
docs/
|
|
10
|
+
node_modules/
|
|
6
11
|
public/
|
|
12
|
+
# Laravel: the runtime files are not source
|
|
13
|
+
storage/
|
|
14
|
+
vendor/
|
|
15
|
+
|
|
16
|
+
# Files
|
|
7
17
|
*.min.css
|
package/config/eslint.config.js
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
// The rules live in @stanislas-poisson/js-dev-tools; this path stays for the projects that use it.
|
|
2
|
-
|
|
2
|
+
import base from '@stanislas-poisson/js-dev-tools/eslint'
|
|
3
|
+
|
|
4
|
+
export default [
|
|
5
|
+
...base,
|
|
6
|
+
// Laravel: the runtime files and the cache are not source
|
|
7
|
+
{ ignores: ['storage/**', 'bootstrap/cache/**'] },
|
|
8
|
+
]
|
package/config/knip.config.js
CHANGED
|
@@ -11,12 +11,16 @@ export default {
|
|
|
11
11
|
// The documentation site (VitePress) has its own tools and is not part of the package.
|
|
12
12
|
ignore: ['docs/**'],
|
|
13
13
|
|
|
14
|
-
// "Referenced optional peerDependencies" is informational
|
|
14
|
+
// "Referenced optional peerDependencies" is informational - stylelint is intentionally optional
|
|
15
15
|
exclude: ['optionalPeerDependencies'],
|
|
16
16
|
|
|
17
|
+
// The Stylelint rules come with @zairakai/js-dev-tools, which gives their absolute paths in the configuration: a project
|
|
18
|
+
// does not list them, so the plugin of Knip for Stylelint would report each of them as unlisted
|
|
19
|
+
stylelint: false,
|
|
20
|
+
|
|
17
21
|
ignoreDependencies: [
|
|
18
|
-
//
|
|
19
|
-
'
|
|
22
|
+
// The binary of Stylelint comes with @zairakai/js-dev-tools too; a project may list it or not
|
|
23
|
+
'stylelint',
|
|
20
24
|
|
|
21
25
|
// Optional peer dep bundled for consumers
|
|
22
26
|
'zod',
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zairakai/js-dev-tools",
|
|
3
|
-
"version": "3.
|
|
4
|
-
"description": "The
|
|
3
|
+
"version": "3.22.0",
|
|
4
|
+
"description": "The development toolkit of the JavaScript and TypeScript projects for the web: shared ESLint, Prettier, Stylelint, Vitest, TypeScript and markdownlint rules, Knip, Makefile targets, Git hooks and GitLab CI pipeline templates",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dev-tools",
|
|
7
7
|
"toolkit",
|
|
@@ -15,7 +15,12 @@
|
|
|
15
15
|
"stylelint",
|
|
16
16
|
"vitest",
|
|
17
17
|
"knip",
|
|
18
|
-
"typescript"
|
|
18
|
+
"typescript",
|
|
19
|
+
"markdownlint",
|
|
20
|
+
"tsconfig",
|
|
21
|
+
"editorconfig",
|
|
22
|
+
"vue",
|
|
23
|
+
"scss"
|
|
19
24
|
],
|
|
20
25
|
"homepage": "https://js-dev-tools-3fa149.gitlab.io",
|
|
21
26
|
"bugs": {
|
|
@@ -71,50 +76,74 @@
|
|
|
71
76
|
"README.md"
|
|
72
77
|
],
|
|
73
78
|
"scripts": {
|
|
74
|
-
"eslint": "
|
|
75
|
-
"eslint:fix": "
|
|
79
|
+
"eslint": "bash ./scripts/eslint.sh",
|
|
80
|
+
"eslint:fix": "bash ./scripts/eslint-fix.sh",
|
|
76
81
|
"postinstall": "bash ./scripts/setup-project.sh --silent || true",
|
|
77
82
|
"knip": "bash ./scripts/knip.sh",
|
|
78
|
-
"markdownlint": "
|
|
79
|
-
"markdownlint:fix": "markdownlint-
|
|
83
|
+
"markdownlint": "bash ./scripts/markdownlint.sh",
|
|
84
|
+
"markdownlint:fix": "bash ./scripts/markdownlint-fix.sh",
|
|
80
85
|
"normalize": "make package-normalize",
|
|
81
86
|
"package:validate": "make package-validate",
|
|
82
|
-
"prettier": "
|
|
83
|
-
"prettier:fix": "
|
|
87
|
+
"prettier": "bash ./scripts/prettier.sh",
|
|
88
|
+
"prettier:fix": "bash ./scripts/prettier-fix.sh",
|
|
89
|
+
"quality": "make quality",
|
|
90
|
+
"quality:fix": "make quality-fix",
|
|
84
91
|
"setup": "bash ./scripts/setup-project.sh",
|
|
85
|
-
"stylelint": "
|
|
86
|
-
"stylelint:fix": "
|
|
87
|
-
"test": "make test-all"
|
|
88
|
-
|
|
92
|
+
"stylelint": "bash ./scripts/stylelint.sh",
|
|
93
|
+
"stylelint:fix": "bash ./scripts/stylelint-fix.sh",
|
|
94
|
+
"test": "make test-all"
|
|
95
|
+
},
|
|
96
|
+
"overrides": {
|
|
97
|
+
"brace-expansion": "5.0.12",
|
|
98
|
+
"colord": "2.9.7",
|
|
99
|
+
"fast-uri": "3.1.9",
|
|
100
|
+
"js-yaml": {
|
|
101
|
+
".": "4.3.2"
|
|
102
|
+
},
|
|
103
|
+
"katex": "0.18.11",
|
|
104
|
+
"markdown-it": "14.3.3",
|
|
105
|
+
"minimatch": "11.0.6",
|
|
106
|
+
"nanoid": "3.3.20",
|
|
107
|
+
"re2js": "2.9.1",
|
|
108
|
+
"smol-toml": "1.9.0"
|
|
89
109
|
},
|
|
90
110
|
"dependencies": {
|
|
91
|
-
"@stanislas-poisson/js-dev-tools": "^
|
|
111
|
+
"@stanislas-poisson/js-dev-tools": "^3.1.0",
|
|
92
112
|
"eslint": "^10.14.0",
|
|
93
113
|
"markdownlint-cli2": "^0.24.0",
|
|
94
114
|
"prettier": "^3.9.10",
|
|
95
115
|
"semver": "^7.8.6",
|
|
96
|
-
"stylelint": "^
|
|
116
|
+
"stylelint": "^18.0.0"
|
|
97
117
|
},
|
|
98
118
|
"devDependencies": {
|
|
99
119
|
"@vitest/coverage-v8": "^5.1.0",
|
|
100
|
-
"knip": "^6.44.
|
|
120
|
+
"knip": "^6.44.2",
|
|
101
121
|
"sort-package-json": "^4.1.0",
|
|
102
122
|
"typescript": "^6.0.3",
|
|
103
123
|
"vitest": "^5.1.0",
|
|
104
124
|
"zod": "^4.6.7"
|
|
105
125
|
},
|
|
106
126
|
"peerDependencies": {
|
|
127
|
+
"@vitest/coverage-v8": "^5.0.0",
|
|
107
128
|
"eslint": "^10.14.0",
|
|
108
129
|
"typedoc": "^0.28.0",
|
|
130
|
+
"typescript": "^6.0.0",
|
|
131
|
+
"vitest": "^5.0.0",
|
|
109
132
|
"zod": "^3.0.0 || ^4.0.0"
|
|
110
133
|
},
|
|
111
134
|
"peerDependenciesMeta": {
|
|
112
|
-
"
|
|
135
|
+
"@vitest/coverage-v8": {
|
|
113
136
|
"optional": true
|
|
114
137
|
},
|
|
115
138
|
"typedoc": {
|
|
116
139
|
"optional": true
|
|
117
140
|
},
|
|
141
|
+
"typescript": {
|
|
142
|
+
"optional": true
|
|
143
|
+
},
|
|
144
|
+
"vitest": {
|
|
145
|
+
"optional": true
|
|
146
|
+
},
|
|
118
147
|
"zod": {
|
|
119
148
|
"optional": true
|
|
120
149
|
}
|
|
@@ -124,17 +153,5 @@
|
|
|
124
153
|
},
|
|
125
154
|
"publishConfig": {
|
|
126
155
|
"access": "public"
|
|
127
|
-
},
|
|
128
|
-
"overrides": {
|
|
129
|
-
"markdown-it": "14.3.3",
|
|
130
|
-
"nanoid": "3.3.20",
|
|
131
|
-
"smol-toml": "1.9.0",
|
|
132
|
-
"colord": "2.9.7",
|
|
133
|
-
"fast-uri": "3.1.9",
|
|
134
|
-
"js-yaml": {
|
|
135
|
-
".": "4.3.2"
|
|
136
|
-
},
|
|
137
|
-
"brace-expansion": "5.0.12",
|
|
138
|
-
"re2js": "2.9.1"
|
|
139
156
|
}
|
|
140
157
|
}
|
package/scripts/build.sh
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
#
|
|
3
3
|
# Build script for npm packages.
|
|
4
4
|
# Supports (in order of preference):
|
|
5
|
-
# 1. Vite
|
|
6
|
-
# 2. tsup
|
|
7
|
-
# 3. tsc
|
|
5
|
+
# 1. Vite - detected via vite.config.ts / vite.config.js (runs npm run build)
|
|
6
|
+
# 2. tsup - fast, esbuild-based bundler (recommended for pure TS packages)
|
|
7
|
+
# 3. tsc - official TypeScript compiler
|
|
8
8
|
#
|
|
9
9
|
# Usage:
|
|
10
10
|
# bash scripts/build.sh
|
|
@@ -27,37 +27,37 @@ TSC_BIN="${BIN_DIR}/tsc"
|
|
|
27
27
|
log_header "Build"
|
|
28
28
|
|
|
29
29
|
if [[ -f "${PROJECT_ROOT}/vite.config.ts" ]] || [[ -f "${PROJECT_ROOT}/vite.config.js" ]]; then
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
log_info "Builder: Vite (vite.config detected - running npm run build)"
|
|
31
|
+
npm run build
|
|
32
|
+
log_success "Build complete - output in dist/"
|
|
33
33
|
|
|
34
34
|
elif [[ -f "$TSUP_BIN" ]]; then
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
log_info "Builder: tsup (fast, esbuild-based)"
|
|
36
|
+
if [[ -n "$TSUP_CONFIG" ]]; then
|
|
37
|
+
"$TSUP_BIN" --config "$TSUP_CONFIG"
|
|
38
|
+
else
|
|
39
|
+
"$TSUP_BIN"
|
|
40
|
+
fi
|
|
41
|
+
log_success "Build complete - output in dist/"
|
|
42
42
|
|
|
43
43
|
elif [[ -f "$TSC_BIN" ]]; then
|
|
44
|
-
|
|
44
|
+
log_info "Builder: tsc (official TypeScript compiler)"
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
if [[ ! -f "${PROJECT_ROOT}/tsconfig.json" ]]; then
|
|
47
|
+
log_error "No tsconfig.json found at project root"
|
|
48
|
+
log_info "Publish one with:"
|
|
49
|
+
log_info " bash node_modules/@zairakai/js-dev-tools/scripts/setup-project.sh --publish=tsconfig"
|
|
50
|
+
exit 1
|
|
51
|
+
fi
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
log_info "Config: tsconfig.json"
|
|
54
|
+
"$TSC_BIN"
|
|
55
|
+
log_success "Build complete"
|
|
56
56
|
|
|
57
57
|
else
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
58
|
+
log_error "No builder found. Expected one of: vite.config.ts, tsup, tsc"
|
|
59
|
+
log_info "Install one of:"
|
|
60
|
+
log_info " npm install --save-dev tsup (recommended for pure TS packages)"
|
|
61
|
+
log_info " npm install --save-dev typescript (for simple transpilation)"
|
|
62
|
+
exit 1
|
|
63
63
|
fi
|
package/scripts/ci-quality.sh
CHANGED
|
@@ -37,15 +37,15 @@ echo ""
|
|
|
37
37
|
|
|
38
38
|
# 3. Static Analysis (Optional, Project aware)
|
|
39
39
|
if [[ -f "${PROJECT_ROOT}/tsconfig.json" ]] && [[ -f "${BIN_DIR}/tsc" ]]; then
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
run_check "TypeScript (tsc --noEmit)" "bash '${SCRIPT_DIR}/typecheck.sh'" || true
|
|
41
|
+
echo ""
|
|
42
42
|
else
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
log_info "TypeScript: no tsconfig.json or tsc - skipping"
|
|
44
|
+
echo ""
|
|
45
45
|
fi
|
|
46
46
|
|
|
47
47
|
if exit_with_error_count "Quality Checks"; then
|
|
48
|
-
|
|
48
|
+
exit 0
|
|
49
49
|
else
|
|
50
|
-
|
|
50
|
+
exit 1
|
|
51
51
|
fi
|