diff --git a/packages/core/build.ts b/packages/core/build.ts index 0788fdb..fd96a9a 100644 --- a/packages/core/build.ts +++ b/packages/core/build.ts @@ -9,7 +9,7 @@ import packageJson from './package.json' assert { type: 'json' }; import { transfer } from 'multi-stage-sourcemap'; import { stderr, stdout } from 'process'; -const entry = './lib.ts'; +const entry = './src/lib.ts'; const tsbuildinfo = 'node_modules/.cache/tsbuildinfo.json'; consola.start('Building @sugarform/core...'); @@ -82,6 +82,15 @@ async function types() { await rm(tsbuildinfo); } + // Check both index.d.ts and index.d.ts.map exists + await Promise.all([ + readFile('./dist/index.d.ts', 'utf-8'), + readFile('./dist/index.d.ts.map', 'utf-8'), + ]).catch(() => { + consola.error('tsc did not generate declaration files! Ensure you ran `pnpm typecheck` before run build.'); + process.exit(1); + }); + consola.start('Merging Declarationmap...'); const sourcemap = transfer({ fromSourceMap: await readFile('./dist/index.d.ts.map', 'utf-8'), diff --git a/packages/core/lib.ts b/packages/core/src/lib.ts similarity index 58% rename from packages/core/lib.ts rename to packages/core/src/lib.ts index f5a87b4..ba7922d 100644 --- a/packages/core/lib.ts +++ b/packages/core/src/lib.ts @@ -1,4 +1,4 @@ -import { aabbccddeeffgg } from './src/util'; +import { aabbccddeeffgg } from './util'; export function hello() { return 'a' == aabbccddeeffgg(); diff --git a/turbo.json b/turbo.json index 996bdb6..ff31ae0 100644 --- a/turbo.json +++ b/turbo.json @@ -2,11 +2,17 @@ "$schema": "https://turbo.build/schema.json", "globalDependencies": ["**/.env.*local"], "pipeline": { + "topo": { + "dependsOn": ["^topo"] + }, "build": { - "dependsOn": ["^build"], - "outputs": [".next/**", "!.next/cache/**"] + "dependsOn": ["typecheck", "^build"], + "outputs": ["dist/**"] }, "lint": {}, - "typecheck": {} + "typecheck": { + "dependsOn": ["^topo"], + "outputs": ["node_modules/.cache/tsbuildinfo.json"] + } } }