@particle/tooling 0.1.7 → 0.1.8
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 +1 -1
- package/lib/migrate.js +12 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ What it does, depending on what it finds:
|
|
|
24
24
|
- **Lint and format configs:** deletes `eslint.config.*`, `.eslintrc*`, `.oxlintrc.json` and `.oxfmtrc.json`, and creates `oxlint.config.ts` and `oxfmt.config.ts` that re-export the shared configs. In a package that is not an ES module (no `"type": "module"`), the files are `.mts`, and existing `.ts` ones are renamed: Node only loads a `.ts` config as an ES module in an ES module package, and otherwise warns or fails. TypeScript projects re-export `@particle/tooling/oxlint-typescript`, JavaScript projects `@particle/tooling/oxlint`.
|
|
25
25
|
- **tsconfigs:** rewrites `tsconfig.json` and `tsconfig.build.json` to extend the shared configs, keeping the project's own `include`, `exclude` and `types`. A config with other project-specific compiler options, or one that already extends something else, is left alone and reported for you to migrate by hand.
|
|
26
26
|
- **Sentry:** when the project depends on a `@sentry/*` package, the build config gets `"sourceRoot": "/"`, which strips the build path from source references so Sentry groups issues consistently. Without Sentry it is removed, because it makes Node stack traces point at paths that do not exist.
|
|
27
|
-
- **`.gitignore`:** adds `.claude
|
|
27
|
+
- **`.gitignore`:** adds `.claude/` and `CLAUDE.md`. These are often ignored only in a developer's global gitignore, and oxlint and oxfmt only skip what the project's own `.gitignore` lists. Without the entries, agent worktrees (full copies of the repo) get linted and formatted along with the project, and a local `CLAUDE.md` fails the format check on one machine but not in CI.
|
|
28
28
|
- **Build output:** standardizes on `build/`, adds it to `.gitignore`, and lists every place that still names the old directory (`package.json` fields, scripts, `Dockerfile`, CI config) for you to update.
|
|
29
29
|
- **Scripts:** removes a `lint` script and has `check` do the linting: plain `eslint` steps become `oxlint --deny-warnings` (so a warning fails the check, in CI too), `check` gains `oxfmt --check`, and other scripts that ran `npm run lint` are pointed at `npm run check`. Adds `fmt` where it is missing, a `check` for TypeScript projects (`tsc && oxlint --deny-warnings && oxfmt --check`) and for JavaScript projects that had a `lint` script, and `build` for TypeScript projects.
|
|
30
30
|
- **CI:** looks at `.circleci/config.yml` and `.github/workflows` and reminds you to confirm that CI runs a step that checks formatting.
|
package/lib/migrate.js
CHANGED
|
@@ -57,8 +57,12 @@ const FORMAT_SCRIPTS = {
|
|
|
57
57
|
};
|
|
58
58
|
|
|
59
59
|
const BUILD_DIR = 'build';
|
|
60
|
-
/**
|
|
61
|
-
|
|
60
|
+
/**
|
|
61
|
+
* Agent files that are usually ignored only in a developer's global gitignore. oxlint and oxfmt skip a path only when
|
|
62
|
+
* the project's own .gitignore lists it: `.claude/` holds worktrees, which are full copies of the repo, and oxfmt
|
|
63
|
+
* would otherwise format-check a local CLAUDE.md that CI never sees.
|
|
64
|
+
*/
|
|
65
|
+
const AGENT_IGNORES = ['.claude/', 'CLAUDE.md'];
|
|
62
66
|
const BUILD_SCRIPT = `rm -rf ${BUILD_DIR}/ && tsc -p tsconfig.build.json`;
|
|
63
67
|
const OUT_DIR_REFERENCE_FILES = ['.gitignore', '.dockerignore', 'Dockerfile', '.circleci/config.yml'];
|
|
64
68
|
const REDUNDANT_UNDER_STRICT = new Set(['noImplicitAny', 'strictNullChecks']);
|
|
@@ -641,13 +645,14 @@ export async function createPlan(dir, style, options = {}) {
|
|
|
641
645
|
const { hasBuildConfig, previousOutDir } = await planTsconfigs(dir, style, plan, hasSentry);
|
|
642
646
|
|
|
643
647
|
const gitignore = (await readOptional(dir, '.gitignore')) ?? '';
|
|
644
|
-
const
|
|
645
|
-
const toIgnore = [...(hasBuildConfig ? [BUILD_DIR] : []),
|
|
648
|
+
const ignored = new Set(gitignore.split('\n').map((line) => directoryOf(line.trim().replace(/^\//, ''))));
|
|
649
|
+
const toIgnore = [...(hasBuildConfig ? [`${BUILD_DIR}/`] : []), ...AGENT_IGNORES].filter(
|
|
650
|
+
(entry) => !ignored.has(directoryOf(entry))
|
|
651
|
+
);
|
|
646
652
|
if (toIgnore.length > 0) {
|
|
647
653
|
const separator = gitignore === '' || gitignore.endsWith('\n') ? '' : '\n';
|
|
648
|
-
|
|
649
|
-
plan.
|
|
650
|
-
plan.files.push(`add ${toIgnore.map((name) => `${name}/`).join(' and ')} to .gitignore`);
|
|
654
|
+
plan.writes.push({ file: '.gitignore', contents: `${gitignore}${separator}${toIgnore.join('\n')}\n` });
|
|
655
|
+
plan.files.push(`add ${new Intl.ListFormat('en').format(toIgnore)} to .gitignore`);
|
|
651
656
|
}
|
|
652
657
|
if (previousOutDir !== null && previousOutDir !== BUILD_DIR) {
|
|
653
658
|
const references = await findOutDirReferences(dir, original, previousOutDir);
|
package/package.json
CHANGED