This repository has been archived by the owner on Aug 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: strip development code in destination JS files
Also remove redundant dependency @types/nodes.
- Loading branch information
Showing
4 changed files
with
51 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,17 +15,18 @@ | |
}, | ||
"packageManager": "[email protected]", | ||
"scripts": { | ||
"dev": "pnpm clean && rollup -c rollup.config.js && pnpm sass && pnpm copy && cp ./src/manifest-chrome.json ./dist/manifest.json", | ||
"dev": "pnpm clean && NODE_ENV=DEVELOPMENT rollup -c rollup.config.js --bundleConfigAsCjs && pnpm sass && pnpm copy && cp ./src/manifest-chrome.json ./dist/manifest.json", | ||
"build:chrome": "pnpm clean && pnpm tsc && pnpm sass && pnpm copy && cp ./src/manifest-chrome.json ./dist/manifest.json && pnpm zip:chrome", | ||
"build:firefox": "pnpm clean && pnpm tsc && pnpm sass && pnpm copy && cp ./src/manifest-firefox.json ./dist/manifest.json && pnpm zip:firefox", | ||
"tsc": "rollup -c rollup.config.js && eslint --fix dist/scripts", | ||
"tsc": "rollup -c rollup.config.js --bundleConfigAsCjs && eslint --fix dist/scripts", | ||
"sass": "sass --no-source-map ./src/scss/popup.scss:./dist/css/popup.css ./src/scss/content-script.scss:./dist/css/content-script.css", | ||
"copy": "cp -r src/_locales src/images src/popup.html dist", | ||
"zip:chrome": "cd dist && zip -FSr ../the-content-farm-terminator_chrome.zip .", | ||
"zip:firefox": "cd dist && zip -FSr ../the-content-farm-terminator_firefox.zip .", | ||
"clean": "rm -rf lib dist the-content-farm-terminator_*.zip" | ||
}, | ||
"dependencies": { | ||
"@rollup/plugin-replace": "^5.0.2", | ||
"@rollup/plugin-typescript": "^11.0.0", | ||
"@types/chrome": "0.0.225", | ||
"@types/firefox-webext-browser": "^111.0.0", | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,21 +1,30 @@ | ||
import typescript from '@rollup/plugin-typescript' | ||
import replace from '@rollup/plugin-replace' | ||
|
||
const popupConfig = { | ||
input: 'src/scripts/popup.ts', | ||
output: { | ||
dir: 'dist/scripts', | ||
format: 'cjs' | ||
format: 'cjs', | ||
}, | ||
plugins: [typescript()] | ||
plugins: [typescript()], | ||
} | ||
|
||
const contentScriptConfig = { | ||
input: 'src/scripts/content-script.ts', | ||
output: { | ||
dir: 'dist/scripts', | ||
format: 'cjs' | ||
format: 'cjs', | ||
}, | ||
plugins: [typescript()] | ||
plugins: [ | ||
typescript(), | ||
replace({ | ||
values: { | ||
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'PRODUCTION'), | ||
}, | ||
preventAssignment: true, | ||
}), | ||
], | ||
} | ||
|
||
export default [popupConfig, contentScriptConfig] |
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