mirror of
https://github.com/pure-css/pure.git
synced 2024-11-24 10:44:21 +00:00
refactor(site): pull pure files from npm install
This commit is contained in:
parent
2d9b809d4d
commit
72da9c0f20
2
.github/workflows/deploy.yml
vendored
2
.github/workflows/deploy.yml
vendored
@ -28,8 +28,6 @@ jobs:
|
|||||||
npm ci
|
npm ci
|
||||||
git config --global user.name "${GH_NAME}"
|
git config --global user.name "${GH_NAME}"
|
||||||
git config --global user.email "${GH_EMAIL}"
|
git config --global user.email "${GH_EMAIL}"
|
||||||
npm run prepare
|
|
||||||
cp -rf ./build/ ./site/static/css/pure/
|
|
||||||
cd site
|
cd site
|
||||||
npm install
|
npm install
|
||||||
npm run deploy
|
npm run deploy
|
||||||
|
@ -8,8 +8,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "eslint . --ext .js",
|
"lint": "eslint . --ext .js",
|
||||||
"prepare": "grunt release",
|
"prepare": "grunt release",
|
||||||
"site:build": "npm run pretest && cd site && npm install && npm run build",
|
"start": "cd site && npm install && npm run start",
|
||||||
"site:start": "cd site && npm run start",
|
|
||||||
"test": "grunt test && tap test/*.js --no-coverage"
|
"test": "grunt test && tap test/*.js --no-coverage"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
|
@ -2,10 +2,12 @@ const crypto = require('crypto');
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const gzip = require('gzip-size');
|
const gzip = require('gzip-size');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const { version } = require('../../package.json');
|
|
||||||
|
|
||||||
const pureDir = path.resolve(__dirname, '..', 'static', 'css', 'pure');
|
// load pure package metadata
|
||||||
const pureMin = fs.readFileSync(path.resolve(pureDir, 'pure-min.css'), 'utf8');
|
const pureDir = path.dirname(require.resolve('purecss'));
|
||||||
|
const { version } = require(path.resolve(pureDir, 'package.json'));
|
||||||
|
const pureFiles = path.resolve(pureDir, 'build');
|
||||||
|
const pureMin = fs.readFileSync(path.resolve(pureFiles, 'pure-min.css'), 'utf8');
|
||||||
|
|
||||||
// use pure-min.css to determine site integrity hash
|
// use pure-min.css to determine site integrity hash
|
||||||
const sriHash = crypto.createHash('sha384').update(pureMin, 'utf8').digest('base64');
|
const sriHash = crypto.createHash('sha384').update(pureMin, 'utf8').digest('base64');
|
||||||
@ -15,7 +17,7 @@ module.exports.PURE_DOWNLOAD_SNIPPET = `<link rel="stylesheet" href="https://unp
|
|||||||
|
|
||||||
// calculate each pure module size
|
// calculate each pure module size
|
||||||
module.exports.moduleSizes = function moduleSizes() {
|
module.exports.moduleSizes = function moduleSizes() {
|
||||||
const files = fs.readdirSync(pureDir);
|
const files = fs.readdirSync(pureFiles);
|
||||||
|
|
||||||
// collect all minified module files
|
// collect all minified module files
|
||||||
const modules = files.filter(file => (/-min\.css$/).test(file))
|
const modules = files.filter(file => (/-min\.css$/).test(file))
|
||||||
@ -23,7 +25,7 @@ module.exports.moduleSizes = function moduleSizes() {
|
|||||||
|
|
||||||
// get sizes across all modules
|
// get sizes across all modules
|
||||||
const moduleSizes = modules.map(module => {
|
const moduleSizes = modules.map(module => {
|
||||||
const filePath = path.join(pureDir, module + '-min.css');
|
const filePath = path.join(pureFiles, module + '-min.css');
|
||||||
const contents = fs.readFileSync(filePath, { encoding: 'utf-8' });
|
const contents = fs.readFileSync(filePath, { encoding: 'utf-8' });
|
||||||
return gzip.sync(contents);
|
return gzip.sync(contents);
|
||||||
});
|
});
|
||||||
|
5
site/package-lock.json
generated
5
site/package-lock.json
generated
@ -8532,6 +8532,11 @@
|
|||||||
"escape-goat": "^2.0.0"
|
"escape-goat": "^2.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"purecss": {
|
||||||
|
"version": "2.0.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/purecss/-/purecss-2.0.6.tgz",
|
||||||
|
"integrity": "sha512-R5V/Yk/j8/v5ivlg0MvQKQmo7F1BnWupK0wiMrKDyz2BofLB5BFKfZtSqu90YwHYBH4uzLtebmnDltY3ElcyLw=="
|
||||||
|
},
|
||||||
"qs": {
|
"qs": {
|
||||||
"version": "6.9.6",
|
"version": "6.9.6",
|
||||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.9.6.tgz",
|
"resolved": "https://registry.npmjs.org/qs/-/qs-6.9.6.tgz",
|
||||||
|
@ -5,8 +5,9 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "docusaurus build",
|
"build": "docusaurus build",
|
||||||
"deploy": "docusaurus deploy",
|
"deploy": "docusaurus deploy",
|
||||||
"predeploy": "npm run build",
|
"predeploy": "npm run pure && npm run build",
|
||||||
"prestart": "cp -rf ../build/ ./static/css/pure/",
|
"prestart": "npm run pure",
|
||||||
|
"pure": "cp -rf ./node_modules/purecss/build/ ./static/css/pure/",
|
||||||
"start": "docusaurus start",
|
"start": "docusaurus start",
|
||||||
"swizzle": "docusaurus swizzle"
|
"swizzle": "docusaurus swizzle"
|
||||||
},
|
},
|
||||||
@ -19,6 +20,7 @@
|
|||||||
"common-tags": "^1.8.2",
|
"common-tags": "^1.8.2",
|
||||||
"gzip-size": "^6.0.0",
|
"gzip-size": "^6.0.0",
|
||||||
"js-beautify": "^1.11.0",
|
"js-beautify": "^1.11.0",
|
||||||
|
"purecss": "^2.0.6",
|
||||||
"react": "^17.0.2",
|
"react": "^17.0.2",
|
||||||
"react-dom": "^17.0.2",
|
"react-dom": "^17.0.2",
|
||||||
"react-syntax-highlighter": "^15.5.0",
|
"react-syntax-highlighter": "^15.5.0",
|
||||||
|
Loading…
Reference in New Issue
Block a user