Skip to content

Commit

Permalink
fix(bindgen): Typescript layout updates
Browse files Browse the repository at this point in the history
  • Loading branch information
thewtex committed Feb 13, 2023
1 parent 0c29698 commit 2238fb5
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/bindgen/typescript-resources/demo-index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/demo/logo.svg" />
<link rel="stylesheet" href="/demo/style.css" />
<link rel="icon" type="image/svg+xml" href="./logo.svg" />
<link rel="stylesheet" href="./style.css" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title><bindgenPackageName></title>
</head>
<body>
<div id="app">
<a href="https://wasm.itk.org/" target="_blank">
<img src="/demo/logo.svg" class="logo vanilla" alt="ITK Wasm logo" />
<img src="./logo.svg" class="logo vanilla" alt="ITK Wasm logo" />
</a>
<h1><bindgenPackageName></h1>
package
Expand All @@ -25,6 +25,6 @@ <h2>functions</h2>
</p>
</div>

<script type="module" src="/demo/app.js"></script>
<script type="module" src="./app.ts"></script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as <bindgenPackageNameCamelCase> from '../<bindgenPackageName>.js'
import * as <bindgenPackageNameCamelCase> from '../../dist/bundles/<bindgenPackageName>.js'
<bindgenPackageNameCamelCase>.setPipelinesBaseUrl('/pipelines')

const packageFunctions = []
Expand Down
7 changes: 4 additions & 3 deletions src/bindgen/typescript-resources/template.package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"start": "vite -c build/vite.config.js",
"test": "echo \"Error: no test specified\" && exit 1",
"build": "npm run build:tsc && npm run build:node && npm run build:browser && npm run build:demo",
"build:node": "rollup -c ./rollup.node.config.js",
"build:browser": "rollup -c ./rollup.browser.config.js",
"build:node": "rollup -c ./build/rollup.node.config.js",
"build:browser": "rollup -c ./build/rollup.browser.config.js",
"build:tsc": "tsc --pretty",
"build:demo": "vite -c build/vite.config.js build"
},
Expand All @@ -30,7 +30,7 @@
"author": "",
"license": "Apache-2.0",
"dependencies": {
"itk-wasm": "^1.0.0-b.65"
"itk-wasm": "^1.0.0-b.72"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^24.0.0",
Expand All @@ -42,6 +42,7 @@
"rollup-plugin-copy": "^3.4.0",
"rollup-plugin-ignore": "^1.0.10",
"rollup-plugin-polyfill-node": "^0.11.0",
"tslib": "^2.5.0",
"typescript": "^4.9.4",
"vite": "^4.0.4",
"vite-plugin-static-copy": "^0.13.0"
Expand Down
2 changes: 1 addition & 1 deletion src/bindgen/typescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ function typescriptBindings(outputDir, buildDir, wasmBinaries, options, forNode=

const demoPath = path.join(outputDir, 'test', 'browser', 'app.ts')
if (!fs.existsSync(demoPath)) {
let demoContent = fs.readFileSync(bindgenResource('demo.js'), { encoding: 'utf8', flag: 'r' })
let demoContent = fs.readFileSync(bindgenResource('demo.ts'), { encoding: 'utf8', flag: 'r' })
demoContent = demoContent.replaceAll('<bindgenPackageName>', options.packageName)
demoContent = demoContent.replaceAll('<bindgenPackageNameCamelCase>', camelCase(packageName))
fs.writeFileSync(demoPath, demoContent)
Expand Down

0 comments on commit 2238fb5

Please sign in to comment.