Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,4 @@ typings/
.DS_Store

# Action Deploy Theme Custom
.build/
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pnpm install --frozen-lockfile
- `pnpm typecheck` checks the action, tests and Vitest configuration with TypeScript
- `pnpm test` runs the unit, entrypoint and real-archive acceptance tests
- `pnpm test:coverage` enforces the ratcheted coverage thresholds used by CI
- `pnpm build` bundles the action into `dist/` with ncc
- `pnpm build` compiles the source with TypeScript, then bundles the emitted JavaScript into `dist/` with ncc
- `pnpm preship` runs the complete release validation sequence

GitHub Actions runs `dist/index.js`, so the built output is committed. For human-authored changes to the source or bundled dependencies, run `pnpm build` and commit the resulting `dist/` changes. Do not edit `dist/` by hand. CI verifies that the committed bundle matches the source.
Expand Down
4 changes: 2 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49979,7 +49979,7 @@ slug.setLocale = function (locale) {
// EXTERNAL MODULE: ./node_modules/.pnpm/@tryghost+admin-api@1.14.11/node_modules/@tryghost/admin-api/index.js
var admin_api = __nccwpck_require__(3591);
var admin_api_default = /*#__PURE__*/__nccwpck_require__.n(admin_api);
;// CONCATENATED MODULE: ./src/main.ts
;// CONCATENATED MODULE: ./.build/main.js



Expand Down Expand Up @@ -50137,7 +50137,7 @@ async function run() {
}
}

;// CONCATENATED MODULE: ./src/index.ts
;// CONCATENATED MODULE: ./.build/index.js

void run();

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
],
"main": "dist/index.js",
"scripts": {
"build": "ncc build src/index.ts",
"build": "node scripts/build.mjs",
"lint": "oxlint --quiet && oxfmt --check .",
"lint:fix": "oxlint --fix && oxfmt .",
"format": "oxfmt .",
Expand All @@ -34,7 +34,7 @@
"@vitest/coverage-v8": "4.1.10",
"oxfmt": "0.58.0",
"oxlint": "1.73.0",
"typescript": "6.0.3",
"typescript": "7.0.2",
"vitest": "4.1.10"
},
"packageManager": "pnpm@11.11.0"
Expand Down
213 changes: 207 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions scripts/build.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { spawnSync } from 'node:child_process';
import { rmSync } from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';

const repositoryDirectory = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
const buildDirectory = path.join(repositoryDirectory, '.build');

function run(command, args) {
const result = spawnSync(command, args, {
cwd: repositoryDirectory,
shell: process.platform === 'win32',
stdio: 'inherit',
});

if (result.error) {
throw result.error;
}

return result.status === 0;
}

rmSync(buildDirectory, { recursive: true, force: true });

try {
const compiled = run('tsc', ['--outDir', buildDirectory, '--noEmit', 'false']);
const bundled = compiled && run('ncc', ['build', path.join(buildDirectory, 'index.js')]);

if (!bundled) {
process.exitCode = 1;
}
} finally {
rmSync(buildDirectory, { recursive: true, force: true });
}
Loading