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
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.
@ -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
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. Run `npm install`,
1. Run `./node_modules/.bin/gulp build`,
1. In another terminal, run `./node_modules/.bin/hexo serve -p 8000`,
1. Open http://localhost:8000 in a browser.
2. Run `yarn install`
3. Run `yarn devel`
4. 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.

View File

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

View File

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

View File

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

5648
yarn.lock

File diff suppressed because it is too large Load Diff