fix: compile TypeScript to dist/ instead of shipping raw .ts

Move entry point source to src/index.ts, compile to dist/ via
tsconfig.build.json. Paths resolve back to plugins/workos/ from
the package root. Consumers get proper .js + .d.ts instead of
requiring tsx.

- Add build script and prepublishOnly hook
- Add build step to release workflow
- Update exports to point at dist/
- Include dist/ in files array
This commit is contained in:
Nick Nisi
2026-03-09 09:11:16 -05:00
parent ff17c66c2f
commit e23f8f9019
4 changed files with 33 additions and 5 deletions
+3
View File
@@ -25,5 +25,8 @@ jobs:
- name: Install
run: pnpm install
- name: Build
run: pnpm build
- name: Publish
run: npm publish --tag latest --access public --provenance
+7 -1
View File
@@ -17,13 +17,19 @@
"url": "https://github.com/workos/skills"
},
"exports": {
".": "./plugins/workos/index.ts"
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"files": [
"dist",
"plugins"
],
"type": "module",
"scripts": {
"build": "tsc -p tsconfig.build.json",
"prepublishOnly": "pnpm build",
"eval": "npx tsx scripts/eval.ts",
"eval:label": "npx tsx scripts/eval-label.ts",
"eval:diff": "npx tsx scripts/eval-diff.ts",
+5 -4
View File
@@ -2,21 +2,22 @@ import { readFile } from 'fs/promises';
import { fileURLToPath } from 'url';
import { dirname, join } from 'path';
const __dirname = dirname(fileURLToPath(import.meta.url));
const packageRoot = join(dirname(fileURLToPath(import.meta.url)), '..');
const pluginDir = join(packageRoot, 'plugins', 'workos');
/** Resolve path to a reference file by name (without .md extension) */
export function getReferencePath(name: string): string {
return join(__dirname, 'skills', 'workos', 'references', `${name}.md`);
return join(pluginDir, 'skills', 'workos', 'references', `${name}.md`);
}
/** Resolve path to the skills directory (contains workos/ and workos-widgets/) */
export function getSkillsDir(): string {
return join(__dirname, 'skills');
return join(pluginDir, 'skills');
}
/** Resolve path to a specific skill's SKILL.md */
export function getSkillPath(skillName: string): string {
return join(__dirname, 'skills', skillName, 'SKILL.md');
return join(pluginDir, 'skills', skillName, 'SKILL.md');
}
/** Read a reference file's content by name (without .md extension) */
+18
View File
@@ -0,0 +1,18 @@
{
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
"declaration": true,
"sourceMap": true,
"outDir": "dist",
"rootDir": "src",
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
"types": ["node"]
},
"include": ["src/index.ts"]
}