Merge both package.json, simplify build process

This commit is contained in:
Hans5958 2023-03-18 12:02:56 +07:00
parent 321731f6b4
commit 7f4be33861
5 changed files with 36 additions and 47 deletions

View file

@ -1,5 +1,37 @@
{
"devDependencies": {
"@fullhuman/postcss-purgecss": "^4.1.3",
"@parcel/packager-raw-url": "^2.5.0",
"@parcel/transformer-jsonld": "^2.5.0",
"@parcel/transformer-webmanifest": "^2.5.0",
"parcel": "^2.5.0",
"parcel-namer-rewrite": "^2.0.0-rc.2",
"parcel-resolver-ignore": "^2.1.3",
"postcss": "^8.4.12",
"all-contributors-cli": "^6.23.1"
},
"parcel-namer-rewrite": {
"rules": {
"^(icon-.+)\\.(svg|png|gif|jpg|jpeg)": "_img/pwa/$1.$2",
"^(screenshot-.+)\\.(svg|png|gif|jpg|jpeg)": "_img/pwa/$1.$2",
"(.*)\\.(svg|png|gif|jpg|jpeg)": "_img/$1.$2",
"(.*)\\.(css|woff2?)": "_css/$1{.hash}.$2",
"(.*)\\.(js)": "_js/$1{.hash}.$2"
}
},
"parcelIgnore": [
"pwabuilder-sw-register.js",
"pwabuilder-sw.js"
],
"browserslist": [
">= 0.5%",
"last 2 major versions",
"not dead",
"Chrome >= 60",
"Firefox >= 60",
"Firefox ESR",
"iOS >= 12",
"Safari >= 12",
"not Explorer <= 11"
]
}

View file

@ -1,10 +1,8 @@
const purgecss = require("@fullhuman/postcss-purgecss");
const plugins = [];
if (process.env.NODE_ENV === "production") {
plugins.push(
purgecss({
require("@fullhuman/postcss-purgecss")({
content: [
'./dist-temp/*.html',
'./dist-temp/**/*.html',
@ -17,5 +15,5 @@ if (process.env.NODE_ENV === "production") {
}
module.exports = {
plugins: plugins
plugins
};

View file

@ -6,17 +6,12 @@ rm -rf dist
rm -rf .parcel-cache
cp -r web/ dist-temp/
cp tools/ci/postcss.config.js ./
cp tools/ci/package.json ./
cp tools/ci/.parcelrc ./
npm i
python tools/ci/cdn-to-local.py
npx parcel build dist-temp/index.html dist-temp/**.html --dist-dir "dist" --no-source-maps --no-content-hash
rm -rf dist-temp
rm -rf postcss.config.js
rm -rf .parcelrc
cp -r web/_img/ dist/
cp web/atlas.json dist/

View file

@ -1,36 +0,0 @@
{
"devDependencies": {
"@fullhuman/postcss-purgecss": "^4.1.3",
"@parcel/packager-raw-url": "^2.5.0",
"@parcel/transformer-jsonld": "^2.5.0",
"@parcel/transformer-webmanifest": "^2.5.0",
"parcel": "^2.5.0",
"parcel-namer-rewrite": "^2.0.0-rc.2",
"parcel-resolver-ignore": "^2.1.3",
"postcss": "^8.4.12"
},
"parcel-namer-rewrite": {
"rules": {
"^(icon-.+)\\.(svg|png|gif|jpg|jpeg)": "_img/pwa/$1.$2",
"^(screenshot-.+)\\.(svg|png|gif|jpg|jpeg)": "_img/pwa/$1.$2",
"(.*)\\.(svg|png|gif|jpg|jpeg)": "_img/$1.$2",
"(.*)\\.(css|woff2?)": "_css/$1{.hash}.$2",
"(.*)\\.(js)": "_js/$1{.hash}.$2"
}
},
"parcelIgnore": [
"pwabuilder-sw-register.js",
"pwabuilder-sw.js"
],
"browserslist": [
">= 0.5%",
"last 2 major versions",
"not dead",
"Chrome >= 60",
"Firefox >= 60",
"Firefox ESR",
"iOS >= 12",
"Safari >= 12",
"not Explorer <= 11"
]
}