Skip to content

Commit

Permalink
centralize
Browse files Browse the repository at this point in the history
  • Loading branch information
endiliey committed May 17, 2019
1 parent 817ac6e commit 5f3d3cb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
13 changes: 5 additions & 8 deletions packages/docusaurus-1.x/lib/server/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
*/

async function execute() {
const commander = require('commander');
commander
.option('--skip-image-compression')
.option('--skip-next-release')
.parse(process.argv);
require('../write-translations.js');
const metadataUtils = require('./metadataUtils');
const blog = require('./blog');
Expand All @@ -30,20 +35,12 @@ async function execute() {
const sep = path.sep;
const escapeStringRegexp = require('escape-string-regexp');
const {renderToStaticMarkupWithDoctype} = require('./renderUtils');
const commander = require('commander');
const imagemin = require('imagemin');
const imageminJpegtran = require('imagemin-jpegtran');
const imageminOptipng = require('imagemin-optipng');
const imageminSvgo = require('imagemin-svgo');
const imageminGifsicle = require('imagemin-gifsicle');

commander
.option('--skip-image-compression')
.option('--skip-next-release')
.parse(process.argv);

process.env.SKIP_NEXT_RELEASE = commander.skipNextRelease;

// create the folder path for a file if it does not exist, then write the file
function writeFileAndCreateFolder(file, content) {
mkdirp.sync(path.dirname(file));
Expand Down
3 changes: 2 additions & 1 deletion packages/docusaurus-1.x/lib/server/readMetadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const CWD = process.cwd();
const path = require('path');
const fs = require('fs');
const glob = require('glob');
const program = require('commander');

const metadataUtils = require('./metadataUtils');

Expand Down Expand Up @@ -55,7 +56,7 @@ function getDocsPath() {
}

function shouldGenerateNextReleaseDocs() {
return !(env.versioning.enabled && process.env.SKIP_NEXT_RELEASE);
return !(env.versioning.enabled && program.skipNextRelease);
}

// returns map from id to object containing sidebar ordering info
Expand Down

0 comments on commit 5f3d3cb

Please sign in to comment.