Skip to content

Commit

Permalink
fix: deploy (#148)
Browse files Browse the repository at this point in the history
* feat: log sql languages' version

* build: website build error

* ci: CD for auto deploy docs
  • Loading branch information
liuxy0551 authored Nov 13, 2024
1 parent a8f6ea8 commit 3275599
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"watch-esm": "tsc -p ./tsconfig.esm.json --watch",
"test": "npm run build-amd && mocha ./test/all.js",
"dev": "node --max_old_space_size=4092 & cd website && npm run dev",
"prod": "rm -rf ./docs && node --max_old_space_size=4092 & cd website && npm run build",
"prod": "npm run build && rm -rf ./docs && node --max_old_space_size=4092 & cd website && npm run build",
"deploy": "npm run prod && gh-pages -d docs -r [email protected]:DTStack/monaco-sql-languages.git",
"format": "prettier --write .",
"prettier-check": "prettier --check .",
Expand Down
1 change: 1 addition & 0 deletions scripts/bumpVersion.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ function execStandardVersion(res) {
.then(({ message }) => {
console.log('Please checkout recent commit, and then');
console.log('Push branch and new tag to github, publish package to npm');
console.log('Please run "npm run deploy" to deploy website to github pages.');
// message && console.log(message)
})
.catch(({ error, code }) => {
Expand Down
6 changes: 6 additions & 0 deletions website/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import React, { useEffect, useRef, useState } from 'react';
import { create, Workbench } from '@dtinsight/molecule';
import InstanceService from '@dtinsight/molecule/esm/services/instanceService';
import { ExtendsWorkbench } from './extensions/workbench';
import { version, dependencies } from '../../package.json';

import './languages';

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

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

export default App;
2 changes: 1 addition & 1 deletion website/src/extensions/workbench/sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { IEditorTab, IProblemsItem, MarkerSeverity } from '@dtinsight/molecule/e

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

export default class Sidebar extends React.Component {
private _language = defaultLanguage;
Expand Down
21 changes: 21 additions & 0 deletions website/src/extensions/workbench/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
export function debounce<T extends (...args: unknown[]) => unknown>(
func: T,
timeout: number,
immediate?: boolean
): (...args: Parameters<T>) => unknown {
let timer: NodeJS.Timeout | null = null;
return (...args) => {
if (timer) {
clearTimeout(timer);
}
if (immediate && !timer) {
return func?.(...args);
}

timer = setTimeout(() => {
timer && clearTimeout(timer);
timer = null;
func?.(...args);
}, timeout);
};
}
6 changes: 6 additions & 0 deletions website/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ export default defineConfig({
}
},
base: '/monaco-sql-languages/',
build: {
commonjsOptions: {
transformMixedEsModules: true
},
outDir: resolve(__dirname, '../docs')
},
server: {
fs: {
allow: ['..']
Expand Down

0 comments on commit 3275599

Please sign in to comment.