@minimalstuff/tooling 0.8.0-next.0 → 0.8.1
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 +27 -170
- package/dist/cli/index.mjs +171 -87
- package/dist/oxc/lint.d.mts +2 -0
- package/dist/oxc/lint.mjs +26 -3
- package/package.json +15 -15
package/README.md
CHANGED
|
@@ -1,47 +1,32 @@
|
|
|
1
1
|
# @minimalstuff/tooling
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
- [OXC](https://oxc.rs/) presets: oxlint and oxfmt
|
|
6
|
-
- [Knip](https://knip.dev/) preset, with AdonisJS support
|
|
7
|
-
- EditorConfig preset
|
|
8
|
-
- CLI for quick project setup
|
|
3
|
+
Shared tooling configs: EditorConfig, OXC (oxlint + oxfmt), Knip. A CLI sets them up in a project.
|
|
9
4
|
|
|
10
5
|
## Requirements
|
|
11
6
|
|
|
12
7
|
- Node >= 26
|
|
13
|
-
- `oxlint
|
|
8
|
+
- `oxlint` >= 1.89.0, `oxfmt` >= 0.74.0 and `oxlint-tsgolint` >= 7.0.2004 (optional peer dependencies, for the OXC presets)
|
|
14
9
|
- `knip` >= 6.42.1 (optional peer dependency, for the Knip preset)
|
|
15
|
-
- `@adonisjs/eslint-plugin` ^2.2.2 (optional peer dependency,
|
|
10
|
+
- `@adonisjs/eslint-plugin` ^2.2.2 (optional peer dependency, needed with `adonisjs: true` in the oxlint preset; the CLI installs it)
|
|
11
|
+
|
|
12
|
+
## Versioning
|
|
16
13
|
|
|
17
14
|
> [!IMPORTANT]
|
|
18
|
-
>
|
|
15
|
+
> Removing or changing an export or option is a breaking change. Before 1.0, new or stricter `error`-level rules and new required peer dependencies are breaking too: they ship in a minor release, which `^0.x` ranges never pick up automatically. New `warn`-level rules and relaxed rules are not breaking.
|
|
19
16
|
|
|
20
|
-
##
|
|
17
|
+
## Set up a project
|
|
21
18
|
|
|
22
|
-
### CLI
|
|
19
|
+
### With the CLI
|
|
23
20
|
|
|
24
|
-
Run this command
|
|
21
|
+
Run this command from the project root, in an interactive terminal:
|
|
25
22
|
|
|
26
23
|
```bash
|
|
27
24
|
pnpm dlx @minimalstuff/tooling@latest
|
|
28
25
|
```
|
|
29
26
|
|
|
30
|
-
The CLI
|
|
31
|
-
|
|
32
|
-
| Script | Command |
|
|
33
|
-
| -------------- | -------------------------------------------------- |
|
|
34
|
-
| `lint` | `oxlint` |
|
|
35
|
-
| `lint:fix` | `oxlint --fix` |
|
|
36
|
-
| `format` | `oxfmt && oxlint --fix` |
|
|
37
|
-
| `format:check` | `oxfmt --check` |
|
|
38
|
-
| `typecheck` | `tsc --noEmit` |
|
|
39
|
-
| `knip` | `knip` |
|
|
40
|
-
| `check` | `pnpm lint && pnpm format:check && pnpm typecheck` |
|
|
27
|
+
The CLI asks which tools to set up (EditorConfig, OXC, Knip), offers VS Code settings when OXC is selected, and asks for presets (`react`, `adonisjs`, `vitest`) pre-selected from your dependencies. It asks before overwriting a file and only adds the `package.json` scripts that are missing. It then installs the packages once as devDependencies with the detected package manager. See the [CLI reference](docs/cli.md) for details.
|
|
41
28
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
### Manual install
|
|
29
|
+
### Manually
|
|
45
30
|
|
|
46
31
|
```bash
|
|
47
32
|
pnpm add -D oxlint oxfmt oxlint-tsgolint @minimalstuff/tooling
|
|
@@ -51,178 +36,50 @@ pnpm add -D @adonisjs/eslint-plugin
|
|
|
51
36
|
pnpm add -D knip
|
|
52
37
|
```
|
|
53
38
|
|
|
54
|
-
## oxlint
|
|
55
|
-
|
|
56
39
|
```ts
|
|
57
40
|
// oxlint.config.ts
|
|
58
41
|
import { minimalstuffPreset } from '@minimalstuff/tooling/oxc/lint';
|
|
59
42
|
|
|
60
|
-
export default minimalstuffPreset({
|
|
61
|
-
react: true,
|
|
62
|
-
ignorePatterns: ['tmp/**'],
|
|
63
|
-
rules: {
|
|
64
|
-
'no-console': 'warn',
|
|
65
|
-
},
|
|
66
|
-
});
|
|
43
|
+
export default minimalstuffPreset({ react: true });
|
|
67
44
|
```
|
|
68
45
|
|
|
69
|
-
`minimalstuffPreset` returns the root config. Any oxlint option (`rules`, `overrides`, `plugins`, `extends`, ...) can be passed next to the preset options:
|
|
70
|
-
|
|
71
|
-
| Option | Type | Default | Enables |
|
|
72
|
-
| ---------- | --------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
73
|
-
| `react` | `boolean` | `false` | `react` and `jsx-a11y` plugins, `react/rules-of-hooks` and `react/only-export-components` |
|
|
74
|
-
| `adonisjs` | `boolean` | `false` | `@adonisjs/eslint-plugin` lazy import rules, Lucid-aware `no-floating-promises`, AdonisJS ignore patterns (needs `@adonisjs/eslint-plugin` as a dev dependency, the CLI installs it) |
|
|
75
|
-
| `vitest` | `boolean` | `false` | `vitest` plugin |
|
|
76
|
-
|
|
77
|
-
With both `adonisjs` and `react`, the Inertia rules (`no-backend-import-in-frontend`, `prefer-adonisjs-inertia-link`, `prefer-adonisjs-inertia-form`) are enabled on `**/inertia/**/*.{ts,tsx}`.
|
|
78
|
-
|
|
79
|
-
The base preset enables the `typescript`, `unicorn` and `oxc` plugins, the `correctness` category as `error`, and type-aware linting with type checking (`typeAware`, `typeCheck`) with a set of strict `typescript/*` rules.
|
|
80
|
-
|
|
81
|
-
It also enables the `promise` plugin and these async rules:
|
|
82
|
-
|
|
83
|
-
- `no-await-in-loop`: `warn`, turned off for test files (`**/*.{test,spec}.{ts,tsx,js,jsx}` and `**/tests/**`)
|
|
84
|
-
- `error`: `promise/param-names`, `promise/no-return-in-finally`, `promise/no-multiple-resolved`, `promise/no-new-statics`, `promise/valid-params`
|
|
85
|
-
- `warn`: `promise/no-nesting`
|
|
86
|
-
|
|
87
|
-
### Merge semantics
|
|
88
|
-
|
|
89
|
-
- `rules`: yours override the preset's
|
|
90
|
-
- `overrides`: yours come after the preset's
|
|
91
|
-
- `plugins`, `jsPlugins`: yours are added to the preset's
|
|
92
|
-
- `extends`: yours come after the preset's
|
|
93
|
-
- `ignorePatterns`: the defaults are kept and yours are appended
|
|
94
|
-
|
|
95
|
-
### Default ignore patterns
|
|
96
|
-
|
|
97
|
-
- Always: `**/node_modules/**`, `**/dist/**`, `**/build/**`, `**/routeTree.gen.ts`, `**/*.yml`, `**/*.yaml`
|
|
98
|
-
- With `adonisjs`: `**/.adonisjs/**`, `**/bin/*`, `**/database/schema.ts`
|
|
99
|
-
|
|
100
|
-
## oxfmt
|
|
101
|
-
|
|
102
46
|
```ts
|
|
103
47
|
// oxfmt.config.ts
|
|
104
48
|
import { minimalstuffPreset } from '@minimalstuff/tooling/oxc/fmt';
|
|
105
49
|
|
|
106
|
-
export default minimalstuffPreset(
|
|
50
|
+
export default minimalstuffPreset();
|
|
107
51
|
```
|
|
108
52
|
|
|
109
|
-
Defaults: `printWidth: 80`, `tabWidth: 2`, `useTabs: true`, `semi: true`, `singleQuote: true`, `quoteProps: 'as-needed'`, `bracketSpacing: true`, `arrowParens: 'always'`, `trailingComma: 'es5'`, `htmlWhitespaceSensitivity: 'ignore'`.
|
|
110
|
-
|
|
111
|
-
Imports are sorted natively with `sortImports`, alphabetically, in three groups separated by a blank line: side effects, then `builtin` and `external`, then `@/` and `~/` internal imports and relative imports.
|
|
112
|
-
|
|
113
|
-
| Option | Type | Default | Description |
|
|
114
|
-
| ---------- | --------- | ------- | -------------------------------- |
|
|
115
|
-
| `adonisjs` | `boolean` | `false` | Add the AdonisJS ignore patterns |
|
|
116
|
-
|
|
117
|
-
Any other oxfmt option overrides the defaults. `ignorePatterns` are appended to the defaults (the oxlint ones plus `**/CHANGELOG.md`), never replaced.
|
|
118
|
-
|
|
119
|
-
## knip
|
|
120
|
-
|
|
121
53
|
```ts
|
|
122
54
|
// knip.ts
|
|
123
55
|
import { minimalstuffPreset } from '@minimalstuff/tooling/knip';
|
|
124
56
|
|
|
125
|
-
export default minimalstuffPreset(
|
|
57
|
+
export default minimalstuffPreset();
|
|
126
58
|
```
|
|
127
59
|
|
|
128
|
-
Monorepo, with the AdonisJS app(s) in workspaces:
|
|
129
|
-
|
|
130
|
-
```ts
|
|
131
|
-
export default minimalstuffPreset({ adonisjs: ['apps/webapp'] });
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
`minimalstuffPreset` returns the root config. Any knip option (`entry`, `project`, `ignore`, `ignoreDependencies`, `workspaces`, ...) can be passed next to the preset option. Without `adonisjs`, it returns your config as is: knip's built-in plugins (vite, vitest, playwright, tsdown, oxlint, ...) already cover most setups.
|
|
135
|
-
|
|
136
|
-
| Option | Type | Default | Description |
|
|
137
|
-
| ---------- | ------------------------------ | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
138
|
-
| `adonisjs` | `boolean \| readonly string[]` | `false` | `true` applies the AdonisJS config to the root workspace. A list of paths applies it to each of those workspaces (under `workspaces[path]`, monorepo case) |
|
|
139
|
-
|
|
140
|
-
Knip has no AdonisJS or Japa plugin, so everything Adonis loads by convention would be reported as unused. The AdonisJS config declares:
|
|
141
|
-
|
|
142
|
-
- `entry`: `adonisrc.ts`, `ace.js`, `bin/*.ts`, `start/**`, `config/**`, `providers/**`, `commands/**`, `database/{migrations,seeders,factories}/**`, `tests/bootstrap.ts`, Japa specs (`tests/**/*.spec.{ts,js}`, `app/**/*.spec.{ts,js}`), and the Inertia files (`inertia/{app,ssr}.{ts,tsx}`, `inertia/app/{app,ssr}.{ts,tsx}`, `inertia/pages/**/*.{ts,tsx}`, pages are resolved by name at runtime)
|
|
143
|
-
- `project`: `**/*.{ts,tsx,js}`
|
|
144
|
-
- `ignore`: `.adonisjs/**` (generated), `database/schema.ts` (generated by Lucid)
|
|
145
|
-
- `ignoreDependencies`: `pg`, `mysql2`, `better-sqlite3`, `sqlite3` (database drivers only referenced by name in `config/database.ts`), `pino-pretty` (logger transport referenced by name), `hot-hook` (only referenced in `package.json`)
|
|
146
|
-
|
|
147
|
-
### Merge semantics
|
|
148
|
-
|
|
149
|
-
For the targeted workspace(s):
|
|
150
|
-
|
|
151
|
-
- arrays (`entry`, `project`, `ignore`, `ignoreDependencies`, ...): yours are appended to the preset's (a single string is accepted)
|
|
152
|
-
- other keys (booleans, objects such as plugin configs): yours win
|
|
153
|
-
|
|
154
|
-
With `adonisjs: true`, the preset is merged into the root keys. If you define `workspaces['.']` yourself, knip ignores the root keys: use `adonisjs: ['.']` instead. With a list of paths, the root keys are left untouched and each listed workspace gets the preset merged with its own `workspaces[path]` entry.
|
|
155
|
-
|
|
156
|
-
## Migrating from 0.7
|
|
157
|
-
|
|
158
|
-
In 0.x a minor bump is breaking, so `^0.7.0` never resolves to 0.8: upgrade explicitly.
|
|
159
|
-
|
|
160
60
|
```bash
|
|
161
|
-
|
|
61
|
+
cp node_modules/@minimalstuff/tooling/preset/.editorconfig .editorconfig
|
|
162
62
|
```
|
|
163
63
|
|
|
164
|
-
|
|
165
|
-
- The base oxlint preset now enables the `promise` plugin and the async rules listed in [oxlint](#oxlint): the error-level ones may surface new errors.
|
|
166
|
-
|
|
167
|
-
## Migrating from 0.6
|
|
64
|
+
See the [presets reference](docs/presets.md) for the options.
|
|
168
65
|
|
|
169
|
-
|
|
66
|
+
## Develop
|
|
170
67
|
|
|
171
68
|
```bash
|
|
172
|
-
pnpm
|
|
69
|
+
pnpm install
|
|
70
|
+
pnpm checks
|
|
173
71
|
```
|
|
174
72
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
- Node >= 26.
|
|
178
|
-
- Peers: `oxlint >= 1.89.0`, `oxfmt >= 0.74.0`, `oxlint-tsgolint >= 7.0.2004`.
|
|
179
|
-
|
|
180
|
-
oxlint: the preset now returns the root config instead of being passed to `extends`.
|
|
181
|
-
|
|
182
|
-
```ts
|
|
183
|
-
// before
|
|
184
|
-
export default defineConfig({
|
|
185
|
-
ignorePatterns: [...ADONISJS_DEFAULT_IGNORE_PATTERNS, 'tmp/**'],
|
|
186
|
-
extends: [minimalstuffPreset({ react: true, adonisjs: true })],
|
|
187
|
-
rules: { 'no-console': 'warn' },
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
// after
|
|
191
|
-
export default minimalstuffPreset({
|
|
192
|
-
react: true,
|
|
193
|
-
adonisjs: true,
|
|
194
|
-
ignorePatterns: ['tmp/**'],
|
|
195
|
-
rules: { 'no-console': 'warn' },
|
|
196
|
-
});
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
oxfmt: `OXFMT_DEFAULT_IGNORE_PATTERNS` and `ADONISJS_DEFAULT_IGNORE_PATTERNS` are no longer exported.
|
|
200
|
-
|
|
201
|
-
```ts
|
|
202
|
-
// before
|
|
203
|
-
export default minimalstuffPreset({
|
|
204
|
-
ignorePatterns: [
|
|
205
|
-
...OXFMT_DEFAULT_IGNORE_PATTERNS,
|
|
206
|
-
...ADONISJS_DEFAULT_IGNORE_PATTERNS,
|
|
207
|
-
],
|
|
208
|
-
});
|
|
209
|
-
|
|
210
|
-
// after
|
|
211
|
-
export default minimalstuffPreset({ adonisjs: true });
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
Other changes:
|
|
215
|
-
|
|
216
|
-
- The `perfectionist` option is removed. Imports are now sorted alphabetically by oxfmt: run `pnpm format` once.
|
|
217
|
-
- Remove the ignore patterns that are now defaults from your configs.
|
|
218
|
-
- The `eslint-plugin-perfectionist` dependency is no longer needed.
|
|
219
|
-
- Correctness rules are now errors and new type-aware rules are enabled (see [oxlint](#oxlint)): `pnpm lint` may fail where it passed before.
|
|
220
|
-
- The CLI only adds missing scripts, so update existing ones by hand: drop `--fix-dangerously` from `lint:fix` and replace `format: "pnpm lint:fix; oxfmt ."` with `format: "oxfmt && oxlint --fix"` (see [CLI](#cli)).
|
|
221
|
-
- Optional: add Knip (see [knip](#knip)).
|
|
73
|
+
`pnpm checks` runs the typecheck, lint, format check, Knip, unit tests and build. `pnpm test:package` installs the packed tarball into throwaway consumer projects with strict pnpm: it needs network access and runs in CI.
|
|
222
74
|
|
|
223
|
-
##
|
|
75
|
+
## Documentation
|
|
224
76
|
|
|
225
|
-
|
|
77
|
+
- [CLI reference](docs/cli.md)
|
|
78
|
+
- [Presets reference](docs/presets.md)
|
|
79
|
+
- [Upgrade guides](docs/migrating.md)
|
|
80
|
+
- [Release a version](docs/releasing.md) (for maintainers)
|
|
81
|
+
- [Changelog](CHANGELOG.md)
|
|
82
|
+
- [Issues](https://github.com/minimalstuff/tooling/issues)
|
|
226
83
|
|
|
227
84
|
## License
|
|
228
85
|
|
package/dist/cli/index.mjs
CHANGED
|
@@ -1,12 +1,47 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { cancel, confirm, intro, isCancel, log, multiselect } from "@clack/prompts";
|
|
2
|
+
import { cancel, confirm, intro, isCancel, log, multiselect, outro } from "@clack/prompts";
|
|
3
|
+
import color from "picocolors";
|
|
4
|
+
import { detectPackageManager, installPackage } from "@antfu/install-pkg";
|
|
3
5
|
import { existsSync } from "node:fs";
|
|
4
6
|
import { basename, dirname, join } from "node:path";
|
|
5
|
-
import color from "picocolors";
|
|
6
7
|
import { mkdir, readFile, readdir, writeFile } from "node:fs/promises";
|
|
7
8
|
import { parse, printParseErrorCode } from "jsonc-parser";
|
|
8
9
|
import { fileURLToPath } from "node:url";
|
|
9
|
-
|
|
10
|
+
// src/cli/install_dev_packages.ts
|
|
11
|
+
const DEFAULT_AGENT = "npm";
|
|
12
|
+
const PNPM_WORKSPACE_FILE = "pnpm-workspace.yaml";
|
|
13
|
+
var InstallPackagesError = class extends Error {
|
|
14
|
+
constructor(command, cause) {
|
|
15
|
+
super(`Installing packages failed. Run it yourself: ${command}`, { cause });
|
|
16
|
+
this.name = "InstallPackagesError";
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
function buildDevInstallCommand(agent, packageNames, hasPnpmWorkspace) {
|
|
20
|
+
return [
|
|
21
|
+
agent,
|
|
22
|
+
agent === "yarn" ? "add" : "install",
|
|
23
|
+
"-D",
|
|
24
|
+
...agent === "pnpm" && hasPnpmWorkspace ? ["-w"] : [],
|
|
25
|
+
...packageNames
|
|
26
|
+
].join(" ");
|
|
27
|
+
}
|
|
28
|
+
async function detectAgent(cwd) {
|
|
29
|
+
return (await detectPackageManager(cwd) ?? DEFAULT_AGENT).split("@")[0] ?? DEFAULT_AGENT;
|
|
30
|
+
}
|
|
31
|
+
async function installDevPackages(packageNames, cwd) {
|
|
32
|
+
if (packageNames.length === 0) return;
|
|
33
|
+
log.step(`Installing ${packageNames.join(", ")}`);
|
|
34
|
+
const agent = await detectAgent(cwd);
|
|
35
|
+
try {
|
|
36
|
+
await installPackage([...packageNames], {
|
|
37
|
+
dev: true,
|
|
38
|
+
cwd,
|
|
39
|
+
packageManager: agent
|
|
40
|
+
});
|
|
41
|
+
} catch (error) {
|
|
42
|
+
throw new InstallPackagesError(buildDevInstallCommand(agent, packageNames, existsSync(join(cwd, PNPM_WORKSPACE_FILE))), error);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
10
45
|
// src/constants.ts
|
|
11
46
|
const TOOLING_PACKAGE_NAME = "@minimalstuff/tooling";
|
|
12
47
|
const OXC_LINT_IMPORT = `${TOOLING_PACKAGE_NAME}/oxc/lint`;
|
|
@@ -21,6 +56,25 @@ const KNIP_CONFIG_FILE_NAMES = [
|
|
|
21
56
|
".knip.jsonc",
|
|
22
57
|
"knip.config.ts"
|
|
23
58
|
];
|
|
59
|
+
// src/cli/list_oxc_packages.ts
|
|
60
|
+
const BASE_OXC_PACKAGES = [
|
|
61
|
+
"oxfmt",
|
|
62
|
+
"oxlint",
|
|
63
|
+
"oxlint-tsgolint",
|
|
64
|
+
TOOLING_PACKAGE_NAME
|
|
65
|
+
];
|
|
66
|
+
const ADONISJS_ESLINT_PLUGIN_PACKAGE = "@adonisjs/eslint-plugin";
|
|
67
|
+
function listOxcPackages(presetFlags) {
|
|
68
|
+
if (!presetFlags.adonisjs) return [...BASE_OXC_PACKAGES];
|
|
69
|
+
return [...BASE_OXC_PACKAGES, ADONISJS_ESLINT_PLUGIN_PACKAGE];
|
|
70
|
+
}
|
|
71
|
+
// src/cli/list_dev_packages.ts
|
|
72
|
+
const KNIP_PACKAGES = ["knip", TOOLING_PACKAGE_NAME];
|
|
73
|
+
function listDevPackages(result) {
|
|
74
|
+
const oxcPackages = result.tools.includes("oxc") ? listOxcPackages(result.presetFlags) : [];
|
|
75
|
+
const knipPackages = result.tools.includes("knip") ? KNIP_PACKAGES : [];
|
|
76
|
+
return [.../* @__PURE__ */ new Set([...oxcPackages, ...knipPackages])];
|
|
77
|
+
}
|
|
24
78
|
const LEADING_WHITESPACE_PATTERN = /^([ \t]+)\S/m;
|
|
25
79
|
var InvalidJsonFileError = class extends Error {
|
|
26
80
|
constructor(filePath, reason) {
|
|
@@ -67,6 +121,7 @@ const REACT_PACKAGES = [
|
|
|
67
121
|
];
|
|
68
122
|
const VITEST_PACKAGES = ["vitest"];
|
|
69
123
|
const ADONISJS_SCOPE_PREFIX = "@adonisjs/";
|
|
124
|
+
const SUBPATH_IMPORT_PREFIX = "#";
|
|
70
125
|
function collectDependencyNames(manifests) {
|
|
71
126
|
const names = /* @__PURE__ */ new Set();
|
|
72
127
|
for (const manifest of manifests) for (const dependencies of [
|
|
@@ -85,6 +140,9 @@ function detectPresetFlags(manifests) {
|
|
|
85
140
|
adonisjs: [...names].some((name) => name.startsWith(ADONISJS_SCOPE_PREFIX))
|
|
86
141
|
};
|
|
87
142
|
}
|
|
143
|
+
function hasSubpathImports(manifests) {
|
|
144
|
+
return manifests.some(({ imports }) => Object.keys(imports ?? {}).some((key) => key.startsWith(SUBPATH_IMPORT_PREFIX)));
|
|
145
|
+
}
|
|
88
146
|
function toDetectedPresetNames(flags) {
|
|
89
147
|
return Object.keys(flags).filter((name) => flags[name]);
|
|
90
148
|
}
|
|
@@ -127,11 +185,15 @@ async function detectPresets(cwd) {
|
|
|
127
185
|
async function detectAdonisjsWorkspacePaths(cwd) {
|
|
128
186
|
return findAdonisjsWorkspacePaths(await readWorkspaceManifests(cwd));
|
|
129
187
|
}
|
|
188
|
+
async function detectSubpathImports(cwd) {
|
|
189
|
+
return hasSubpathImports((await readWorkspaceManifests(cwd)).map(({ manifest }) => manifest));
|
|
190
|
+
}
|
|
130
191
|
// src/cli/prompts.ts
|
|
192
|
+
const CANCELLED_EXIT_CODE = 130;
|
|
131
193
|
function exitWhenCancelled(answer) {
|
|
132
194
|
if (!isCancel(answer)) return answer;
|
|
133
195
|
cancel("Cancelled");
|
|
134
|
-
return process.exit(
|
|
196
|
+
return process.exit(CANCELLED_EXIT_CODE);
|
|
135
197
|
}
|
|
136
198
|
// src/cli/prompt_presets.ts
|
|
137
199
|
const TOOLS_USING_PRESETS = ["oxc", "knip"];
|
|
@@ -162,6 +224,87 @@ async function promptPresetsForTools(tools, cwd) {
|
|
|
162
224
|
if (!TOOLS_USING_PRESETS.some((tool) => tools.includes(tool))) return NO_PRESETS;
|
|
163
225
|
return promptPresets(cwd);
|
|
164
226
|
}
|
|
227
|
+
// src/cli/tool_options.ts
|
|
228
|
+
const MAIN_TOOLS = [
|
|
229
|
+
"editorconfig",
|
|
230
|
+
"oxc",
|
|
231
|
+
"knip"
|
|
232
|
+
];
|
|
233
|
+
const ALREADY_EXISTS_SUFFIX = " (already exists)";
|
|
234
|
+
function withExistingSuffix(label, isExisting) {
|
|
235
|
+
return isExisting ? `${label}${ALREADY_EXISTS_SUFFIX}` : label;
|
|
236
|
+
}
|
|
237
|
+
function buildToolOptions(existing) {
|
|
238
|
+
return [
|
|
239
|
+
{
|
|
240
|
+
value: "editorconfig",
|
|
241
|
+
label: withExistingSuffix("EditorConfig", existing.hasEditorConfig)
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
value: "oxc",
|
|
245
|
+
label: "OXC (oxlint + oxfmt)"
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
value: "knip",
|
|
249
|
+
label: withExistingSuffix("Knip (unused files, exports, dependencies)", existing.hasKnip)
|
|
250
|
+
}
|
|
251
|
+
];
|
|
252
|
+
}
|
|
253
|
+
function isInitiallySelected(tool, existing) {
|
|
254
|
+
if (tool === "editorconfig") return !existing.hasEditorConfig;
|
|
255
|
+
if (tool === "knip") return !existing.hasKnip;
|
|
256
|
+
return true;
|
|
257
|
+
}
|
|
258
|
+
function selectInitialTools(existing) {
|
|
259
|
+
return MAIN_TOOLS.filter((tool) => isInitiallySelected(tool, existing));
|
|
260
|
+
}
|
|
261
|
+
function canConfigureVscode(tools) {
|
|
262
|
+
return tools.includes("oxc");
|
|
263
|
+
}
|
|
264
|
+
// src/cli/prompt_tools.ts
|
|
265
|
+
const VSCODE_CONFIRM_MESSAGE = "Add OXC settings to .vscode/settings.json?";
|
|
266
|
+
const VSCODE_EXISTING_NOTE = " (it already exists, existing settings are kept)";
|
|
267
|
+
function findGitRoot(startDirectory) {
|
|
268
|
+
let directory = startDirectory;
|
|
269
|
+
while (true) {
|
|
270
|
+
if (existsSync(join(directory, ".git"))) return directory;
|
|
271
|
+
const parent = dirname(directory);
|
|
272
|
+
if (parent === directory) return null;
|
|
273
|
+
directory = parent;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
function existsAtAnyRoot(roots, entryNames) {
|
|
277
|
+
return roots.some((root) => entryNames.some((entryName) => existsSync(join(root, entryName))));
|
|
278
|
+
}
|
|
279
|
+
function detectExistingConfigs(cwd) {
|
|
280
|
+
const gitRoot = findGitRoot(cwd);
|
|
281
|
+
const roots = gitRoot && gitRoot !== cwd ? [cwd, gitRoot] : [cwd];
|
|
282
|
+
return {
|
|
283
|
+
hasEditorConfig: existsAtAnyRoot(roots, [".editorconfig"]),
|
|
284
|
+
hasVscode: existsAtAnyRoot(roots, [".vscode"]),
|
|
285
|
+
hasKnip: existsAtAnyRoot(roots, KNIP_CONFIG_FILE_NAMES)
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
async function promptMainTools(existing) {
|
|
289
|
+
return exitWhenCancelled(await multiselect({
|
|
290
|
+
message: "Select tools to configure",
|
|
291
|
+
options: buildToolOptions(existing),
|
|
292
|
+
initialValues: selectInitialTools(existing),
|
|
293
|
+
required: true
|
|
294
|
+
}));
|
|
295
|
+
}
|
|
296
|
+
async function promptVscodeSettings(existing) {
|
|
297
|
+
return exitWhenCancelled(await confirm({
|
|
298
|
+
message: existing.hasVscode ? `${VSCODE_CONFIRM_MESSAGE}${VSCODE_EXISTING_NOTE}` : VSCODE_CONFIRM_MESSAGE,
|
|
299
|
+
initialValue: !existing.hasVscode
|
|
300
|
+
}));
|
|
301
|
+
}
|
|
302
|
+
async function promptTools(cwd) {
|
|
303
|
+
const existing = detectExistingConfigs(cwd);
|
|
304
|
+
const tools = await promptMainTools(existing);
|
|
305
|
+
if (!canConfigureVscode(tools)) return tools;
|
|
306
|
+
return await promptVscodeSettings(existing) ? [...tools, "vscode"] : tools;
|
|
307
|
+
}
|
|
165
308
|
// src/cli/write_generated_file.ts
|
|
166
309
|
async function writeGeneratedFile(filePath, content) {
|
|
167
310
|
const fileName = basename(filePath);
|
|
@@ -186,7 +329,9 @@ async function updateEditorConfig(result) {
|
|
|
186
329
|
const INDENT = " ";
|
|
187
330
|
const INDENT_WIDTH = 2;
|
|
188
331
|
const PRINT_WIDTH = 80;
|
|
332
|
+
const SAFE_SINGLE_QUOTED_TEXT = /^[^'\\\p{Cc}]*$/u;
|
|
189
333
|
function quote(text) {
|
|
334
|
+
if (!SAFE_SINGLE_QUOTED_TEXT.test(text)) return JSON.stringify(text);
|
|
190
335
|
return `'${text}'`;
|
|
191
336
|
}
|
|
192
337
|
function buildArrayOptionLines(key, items) {
|
|
@@ -231,7 +376,6 @@ function buildKnipConfigContent(adonisjs) {
|
|
|
231
376
|
return buildPresetConfigFile(KNIP_IMPORT, toPresetOptions$1(adonisjs));
|
|
232
377
|
}
|
|
233
378
|
// src/cli/update_knip.ts
|
|
234
|
-
const KNIP_PACKAGES = ["knip", TOOLING_PACKAGE_NAME];
|
|
235
379
|
function warnAboutConflictingConfigs$1(cwd) {
|
|
236
380
|
const conflictingFileNames = KNIP_CONFIG_FILE_NAMES.filter((fileName) => fileName !== "knip.ts" && existsSync(join(cwd, fileName)));
|
|
237
381
|
for (const fileName of conflictingFileNames) log.warn(`${fileName} found: it will conflict with the generated ${KNIP_CONFIG_FILE_NAME}. Consider removing it.`);
|
|
@@ -246,39 +390,27 @@ async function updateKnip(result) {
|
|
|
246
390
|
const adonisjsOption = await detectAdonisjsOption(cwd, result);
|
|
247
391
|
warnAboutConflictingConfigs$1(cwd);
|
|
248
392
|
await writeGeneratedFile(join(cwd, KNIP_CONFIG_FILE_NAME), buildKnipConfigContent(adonisjsOption));
|
|
249
|
-
await installPackage(KNIP_PACKAGES, {
|
|
250
|
-
dev: true,
|
|
251
|
-
cwd
|
|
252
|
-
});
|
|
253
393
|
log.success("Knip configured");
|
|
254
394
|
}
|
|
255
|
-
// src/cli/list_oxc_packages.ts
|
|
256
|
-
const BASE_OXC_PACKAGES = [
|
|
257
|
-
"oxfmt",
|
|
258
|
-
"oxlint",
|
|
259
|
-
"oxlint-tsgolint",
|
|
260
|
-
TOOLING_PACKAGE_NAME
|
|
261
|
-
];
|
|
262
|
-
const ADONISJS_ESLINT_PLUGIN_PACKAGE = "@adonisjs/eslint-plugin";
|
|
263
|
-
function listOxcPackages(presetFlags) {
|
|
264
|
-
if (!presetFlags.adonisjs) return [...BASE_OXC_PACKAGES];
|
|
265
|
-
return [...BASE_OXC_PACKAGES, ADONISJS_ESLINT_PLUGIN_PACKAGE];
|
|
266
|
-
}
|
|
267
395
|
// src/cli/oxc_config_content.ts
|
|
268
396
|
const OXLINT_PRESET_ORDER = [
|
|
269
397
|
"adonisjs",
|
|
270
398
|
"react",
|
|
271
399
|
"vitest"
|
|
272
400
|
];
|
|
401
|
+
const DISABLED_SUBPATH_IMPORTS_OPTION = {
|
|
402
|
+
key: "subpathImports",
|
|
403
|
+
value: "false"
|
|
404
|
+
};
|
|
273
405
|
function toPresetOptions(enabledNames) {
|
|
274
406
|
return enabledNames.map((name) => ({
|
|
275
407
|
key: name,
|
|
276
408
|
value: "true"
|
|
277
409
|
}));
|
|
278
410
|
}
|
|
279
|
-
function buildOxlintConfigContent(flags) {
|
|
280
|
-
const
|
|
281
|
-
return buildPresetConfigFile(OXC_LINT_IMPORT,
|
|
411
|
+
function buildOxlintConfigContent(flags, hasSubpathImports) {
|
|
412
|
+
const options = [...toPresetOptions(OXLINT_PRESET_ORDER.filter((name) => flags[name])), ...hasSubpathImports ? [] : [DISABLED_SUBPATH_IMPORTS_OPTION]];
|
|
413
|
+
return buildPresetConfigFile(OXC_LINT_IMPORT, options);
|
|
282
414
|
}
|
|
283
415
|
function buildOxfmtConfigContent(flags) {
|
|
284
416
|
const enabledNames = flags.adonisjs ? ["adonisjs"] : [];
|
|
@@ -316,14 +448,11 @@ function warnAboutConflictingConfigs(cwd) {
|
|
|
316
448
|
async function updateOxc(result) {
|
|
317
449
|
if (!result.tools.includes("oxc")) return;
|
|
318
450
|
const cwd = process.cwd();
|
|
451
|
+
const hasSubpathImports = await detectSubpathImports(cwd);
|
|
319
452
|
warnAboutConflictingConfigs(cwd);
|
|
320
|
-
await writeGeneratedFile(join(cwd, OXLINT_CONFIG_FILE), buildOxlintConfigContent(result.presetFlags));
|
|
453
|
+
await writeGeneratedFile(join(cwd, OXLINT_CONFIG_FILE), buildOxlintConfigContent(result.presetFlags, hasSubpathImports));
|
|
321
454
|
await writeGeneratedFile(join(cwd, OXFMT_CONFIG_FILE), buildOxfmtConfigContent(result.presetFlags));
|
|
322
455
|
if (result.tools.includes("vscode")) await updateVscodeSettings(cwd);
|
|
323
|
-
await installPackage(listOxcPackages(result.presetFlags), {
|
|
324
|
-
dev: true,
|
|
325
|
-
cwd
|
|
326
|
-
});
|
|
327
456
|
log.success("OXC configured (oxlint + oxfmt)");
|
|
328
457
|
}
|
|
329
458
|
// src/cli/package_scripts.ts
|
|
@@ -400,68 +529,21 @@ async function updatePackageScripts(result) {
|
|
|
400
529
|
if (merge.skippedNames.length > 0) log.info(`package.json scripts already defined, kept: ${merge.skippedNames.join(", ")}`);
|
|
401
530
|
}
|
|
402
531
|
// src/cli/index.ts
|
|
403
|
-
const
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
"
|
|
407
|
-
|
|
408
|
-
];
|
|
409
|
-
function findGitRoot(startDirectory) {
|
|
410
|
-
let directory = startDirectory;
|
|
411
|
-
while (true) {
|
|
412
|
-
if (existsSync(join(directory, ".git"))) return directory;
|
|
413
|
-
const parent = dirname(directory);
|
|
414
|
-
if (parent === directory) return null;
|
|
415
|
-
directory = parent;
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
function existsAtAnyRoot(roots, entryNames) {
|
|
419
|
-
return roots.some((root) => entryNames.some((entryName) => existsSync(join(root, entryName))));
|
|
420
|
-
}
|
|
421
|
-
async function promptTools(cwd) {
|
|
422
|
-
const gitRoot = findGitRoot(cwd);
|
|
423
|
-
const roots = gitRoot && gitRoot !== cwd ? [cwd, gitRoot] : [cwd];
|
|
424
|
-
const hasEditorConfig = existsAtAnyRoot(roots, [".editorconfig"]);
|
|
425
|
-
const hasVscode = existsAtAnyRoot(roots, [".vscode"]);
|
|
426
|
-
const hasKnip = existsAtAnyRoot(roots, KNIP_CONFIG_FILE_NAMES);
|
|
427
|
-
const initialValues = DEFAULT_SELECTED_TOOLS.filter((tool) => {
|
|
428
|
-
if (tool === "editorconfig") return !hasEditorConfig;
|
|
429
|
-
if (tool === "vscode") return !hasVscode;
|
|
430
|
-
if (tool === "knip") return !hasKnip;
|
|
431
|
-
return true;
|
|
432
|
-
});
|
|
433
|
-
return exitWhenCancelled(await multiselect({
|
|
434
|
-
message: "Select tools to configure",
|
|
435
|
-
options: [
|
|
436
|
-
{
|
|
437
|
-
value: "editorconfig",
|
|
438
|
-
label: "EditorConfig",
|
|
439
|
-
...hasEditorConfig && { hint: "already exists" }
|
|
440
|
-
},
|
|
441
|
-
{
|
|
442
|
-
value: "oxc",
|
|
443
|
-
label: "OXC (oxlint + oxfmt)"
|
|
444
|
-
},
|
|
445
|
-
{
|
|
446
|
-
value: "knip",
|
|
447
|
-
label: "Knip (unused files, exports, dependencies)",
|
|
448
|
-
...hasKnip && { hint: "already exists" }
|
|
449
|
-
},
|
|
450
|
-
{
|
|
451
|
-
value: "vscode",
|
|
452
|
-
label: "VSCode settings (.vscode/settings.json)",
|
|
453
|
-
...hasVscode && { hint: "already exists" }
|
|
454
|
-
}
|
|
455
|
-
],
|
|
456
|
-
initialValues,
|
|
457
|
-
required: true
|
|
458
|
-
}));
|
|
532
|
+
const FAILURE_EXIT_CODE = 1;
|
|
533
|
+
function exitWhenNotInteractive() {
|
|
534
|
+
if (process.stdin.isTTY) return;
|
|
535
|
+
log.error("This setup asks questions and needs an interactive terminal. Run it again from a terminal.");
|
|
536
|
+
process.exit(FAILURE_EXIT_CODE);
|
|
459
537
|
}
|
|
460
538
|
async function main() {
|
|
539
|
+
exitWhenNotInteractive();
|
|
461
540
|
const cwd = process.cwd();
|
|
462
541
|
intro(color.blue(TOOLING_PACKAGE_NAME));
|
|
463
542
|
log.info(`You are about to configure ${TOOLING_PACKAGE_NAME} in the current directory: ${color.green(cwd)}`);
|
|
464
|
-
if (!exitWhenCancelled(await confirm({ message: "Continue
|
|
543
|
+
if (!exitWhenCancelled(await confirm({ message: "Continue?" }))) {
|
|
544
|
+
outro("Nothing was changed.");
|
|
545
|
+
return;
|
|
546
|
+
}
|
|
465
547
|
const tools = await promptTools(cwd);
|
|
466
548
|
const result = {
|
|
467
549
|
tools,
|
|
@@ -471,10 +553,12 @@ async function main() {
|
|
|
471
553
|
await updatePackageScripts(result);
|
|
472
554
|
await updateOxc(result);
|
|
473
555
|
await updateKnip(result);
|
|
556
|
+
await installDevPackages(listDevPackages(result), cwd);
|
|
474
557
|
log.success("All done.");
|
|
475
558
|
}
|
|
476
559
|
main().catch((error) => {
|
|
477
560
|
log.error(error instanceof Error ? error.message : String(error));
|
|
478
|
-
|
|
561
|
+
log.info("Files written before the error are kept.");
|
|
562
|
+
process.exit(FAILURE_EXIT_CODE);
|
|
479
563
|
});
|
|
480
564
|
export {};
|
package/dist/oxc/lint.d.mts
CHANGED
|
@@ -6,6 +6,8 @@ export interface MinimalstuffOxlintOptions extends OxlintConfig {
|
|
|
6
6
|
adonisjs?: boolean;
|
|
7
7
|
/** Enable the vitest plugin. */
|
|
8
8
|
vitest?: boolean;
|
|
9
|
+
/** Report relative imports so code uses Node subpath imports (`#folder/file.ts`). Defaults to true. */
|
|
10
|
+
subpathImports?: boolean;
|
|
9
11
|
}
|
|
10
12
|
/**
|
|
11
13
|
* Builds the root oxlint config: preset parts are placed in `extends` before the
|
package/dist/oxc/lint.mjs
CHANGED
|
@@ -2,7 +2,18 @@ import { n as COMMON_IGNORE_PATTERNS, t as ADONISJS_IGNORE_PATTERNS } from "../s
|
|
|
2
2
|
import { defineConfig } from "oxlint";
|
|
3
3
|
// src/oxc/lint.ts
|
|
4
4
|
const INERTIA_FRONTEND_FILES = ["**/inertia/**/*.{ts,tsx}"];
|
|
5
|
+
/**
|
|
6
|
+
* AdonisJS server code receives dependencies through `@inject()` constructor
|
|
7
|
+
* injection, which relies on `emitDecoratorMetadata`: the injected class must be
|
|
8
|
+
* a value import, so `typescript/consistent-type-imports` must not rewrite it.
|
|
9
|
+
*/
|
|
10
|
+
const ADONISJS_INJECTION_FILES = [
|
|
11
|
+
"**/app/**",
|
|
12
|
+
"**/commands/**",
|
|
13
|
+
"**/providers/**"
|
|
14
|
+
];
|
|
5
15
|
const TEST_FILES = ["**/*.{test,spec}.{ts,tsx,js,jsx}", "**/tests/**"];
|
|
16
|
+
const RELATIVE_IMPORT_MESSAGE = "Use a subpath import (#folder/file.ts) instead of a relative path.";
|
|
6
17
|
function createBasePreset() {
|
|
7
18
|
return defineConfig({
|
|
8
19
|
plugins: [
|
|
@@ -84,9 +95,19 @@ function createAdonisjsPreset() {
|
|
|
84
95
|
package: "knex",
|
|
85
96
|
name: "QueryBuilder"
|
|
86
97
|
}] }]
|
|
87
|
-
}
|
|
98
|
+
},
|
|
99
|
+
overrides: [{
|
|
100
|
+
files: ADONISJS_INJECTION_FILES,
|
|
101
|
+
rules: { "typescript/consistent-type-imports": "off" }
|
|
102
|
+
}]
|
|
88
103
|
});
|
|
89
104
|
}
|
|
105
|
+
function createSubpathImportsPreset() {
|
|
106
|
+
return defineConfig({ rules: { "no-restricted-imports": ["error", { patterns: [{
|
|
107
|
+
group: ["./*", "../*"],
|
|
108
|
+
message: RELATIVE_IMPORT_MESSAGE
|
|
109
|
+
}] }] } });
|
|
110
|
+
}
|
|
90
111
|
function createInertiaPreset() {
|
|
91
112
|
return defineConfig({ overrides: [{
|
|
92
113
|
files: INERTIA_FRONTEND_FILES,
|
|
@@ -103,6 +124,7 @@ function createPresets(options) {
|
|
|
103
124
|
if (options.vitest) presets.push(createVitestPreset());
|
|
104
125
|
if (options.adonisjs) presets.push(createAdonisjsPreset());
|
|
105
126
|
if (options.adonisjs && options.react) presets.push(createInertiaPreset());
|
|
127
|
+
if (options.subpathImports) presets.push(createSubpathImportsPreset());
|
|
106
128
|
return presets;
|
|
107
129
|
}
|
|
108
130
|
function createIgnorePatterns(isAdonisjsEnabled, userIgnorePatterns) {
|
|
@@ -119,13 +141,14 @@ function createIgnorePatterns(isAdonisjsEnabled, userIgnorePatterns) {
|
|
|
119
141
|
* root because oxlint does not inherit them through `extends`.
|
|
120
142
|
*/
|
|
121
143
|
function minimalstuffPreset(options = {}) {
|
|
122
|
-
const { react = false, adonisjs = false, vitest = false, extends: userExtends = [], ignorePatterns: userIgnorePatterns = [], ...userConfig } = options;
|
|
144
|
+
const { react = false, adonisjs = false, vitest = false, subpathImports = true, extends: userExtends = [], ignorePatterns: userIgnorePatterns = [], ...userConfig } = options;
|
|
123
145
|
return defineConfig({
|
|
124
146
|
...userConfig,
|
|
125
147
|
extends: [...createPresets({
|
|
126
148
|
react,
|
|
127
149
|
adonisjs,
|
|
128
|
-
vitest
|
|
150
|
+
vitest,
|
|
151
|
+
subpathImports
|
|
129
152
|
}), ...userExtends],
|
|
130
153
|
ignorePatterns: createIgnorePatterns(adonisjs, userIgnorePatterns)
|
|
131
154
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@minimalstuff/tooling",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "Shared tooling configs: EditorConfig, OXC (oxlint + oxfmt), Knip",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"editorconfig",
|
|
@@ -10,6 +10,10 @@
|
|
|
10
10
|
"oxlint",
|
|
11
11
|
"react"
|
|
12
12
|
],
|
|
13
|
+
"homepage": "https://github.com/minimalstuff/tooling#readme",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/minimalstuff/tooling/issues"
|
|
16
|
+
},
|
|
13
17
|
"license": "MIT",
|
|
14
18
|
"author": "Sonny93 <sonnyasdev@gmail.com>",
|
|
15
19
|
"repository": {
|
|
@@ -24,6 +28,9 @@
|
|
|
24
28
|
"preset"
|
|
25
29
|
],
|
|
26
30
|
"type": "module",
|
|
31
|
+
"imports": {
|
|
32
|
+
"#*": "./src/*"
|
|
33
|
+
},
|
|
27
34
|
"exports": {
|
|
28
35
|
"./editorconfig": "./preset/.editorconfig",
|
|
29
36
|
"./oxc/lint": "./dist/oxc/lint.mjs",
|
|
@@ -42,7 +49,7 @@
|
|
|
42
49
|
},
|
|
43
50
|
"devDependencies": {
|
|
44
51
|
"@adonisjs/eslint-plugin": "^2.2.2",
|
|
45
|
-
"@release-it/
|
|
52
|
+
"@release-it/keep-a-changelog": "^8.0.1",
|
|
46
53
|
"@types/node": "^26.6.6",
|
|
47
54
|
"knip": "6.44.1",
|
|
48
55
|
"oxfmt": "^0.75.0",
|
|
@@ -100,18 +107,10 @@
|
|
|
100
107
|
"publish": false
|
|
101
108
|
},
|
|
102
109
|
"plugins": {
|
|
103
|
-
"@release-it/
|
|
104
|
-
"
|
|
105
|
-
"
|
|
106
|
-
|
|
107
|
-
"preMajor": true
|
|
108
|
-
},
|
|
109
|
-
"tagOpts": {
|
|
110
|
-
"skipUnstable": true
|
|
111
|
-
},
|
|
112
|
-
"writerOpts": {
|
|
113
|
-
"generateOn": null
|
|
114
|
-
}
|
|
110
|
+
"@release-it/keep-a-changelog": {
|
|
111
|
+
"filename": "CHANGELOG.md",
|
|
112
|
+
"addUnreleased": true,
|
|
113
|
+
"addVersionUrl": true
|
|
115
114
|
}
|
|
116
115
|
}
|
|
117
116
|
},
|
|
@@ -126,6 +125,7 @@
|
|
|
126
125
|
"test:package": "vitest run --config vitest.package.config.ts",
|
|
127
126
|
"build": "tsdown",
|
|
128
127
|
"checks": "pnpm typecheck && pnpm lint && pnpm format:check && pnpm knip && pnpm test && pnpm build",
|
|
129
|
-
"release": "release-it"
|
|
128
|
+
"release": "release-it",
|
|
129
|
+
"release:next": "release-it --preRelease=next --plugins.@release-it/keep-a-changelog.keepUnreleased"
|
|
130
130
|
}
|
|
131
131
|
}
|