Skip to content

Commit

Permalink
build(scripts): add bundle script
Browse files Browse the repository at this point in the history
  • Loading branch information
remarkablemark committed Jan 15, 2024
1 parent 65fb929 commit 915e58d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"author": "Mark <[email protected]>",
"scripts": {
"build": "npm run clean && vite build",
"bundle": "scripts/bundle.sh",
"clean": "rm -rf dist",
"lint": "eslint --ignore-path .gitignore .",
"lint:fix": "npm run lint -- --fix",
Expand Down
16 changes: 16 additions & 0 deletions scripts/bundle.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env sh

BUNDLE=true npm run build

# replace absolute URLs with relative URLs
if [ "$(uname)" == 'Darwin' ]; then
sed -i '' -e 's|src="/|src="|g' -e 's|href="/|href="|g' dist/index.html
else
sed -i -e 's|src="/|src="|g' -e 's|href="/|href="|g' dist/index.html
fi

# zip file
zip -r "dist/$(npm pkg get name | tr -d \")-$(npm pkg get version | tr -d \").zip" dist
echo
find dist -type f -depth 1 -name '*.zip'
open dist

0 comments on commit 915e58d

Please sign in to comment.