Skip to content

Optimize build #551

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Nov 28, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
esbuild for src extension
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
  • Loading branch information
ShMcK committed Nov 28, 2021
commit 3556ede8d7cb74a057027b499b95bb9d8bee12e2
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build
dist
node_modules
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ package-lock.json
.npmrc

# output directory
out
build
dist
web-app/build/
web-app/node_modules

Expand Down
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
"browserslist",
"codeally",
"coderoad",
"esbuild",
"flowtype",
"outfile",
"packagejson",
"prismjs",
"Traceback",
Expand Down
3 changes: 0 additions & 3 deletions .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
.vscode-test/**
vsc-extension-quickstart.md

## CI/CD
.circleci

## TypeScript
**/tsconfig.json
**/tslint.json
Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@
"package": "./scripts/package.sh",
"storybook": "yarn --cwd web-app storybook",
"test": "jest",
"watch": "tsc -watch -p ./"
"esbuild-base": "esbuild ./src/extension.ts --bundle --outfile=build/extension.js --external:vscode --external:fsevents --external:jsdom --format=cjs --platform=node",
"esbuild": "npm run esbuild-base -- --sourcemap",
"esbuild-watch": "npm run esbuild-base -- --sourcemap --watch",
"test-compile": "tsc -watch -p ./"
},
"dependencies": {
"chokidar": "3.5.2",
Expand All @@ -56,6 +59,7 @@
"@types/semver": "^7.3.9",
"@typescript-eslint/eslint-plugin": "5.4.0",
"@typescript-eslint/parser": "5.4.0",
"esbuild": "0.14.0",
"eslint-config-prettier": "8.3.0",
"eslint-config-react-app": "6.0.0",
"eslint-plugin-flowtype": "8.0.3",
Expand Down
10 changes: 6 additions & 4 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,22 @@ echo "Cleaning up previous build..."
rm -rf build

# build extension
echo "Compiling..."
tsc -p ./
echo "Bundling src..."
npm run esbuild

# build web app
echo "Building webapp..."
cd web-app
yarn build
cd ..

# For Windows build: switch the next 2 lines
echo "Bundling webapp..."
if [[ "$OSTYPE" == "msys" ]]; then
echo "linux subsystem on windows selected"
# linux subsystem on windows selected
cp -R ./web-app/build/ ./
else
echo "Unix system selected"
# unix
cp -R ./web-app/build/. ./build/
fi

Expand Down
1 change: 1 addition & 0 deletions scripts/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ echo "Creating $OUTPUT_FILE..."
echo "Building..."
GENERATE_SOURCEMAP=false # reduces output size by 5mb+
yarn build
npm run esbuild-base -- --minify

echo "Packaging Extension..."
mkdir -p ./$RELEASES_FOLDER
Expand Down
12 changes: 11 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,15 @@
"allowJs": true,
"removeComments": true
},
"exclude": ["docs", "node_modules", ".vscode-test", "build", "resources", "web-app", "*.js", "*.test.ts", "scripts"]
"exclude": [
"docs",
"node_modules",
".vscode-test",
"build",
"resources",
"web-app",
"*.js",
"*.test.ts",
"scripts"
]
}
Loading