-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #48 from kieler/jep/langiumV3
Jep/langium v3
- Loading branch information
Showing
90 changed files
with
1,728 additions
and
1,605 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
//@ts-check | ||
import * as esbuild from 'esbuild'; | ||
|
||
const options = { | ||
watch: process.argv.includes('--watch'), | ||
minify: process.argv.includes('--minify'), | ||
}; | ||
|
||
const successMessage = options.watch | ||
? 'Watch build succeeded' | ||
: 'Build succeeded'; | ||
|
||
/** @type {import('esbuild').Plugin[]} */ | ||
const plugins = [ | ||
{ | ||
name: 'watch-plugin', | ||
setup(build) { | ||
build.onEnd((result) => { | ||
if (result.errors.length === 0) { | ||
console.log(getTime() + successMessage); | ||
} | ||
}); | ||
}, | ||
}, | ||
]; | ||
|
||
const nodeContext = await esbuild.context({ | ||
entryPoints: [ | ||
'src/extension.ts', | ||
'src-language-server/main.ts' | ||
], | ||
outdir: 'pack', | ||
bundle: true, | ||
target: 'es6', | ||
format: 'cjs', | ||
loader: { '.ts': 'ts' }, | ||
outExtension: { | ||
'.js': '.cjs', | ||
}, | ||
external: ['vscode'], | ||
platform: 'node', | ||
sourcemap: 'inline', | ||
minify: options.minify, | ||
plugins, | ||
}); | ||
|
||
const browserContext = await esbuild.context({ | ||
entryPoints: [ | ||
'src-webview/main.ts', | ||
'src-diagram-snippets/main.ts', | ||
'src-context-table/main.ts', | ||
], | ||
outdir: 'pack', | ||
bundle: true, | ||
target: 'es6', | ||
loader: { '.ts': 'ts', '.css': 'css' }, | ||
platform: 'browser', | ||
sourcemap: 'inline', | ||
minify: options.minify, | ||
plugins, | ||
}); | ||
|
||
if (options.watch) { | ||
await Promise.all([ | ||
nodeContext.watch(), | ||
browserContext.watch() | ||
]); | ||
} else { | ||
await Promise.all([ | ||
nodeContext.rebuild(), | ||
browserContext.rebuild() | ||
]); | ||
nodeContext.dispose(); | ||
browserContext.dispose(); | ||
} | ||
|
||
function getTime() { | ||
const date = new Date(); | ||
return `[${`${padZeroes(date.getHours())}:${padZeroes( | ||
date.getMinutes() | ||
)}:${padZeroes(date.getSeconds())}`}] `; | ||
} | ||
|
||
/** | ||
* @param {number} i | ||
*/ | ||
function padZeroes(i) { | ||
return i.toString().padStart(2, '0'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"extends": "../tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "../pack/src-context-table", | ||
"target": "ES2017", | ||
"lib": [ | ||
"es2017", | ||
"dom" | ||
], | ||
"module": "commonjs", | ||
"moduleResolution": "node", | ||
"jsx": "react", | ||
"jsxFactory": "jsx" | ||
} | ||
} |
Oops, something went wrong.