Merge pull request #52 from status-im/upgrade-node-packages

upgrade node packages, fix gulpfile.js
This commit is contained in:
Jacek Sieka 2020-03-24 09:43:31 +01:00 committed by GitHub
commit 2235bd8ed6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 2819 additions and 2947 deletions

View File

@ -1,6 +1,9 @@
# Nimbus Site # Nimbus Site
This repo hosts the code for both [nimbus.team](https://nimbus.team) on the `master` branch (which builds and serves through `gh-pages`), and [dev.nimbus.team](https://dev.nimbus.team) on the `develop` branch. This repo holds the code for two sites:
* [nimbus.team](https://nimbus.team) - From `master`, built in [CI](https://ci.status.im/job/misc/job/nimbus.team/), served from `gh-pages`
* [dev.nimbus.team](https://dev.nimbus.team) - From `develop`, built in [CI](https://ci.status.im/job/misc/job/dev.nimbus.team/), serverd from dev host
There is an `edit` button on each page, which will take you directly to the document you need to edit on the `develop` branch. We can then allow a large group of people to push directly to `develop` and show their changes on the staging site when asking for review, which should smooth out and speed up the process considerably for everyone. `master` is obviously protected, and will only have changes merged in from `develop` once accepted. There is an `edit` button on each page, which will take you directly to the document you need to edit on the `develop` branch. We can then allow a large group of people to push directly to `develop` and show their changes on the staging site when asking for review, which should smooth out and speed up the process considerably for everyone. `master` is obviously protected, and will only have changes merged in from `develop` once accepted.
@ -14,12 +17,11 @@ If you want to add a page, rather than just edit, you'll need to make sure it ap
## Testing locally ## Testing locally
Make sure you have node.js installed first. Make sure you have [Node.js](https://nodejs.org/) installed first.
1. Open Terminal and navigate to the project root directory, 1. Open Terminal and navigate to the project root directory,
1. Run `npm install`, 2. Run `yarn install`
1. Run `./node_modules/.bin/gulp build`, 3. Run `yarn devel`
1. In another terminal, run `./node_modules/.bin/hexo serve -p 8000`, 4. Open http://localhost:8000 in a browser
1. Open http://localhost:8000 in a browser.
This prevents the need for any global installs, and will allow you to have live reloading for any changes you are making. This prevents the need for any global installs, and will allow you to have live reloading for any changes you are making.

View File

@ -1,9 +1,10 @@
const log = require('fancy-log') const log = require('fancy-log')
const gulp = require('gulp') const gulp = require('gulp')
const sass = require('gulp-sass') const gulpSass = require('gulp-sass')
const rename = require("gulp-rename") const rename = require("gulp-rename")
const cleanCSS = require('gulp-clean-css') const cleanCSS = require('gulp-clean-css')
const rollup = require('gulp-better-rollup') const rollup = require('gulp-better-rollup')
const webserver = require('gulp-webserver')
const terser = require('rollup-plugin-terser').terser const terser = require('rollup-plugin-terser').terser
const browserSync = require('browser-sync').create() const browserSync = require('browser-sync').create()
const Hexo = require('hexo') const Hexo = require('hexo')
@ -15,7 +16,7 @@ const getEnv = function () {
return gitBranch() == 'master' ? 'prod' : 'dev' return gitBranch() == 'master' ? 'prod' : 'dev'
} }
gulp.task('generate', (cb) => { const generate = (done) => {
var hexo = new Hexo(process.cwd(), { var hexo = new Hexo(process.cwd(), {
config: `_config.${getEnv()}.yml`, config: `_config.${getEnv()}.yml`,
watch: false, watch: false,
@ -26,52 +27,48 @@ gulp.task('generate', (cb) => {
}).then(function() { }).then(function() {
return hexo.exit() return hexo.exit()
}).then(function() { }).then(function() {
return cb() return done()
}).catch(function(err) { }).catch(function(err) {
console.log(err) console.log(err)
hexo.exit(err) hexo.exit(err)
return cb(err) return done(err)
})
}) })
}
gulp.task('bundle', () => ( const bundle = () =>
gulp.src('js/main.js') gulp.src('js/main.js')
.on('error', log.error) .on('error', log.error)
.pipe(rollup({ plugins: [terser()] }, 'iife')) .pipe(rollup({ plugins: [terser()] }, 'iife'))
.pipe(rename("main.min.js")) .pipe(rename("main.min.js"))
.pipe(gulp.dest('public/js')) .pipe(gulp.dest('public/js'))
))
gulp.task('sass', () => (
const sass = () =>
gulp.src("./themes/navy/source/scss/main.scss") gulp.src("./themes/navy/source/scss/main.scss")
.on('error', log.error) .on('error', log.error)
.pipe(sass()) .pipe(gulpSass())
.pipe(gulp.dest('./public/css')) .pipe(gulp.dest('./public/css'))
.pipe(browserSync.stream()) .pipe(browserSync.stream())
))
gulp.task('css', ['sass'], () => ( const css = () =>
gulp.src('./public/css/main.css') gulp.src('./public/css/main.css')
.on('error', log.error) .on('error', log.error)
.pipe(cleanCSS()) .pipe(cleanCSS())
.pipe(rename("main.min.css")) .pipe(rename("main.min.css"))
.pipe(gulp.dest('./public/css/')) .pipe(gulp.dest('./public/css/'))
))
gulp.task('watch', () => ( const devel = () => {
gulp.watch('./themes/navy/source/scss/*.scss', ['css']) gulp.watch('./js/*.js', bundle)
)) gulp.watch(['./source/**/*.{md,yml}', './themes/navy/**/*'], generate)
gulp.watch('./themes/navy/source/scss/*.scss', sass, css)
}
gulp.task('exit', () => ( const server = () =>
process.exit(0) gulp.src('./public').pipe(webserver({livereload: true, open: true}));
))
gulp.task('build', () => ( exports.bundle = bundle
runSequence('generate', 'bundle', 'css', 'watch') exports.sass = sass
)) exports.css = gulp.series(sass, css)
exports.devel = gulp.parallel(server, devel)
gulp.task('run', () => ( exports.build = gulp.parallel(generate, bundle, exports.sass)
runSequence('generate', 'bundle', 'css') exports.default = exports.build
))
gulp.task('default', [])

View File

@ -3,43 +3,43 @@
"version": "0.0.0", "version": "0.0.0",
"private": true, "private": true,
"hexo": { "hexo": {
"version": "3.9.0" "version": "4.2.0"
}, },
"scripts": { "scripts": {
"clean": "rm -rf public/*", "clean": "rm -rf public/*",
"build": "gulp run", "build": "gulp build",
"devel": "gulp devel",
"eslint": "eslint .", "eslint": "eslint .",
"deploy": "hexo deploy" "deploy": "hexo deploy"
}, },
"devDependencies": { "devDependencies": {
"browser-sync": "^2.26.7", "browser-sync": "^2.26.7",
"cheerio": "^0.20.0", "cheerio": "^0.22.0",
"eslint": "^4.3.0", "eslint": "^6.8.0",
"eslint-config-hexo": "^2.0.0", "eslint-config-hexo": "^4.1.0",
"fancy-log": "^1.3.2", "fancy-log": "^1.3.3",
"gulp": "^3.9.1", "gulp": "^4.0.2",
"gulp-better-rollup": "^4.0.1", "gulp-better-rollup": "^4.0.1",
"gulp-clean-css": "^3.10.0", "gulp-clean-css": "^4.3.0",
"gulp-imagemin": "^4.1.0", "gulp-imagemin": "^7.1.0",
"gulp-rename": "^1.4.0", "gulp-rename": "^2.0.0",
"gulp-sass": "^4.0.1", "gulp-sass": "^4.0.2",
"hexo": "^3.7.1", "gulp-webserver": "^0.9.1",
"hexo-deployer-git": "^0.3.1", "hexo": "^4.2.0",
"hexo-generator-archive": "^0.1.4", "hexo-deployer-git": "^2.1.0",
"hexo-generator-feed": "^1.1.0", "hexo-generator-archive": "^1.0.0",
"hexo-generator-sitemap": "^1.1.2", "hexo-generator-feed": "^2.2.0",
"hexo-renderer-ejs": "^0.3.1", "hexo-generator-sitemap": "^2.0.0",
"hexo-renderer-jade": "^0.4.1", "hexo-renderer-ejs": "^1.0.0",
"hexo-renderer-marked": "^0.2.10", "hexo-renderer-marked": "^2.0.0",
"hexo-renderer-stylus": "^0.3.1", "hexo-renderer-stylus": "^1.1.0",
"hexo-server": "^0.2.0", "lodash": "^4.17.15",
"lodash": "^4.17.13", "lunr": "^2.3.8",
"lunr": "^2.1.2",
"rename": "^1.0.4", "rename": "^1.0.4",
"rollup": "^1.27.2", "rollup": "^2.1.0",
"rollup-plugin-terser": "^5.1.2", "rollup-plugin-terser": "^5.3.0",
"run-sequence": "^2.2.1", "run-sequence": "^2.2.1",
"watchify": "^3.11.0" "watchify": "^3.11.1"
}, },
"dependencies": { "dependencies": {
"date-fns": "^2.7.0" "date-fns": "^2.7.0"

View File

@ -40,4 +40,3 @@
statusLink: "" statusLink: ""
statusName: "" statusName: ""
gitHubLink: "https://github.com/kdeme" gitHubLink: "https://github.com/kdeme"

5648
yarn.lock

File diff suppressed because it is too large Load Diff