Repository navigation
feat: add script mode values - #82
Merged
Merged
Conversation
3 tasks done
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A client script could not tell
bongo devfrombongo build. A user had the layout write adata-devattribute for dev-only scripts to read.Changes
process.env.NODE_ENV("development"or"production"),import.meta.env.DEV, andimport.meta.env.PROD.import.meta.envitself becomes an object, soimport.meta.env.OTHERisundefined, not aTypeError.process.env.NODE_ENVgets the mode. Before, it threw in the browser.developmentcondition in dev. Before, dev always usedproduction.$build.defineadds user values, and replaces the built-in ones of the same name. Thedefinemaps of plugins and the config merge, and the config's values win.bongo/envtypesimport.meta.env.DEVandPROD. A project opts in with"types": ["bongo/env"]in itstsconfig.json, or with/// <reference types="bongo/env" />, sincebun-typesalso declaresImportMeta.envand the two conflict.create-bongotemplate sets"types": ["bongo/env", "node"]. TypeScript loads only the listed types, so a later@types/bundoes not conflict on its own. Release@bongo/bongowith this change beforecreate-bongo, since the template installs the latestbongo.config.md.Test plan
bun test(857 pass),bunx tsc -p .,bunx tsc -p build,bun run builddefineover the built-ins,$build.definethroughbuild(), and the merge ofdefinemapsbongo/clienttypes #86: a site fromcreate-bongo, installed from packed tarballs, passestscas shipped, and withimport.meta.env.DEV/PRODinmain.tsandprocess.env.NODE_ENVin the config.bongo build --minifydrops the dev branch, andbongo devkeeps it.create-bongo, installed from packed local tarballs, has noimport.meta.enverrors intscwith the template'stypes, and has them without itcreate-bongotemplate,tscfails onimport.meta.env.DEVwithout the reference and passes with itbongo buildgives"production",false, and theproductionexport.bongo devgives"development",true, and thedevelopmentexport.--minifyremovesif (import.meta.env.DEV)branches.