pull/145972/head
Dirk Baeumer 2022-03-24 09:04:05 +01:00
parent 001fb95c3d
commit 6786b0ad7d
No known key found for this signature in database
GPG Key ID: DD95715335E91385
5 changed files with 86 additions and 142 deletions

View File

@ -2,10 +2,8 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// @ts-check
const path = require('path');
const esbuild = require('esbuild');
const watcher = require('@parcel/watcher');
const args = process.argv.slice(2);
@ -17,29 +15,19 @@ if (outputRootIndex >= 0) {
outputRoot = args[outputRootIndex + 1];
}
const srcDir = path.join(__dirname, 'notebook');
const outDir = path.join(outputRoot, 'notebook-out');
function build() {
return esbuild.build({
entryPoints: [
path.join(__dirname, 'notebook', 'index.ts'),
],
bundle: true,
minify: true,
sourcemap: false,
format: 'esm',
outdir: outDir,
platform: 'browser',
target: ['es2020'],
});
}
build().catch(() => process.exit(1));
if (isWatch) {
watcher.subscribe(srcDir, () => {
return build();
});
}
esbuild.build({
entryPoints: [
path.join(__dirname, 'notebook', 'index.ts'),
],
bundle: true,
minify: true,
sourcemap: false,
format: 'esm',
outdir: outDir,
platform: 'browser',
target: ['es2020'],
watch: isWatch,
incremental: isWatch,
}).catch(() => process.exit(1));

View File

@ -2,10 +2,8 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// @ts-check
const path = require('path');
const esbuild = require('esbuild');
const watcher = require('@parcel/watcher');
const args = process.argv.slice(2);
@ -17,29 +15,20 @@ if (outputRootIndex >= 0) {
outputRoot = args[outputRootIndex + 1];
}
const srcDir = path.join(__dirname, 'preview-src');
const outDir = path.join(outputRoot, 'media');
function build() {
return esbuild.build({
entryPoints: [
path.join(srcDir, 'index.ts'),
path.join(srcDir, 'pre'),
],
bundle: true,
minify: true,
sourcemap: false,
format: 'esm',
outdir: outDir,
platform: 'browser',
target: ['es2020'],
});
}
build().catch(() => process.exit(1));
if (isWatch) {
watcher.subscribe(srcDir, () => {
return build();
});
}
esbuild.build({
entryPoints: [
path.join(__dirname, 'preview-src', 'index.ts'),
path.join(__dirname, 'preview-src', 'pre'),
],
bundle: true,
minify: true,
sourcemap: false,
format: 'esm',
outdir: outDir,
platform: 'browser',
target: ['es2020'],
watch: isWatch,
incremental: isWatch,
}).catch(() => process.exit(1));

View File

@ -7,7 +7,6 @@
const path = require('path');
const fse = require('fs-extra');
const esbuild = require('esbuild');
const watcher = require('@parcel/watcher');
const args = process.argv.slice(2);
@ -19,44 +18,34 @@ if (outputRootIndex >= 0) {
outputRoot = args[outputRootIndex + 1];
}
const srcDir = path.join(__dirname, 'notebook');
const outDir = path.join(outputRoot, 'notebook-out');
esbuild.build({
entryPoints: [
path.join(__dirname, 'notebook', 'katex.ts'),
],
bundle: true,
minify: true,
sourcemap: false,
format: 'esm',
outdir: outDir,
platform: 'browser',
target: ['es2020'],
watch: isWatch,
incremental: isWatch,
}).catch(() => process.exit(1));
async function build() {
await esbuild.build({
entryPoints: [
path.join(srcDir, 'katex.ts'),
],
bundle: true,
minify: true,
sourcemap: false,
format: 'esm',
outdir: outDir,
platform: 'browser',
target: ['es2020'],
});
fse.copySync(
path.join(__dirname, 'node_modules', 'katex', 'dist', 'katex.min.css'),
path.join(outDir, 'katex.min.css'));
fse.copySync(
path.join(__dirname, 'node_modules', 'katex', 'dist', 'katex.min.css'),
path.join(outDir, 'katex.min.css'));
const fontsDir = path.join(__dirname, 'node_modules', 'katex', 'dist', 'fonts');
const fontsOutDir = path.join(outDir, 'fonts/');
const fontsDir = path.join(__dirname, 'node_modules', 'katex', 'dist', 'fonts');
const fontsOutDir = path.join(outDir, 'fonts/');
fse.mkdirSync(fontsOutDir, { recursive: true });
fse.mkdirSync(fontsOutDir, { recursive: true });
for (const file of fse.readdirSync(fontsDir)) {
if (file.endsWith('.woff2')) {
fse.copyFileSync(path.join(fontsDir, file), path.join(fontsOutDir, file));
}
for (const file of fse.readdirSync(fontsDir)) {
if (file.endsWith('.woff2')) {
fse.copyFileSync(path.join(fontsDir, file), path.join(fontsOutDir, file));
}
}
build().catch(() => process.exit(1));
if (isWatch) {
watcher.subscribe(srcDir, () => {
return build();
});
}

View File

@ -2,10 +2,8 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// @ts-check
const path = require('path');
const esbuild = require('esbuild');
const watcher = require('@parcel/watcher');
const args = process.argv.slice(2);
@ -17,28 +15,19 @@ if (outputRootIndex >= 0) {
outputRoot = args[outputRootIndex + 1];
}
const srcDir = path.join(__dirname, 'src');
const outDir = path.join(outputRoot, 'renderer-out');
function build() {
return esbuild.build({
entryPoints: [
path.join(srcDir, 'index.ts'),
],
bundle: true,
minify: false,
sourcemap: false,
format: 'esm',
outdir: outDir,
platform: 'browser',
target: ['es2020'],
});
}
build().catch(() => process.exit(1));
if (isWatch) {
watcher.subscribe(srcDir, () => {
return build();
});
}
esbuild.build({
entryPoints: [
path.join(__dirname, 'src', 'index.ts'),
],
bundle: true,
minify: false,
sourcemap: false,
format: 'esm',
outdir: outDir,
platform: 'browser',
target: ['es2020'],
watch: isWatch,
incremental: isWatch,
}).catch(() => process.exit(1));

View File

@ -2,11 +2,9 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// @ts-check
const path = require('path');
const fs = require('fs');
const esbuild = require('esbuild');
const watcher = require('@parcel/watcher');
const args = process.argv.slice(2);
@ -18,36 +16,27 @@ if (outputRootIndex >= 0) {
outputRoot = args[outputRootIndex + 1];
}
const srcDir = path.join(__dirname, 'preview-src');
const outDir = path.join(outputRoot, 'media');
async function build() {
fs.copyFileSync(
path.join(__dirname, 'node_modules', 'vscode-codicons', 'dist', 'codicon.css'),
path.join(outDir, 'codicon.css'));
fs.copyFileSync(
path.join(__dirname, 'node_modules', 'vscode-codicons', 'dist', 'codicon.css'),
path.join(outDir, 'codicon.css'));
fs.copyFileSync(
path.join(__dirname, 'node_modules', 'vscode-codicons', 'dist', 'codicon.ttf'),
path.join(outDir, 'codicon.ttf'));
fs.copyFileSync(
path.join(__dirname, 'node_modules', 'vscode-codicons', 'dist', 'codicon.ttf'),
path.join(outDir, 'codicon.ttf'));
await esbuild.build({
entryPoints: [
path.join(srcDir, 'index.ts')
],
bundle: true,
minify: true,
sourcemap: false,
format: 'esm',
outdir: outDir,
platform: 'browser',
target: ['es2020'],
});
}
build().catch(() => process.exit(1));
if (isWatch) {
watcher.subscribe(srcDir, () => {
return build();
});
}
esbuild.build({
entryPoints: [
path.join(__dirname, 'preview-src', 'index.ts')
],
bundle: true,
minify: true,
sourcemap: false,
format: 'esm',
outdir: outDir,
platform: 'browser',
target: ['es2020'],
watch: isWatch,
incremental: isWatch,
}).catch(() => process.exit(1));