Skip to content

Commit

Permalink
generate d ts files
Browse files Browse the repository at this point in the history
  • Loading branch information
aliaksei-chareshneu committed Jun 26, 2024
1 parent 91d94df commit 0a9b99d
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 10 deletions.
9 changes: 5 additions & 4 deletions molstar-extension/esbuild.config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { argv } from 'node:process';
import * as esbuild from 'esbuild';
import {sassPlugin} from 'esbuild-sass-plugin'
import { sassPlugin } from 'esbuild-sass-plugin'
import copyStaticFiles from 'esbuild-copy-static-files';
import { dtsPlugin } from 'esbuild-plugin-d.ts'

const
productionMode = ('development' !== (argv[2] || process.env.NODE_ENV)),
target = 'chrome100,firefox100,safari15'.split(',');

console.log(`${ productionMode ? 'production' : 'development' } build`);
console.log(`${productionMode ? 'production' : 'development'} build`);

const staticFilesPluginOptions = {
src: './src',
Expand All @@ -22,7 +23,7 @@ const buildLib = await esbuild.context({
outdir: './lib',
platform: 'browser',
tsconfig: 'tsconfig.json',
plugins: [copyStaticFiles(staticFilesPluginOptions)]
plugins: [copyStaticFiles(staticFilesPluginOptions), dtsPlugin()]
})

const buildCSS = await esbuild.context({
Expand All @@ -44,7 +45,7 @@ const buildCSS = await esbuild.context({
// bundle TS
const buildTS = await esbuild.context({

entryPoints: [ 'src/viewer/app.ts' ],
entryPoints: ['src/viewer/app.ts'],
format: "esm",
bundle: true,
target,
Expand Down
71 changes: 68 additions & 3 deletions molstar-extension/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions molstar-extension/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "molstar-volseg",
"version": "0.0.7",
"version": "0.0.9",
"type": "module",
"description": "MolStar extension for visualizing volumetric and segmentation data",
"repository": {
Expand All @@ -20,7 +20,8 @@
"build-site": "npm run bundle -- production && mkdir ./site && cp ./build/* ./site/.",
"start": "npm run bundle -- development",
"rebuild": "npm run clean && npm run build",
"version": "npm run rebuild && cpx .npmignore lib/"
"version": "npm run rebuild && cpx .npmignore lib/",
"build:types": "tsc -d --declarationDir dist/lib --declarationMap --emitDeclarationOnly"
},
"files": [
"lib/",
Expand Down Expand Up @@ -48,6 +49,7 @@
"cpx2": "^7.0.1",
"esbuild": "0.21.4",
"esbuild-copy-static-files": "^0.1.0",
"esbuild-plugin-d.ts": "^1.2.3",
"esbuild-sass-plugin": "^3",
"typescript": "^5.4.5"
},
Expand Down
4 changes: 3 additions & 1 deletion molstar-extension/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"compilerOptions": {
"allowJs": true,
"declaration": true,
"target": "ES2018",
"alwaysStrict": true,
Expand All @@ -22,4 +23,5 @@
},
"include": [ "src/**/*", "src/extensions/volumes-and-segmentations", "src/extensions/meshes", "src/extensions/cvsx-extension" ],
// "exclude": [ "src/servers/**/*", "src/perf-tests/*", "src/cli/**/*" ]
}
}

0 comments on commit 0a9b99d

Please sign in to comment.