mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 15:53:27 +00:00
build(cli): integrate nx (#16648)
* build(cli): integrate nx * refactor(project.json): rename "bit" builds to "commercial" * refactor(webpack.base): implement DEFAULT_PARAMS * refactor(webpack.base): move DEFAULT_PARAMS out of buildConfig
This commit is contained in:
@@ -1,7 +1,48 @@
|
||||
const path = require("path");
|
||||
const { buildConfig } = require("../../apps/cli/webpack.base");
|
||||
|
||||
module.exports = buildConfig({
|
||||
configName: "Commercial",
|
||||
entry: "../../bitwarden_license/bit-cli/src/bw.ts",
|
||||
tsConfig: "../../bitwarden_license/bit-cli/tsconfig.json",
|
||||
});
|
||||
module.exports = (webpackConfig, context) => {
|
||||
// Detect if called by Nx (context parameter exists)
|
||||
const isNxBuild = context && context.options;
|
||||
|
||||
if (isNxBuild) {
|
||||
// Nx build configuration
|
||||
const mode = context.options.mode || "development";
|
||||
if (process.env.NODE_ENV == null) {
|
||||
process.env.NODE_ENV = mode;
|
||||
}
|
||||
const ENV = (process.env.ENV = process.env.NODE_ENV);
|
||||
|
||||
return buildConfig({
|
||||
configName: "Commercial",
|
||||
entry: context.options.main || "bitwarden_license/bit-cli/src/bw.ts",
|
||||
tsConfig: "tsconfig.base.json",
|
||||
outputPath: path.resolve(context.context.root, context.options.outputPath),
|
||||
mode: mode,
|
||||
env: ENV,
|
||||
modulesPath: [path.resolve("node_modules")],
|
||||
localesPath: "apps/cli/src/locales",
|
||||
externalsModulesDir: "node_modules",
|
||||
watch: context.options.watch || false,
|
||||
});
|
||||
} else {
|
||||
// npm build configuration
|
||||
if (process.env.NODE_ENV == null) {
|
||||
process.env.NODE_ENV = "development";
|
||||
}
|
||||
const ENV = (process.env.ENV = process.env.NODE_ENV);
|
||||
const mode = ENV;
|
||||
|
||||
return buildConfig({
|
||||
configName: "Commercial",
|
||||
entry: "../../bitwarden_license/bit-cli/src/bw.ts",
|
||||
tsConfig: "../../bitwarden_license/bit-cli/tsconfig.json",
|
||||
outputPath: path.resolve(__dirname, "../../apps/cli/build"),
|
||||
mode: mode,
|
||||
env: ENV,
|
||||
modulesPath: [path.resolve("../../node_modules")],
|
||||
localesPath: "../../apps/cli/src/locales",
|
||||
externalsModulesDir: "../../node_modules",
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user