mirror of
https://github.com/murashit/codex-panel.git
synced 2026-07-22 06:57:10 +00:00
Organize scripts by purpose
This commit is contained in:
parent
03219abc70
commit
36b9d99fcd
12 changed files with 24 additions and 31 deletions
|
|
@ -7,8 +7,8 @@ npm run check
|
|||
npm run build
|
||||
```
|
||||
|
||||
Run `npm run format` after edits and before `npm run check` so Prettier-only issues are fixed upfront. `npm run check` runs TypeScript type checking, unit tests, ESLint, Prettier check, and a production esbuild bundle.
|
||||
The local `npm run check` path runs checks in parallel and uses local caches for TypeScript, Vitest, ESLint, and Prettier. Use `npm run check:ci` when you need to reproduce the sequential, non-cached CI validation path.
|
||||
Run `npm run format` after edits and before `npm run check` so Prettier-only issues are fixed upfront. `npm run check` runs TypeScript type checking, unit tests, lint checks, Prettier check, CSS build verification, and a production esbuild bundle.
|
||||
The local `npm run check` path runs checks in parallel and uses local caches where available. Use `npm run check:ci` when you need to reproduce the sequential, non-cached CI validation path.
|
||||
|
||||
`main.js`, `styles.css`, `data.json`, and `node_modules/` are ignored by Git. `main.js` and `styles.css` are still the files Obsidian loads, so run `npm run build` after source changes.
|
||||
CSS is authored in `src/styles/` and generated into the ignored root `styles.css` release asset. Use `npm run build:styles` when only regenerating CSS, or `npm run build:styles:check` to verify that the authored CSS can be rendered.
|
||||
|
|
|
|||
23
package.json
23
package.json
|
|
@ -14,33 +14,32 @@
|
|||
},
|
||||
"homepage": "https://github.com/murashit/codex-panel#readme",
|
||||
"scripts": {
|
||||
"api:baseline": "node scripts/api-baseline.mjs",
|
||||
"api:baseline:check": "node scripts/api-baseline.mjs --check",
|
||||
"build": "node esbuild.config.mjs",
|
||||
"build:styles": "node scripts/build-styles.mjs",
|
||||
"build:styles:check": "node scripts/build-styles.mjs --check",
|
||||
"build": "node esbuild.config.mjs",
|
||||
"check": "node scripts/check.mjs",
|
||||
"check:ci": "node scripts/check.mjs --ci",
|
||||
"format": "node scripts/format.mjs",
|
||||
"format:check": "node scripts/format.mjs --check --cache",
|
||||
"format:check:ci": "node scripts/format.mjs --check",
|
||||
"api:baseline": "node scripts/api-baseline.mjs",
|
||||
"api:baseline:check": "node scripts/api-baseline.mjs --check",
|
||||
"generate:app-server-types": "node scripts/generate-app-server-types.mjs",
|
||||
"lint": "node scripts/run-parallel.mjs lint:ts lint:css",
|
||||
"lint": "node scripts/run-parallel.mjs lint:ts lint:css lint:css-usage lint:deps lint:unused",
|
||||
"lint:ci": "node scripts/run-parallel.mjs lint:ts:ci lint:css lint:css-usage lint:deps lint:unused",
|
||||
"lint:css": "stylelint \"src/**/*.css\" --max-warnings=0",
|
||||
"lint:css:usage": "node scripts/check-css-usage.mjs",
|
||||
"lint:css:usage:check": "node scripts/check-css-usage.mjs --fail-on-candidates",
|
||||
"lint:deps": "node scripts/check-import-cycles.mjs",
|
||||
"lint:css-usage": "node scripts/lint/check-css-usage.mjs --fail-on-candidates",
|
||||
"lint:deps": "node scripts/lint/check-import-cycles.mjs",
|
||||
"lint:ts": "eslint src tests scripts \"*.config.ts\" \"*.config.mjs\" --max-warnings=0",
|
||||
"lint:ts:ci": "eslint src tests scripts \"*.config.ts\" \"*.config.mjs\" --max-warnings=0",
|
||||
"lint:unused": "knip --no-progress",
|
||||
"release:check": "node scripts/release/check.mjs",
|
||||
"release:preflight": "node scripts/release/preflight.mjs",
|
||||
"release:prepare": "node scripts/release/prepare.mjs",
|
||||
"test": "vitest run --cache",
|
||||
"test:ci": "vitest run",
|
||||
"typecheck": "tsc -p tsconfig.json --noEmit --incremental --tsBuildInfoFile node_modules/.cache/typescript/tsconfig.tsbuildinfo",
|
||||
"typecheck:ci": "tsc -p tsconfig.json --noEmit",
|
||||
"unused": "npm run unused:exports",
|
||||
"unused:exports": "knip --no-progress",
|
||||
"check": "node scripts/check.mjs",
|
||||
"check:ci": "node scripts/check.mjs --ci"
|
||||
"typecheck:ci": "tsc -p tsconfig.json --noEmit"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^10.0.1",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { readFile } from "node:fs/promises";
|
||||
import { spawnSync } from "node:child_process";
|
||||
import { readJson } from "./release/utils.mjs";
|
||||
import { readJson } from "./utils.mjs";
|
||||
|
||||
const args = new Set(process.argv.slice(2));
|
||||
const shouldCheck = args.has("--check");
|
||||
|
|
|
|||
|
|
@ -5,13 +5,9 @@ const npmCommand = process.platform === "win32" ? "npm.cmd" : "npm";
|
|||
const checks = [
|
||||
{ local: "typecheck", ci: "typecheck:ci", localPhase: "parallel" },
|
||||
{ local: "test", ci: "test:ci", localPhase: "parallel" },
|
||||
{ local: "lint:ts", ci: "lint:ts:ci", localPhase: "parallel" },
|
||||
{ local: "lint:css", ci: "lint:css", localPhase: "parallel" },
|
||||
{ local: "lint:css:usage:check", ci: null, localPhase: "parallel" },
|
||||
{ local: "lint:deps", ci: "lint:deps", localPhase: "parallel" },
|
||||
{ local: "lint", ci: "lint:ci", localPhase: "parallel" },
|
||||
{ local: "format:check", ci: "format:check:ci", localPhase: "parallel" },
|
||||
{ local: "build:styles:check", ci: "build:styles:check", localPhase: "parallel" },
|
||||
{ local: "unused", ci: "unused", localPhase: "parallel" },
|
||||
{ local: "build", ci: "build", localPhase: "sequential" },
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ const validArgs = new Set(["--fail-on-candidates"]);
|
|||
|
||||
for (const arg of args) {
|
||||
if (!validArgs.has(arg)) {
|
||||
console.error("Usage: node scripts/check-css-usage.mjs [--fail-on-candidates]");
|
||||
console.error("Usage: node scripts/lint/check-css-usage.mjs [--fail-on-candidates]");
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@ import path from "node:path";
|
|||
import ts from "typescript";
|
||||
|
||||
if (process.argv.length > 2) {
|
||||
console.error("Usage: node scripts/check-import-cycles.mjs");
|
||||
console.error("Usage: node scripts/lint/check-import-cycles.mjs");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import { readFile } from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { compareVersions, isExpectedNextVersion, parseVersion, readJson } from "./utils.mjs";
|
||||
import { compareVersions, isExpectedNextVersion, parseVersion, readJson } from "../utils.mjs";
|
||||
|
||||
function fail(message) {
|
||||
console.error(`release check failed: ${message}`);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { compareVersions, isExpectedNextVersion, parseVersion, readJson, writeJson } from "./utils.mjs";
|
||||
import { compareVersions, isExpectedNextVersion, parseVersion, readJson, writeJson } from "../utils.mjs";
|
||||
|
||||
function fail(message) {
|
||||
console.error(`release prepare failed: ${message}`);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import noSpecificityWhere from "./scripts/stylelint-no-specificity-where.mjs";
|
||||
import noSpecificityWhere from "./scripts/lint/stylelint-no-specificity-where.mjs";
|
||||
|
||||
export default {
|
||||
extends: ["stylelint-config-standard"],
|
||||
|
|
|
|||
|
|
@ -14,9 +14,7 @@ describe("development scripts", () => {
|
|||
scripts: {
|
||||
"typecheck:ci": "node fail.mjs",
|
||||
"test:ci": 'node -e "process.exit(0)"',
|
||||
"lint:ts:ci": 'node -e "process.exit(0)"',
|
||||
"lint:css": 'node -e "process.exit(0)"',
|
||||
"lint:deps": 'node -e "process.exit(0)"',
|
||||
"lint:ci": 'node -e "process.exit(0)"',
|
||||
"format:check:ci": 'node -e "process.exit(0)"',
|
||||
build: 'node -e "process.exit(0)"',
|
||||
},
|
||||
|
|
@ -164,7 +162,7 @@ describe("development scripts", () => {
|
|||
"src/b.ts": 'import { a } from "./a";\nexport const b = a;\n',
|
||||
});
|
||||
|
||||
const result = runNodeScript("scripts/check-import-cycles.mjs", [], cwd);
|
||||
const result = runNodeScript("scripts/lint/check-import-cycles.mjs", [], cwd);
|
||||
|
||||
expect(result.status).toBe(1);
|
||||
expect(result.stderr).toContain("found 1 cycle");
|
||||
|
|
@ -178,7 +176,7 @@ describe("development scripts", () => {
|
|||
"src/b.ts": 'import type { A } from "./a";\nexport interface B { a?: A }\n',
|
||||
});
|
||||
|
||||
const result = runNodeScript("scripts/check-import-cycles.mjs", [], cwd);
|
||||
const result = runNodeScript("scripts/lint/check-import-cycles.mjs", [], cwd);
|
||||
|
||||
expect(result.status).toBe(0);
|
||||
expect(result.stdout).toContain("No import cycles found.");
|
||||
|
|
@ -191,7 +189,7 @@ describe("development scripts", () => {
|
|||
"src/b.ts": 'import { a, type A } from "./a";\nexport interface B { a?: A }\nexport const b = a;\n',
|
||||
});
|
||||
|
||||
const result = runNodeScript("scripts/check-import-cycles.mjs", [], cwd);
|
||||
const result = runNodeScript("scripts/lint/check-import-cycles.mjs", [], cwd);
|
||||
|
||||
expect(result.status).toBe(1);
|
||||
expect(result.stderr).toContain("found 1 cycle");
|
||||
|
|
|
|||
Loading…
Reference in a new issue