Skip to content
This repository has been archived by the owner on Jan 20, 2025. It is now read-only.

Pass command flags #25

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const cp = require(`child_process`)
const log = require(`loglevel`)
const path = require(`path`)
const { env } = require('process')
const { ProcessorQueue } = require(`./processor-queue`)
const {
GoogleFunctions,
Expand All @@ -21,7 +22,7 @@ const MESSAGE_TYPES = {
}

function messageHandler(gatsbyProcess, processors = {}) {
return async function(msg) {
return async function (msg) {
if (
log.getLevel() <= log.levels.TRACE &&
msg.type !== MESSAGE_TYPES.LOG_ACTION
Expand Down Expand Up @@ -65,7 +66,7 @@ function messageHandler(gatsbyProcess, processors = {}) {
}
}

exports.build = async function(cmd = `node_modules/.bin/gatsby build`) {
exports.build = async function (cmd = `node_modules/.bin/gatsby build`) {
log.setLevel(process.env.PARALLEL_RUNNER_LOG_LEVEL || `warn`)

process.env.ENABLE_GATSBY_EXTERNAL_JOBS = true
Expand All @@ -86,7 +87,7 @@ exports.build = async function(cmd = `node_modules/.bin/gatsby build`) {
)

const [bin, ...args] = cmd.split(` `)
const gatsbyProcess = cp.fork(path.join(process.cwd(), bin), args)
const gatsbyProcess = cp.fork(path.join(process.cwd(), bin), args.concat(process.argv.slice(2)), env)
gatsbyProcess.on(`exit`, async code => {
log.debug(`Gatsby existed with`, code)
process.exit(code)
Expand Down