Commit ccf821ae authored by Tim Neutkens's avatar Tim Neutkens

Add option to pass buildId

parent c6c64b4f
...@@ -318,9 +318,9 @@ function rewriteFileName(Bundle, buildId) { ...@@ -318,9 +318,9 @@ function rewriteFileName(Bundle, buildId) {
} }
} }
module.exports = async function build({dir, conf, entrypoint}) { module.exports = async function build({dir, conf, entrypoint, buildid: passedBuildId}) {
const config = loadConfig(PHASE_PRODUCTION_BUILD, dir, conf) const config = loadConfig(PHASE_PRODUCTION_BUILD, dir, conf)
const buildId = await config.generateBuildId().trim() // defaults to a uuid const buildId = passedBuildId || await config.generateBuildId().trim() // defaults to a uuid
const distDir = path.join(dir, config.distDir) const distDir = path.join(dir, config.distDir)
try { try {
......
...@@ -11,7 +11,7 @@ const argv = parseArgs(process.argv.slice(2), { ...@@ -11,7 +11,7 @@ const argv = parseArgs(process.argv.slice(2), {
h: 'help' h: 'help'
}, },
boolean: ['h'], boolean: ['h'],
string: ['entrypoint'] string: ['entrypoint', 'buildid']
}) })
if (argv.help) { if (argv.help) {
...@@ -31,6 +31,7 @@ if (argv.help) { ...@@ -31,6 +31,7 @@ if (argv.help) {
const dir = resolve(argv._[0] || '.') const dir = resolve(argv._[0] || '.')
const entrypoint = argv.entrypoint const entrypoint = argv.entrypoint
const buildid = argv.buildid
// Check if pages dir exists and warn if not // Check if pages dir exists and warn if not
if (!existsSync(dir)) { if (!existsSync(dir)) {
...@@ -45,7 +46,7 @@ if (!existsSync(join(dir, 'pages'))) { ...@@ -45,7 +46,7 @@ if (!existsSync(join(dir, 'pages'))) {
printAndExit('> Couldn\'t find a `pages` directory. Please create one under the project root') printAndExit('> Couldn\'t find a `pages` directory. Please create one under the project root')
} }
build({dir, entrypoint}) build({dir, entrypoint, entrypoint})
.catch((err) => { .catch((err) => {
printAndExit(err) printAndExit(err)
}) })
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment