diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 10868a7..4f4af8c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,14 +37,15 @@ jobs: with: path: './dist/pages' # vite's outDir as specified in package.json - # build the .tgz in ./out and upload as artifact + # build the .tgz in ./out and upload as artifact (so non-release commit can + # be tested out) - name: Build library run: mkdir -p ./out && npm pack --pack-destination ./out - name: Upload lib artifact - uses: actions/upload-pages-artifact@v3 + uses: actions/upload-artifact@v4 with: - path: './out' name: lib + path: './out' # Single deploy job since we're just deploying diff --git a/package.json b/package.json index 5c26ef1..fa57b73 100644 --- a/package.json +++ b/package.json @@ -5,26 +5,24 @@ "files": [ "README.md", "LICENSE", - "dist/lib/quad-shader.js", - "dist/lib/quad-shader.cjs", + "dist/lib/index.js", "dist/types/index.d.ts" ], "exports": { ".": { "types": "./dist/types/index.d.ts", - "default": "./dist/lib/quad-shader.js" + "default": "./dist/lib/index.js" } }, "//scripts": { "dev, build & preview": "build the webapp (e.g. for GitHub Pages deployment)", - "types & prepare": "build the lib, to be used by 'npm publish' or 'npm pack'" + "prepare": "build the lib, to be used by 'npm publish' or 'npm pack'" }, "scripts": { "dev": "vite", - "build": "tsc --project tsconfig.json && vite build --config /dev/null --outDir ./dist/pages", + "build": "tsc --project tsconfig.json && vite build --outDir ./dist/pages", "preview": "npm run build && vite preview --outDir ./dist/pages", - "prepare": "npm run types && vite build --outDir ./dist/lib", - "types": "tsc --project ./tsconfig.lib.json", + "prepare": "tsc --project ./tsconfig.lib.json", "format": "prettier ./src ./index.ts ./index.html ./style.css ./package.json vite.config.ts -w" }, "devDependencies": { diff --git a/tsconfig.json b/tsconfig.json index 9e35b9f..7fc0856 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,8 +8,6 @@ /* Bundler mode */ "moduleResolution": "bundler", - "allowImportingTsExtensions": true, - "resolveJsonModule": true, "isolatedModules": true, "moduleDetection": "force", "noEmit": true, @@ -22,7 +20,6 @@ "paths": { "quad-shader": ["./src"] - } }, "include": ["src", "index.ts", "types.d.ts", "examples"] diff --git a/tsconfig.lib.json b/tsconfig.lib.json index e2f471a..9a2341a 100644 --- a/tsconfig.lib.json +++ b/tsconfig.lib.json @@ -1,10 +1,12 @@ { "extends": "./tsconfig.json", + /* merges (potentially overriding) with .extends */ "compilerOptions": { "noEmit": false, + "outDir": "dist/lib", "declaration": true, - "emitDeclarationOnly": true, "declarationDir": "dist/types" }, + /* replaces the values in .extends */ "include": ["src/index.ts" ] } diff --git a/vite.config.ts b/vite.config.ts index 1c995fc..6150f9a 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,15 +1,3 @@ -import { dirname, resolve } from "node:path"; -import { fileURLToPath } from "node:url"; import { defineConfig } from "vite"; -const __dirname = dirname(fileURLToPath(import.meta.url)); - -export default defineConfig({ - build: { - copyPublicDir: false /* in the lib we don't care about any assets */, - lib: { - entry: resolve(__dirname, "src/index.ts"), - formats: ["es", "cjs"] /* target modern browsers & node */, - }, - }, -}); +export default defineConfig({});