Skip to content

Commit bde5fb5

Browse files
committed
rebase onto Victor Hugo, update all the things 🎉
1 parent c9dbff5 commit bde5fb5

File tree

11 files changed

+3452
-13436
lines changed

11 files changed

+3452
-13436
lines changed

‎.babelrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"presets": [
33
"@babel/preset-env",
4-
"react"
4+
"@babel/preset-react"
55
],
66
"plugins": [
77
"@babel/plugin-syntax-object-rest-spread",

‎package-lock.json

Lines changed: 0 additions & 12266 deletions
This file was deleted.

‎package.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"@babel/plugin-proposal-object-rest-spread": "^7.0.0",
2727
"@babel/plugin-syntax-object-rest-spread": "^7.0.0",
2828
"@babel/preset-env": "^7.1.0",
29+
"@babel/preset-react": "^7.0.0",
2930
"@babel/register": "^7.0.0",
3031
"assets-webpack-plugin": "^3.9.7",
3132
"babel-eslint": "^10.0.1",
@@ -34,14 +35,17 @@
3435
"copy-webpack-plugin": "^5.0.0",
3536
"cross-env": "^5.2.0",
3637
"css-loader": "^3.0.0",
38+
"date-fns": "^1.30.1",
3739
"eslint": "^6.0.0",
3840
"eslint-plugin-import": "^2.14.0",
3941
"exports-loader": "^0.7.0",
4042
"fancy-log": "^1.3.2",
4143
"file-loader": "^4.0.0",
42-
"hugo-bin": "^0.37.0",
44+
"html-webpack-plugin": "^3.2.0",
45+
"hugo-bin": "^0.43.6",
4346
"imports-loader": "^0.8.0",
4447
"mini-css-extract-plugin": "^0.7.0",
48+
"netlify-cms-app": "^2.9.6",
4549
"node-sass": "^4.10.0",
4650
"npm-run-all": "^4.1.5",
4751
"optimize-css-assets-webpack-plugin": "^5.0.1",
@@ -52,15 +56,12 @@
5256
"rimraf": "^2.6.2",
5357
"sass-loader": "^7.1.0",
5458
"style-loader": "^0.23.1",
55-
"uglifyjs-webpack-plugin": "^2.0.1",
59+
"terser-webpack-plugin": "^1.3.0",
60+
"to-string-loader": "^1.1.5",
5661
"url-loader": "^2.0.0",
5762
"webpack": "^4.25.1",
5863
"webpack-cli": "^3.1.2",
5964
"webpack-dev-server": "^3.1.10",
60-
"webpack-merge": "^4.1.4",
61-
"whatwg-fetch": "^3.0.0"
62-
},
63-
"resolutions": {
64-
"natives": "1.1.6"
65+
"webpack-merge": "^4.1.4"
6566
}
6667
}

‎postcss.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ module.exports = {
44
"postcss-preset-env": {
55
browsers: "last 2 versions"
66
},
7+
"postcss-custom-media": {},
78
autoprefixer: {}
89
}
910
};

‎site/layouts/404.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{{ define "main" }}
22

33
<h1>Nothing Here...</h1>
4-
<h2 style="font-size: 120px; margin:0;">💩</h2>
54
<h3><a href="{{ "/" | relURL }}">Go Home</a></h3>
65

76
{{ end }}

‎site/static/admin/index.html renamed to ‎src/cms.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
66

77
<title>Content Manager</title>
8-
<!-- Include the stylesheets from your site here -->
98

109
<script src="https://identity-js.netlify.com/v1/netlify-identity-widget.js"></script>
1110
</head>
1211
<body>
13-
<script src="/cms.js"></script>
12+
<script src="<%= htmlWebpackPlugin.files.chunks.cms.entry %>"></script>
1413
</body>
1514
</html>

‎src/js/cms-preview-templates/post.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ export default class PostPreview extends React.Component {
99
return <div className="mw6 center ph3 pv4">
1010
<h1 className="f2 lh-title b mb3">{ entry.getIn(["data", "title"])}</h1>
1111
<div className="flex justify-between grey-3">
12-
<div style={{
13-
width: "80px",
14-
height: "80px"
15-
}}></div>
1612
<p>{ format(entry.getIn(["data", "date"]), "ddd, MMM D, YYYY") }</p>
1713
<p>Read in x minutes</p>
1814
</div>

‎src/js/cms.js

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,19 @@
11
import React from "react";
2-
import CMS from "netlify-cms";
2+
import CMS from "netlify-cms-app";
3+
4+
// Import main site styles as a string to inject into the CMS preview pane
5+
import styles from "!to-string-loader!css-loader!postcss-loader!sass-loader!../css/main.css";
36

47
import HomePreview from "./cms-preview-templates/home";
58
import PostPreview from "./cms-preview-templates/post";
69
import ProductsPreview from "./cms-preview-templates/products";
710
import ValuesPreview from "./cms-preview-templates/values";
811
import ContactPreview from "./cms-preview-templates/contact";
912

10-
11-
// Example of creating a custom color widget
12-
class ColorControl extends React.Component {
13-
render() {
14-
return <input
15-
style={{height: "80px"}}
16-
type="color"
17-
value={this.props.value}
18-
onInput={(e) => this.props.onChange(e.target.value)}
19-
/>;
20-
}
21-
}
22-
23-
CMS.registerPreviewStyle("/css/main.css");
13+
CMS.registerPreviewStyle(styles, { raw: true });
2414
CMS.registerPreviewTemplate("home", HomePreview);
2515
CMS.registerPreviewTemplate("post", PostPreview);
2616
CMS.registerPreviewTemplate("products", ProductsPreview);
2717
CMS.registerPreviewTemplate("values", ValuesPreview);
2818
CMS.registerPreviewTemplate("contact", ContactPreview);
29-
CMS.registerWidget("color", ColorControl);
19+
CMS.init();

‎webpack.common.js

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ const path = require("path");
33
const CopyWebpackPlugin = require("copy-webpack-plugin");
44
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
55
const AssetsPlugin = require("assets-webpack-plugin");
6+
const HtmlWebpackPlugin = require("html-webpack-plugin");
67

78
module.exports = {
89
entry: {
9-
main: path.join(__dirname, "src", "index.js")
10+
main: path.join(__dirname, "src", "index.js"),
11+
cms: path.join(__dirname, "src", "js", "cms.js"),
1012
},
1113

1214
output: {
@@ -19,16 +21,12 @@ module.exports = {
1921
test: /\.((png)|(eot)|(woff)|(woff2)|(ttf)|(svg)|(gif))(\?v=\d+\.\d+\.\d+)?$/,
2022
loader: "file-loader?name=/[hash].[ext]"
2123
},
22-
23-
{test: /\.json$/, loader: "json-loader"},
24-
2524
{
2625
loader: "babel-loader",
2726
test: /\.js?$/,
2827
exclude: /node_modules/,
2928
query: {cacheDirectory: true}
3029
},
31-
3230
{
3331
test: /\.(sa|sc|c)ss$/,
3432
exclude: /node_modules/,
@@ -38,22 +36,22 @@ module.exports = {
3836
},
3937

4038
plugins: [
41-
new webpack.ProvidePlugin({
42-
fetch: "imports-loader?this=>global!exports-loader?global.fetch!whatwg-fetch"
43-
}),
44-
4539
new AssetsPlugin({
4640
filename: "webpack.json",
4741
path: path.join(process.cwd(), "site/data"),
4842
prettyPrint: true
4943
}),
50-
5144
new CopyWebpackPlugin([
5245
{
5346
from: "./src/fonts/",
5447
to: "fonts/",
5548
flatten: true
5649
}
57-
])
50+
]),
51+
new HtmlWebpackPlugin({
52+
filename: 'admin/index.html',
53+
template: 'src/cms.html',
54+
inject: false,
55+
}),
5856
]
5957
};

‎webpack.prod.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const merge = require("webpack-merge");
2-
const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
2+
const TerserPlugin = require("terser-webpack-plugin");
33
const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin");
44
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
55

@@ -15,18 +15,17 @@ module.exports = merge(common, {
1515

1616
optimization: {
1717
minimizer: [
18-
new UglifyJsPlugin({
18+
new TerserPlugin({
1919
cache: true,
2020
parallel: true,
21-
sourceMap: true
21+
sourceMap: true,
22+
exclude: /\/node_modules\//,
2223
}),
23-
2424
new MiniCssExtractPlugin({
2525
filename: "[name].[hash:5].css",
2626
chunkFilename: "[id].[hash:5].css"
2727
}),
28-
29-
new OptimizeCSSAssetsPlugin({})
28+
new OptimizeCSSAssetsPlugin({}),
3029
]
3130
}
3231
});

0 commit comments

Comments
 (0)