Skip to content

Commit 3275599

Browse files
authored
fix: deploy (#148)
* feat: log sql languages' version * build: website build error * ci: CD for auto deploy docs
1 parent a8f6ea8 commit 3275599

File tree

6 files changed

+36
-2
lines changed

6 files changed

+36
-2
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"watch-esm": "tsc -p ./tsconfig.esm.json --watch",
1010
"test": "npm run build-amd && mocha ./test/all.js",
1111
"dev": "node --max_old_space_size=4092 & cd website && npm run dev",
12-
"prod": "rm -rf ./docs && node --max_old_space_size=4092 & cd website && npm run build",
12+
"prod": "npm run build && rm -rf ./docs && node --max_old_space_size=4092 & cd website && npm run build",
1313
"deploy": "npm run prod && gh-pages -d docs -r [email protected]:DTStack/monaco-sql-languages.git",
1414
"format": "prettier --write .",
1515
"prettier-check": "prettier --check .",

scripts/bumpVersion.js

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ function execStandardVersion(res) {
5959
.then(({ message }) => {
6060
console.log('Please checkout recent commit, and then');
6161
console.log('Push branch and new tag to github, publish package to npm');
62+
console.log('Please run "npm run deploy" to deploy website to github pages.');
6263
// message && console.log(message)
6364
})
6465
.catch(({ error, code }) => {

website/src/App.tsx

+6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import React, { useEffect, useRef, useState } from 'react';
33
import { create, Workbench } from '@dtinsight/molecule';
44
import InstanceService from '@dtinsight/molecule/esm/services/instanceService';
55
import { ExtendsWorkbench } from './extensions/workbench';
6+
import { version, dependencies } from '../../package.json';
67

78
import './languages';
89

@@ -28,4 +29,9 @@ function App(): React.ReactElement {
2829
return <div>{MyWorkbench}</div>;
2930
}
3031

32+
window.console.log(
33+
`%c dt-sql-parser: v${dependencies['dt-sql-parser']} \n monaco-sql-languages: v${version}`,
34+
'font-family: Cabin, Helvetica, Arial, sans-serif;text-align: left;font-size:32px;color:#B21212;'
35+
);
36+
3137
export default App;

website/src/extensions/workbench/sidebar.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { IEditorTab, IProblemsItem, MarkerSeverity } from '@dtinsight/molecule/e
99

1010
import { defaultLanguage, defaultEditorTab, defaultLanguageStatusItem, languages } from './common';
1111
import { LanguageService, ParseError } from 'monaco-sql-languages/esm/languageService';
12-
import { debounce } from 'monaco-sql-languages/esm/common/utils';
12+
import { debounce } from './utils';
1313

1414
export default class Sidebar extends React.Component {
1515
private _language = defaultLanguage;
+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
export function debounce<T extends (...args: unknown[]) => unknown>(
2+
func: T,
3+
timeout: number,
4+
immediate?: boolean
5+
): (...args: Parameters<T>) => unknown {
6+
let timer: NodeJS.Timeout | null = null;
7+
return (...args) => {
8+
if (timer) {
9+
clearTimeout(timer);
10+
}
11+
if (immediate && !timer) {
12+
return func?.(...args);
13+
}
14+
15+
timer = setTimeout(() => {
16+
timer && clearTimeout(timer);
17+
timer = null;
18+
func?.(...args);
19+
}, timeout);
20+
};
21+
}

website/vite.config.ts

+6
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ export default defineConfig({
1212
}
1313
},
1414
base: '/monaco-sql-languages/',
15+
build: {
16+
commonjsOptions: {
17+
transformMixedEsModules: true
18+
},
19+
outDir: resolve(__dirname, '../docs')
20+
},
1521
server: {
1622
fs: {
1723
allow: ['..']

0 commit comments

Comments
 (0)