Skip to content

Commit f966ed0

Browse files
committed
chore: update dependencies
hugo to 0.55.6
1 parent 4b14c4b commit f966ed0

10 files changed

+7389
-5888
lines changed

.babelrc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
2-
"presets": ["es2015"],
3-
"plugins": [
4-
"syntax-object-rest-spread",
5-
"transform-object-rest-spread"
6-
]
2+
"presets": [
3+
"@babel/preset-env"
4+
],
5+
"plugins": []
76
}

bin/hugo_0.26_darwin_amd64

-12.8 MB
Binary file not shown.

bin/hugo_0.26_linux_amd64

-11.7 MB
Binary file not shown.

bin/hugo_0.26_windows_amd64.exe

-11.8 MB
Binary file not shown.

bin/hugo_0.55.6_darwin_amd64

24.7 MB
Binary file not shown.

bin/hugo_0.55.6_linux_amd64

22.2 MB
Binary file not shown.

bin/hugo_0.55.6_windows_amd64.exe

22.2 MB
Binary file not shown.

gulpfile.babel.js

Lines changed: 77 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,89 @@
1-
import gulp from "gulp";
1+
import babel from "gulp-babel";
2+
import BrowserSync from "browser-sync";
23
import cp from "child_process";
3-
import gutil from "gulp-util";
4-
import postcss from "gulp-postcss";
54
import cssImport from "postcss-import";
6-
import cssnext from "postcss-cssnext";
7-
import BrowserSync from "browser-sync";
8-
import webpack from "webpack";
9-
import webpackConfig from "./webpack.conf";
10-
import inquirer from "inquirer";
11-
import toml from "tomljs";
5+
import cssnext from "postcss-preset-env";
6+
import del from "del";
127
import fs from "fs";
13-
import path from "path";
8+
import gulp from "gulp";
9+
import inquirer from "inquirer";
1410
import kebabCase from "lodash.kebabcase";
11+
import path from "path";
12+
import postcss from "gulp-postcss";
13+
import toml from "tomljs";
1514
import tomlify from "tomlify-j0.4";
1615

1716
const browserSync = BrowserSync.create();
1817
const platform = getPlatform(process.platform);
19-
const hugoBin = `./bin/hugo_0.26_${platform}_amd64${platform === "windows" ? ".exe" : ""}`;
18+
const hugoBin = `./bin/hugo_0.55.6_${platform}_amd64${platform === "windows" ? ".exe" : ""}`;
2019
const defaultArgs = ["-s", "site", "-v"];
2120
const buildArgs = ["-d", "../dist"];
2221

23-
gulp.task("hugo", (cb) => buildSite(cb));
24-
gulp.task("hugo-preview", (cb) => buildSite(cb, ["--buildDrafts", "--buildFuture"]));
25-
26-
gulp.task("build", ["css", "js", "hugo"]);
27-
gulp.task("build-preview", ["css", "js", "hugo-preview"]);
28-
29-
gulp.task("css", () => (
30-
gulp.src("./src/css/*.css")
31-
.pipe(postcss([cssnext(), cssImport({from: "./src/css/main.css"})]))
32-
.pipe(gulp.dest("./dist/css"))
33-
.pipe(browserSync.stream())
34-
));
35-
36-
gulp.task("js", (cb) => {
37-
const myConfig = Object.assign({}, webpackConfig);
38-
39-
webpack(myConfig, (err, stats) => {
40-
if (err) throw new gutil.PluginError("webpack", err);
41-
gutil.log("[webpack]", stats.toString({
42-
colors: true,
43-
progress: true
44-
}));
45-
browserSync.reload();
46-
cb();
22+
function getPlatform(platform) {
23+
switch (platform) {
24+
case "win32":
25+
case "win64": {
26+
return "windows";
27+
}
28+
default: {
29+
return platform;
30+
}
31+
}
32+
}
33+
34+
function generateFrontMatter(frontMatter, answers) {
35+
return `+++
36+
${tomlify.toToml(frontMatter, null, 2)}
37+
+++
38+
${answers.description}`;
39+
}
40+
41+
const hugo = (done, options) => {
42+
cp.spawn(hugoBin, ["version"], {
43+
stdio: "inherit"
4744
});
48-
});
4945

50-
gulp.task("server", ["hugo", "css", "js"], () => {
46+
let args = options ? defaultArgs.concat(options) : defaultArgs;
47+
args = args.concat(buildArgs);
48+
49+
// cp needs to be in site directory
50+
cp.spawn(hugoBin, args, {
51+
stdio: "inherit"
52+
}).on("close", (code) => {
53+
if (code === 0) {
54+
browserSync.reload();
55+
done();
56+
} else {
57+
browserSync.notify("Hugo build failed :(");
58+
done("Hugo build failed");
59+
}
60+
});
61+
62+
return done;
63+
};
64+
65+
export const css = () => gulp.src("./src/css/**/*.css")
66+
.pipe(postcss([cssnext(), cssImport({
67+
from: "./src/css/main.css"
68+
})]))
69+
.pipe(gulp.dest("./dist/css"));
70+
71+
export const js = () => gulp.src("./src/js/*.js")
72+
.pipe(babel())
73+
.pipe(gulp.dest("./dist/js"));
74+
75+
export const server = gulp.series(gulp.parallel(css, js), hugo, () => {
5176
browserSync.init({
5277
server: {
5378
baseDir: "./dist"
5479
}
5580
});
56-
gulp.watch("./src/js/**/*.js", ["js"]);
57-
gulp.watch("./src/css/**/*.css", ["css"]);
58-
gulp.watch("./site/**/*", ["hugo"]);
81+
gulp.watch("./src/js/**/*.js", js);
82+
gulp.watch("./src/css/**/*.css", css);
83+
gulp.watch("./site/**/*", hugo);
5984
});
6085

61-
gulp.task("new-incident", (cb) => {
86+
export const newIncident = (done) => {
6287
const file = fs.readFileSync("site/config.toml").toString();
6388
const config = toml(file);
6489

@@ -105,7 +130,9 @@ gulp.task("new-incident", (cb) => {
105130
let args = ["new", `incidents${path.sep}${kebabCase(answers.name)}.md`];
106131
args = args.concat(defaultArgs);
107132

108-
const hugo = cp.spawn(hugoBin, args, {stdio: "pipe"});
133+
const hugo = cp.spawn(hugoBin, args, {
134+
stdio: "pipe"
135+
});
109136
hugo.stdout.on("data", (data) => {
110137
const message = data.toString();
111138

@@ -151,45 +178,16 @@ gulp.task("new-incident", (cb) => {
151178

152179
hugo.on("close", (code) => {
153180
if (code === 0) {
154-
cb();
181+
done();
155182
} else {
156-
cb("new incident creation failed");
183+
done("new incident creation failed");
157184
}
158185
});
159186
});
160-
});
161-
162-
function getPlatform(platform) {
163-
switch (platform) {
164-
case "win32":
165-
case "win64": {
166-
return "windows";
167-
}
168-
default: {
169-
return platform;
170-
}
171-
}
172-
}
173-
174-
function generateFrontMatter(frontMatter, answers) {
175-
return `+++
176-
${tomlify(frontMatter, null, 2)}
177-
+++
178-
${answers.description}`;
179-
}
187+
};
180188

181-
function buildSite(cb, options) {
182-
let args = options ? defaultArgs.concat(options) : defaultArgs;
183-
args = args.concat(buildArgs);
184-
185-
// cp needs to be in site directory
186-
return cp.spawn(hugoBin, args, {stdio: "inherit"}).on("close", (code) => {
187-
if (code === 0) {
188-
browserSync.reload();
189-
cb();
190-
} else {
191-
browserSync.notify("Hugo build failed :(");
192-
cb("Hugo build failed");
193-
}
194-
});
195-
}
189+
export const clean = (done) => del(["dist"], done);
190+
export const hugoPreview = (done) => hugo(done, ["--buildDrafts", "--buildFuture"]);
191+
export const build = gulp.series(clean, gulp.parallel(css, js), hugo);
192+
export const buildPreview = gulp.series(clean, gulp.parallel(css, js), hugoPreview);
193+
export default hugo;

0 commit comments

Comments
 (0)