11#!/usr/bin/env node
22
3- import process , { env , exit } from "node:process" ;
3+ import process from "node:process" ;
44import { Command } from "@commander-js/extra-typings" ;
55import pkg from "../package.json" with { type : "json" } ;
66import { Build , Config , Release , Serve , Test } from "./index.js" ;
@@ -14,7 +14,7 @@ export default async function main() {
1414
1515 // Env variables are initialized to dev, but can be overridden by each command
1616 // For example, "zotero-plugin build" overrides them to "production"
17- env . NODE_ENV ??= "development" ;
17+ process . env . NODE_ENV ??= "development" ;
1818
1919 const cli = new Command ( ) ;
2020
@@ -29,7 +29,7 @@ export default async function main() {
2929 . option ( "--dev" , "Builds the plugin in dev mode" )
3030 . option ( "--dist <dir>" , "The relative path for the new output directory (default: build)" )
3131 . action ( ( options ) => {
32- env . NODE_ENV = options . dev ? "development" : "production" ;
32+ process . env . NODE_ENV = options . dev ? "development" : "production" ;
3333 Config . loadConfig ( {
3434 dist : options . dist ,
3535 } ) . then ( ctx => new Build ( ctx ) . run ( ) ) ;
@@ -56,7 +56,7 @@ export default async function main() {
5656 . option ( "--abort-on-fail" , "Abort the test suite on first failure" )
5757 . option ( "--exit-on-finish" , "Exit the test suite after all tests have run" )
5858 . action ( ( options ) => {
59- env . NODE_ENV = "test" ;
59+ process . env . NODE_ENV = "test" ;
6060
6161 Config . loadConfig ( { } ) . then ( ( ctx ) => {
6262 if ( options . abortOnFail ) {
@@ -84,7 +84,7 @@ export default async function main() {
8484 . option ( "--preid <preid>" , "ID for prerelease" )
8585 . option ( "-y, --yes" , "Skip confirmation" )
8686 . action ( async ( version , options ) => {
87- env . NODE_ENV = "production" ;
87+ process . env . NODE_ENV = "production" ;
8888 Config . loadConfig ( {
8989 release : {
9090 bumpp : {
@@ -115,5 +115,5 @@ process.on("uncaughtException", onError);
115115
116116function onError ( err : Error ) {
117117 logger . error ( err ) ;
118- exit ( 1 ) ;
118+ process . exit ( 1 ) ;
119119}
0 commit comments