-
-
Notifications
You must be signed in to change notification settings - Fork 368
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* --tag implementation * revert utils * use app-specific flag map * remove unused import Co-authored-by: Louis <[email protected]>
- Loading branch information
Showing
8 changed files
with
94 additions
and
49 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
9 changes: 5 additions & 4 deletions
9
cli/plasmo/src/features/extension-devtools/get-bundle-config.ts
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { paramCase } from "change-case" | ||
|
||
import { flagsHelp as baseFlagHelp, getFlag } from "@plasmo/utils" | ||
|
||
const srcPath = getFlag("--src-path") || process.env.PLASMO_SRC_PATH || "src" | ||
|
||
const buildPath = | ||
getFlag("--build-path") || process.env.PLASMO_BUILD_PATH || "build" | ||
|
||
const tag = | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong. |
||
getFlag("--tag") || | ||
process.env.PLASMO_TAG || | ||
process.env.NODE_ENV === "production" | ||
? "prod" | ||
: "dev" | ||
|
||
const target = paramCase( | ||
getFlag("--target") || process.env.PLASMO_TARGET || "chrome-mv3" | ||
) | ||
|
||
const entry = getFlag("--entry") || "popup" | ||
|
||
export const flagMap = { | ||
tag, | ||
srcPath, | ||
buildPath, | ||
target, | ||
entry | ||
} | ||
|
||
export const flagHelp = ` | ||
init | ||
--entry entry files (default: popup) | ||
--with-<name> use an example template | ||
dev/build | ||
--target [string] set the target (default: chrome-mv3) | ||
--tag [string] set the build tag (default: dev or prod depending on NODE_ENV) | ||
--src-path [path] set the source path relative to project root (default: src) | ||
--build-path [path] set the build path relative to project root (default: build) | ||
--entry entry point name (default: popup) | ||
` |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,16 @@ | ||
import { cLog } from "@plasmo/utils" | ||
|
||
import { validCommandList } from "~commands" | ||
import { flagHelp } from "~features/helpers/flag" | ||
|
||
export const printHeader = () => { | ||
console.log(`🟣 Plasmo v${process.env.APP_VERSION}`) | ||
|
||
console.log("🟠 The browser extension development framework.") | ||
console.log("🔴 The Browser Extension Framework") | ||
} | ||
|
||
export const printHelp = () => cLog("🟡 MODES", validCommandList.join(" | ")) | ||
export const printHelp = () => { | ||
cLog("🟠 CMDS", validCommandList.join(" | ")) | ||
|
||
cLog("🟡 OPTS", flagHelp) | ||
} |
This file contains 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
I think someone got operator precedence wrong here. The value of tag can only be "prod" or "dev".
getFlag("--tag")
andprocess.env.PLASMO_TAG
does not work as expected. Or maybe it should be like thisconst tag = getFlag("--tag") || process.env.PLASMO_TAG || (process.env.NODE_ENV === "production" ? "prod" : "dev")