Typescriptify the main process code (5/N)
Summary: Use dev bundling for "yarn start" Reviewed By: jknoxville Differential Revision: D20034300 fbshipit-source-id: a46c75074c969f5a4958f498c5c0e15aab808552
This commit is contained in:
committed by
Facebook Github Bot
parent
bd0c7bb58f
commit
f6cc7c93ef
@@ -169,7 +169,7 @@ function downloadIcons(buildFolder) {
|
|||||||
const dir = await buildFolder();
|
const dir = await buildFolder();
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.log('Created build directory', dir);
|
console.log('Created build directory', dir);
|
||||||
await compileMain();
|
await compileMain({dev: false});
|
||||||
copyStaticFolder(dir);
|
copyStaticFolder(dir);
|
||||||
await downloadIcons(dir);
|
await downloadIcons(dir);
|
||||||
await compileDefaultPlugins(path.join(dir, 'defaultPlugins'));
|
await compileDefaultPlugins(path.join(dir, 'defaultPlugins'));
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ function compile(buildFolder, entry) {
|
|||||||
.catch(die);
|
.catch(die);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function compileMain() {
|
async function compileMain({dev}) {
|
||||||
const staticDir = path.resolve(__dirname, '..', 'static');
|
const staticDir = path.resolve(__dirname, '..', 'static');
|
||||||
const out = path.join(staticDir, 'main.bundle.js');
|
const out = path.join(staticDir, 'main.bundle.js');
|
||||||
// check if main needs to be compiled
|
// check if main needs to be compiled
|
||||||
@@ -128,7 +128,7 @@ async function compileMain() {
|
|||||||
platform: 'web',
|
platform: 'web',
|
||||||
entry: path.join(staticDir, 'main.ts'),
|
entry: path.join(staticDir, 'main.ts'),
|
||||||
out,
|
out,
|
||||||
dev: false,
|
dev,
|
||||||
minify: false,
|
minify: false,
|
||||||
sourceMap: true,
|
sourceMap: true,
|
||||||
resetCache: true,
|
resetCache: true,
|
||||||
@@ -158,8 +158,7 @@ function getVersionNumber() {
|
|||||||
version = [...version.split('.').slice(0, 2), buildNumber[1]].join('.');
|
version = [...version.split('.').slice(0, 2), buildNumber[1]].join('.');
|
||||||
}
|
}
|
||||||
return version;
|
return version;
|
||||||
}
|
} // Asynchronously determine current mercurial revision as string or `null` in case of any error.
|
||||||
// Asynchronously determine current mercurial revision as string or `null` in case of any error.
|
|
||||||
function genMercurialRevision() {
|
function genMercurialRevision() {
|
||||||
return cp
|
return cp
|
||||||
.spawn('hg', ['log', '-r', '.', '-T', '{node}'], {encoding: 'utf8'})
|
.spawn('hg', ['log', '-r', '.', '-T', '{node}'], {encoding: 'utf8'})
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ function startAssetServer(port) {
|
|||||||
}
|
}
|
||||||
shutdownElectron = launchElectron({
|
shutdownElectron = launchElectron({
|
||||||
devServerURL: `http://localhost:${port}`,
|
devServerURL: `http://localhost:${port}`,
|
||||||
bundleURL: `http://localhost:${port}/src/init.bundle`,
|
bundleURL: `http://localhost:${port}/src/init.bundle?dev=true&platform=web&minify=false&excludeSource=false`,
|
||||||
electronURL: `http://localhost:${port}/index.dev.html`,
|
electronURL: `http://localhost:${port}/index.dev.html`,
|
||||||
});
|
});
|
||||||
res.end();
|
res.end();
|
||||||
@@ -246,7 +246,7 @@ function outputScreen(socket) {
|
|||||||
const socket = await addWebsocket(server);
|
const socket = await addWebsocket(server);
|
||||||
await startMetroServer(app);
|
await startMetroServer(app);
|
||||||
outputScreen(socket);
|
outputScreen(socket);
|
||||||
await compileMain();
|
await compileMain({dev: true});
|
||||||
shutdownElectron = launchElectron({
|
shutdownElectron = launchElectron({
|
||||||
devServerURL: `http://localhost:${port}`,
|
devServerURL: `http://localhost:${port}`,
|
||||||
bundleURL: `http://localhost:${port}/src/init.bundle`,
|
bundleURL: `http://localhost:${port}/src/init.bundle`,
|
||||||
|
|||||||
Reference in New Issue
Block a user