mirror of
https://github.com/benjaminion/upgrading-ethereum-book.git
synced 2026-01-09 14:38:08 -05:00
Simplify prebuild check workflow
This commit is contained in:
@@ -1,16 +0,0 @@
|
||||
// Run the pre-build script standalone to check for issues without doiing a full build
|
||||
|
||||
const doPreBuild = require('./prebuild')
|
||||
|
||||
const reporter = {
|
||||
// Cheat sheets for colours:
|
||||
// - https://tintin.mudhalla.net/info/xterm/
|
||||
// - https://tintin.mudhalla.net/info/256color/
|
||||
|
||||
info: function (m) { console.log('\x1b[38;5;19m%s\x1b[0m %s', 'info', m) },
|
||||
warn: function (m) { console.log('\x1b[38;5;130m%s\x1b[0m %s', 'warn', m) },
|
||||
error: function (m) { console.log('\x1b[38;5;160m%s\x1b[0m %s', 'error', m) },
|
||||
success: function (m) { console.log('\x1b[38;5;34m%s\x1b[0m %s', 'success', m) },
|
||||
}
|
||||
|
||||
doPreBuild(reporter)
|
||||
@@ -17,7 +17,17 @@ const doSplitLint = true
|
||||
const sourceMarkdown = 'src/book.md'
|
||||
const splitMarkdown = glob.sync('src/md/**/*.md', {'ignore': 'src/md/annotated.md'})
|
||||
|
||||
module.exports = (reporter) => {
|
||||
module.exports.runChecks = (reporter) => {
|
||||
|
||||
if (!reporter) {
|
||||
reporter = {
|
||||
// https://tintin.mudhalla.net/info/xterm/
|
||||
// https://tintin.mudhalla.net/info/256color/
|
||||
info: function (m) { console.log('\x1b[38;5;19m%s\x1b[0m %s', 'info', m) },
|
||||
warn: function (m) { console.log('\x1b[38;5;130m%s\x1b[0m %s', 'warn', m) },
|
||||
error: function (m) { console.log('\x1b[38;5;160m%s\x1b[0m %s', 'error', m) },
|
||||
}
|
||||
}
|
||||
|
||||
var sourceLintSucceeded = true
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
const path = require('path')
|
||||
const doPreBuild = require('./bin/build/prebuild')
|
||||
const prebuild = require('./bin/build/prebuild')
|
||||
|
||||
// Set up a hook to pre-process the source file into split files, and perform various
|
||||
// checking and linting operations prior to building.
|
||||
exports.onPreInit = ({ reporter }) => {
|
||||
try {
|
||||
doPreBuild(reporter)
|
||||
prebuild.runChecks(reporter)
|
||||
} catch (err) {
|
||||
reporter.panicOnBuild('Could not run pre-build tasks,', err)
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
"build": "gatsby build --prefix-paths",
|
||||
"serve": "gatsby serve --prefix-paths",
|
||||
"clean": "gatsby clean",
|
||||
"check": "node ./bin/build/check.js"
|
||||
"check": "node -e 'require(\"./bin/build/prebuild\").runChecks()'"
|
||||
},
|
||||
"dependencies": {
|
||||
"gatsby": "^4.17.0",
|
||||
|
||||
Reference in New Issue
Block a user