Execution-mode helper for JavaScript projects. It reads command-line arguments to decide whether the app runs in dev, prod or debug mode and exposes the result as module-level flags.
Note: This repository is archived and read-only.
Package @ralvarezdev/js-mode (0.1.9, ES module, no dependencies).
npm publication was not verified; installing from GitHub works regardless:
npm install github:ralvarezdev/js-modeimport { loadNode, IS_DEBUG, MODE, SAVE, MIGRATE } from "@ralvarezdev/js-mode";
loadNode(); // must be called before reading the flagsnode app.js --dev
node app.js --prod --save --migrateloadNode()— parsesprocess.argvfor exactly one of--dev,--prod,--debug(throwsMultiple modes setorNo mode setotherwise), plus the optional--saveand--migrate.loadVite()— same, but the mode is read from--mode <dev|prod|debug>.- Values — live bindings populated after loading:
IS_DEV,IS_PROD,IS_DEBUG,SAVE,MIGRATE,MODE; constantsDEV,PROD,DEBUG('dev','prod','debug').
There are no tests.
GNU General Public License v3.0. package.json declares GPL-3.0-only, matching the LICENSE file.