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
7 changes: 4 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 5 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
3 changes: 0 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"moduleDetection": "force",
"noEmit": true,
Expand All @@ -22,7 +20,6 @@

"paths": {
"quad-shader": ["./src"]

}
},
"include": ["src", "index.ts", "types.d.ts", "examples"]
Expand Down
4 changes: 3 additions & 1 deletion tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -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" ]
}
14 changes: 1 addition & 13 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -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({});