First attempt at a netlify deploy preview

This commit is contained in:
dannyrb committed 2019-07-16 09:24:24 -04:00
1 parent 91ee615aee
commit 2279e555a3
10 files changed
+212 -127

No files matched your search

+26 -28
View File
@@ -1,18 +1,16 @@
const merge = require('webpack-merge');
const path = require('path');
const merge = require("webpack-merge");
const path = require("path");
const workboxPlugin = require("workbox-webpack-plugin");
const common = require("./webpack.common");
const workboxPlugin = require('workbox-webpack-plugin');
const common = require('./webpack.common');
const SRC_DIR = path.join(__dirname, '../src');
const DIST_DIR = path.join(__dirname, '../dist');
const SRC_DIR = path.join(__dirname, "../src");
const DIST_DIR = path.join(__dirname, "../dist");
module.exports = (env, argv) => {
const commonConfig = common(env, argv);
return merge(commonConfig, {
mode: 'production',
mode: "production",
stats: {
colors: false,
hash: true,
@@ -22,15 +20,15 @@ module.exports = (env, argv) => {
chunkModules: true,
modules: true,
children: true,
warnings: true,
warnings: true
},
optimization: {
minimize: true,
sideEffects: true,
sideEffects: true
},
output: {
path: DIST_DIR,
filename: '[name].bundle.[chunkhash].js',
filename: "[name].bundle.[chunkhash].js"
},
module: {
rules: [
@@ -38,32 +36,32 @@ module.exports = (env, argv) => {
test: /\.(gif|jpe?g|png|svg)$/i,
use: [
{
loader: 'url-loader',
loader: "url-loader",
options: {
limit: 8192,
},
},
],
limit: 8192
}
}
]
},
{
test: /\.(ttf|eot|woff|woff2)$/i,
use: [
{
loader: 'url-loader',
loader: "url-loader",
options: {
limit: 50000,
},
},
],
},
],
limit: 50000
}
}
]
}
]
},
plugins: [
new workboxPlugin.GenerateSW({
swDest: 'sw.js',
swDest: "sw.js",
clientsClaim: true,
skipWaiting: true,
}),
],
skipWaiting: true
})
]
});
};
-57
View File
@@ -1,57 +0,0 @@
#!/bin/bash
# Set directory to location of this script
# https://stackoverflow.com/a/3355423/1867984
cd "$(dirname "$0")"
yarn -v
node -v
echo 'Installing Gitbook CLI'
yarn global add gitbook-cli
echo 'Running Gitbook installation'
# Generate all version's GitBook output
# For each directory in /docs ...
cd ./docs/
for D in *; do
if [ -d "${D}" ]; then
echo "Generating output for: ${D}"
cd "${D}"
# Clear previous output, generate new
rm -rf _book
gitbook install
gitbook build
cd ..
fi
done
# Move CNAME File into `latest`
cp CNAME ./latest/_book/CNAME
# Create a history folder in our latest version's output
mkdir ./latest/_book/history
# Move each version's files to latest's history folder
for D in *; do
if [ -d "${D}" ]; then
if [ "${D}" == v* ] ; then
echo "Moving ${D} to the latest version's history folder"
mkdir "./latest/_book/history/${D}"
cp -v -r "./${D}/_book"/* "./latest/_book/history/${D}"
fi
fi
done
cd ..
# Build and copy the StandaloneViewer into the static directory
mkdir ./docs/latest/_book/demo/
yarn install
yarn build:web:ci
-25
View File
@@ -1,25 +0,0 @@
# https://www.netlify.com/docs/netlify-toml-reference/
[build]
# Directory (relative to root of your repo) that contains the deploy-ready
# HTML files and assets generated by the build. If a base directory has
# been specified, include it in the publish directory path.
publish = "docs/latest/_book/"
# COMMENT: NODE_VERSION in root `.nvmrc` takes priority
# COMMENT: Why we specify YARN_FLAGS: https://www.netlify.com/docs/build-gotchas/#yarn
[build.environment]
NODE_VERSION = "10.15.3"
YARN_VERSION = "1.15.2"
YARN_FLAGS = "--no-ignore-optional --pure-lockfile"
# COMMENT: This a rule for Single Page Applications
[[redirects]]
from = "/demo/*"
to = "/demo/index.html"
status = 200
[[redirects]]
from = "/*"
to = "/index.html"
status = 200
-4
View File
@@ -20,15 +20,11 @@
"build:package": "yarn run preBuild && node --max-old-space-size=4096 node_modules/rollup/bin/rollup -c",
"build:package:ci": "yarn run preBuild && node --max-old-space-size=4096 node_modules/rollup/bin/rollup -c",
"build:web": "yarn run preBuild && react-scripts --max_old_space_size=4096 build",
"build:web:ci": "yarn run preBuild && cross-env PUBLIC_URL=/demo REACT_APP_CONFIG=config/netlify.js react-scripts --max_old_space_size=4096 build && cpx 'build/**/*' docs/latest/_book/demo --verbose",
"build:demo:ci": "yarn run preBuild && cross-env PUBLIC_URL=/ REACT_APP_CONFIG=config/demo.js react-scripts --max_old_space_size=4096 build",
"lint": "eslint -c .eslintrc --fix src && prettier --single-quote --write src/**/*.{js,jsx,json,css}",
"test:unit": "jest",
"test:unit:ci": "jest --ci --runInBand --collectCoverage --reporters=default --reporters=jest-junit && codecov",
"test:e2e": "",
"test:e2e:ci": "start-server-and-test start http://localhost:5000 cy:run:ci",
"staticDeploy": "./generateStaticSite.sh",
"docs:publish": "./publishStaticSite.sh",
"start": "yarn run dev",
"predeploy": "cd example && npm install && yarn run build:package",
"preBuild": "yarn run version && yarn run copy:webworkers",
-13
View File
@@ -1,13 +0,0 @@
#!/bin/bash
# Set directory to location of this script
# https://stackoverflow.com/a/3355423/1867984
cd "$(dirname "$0")"
echo 'PUBLISHING'
./node_modules/.bin/gh-pages \
--silent \
--repo https://$GITHUB_TOKEN@github.com/OHIF/Viewers.git \
--message 'Autogenerated Message: [ci skip]' \
--dist docs/latest/_book