Skip to content

Commit

Permalink
fix HOT_RELOAD being true too often
Browse files Browse the repository at this point in the history
  • Loading branch information
sdumetz committed Sep 25, 2023
1 parent e01f6a1 commit 507025f
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"scripts": {
"start": "npm run server",
"server": "cd source/server/ && npm start",
"watch": "cd source/server && NODE_ENV=development ROOT_DIR=\"../../\" nodemon -e ts,js -w . -w ../ui/webpack.config.js -x ts-node index.ts",
"watch": "cd source/server && hot_reload=1 NODE_ENV=development ROOT_DIR=\"../../\" nodemon -e ts,js -w . -w ../ui/webpack.config.js -x ts-node index.ts",
"build-dev": "cd source/client; webpack --mode=development --env=app=all; cd ../..",
"build-dev-local": "cd source/client; webpack --mode=development --env=app=all --local=true; cd ../..",
"build-prod": "cd source/client; webpack --mode=production --env=app=all; cd ../..",
Expand Down
1 change: 0 additions & 1 deletion source/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import("source-map-support").then((s)=>{
// CONFIGURATION

const port: number = parseInt(process.env["VOYAGER_SERVER_PORT"]|| "8000") ;
const devMode: boolean = process.env["NODE_ENV"] !== "production";


(async ()=>{
Expand Down
6 changes: 1 addition & 5 deletions source/server/utils/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,7 @@ describe("config", function(){
expect(opts).to.have.property("root_dir", "/app");
expect(opts).to.have.property("files_dir", "/app/files");
});
it("hot_reload takes value from node_env", function(){
expect(parse({NODE_ENV:"development"})).to.have.property("hot_reload", true);
expect(parse({NODE_ENV:"production"})).to.have.property("hot_reload", false);
expect(parse({NODE_ENV:"production", HOT_RELOAD: "1"})).to.have.property("hot_reload", true);
});

it("override default functions if necessary", function(){
let opts = parse({ROOT_DIR:"/app", FILES_DIR: "/tmp/files"})
expect(opts).to.have.property("root_dir", "/app");
Expand Down
2 changes: 1 addition & 1 deletion source/server/utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const values = {
assets_dir: [({root_dir}:{root_dir:string})=> path.resolve(root_dir,"assets"), toPath],
trust_proxy: [true, toBool],
hostname: ["ecorpus.holusion.net", toString],
hot_reload:[({node_env}:{node_env:string})=>node_env=="development", toBool],
hot_reload:[false, toBool],
smart_host: ["localhost", toString],
verbose: [false, toBool],
} as const;
Expand Down

0 comments on commit 507025f

Please sign in to comment.