-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- upgrades esbuild to latest version, as part of core dependencies review - incorporate lint into build step, and prefer yarn run build to calling ./build.sh directly - update README and some documentation (comments)
- Loading branch information
Showing
5 changed files
with
280 additions
and
228 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
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 |
---|---|---|
@@ -1,50 +1,47 @@ | ||
const esbuild = require("esbuild"); | ||
const cp = require("child_process"); | ||
const electron = require("electron"); | ||
|
||
// After successful build, log results | ||
function afterBuild(name) { | ||
return ({ errors, warnings, ...rest }) => { | ||
console.log(rest); | ||
if (errors.length) { | ||
console.error(`${name} bundle completed with errors`, errors); | ||
process.exit(1); | ||
} else if (warnings.length) { | ||
console.warn(`${name} bundle completed with warnings`, warnings); | ||
} else { | ||
console.log(`${name} bundle completed`); | ||
} | ||
return { | ||
name: `after-build-${name}`, | ||
setup(build) { | ||
build.onEnd((result) => { | ||
if (result.errors.length) { | ||
console.error(`${name} bundle completed with errors`, errors); | ||
process.exit(1); | ||
} else { | ||
console.log(`${name} bundle completed`); | ||
} | ||
}); | ||
}, | ||
}; | ||
} | ||
|
||
// build renderer bundle | ||
esbuild | ||
.build({ | ||
entryPoints: ["src/index.tsx"], | ||
outfile: "src/renderer.bundle.js", | ||
bundle: true, | ||
platform: "browser", | ||
}) | ||
.then(afterBuild("renderer"), console.error); | ||
esbuild.build({ | ||
entryPoints: ["src/index.tsx"], | ||
outfile: "src/renderer.bundle.js", | ||
bundle: true, | ||
platform: "browser", | ||
plugins: [afterBuild("renderer")], | ||
}); | ||
|
||
// build preload bundle | ||
esbuild | ||
.build({ | ||
entryPoints: ["src/preload/index.ts"], | ||
outfile: "src/preload.bundle.js", | ||
bundle: true, | ||
platform: "node", | ||
external: ["knex", "electron", "electron-store", "better-sqlite3"], | ||
}) | ||
.then(afterBuild("preload"), console.error); | ||
esbuild.build({ | ||
entryPoints: ["src/preload/index.ts"], | ||
outfile: "src/preload.bundle.js", | ||
bundle: true, | ||
platform: "node", | ||
external: ["knex", "electron", "electron-store", "better-sqlite3"], | ||
plugins: [afterBuild("preload")], | ||
}); | ||
|
||
// build electron main bundle | ||
esbuild | ||
.build({ | ||
entryPoints: ["src/electron/index.js"], | ||
outfile: "src/main.bundle.js", | ||
bundle: true, | ||
platform: "node", | ||
external: ["electron", "electron-store", "better-sqlite3"], | ||
}) | ||
.then(afterBuild("main"), console.error); | ||
esbuild.build({ | ||
entryPoints: ["src/electron/index.js"], | ||
outfile: "src/main.bundle.js", | ||
bundle: true, | ||
platform: "node", | ||
external: ["electron", "electron-store", "better-sqlite3"], | ||
plugins: [afterBuild("main")], | ||
}); |
Oops, something went wrong.