mirror of
https://github.com/openglobus/openglobus.git
synced 2025-12-08 19:25:27 +00:00
Add prettier config with husky git precommit hook & Add esm build profile for rollup
This commit is contained in:
parent
5099a72cde
commit
b4740152b6
1
.husky/.gitignore
vendored
Normal file
1
.husky/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
_
|
||||
4
.husky/pre-commit
Normal file
4
.husky/pre-commit
Normal file
@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
. "$(dirname "$0")/_/husky.sh"
|
||||
|
||||
npx lint-staged
|
||||
18
.prettierrc.js
Normal file
18
.prettierrc.js
Normal file
@ -0,0 +1,18 @@
|
||||
module.exports = {
|
||||
printWidth: 100,
|
||||
tabWidth: 4,
|
||||
useTabs: false,
|
||||
semi: true,
|
||||
singleQuote: false,
|
||||
quoteProps: "as-needed",
|
||||
trailingComma: "none",
|
||||
bracketSpacing: true,
|
||||
arrowParens: "always",
|
||||
rangeStart: 0,
|
||||
rangeEnd: Infinity,
|
||||
requirePragma: false,
|
||||
insertPragma: false,
|
||||
proseWrap: "preserve",
|
||||
htmlWhitespaceSensitivity: "css",
|
||||
endOfLine: "auto"
|
||||
};
|
||||
11
package.json
11
package.json
@ -15,7 +15,8 @@
|
||||
"core": "node_modules/.bin/rollup -c --environment entry:core",
|
||||
"test": "jest --coverage",
|
||||
"lint": "node_modules/.bin/eslint src/og",
|
||||
"font": "msdf-bmfont.cmd --reuse -i .\\fonts\\charset.roboto.txt -m 512,512 -f json -o .\\fonts\\Roboto-Regular.png -s 32 -r 8 -p 1 -t msdf .\\fonts\\Roboto-Regular.ttf"
|
||||
"font": "msdf-bmfont.cmd --reuse -i .\\fonts\\charset.roboto.txt -m 512,512 -f json -o .\\fonts\\Roboto-Regular.png -s 32 -r 8 -p 1 -t msdf .\\fonts\\Roboto-Regular.ttf",
|
||||
"prepare": "husky install"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -53,15 +54,23 @@
|
||||
"eslint-plugin-promise": "^4.3.1",
|
||||
"eslint-plugin-react": "^7.21.5",
|
||||
"eslint-plugin-standard": "^4.1.0",
|
||||
"husky": "^6.0.0",
|
||||
"jaguarjs-jsdoc": "^1.1.0",
|
||||
"jest": "^26.6.3",
|
||||
"jsdoc": "^3.6.6",
|
||||
"lint-staged": "^11.0.0",
|
||||
"local-web-server": "^3.0.7",
|
||||
"postcss": "^8.2.6",
|
||||
"prettier": "^2.3.0",
|
||||
"rollup": "^1.32.1",
|
||||
"rollup-plugin-postcss": "^4.0.0",
|
||||
"rollup-plugin-terser": "^5.3.1"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{js,ts}": [
|
||||
"prettier --write"
|
||||
]
|
||||
},
|
||||
"files": [
|
||||
"src/**/*",
|
||||
"css/**/*"
|
||||
|
||||
@ -1,39 +1,51 @@
|
||||
import { terser } from 'rollup-plugin-terser';
|
||||
import json from '@rollup/plugin-json';
|
||||
import pkg from './package.json';
|
||||
import postcss from 'rollup-plugin-postcss';
|
||||
import { terser } from "rollup-plugin-terser";
|
||||
import json from "@rollup/plugin-json";
|
||||
import pkg from "./package.json";
|
||||
import postcss from "rollup-plugin-postcss";
|
||||
|
||||
const LIB_SUFFIX = process.env.entry ? `.${process.env.entry}` : "";
|
||||
const LIB_NAME = pkg.name + LIB_SUFFIX;
|
||||
const OUTPUT_NAME = `dist/${LIB_NAME}-${pkg.version}`;
|
||||
|
||||
export default [{
|
||||
input: `src/og/index${LIB_SUFFIX}.js`,
|
||||
output: [
|
||||
{
|
||||
file: OUTPUT_NAME + ".js",
|
||||
format: 'umd',
|
||||
name: 'og',
|
||||
sourcemap: false
|
||||
}
|
||||
],
|
||||
plugins: [
|
||||
terser(),
|
||||
json()
|
||||
]
|
||||
}, {
|
||||
input: `css/og.css`,
|
||||
output: [
|
||||
{
|
||||
file: OUTPUT_NAME + ".css",
|
||||
format: 'umd',
|
||||
name: pkg.name,
|
||||
sourcemap: false
|
||||
}
|
||||
],
|
||||
plugins: [
|
||||
postcss({
|
||||
extract: true,
|
||||
minimize: true
|
||||
})]
|
||||
}];
|
||||
export default [
|
||||
{
|
||||
input: `src/og/index${LIB_SUFFIX}.js`,
|
||||
output: [
|
||||
{
|
||||
file: `${OUTPUT_NAME}-umd.js`,
|
||||
format: "umd",
|
||||
name: "og",
|
||||
sourcemap: true
|
||||
}
|
||||
],
|
||||
plugins: [terser(), json()]
|
||||
},
|
||||
{
|
||||
input: `src/og/index${LIB_SUFFIX}.js`,
|
||||
output: [
|
||||
{
|
||||
file: `${OUTPUT_NAME}-esm.js`,
|
||||
format: "esm",
|
||||
sourcemap: true
|
||||
}
|
||||
],
|
||||
plugins: [terser(), json()]
|
||||
},
|
||||
{
|
||||
input: `css/og.css`,
|
||||
output: [
|
||||
{
|
||||
file: `${OUTPUT_NAME}.css`,
|
||||
format: "umd",
|
||||
name: pkg.name,
|
||||
sourcemap: false
|
||||
}
|
||||
],
|
||||
plugins: [
|
||||
postcss({
|
||||
extract: true,
|
||||
minimize: true
|
||||
})
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user