Skip to content

Commit

Permalink
fix: webview-legacy build
Browse files Browse the repository at this point in the history
  • Loading branch information
dineug committed Dec 25, 2023
1 parent 347d11c commit bc1c737
Show file tree
Hide file tree
Showing 10 changed files with 127 additions and 150 deletions.
4 changes: 2 additions & 2 deletions packages-legacy/lit-observable/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
"build": "vite build"
},
"dependencies": {
"lit-html": "^1.4.1"
"lit-html": "^1.4.1",
"lodash-es": "^4.17.21"
},
"devDependencies": {
"@types/lodash-es": "^4.17.12",
"lodash-es": "^4.17.21",
"typescript": "5.3.3",
"vite": "^5.0.10"
}
Expand Down
6 changes: 5 additions & 1 deletion packages-legacy/lit-observable/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ import { defineConfig } from 'vite';

const pkg = JSON.parse(readFileSync('package.json', { encoding: 'utf8' }));

const external = new RegExp(
`^(${Object.keys(pkg.dependencies || {}).join('|')})$`
);

export default defineConfig({
build: {
lib: {
Expand All @@ -14,7 +18,7 @@ export default defineConfig({
formats: ['es'],
},
rollupOptions: {
external: ['lit-html'],
external,
},
},
resolve: {
Expand Down
26 changes: 13 additions & 13 deletions packages-legacy/plugin-generate-template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,35 +20,35 @@
"dev": "vite serve",
"build": "vite build"
},
"dependencies": {
"highlight.js": "^10.7.3",
"highlightjs-graphql": "^1.0.2",
"lodash-es": "^4.17.21",
"ramda": "0.27.1",
"rxjs": "^7.8.1",
"tippy.js": "^6.3.7",
"tui-grid": "^4.21.21",
"uuid": "^9.0.1",
"vuerd": "workspace:*"
},
"devDependencies": {
"@codemirror/basic-setup": "^0.19.3",
"@codemirror/commands": "^0.19.8",
"@codemirror/view": "^0.19.48",
"@codemirror/lang-javascript": "^0.19.7",
"@codemirror/theme-one-dark": "^0.19.1",
"@codemirror/view": "^0.19.48",
"@mdi/js": "7.3.67",
"@preact/preset-vite": "^2.7.0",
"@types/lodash-es": "^4.17.12",
"@types/ramda": "^0.29.9",
"@types/ramda": "0.27.44",
"@types/styled-components": "^5.1.34",
"@types/uuid": "^9.0.7",
"ejs": "^3.1.9",
"highlight.js": "^10.7.3",
"highlightjs-graphql": "^1.0.2",
"lodash-es": "^4.17.21",
"mobx-react-lite": "^3.4.3",
"mobx": "^6.12.0",
"preact": "^10.19.3",
"ramda": "^0.29.1",
"rxjs": "^7.8.1",
"styled-components": "5.2.3",
"tippy.js": "^6.3.7",
"tui-grid": "^4.18.1",
"typescript": "5.3.3",
"uuid": "^9.0.1",
"vite": "^5.0.10"
},
"dependencies": {
"vuerd": "workspace:*"
}
}
6 changes: 5 additions & 1 deletion packages-legacy/plugin-generate-template/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import { defineConfig } from 'vite';

const pkg = JSON.parse(readFileSync('package.json', { encoding: 'utf8' }));

const external = new RegExp(
`^(${Object.keys(pkg.dependencies || {}).join('|')})$`
);

export default defineConfig(({ command }) => {
const isBuild = command === 'build';

Expand All @@ -23,7 +27,7 @@ export default defineConfig(({ command }) => {
formats: ['es'],
},
rollupOptions: {
external: ['vuerd'],
external: [external, /^highlight.js\/lib/],
},
},
resolve: {
Expand Down
45 changes: 12 additions & 33 deletions packages-legacy/vuerd/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,45 +4,32 @@
"private": true,
"description": "ERD editor",
"type": "module",
"main": "./dist/vuerd.min.js",
"module": "./dist/vuerd.js",
"main": "./dist/vuerd.js",
"typings": "./types/index.d.ts",
"exports": {
".": {
"import": {
"types": "./types/index.d.ts",
"default": "./dist/vuerd.js"
},
"require": "./dist/vuerd.min.js"
}
}
},
"files": [
"dist/*.js",
"types",
"theme/*.css"
],
"keywords": [
"vuerd",
"editor",
"erd",
"db",
"database",
"diagram"
],
"repository": {
"type": "git",
"url": "https://github.com/dineug/erd-editor.git"
},
"bugs": {
"url": "https://github.com/dineug/erd-editor/issues"
},
"homepage": "https://github.com/dineug/erd-editor#readme",
"author": "dineug <[email protected]>",
"license": "MIT",
"scripts": {
"dev": "vite serve",
"build": "vite build"
},
"dependencies": {
"highlight.js": "^10.7.3",
"highlightjs-graphql": "^1.0.2",
"lodash-es": "^4.17.21",
"ramda": "0.27.1",
"rxjs": "^7.8.1",
"tippy.js": "^6.3.7",
"tui-grid": "^4.21.21",
"uuid": "^9.0.1"
},
"devDependencies": {
"@dineug/erd-editor-schema": "workspace:*",
"@easylogic/colorpicker": "^1.10.11",
Expand All @@ -59,18 +46,10 @@
"@vuerd/lit-observable": "workspace:*",
"@vuerd/sql-ddl-parser": "workspace:*",
"d3": "^7.8.5",
"highlight.js": "^10.7.3",
"highlightjs-graphql": "^1.0.2",
"html-to-image": "^1.11.11",
"lit-html": "^1.4.1",
"lodash-es": "^4.17.21",
"pathfinding": "^0.4.18",
"ramda": "0.27.1",
"rxjs": "^7.8.1",
"tippy.js": "^6.3.7",
"tui-grid": "^4.18.1",
"typescript": "5.3.3",
"uuid": "^9.0.1",
"vite": "^5.0.10"
}
}
9 changes: 7 additions & 2 deletions packages-legacy/vuerd/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ const banner = `/*!
* @license ${pkg.license}
*/`;

const external = new RegExp(
`^(${Object.keys(pkg.dependencies || {}).join('|')})$`
);

export default defineConfig(({ command }) => {
const isBuild = command === 'build';

Expand All @@ -27,10 +31,11 @@ export default defineConfig(({ command }) => {
lib: {
entry: './src/index.ts',
name: pkg.name,
fileName: format => (format === 'es' ? 'vuerd.js' : 'vuerd.min.js'),
formats: ['es', 'umd'],
fileName: pkg.name,
formats: ['es'],
},
rollupOptions: {
external: [external, /^highlight.js\/lib/],
output: {
banner,
},
Expand Down
6 changes: 6 additions & 0 deletions packages/erd-editor-vscode-webview/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,15 @@ export default defineConfig(({ command, mode }) => {
const outDir = '../erd-editor-vscode/'.concat(
isModern ? 'public' : 'public-legacy'
);
const isBuild = command === 'build';

return {
envDir,
define: {
...(isBuild
? { 'process.env.NODE_ENV': JSON.stringify('production') }
: {}),
},
build: {
lib: {
entry,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export const headerButtonWrap = css`
height: ${HEADER_ICON_HEIGHT}px;
justify-content: flex-end;
margin-bottom: ${HEADER_ICON_MARGIN_BOTTOM}px;
cursor: move;
& > .icon {
margin-left: 4px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export const headerButtonWrap = css`
height: ${HEADER_ICON_HEIGHT}px;
justify-content: flex-end;
margin-bottom: ${TABLE_HEADER_ICON_MARGIN_BOTTOM}px;
cursor: move;
& > .icon {
cursor: pointer;
Expand Down
Loading

0 comments on commit bc1c737

Please sign in to comment.