Skip to content

Commit

Permalink
fix: broken 0.10.4 version (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
userquin authored Dec 21, 2024
1 parent 2b34a5b commit 5989445
Show file tree
Hide file tree
Showing 6 changed files with 300 additions and 5 deletions.
24 changes: 24 additions & 0 deletions build.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,28 @@ export default defineBuildConfig({
respectExternal: true,
},
},
hooks: {
'build:done': async () => {
console.log('\nChecking client directory...')
const [
{ createRequire },
lstat,
esmDirClient,
] = await Promise.all([
import('node:module').then(m => m.default || m),
import ('node:fs/promises').then(m => m.lstat),
import('./dist/index.mjs').then(m => m.DIR_CLIENT),
])
let stats = await lstat(esmDirClient)
if (!stats.isDirectory()) {
throw new Error('ESM: Client directory does not exist, review src/dirs.ts module!')
}
const cjsDirClient = createRequire(import.meta.url)('./dist/index.cjs').DIR_CLIENT
stats = await lstat(cjsDirClient)
if (!stats.isDirectory()) {
throw new Error('CJS: Client directory does not exist, review src/dirs.ts module!')
}
console.log('Client directory ok!')
},
},
})
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,15 @@
"node": ">=14"
},
"scripts": {
"build": "rimraf dist && run-s build:* && esno ./scripts/postbuild.ts",
"build": "rimraf dist && run-s build:* && esno ./scripts/postbuild.ts && pnpm run test:attw",
"build:client": "vite build src/client",
"build:js": "unbuild",
"dev": "nr stub && cross-env INSPECT_DEV=true vite src/client",
"dev:client": "vite build src/client --watch",
"stub": "unbuild --stub",
"lint": "eslint .",
"typecheck": "vue-tsc --noEmit",
"test:attw": "attw --pack",
"prepublishOnly": "npm run build",
"release": "bumpp && npm publish"
},
Expand All @@ -93,6 +94,7 @@
"devDependencies": {
"@antfu/eslint-config": "^3.12.0",
"@antfu/ni": "^0.23.1",
"@arethetypeswrong/cli": "^0.17.2",
"@iconify-json/catppuccin": "^1.2.8",
"@iconify/json": "^2.2.286",
"@nuxt/kit": "^3.14.1592",
Expand Down
Loading

0 comments on commit 5989445

Please sign in to comment.