Change build directory to dist and cleanup NPM scripts (#1500)

* Move the build path to `dist`

* mkdir dist if not exists

* Remove build from .gitignore

* Delete `dist/` before building and when cleaning
This commit is contained in:
ylemkimon
2018-07-24 01:46:15 +09:00
committed by Erik Demaine
parent b43ed4b645
commit 237986a7ca
8 changed files with 11 additions and 15 deletions

View File

@@ -1,3 +1,2 @@
**/node_modules/* **/node_modules/*
build/*
dist/* dist/*

View File

@@ -1,5 +1,5 @@
[ignore] [ignore]
<PROJECT_ROOT>/build <PROJECT_ROOT>/dist
[include] [include]

3
.gitignore vendored
View File

@@ -1,4 +1,5 @@
build katex.tar.gz
katex.zip
node_modules node_modules
npm-debug.log npm-debug.log
debug.log debug.log

View File

@@ -24,7 +24,6 @@
"/*.sh", "/*.sh",
"/package.json", "/package.json",
"/Makefile", "/Makefile",
"/build",
"/test", "/test",
"/src", "/src",
"/contrib", "/contrib",

View File

@@ -1,6 +1,5 @@
.git .git
# Autogenerated code # Autogenerated code
build/**
node_modules/** node_modules/**
dist/** dist/**

View File

@@ -70,17 +70,15 @@
"test:screenshots": "npm run test:screenshots:update -- --verify", "test:screenshots": "npm run test:screenshots:update -- --verify",
"test:screenshots:update": "npm run prestart && dockers/Screenshotter/screenshotter.sh", "test:screenshots:update": "npm run prestart && dockers/Screenshotter/screenshotter.sh",
"test:perf": "npm run prestart && NODE_ENV=test node test/perf-test.js", "test:perf": "npm run prestart && NODE_ENV=test node test/perf-test.js",
"clean": "rm -rf build/* node_modules/", "clean": "rm -rf dist/ node_modules/",
"clean-install": "npm run clean && npm i", "clean-install": "npm run clean && npm i",
"prestart": "node check-node-version.js && check-dependencies && node src/unicodeMake.js > src/unicodeSymbols.js", "prestart": "node check-node-version.js && check-dependencies && node src/unicodeMake.js > src/unicodeSymbols.js",
"start": "webpack-dev-server --hot --config webpack.dev.js", "start": "webpack-dev-server --hot --config webpack.dev.js",
"analyze": "webpack --config webpack.analyze.js", "analyze": "webpack --config webpack.analyze.js",
"build": "npm run prestart && rimraf build/* && webpack", "build": "npm run prestart && rimraf dist/ && mkdirp dist && cp README.md dist && webpack",
"watch": "npm run build -- --watch", "watch": "npm run build -- --watch",
"dist": "npm test && npm run build && npm run dist:copy && npm run dist:zip && npm run dist:dist", "dist": "npm test && npm run build && npm run dist:zip",
"dist:copy": "cd build && mkdirp katex && cp -r katex.js katex.min.js katex.css katex.min.css contrib fonts ../README.md katex", "dist:zip": "cd dist && tar czf ../katex.tar.gz * && zip -rq ../katex.zip *"
"dist:zip": "cd build && tar czf katex.tar.gz katex/ && zip -rq katex.zip katex/",
"dist:dist": "rimraf dist/ && cp -r build/katex/ dist/"
}, },
"dependencies": { "dependencies": {
"nomnom": "^1.8.1" "nomnom": "^1.8.1"

View File

@@ -109,7 +109,7 @@ sed -i.bak -E 's|"version": "[^"]+",|"version": "'$VERSION'",|' package.json
rm -f package.json.bak rm -f package.json.bak
# Build generated files and add them to the repository (for bower) # Build generated files and add them to the repository (for bower)
git clean -fdx build dist git clean -fdx dist
npm run dist npm run dist
sed -i.bak -E '/^\/dist\/$/d' .gitignore sed -i.bak -E '/^\/dist\/$/d' .gitignore
rm -f .gitignore.bak rm -f .gitignore.bak
@@ -145,7 +145,7 @@ if [ ! -z "$NEXT_VERSION" ]; then
git commit -n -m "Bump $BRANCH to v$NEXT_VERSION-pre" git commit -n -m "Bump $BRANCH to v$NEXT_VERSION-pre"
git push origin "$BRANCH" git push origin "$BRANCH"
# Go back to the tag which has build/katex.tar.gz and build/katex.zip # Go back to the tag which has katex.tar.gz and katex.zip
git checkout "v$VERSION" git checkout "v$VERSION"
fi fi
@@ -153,7 +153,7 @@ echo ""
echo "The automatic parts are done!" echo "The automatic parts are done!"
echo "Now all that's left is to create the release on github." echo "Now all that's left is to create the release on github."
echo "Visit https://github.com/Khan/KaTeX/releases/new?tag=v$VERSION to edit the release notes" echo "Visit https://github.com/Khan/KaTeX/releases/new?tag=v$VERSION to edit the release notes"
echo "Don't forget to upload build/katex.tar.gz and build/katex.zip to the release!" echo "Don't forget to upload katex.tar.gz and katex.zip to the release!"
if [[ ${DRY_RUN} ]]; then if [[ ${DRY_RUN} ]]; then
echo "" echo ""

View File

@@ -63,7 +63,7 @@ function createConfig(target /*: Target */, dev /*: boolean */,
// Enable output modules to be used in browser or Node. // Enable output modules to be used in browser or Node.
// See: https://github.com/webpack/webpack/issues/6522 // See: https://github.com/webpack/webpack/issues/6522
globalObject: "(typeof self !== 'undefined' ? self : this)", globalObject: "(typeof self !== 'undefined' ? self : this)",
path: path.resolve(__dirname, 'build'), path: path.resolve(__dirname, 'dist'),
publicPath: dev ? '/' : '', publicPath: dev ? '/' : '',
}, },
module: { module: {