Skip to content

Commit

Permalink
[optimize] upgrade Referred components of Community & Hospital pages
Browse files Browse the repository at this point in the history
[fix] Production Building bugs
  • Loading branch information
TechQuery committed Jan 20, 2024
1 parent 1f4b4cd commit e14bf88
Show file tree
Hide file tree
Showing 14 changed files with 476 additions and 162 deletions.
5 changes: 5 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

. "$(dirname "$0")/_/husky.sh"

npm test
5 changes: 5 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

. "$(dirname "$0")/_/husky.sh"

npm run build
25 changes: 25 additions & 0 deletions fix-script.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { promises } from 'fs';

const title = 'fix Parcel bundle',
filePattern = /^index\..+\.js$/i,
bugPattern = /\$\w+?\$import\$\w+?;/g;

console.time(title);

(async () => {
const files = await promises.readdir('dist');

for (const name of files)
if (filePattern.test(name)) {
const file = `dist/${name}`;

const source = await promises.readFile(file, { encoding: 'utf-8' });

if (!bugPattern.test(source)) continue;

await promises.writeFile(file, source.replace(bugPattern, ''));

console.log(`[fixed] ${file}`);
}
console.timeEnd(title);
})();
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"parcel-transformer-markdown": "^3.0.1",
"prettier": "^3.2.4",
"process": "^0.11.10",
"tsx": "^4.7.0",
"typescript": "~5.3.3",
"workbox-cli": "^7.0.0"
},
Expand All @@ -69,13 +70,15 @@
"*.{html,md,less,json,yml}": "prettier --write",
"*.{js,ts,tsx}": "eslint --fix"
},
"browserslist": "> 0.5%, last 2 versions, not dead, IE 11",
"scripts": {
"prepare": "husky install",
"test": "lint-staged",
"clean": "rm -rf .parcel-cache/ dist/",
"start:local": "npm run clean && cross-env HTTP_ENV=local parcel source/index.html --open",
"start:remote": "npm run clean && cross-env HTTP_ENV=remote parcel source/index.html --open",
"start": "npm run clean && cross-env HTTP_ENV=test parcel source/index.html --open",
"pack-dist": "parcel build source/index.html --public-url .",
"pack-dist": "parcel build source/index.html --public-url . --no-source-maps && tsx fix-script",
"pack-sw": "rm -f dist/sw.js.map && workbox generateSW",
"build": "npm run clean && npm run pack-dist && npm run pack-sw"
}
Expand Down
262 changes: 262 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

1 comment on commit e14bf88

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for wuhan2020 ready!

✅ Preview
https://wuhan2020-72gvhs4cr-techquery.vercel.app

Built with commit e14bf88.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.