Skip to content

Commit

Permalink
[removed] Don't need to disable Babel cache
Browse files Browse the repository at this point in the history
  • Loading branch information
Jimmy Jia committed Jun 25, 2015
1 parent 2a0b073 commit e89b9bc
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 40 deletions.
5 changes: 2 additions & 3 deletions docs/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,9 @@ function generateHTML(fileName) {
});
}

export default function BuildDocs({useCache, dev}) {
export default function BuildDocs({dev}) {
console.log('Building: '.cyan + 'docs'.green + (dev ? ' [DEV]'.grey : ''));

const useCacheOption = `--use-cache=${Boolean(useCache)}`;
const devOption = dev ? '' : '-p';

return exec(`rimraf ${docsBuilt}`)
Expand All @@ -46,7 +45,7 @@ export default function BuildDocs({useCache, dev}) {
let pagesGenerators = Root.getPages().map(generateHTML);

return Promise.all(pagesGenerators.concat([
exec(`webpack --config webpack.docs.js ${useCacheOption} --bail ${devOption}`),
exec(`webpack --config webpack.docs.js --bail ${devOption}`),
copy(license, docsBuilt),
copy(readmeSrc, readmeDest)
]));
Expand Down
6 changes: 0 additions & 6 deletions tools/build-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ const argv = yargs
demand: false,
default: false
})
.option('use-cache', {
type: 'boolean',
demand: false,
default: true,
describe: 'Use Babel cache when running webpack'
})
.option('lib-only', {
demand: false,
default: false,
Expand Down
11 changes: 5 additions & 6 deletions tools/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,21 @@ import { copy } from './fs-utils';
import { distRoot, bowerRoot } from './constants';
import { exec } from './exec';

function forkAndBuildDocs({verbose, useCache}) {
function forkAndBuildDocs({verbose}) {
console.log('Building: '.cyan + 'docs'.green);

const verboseOption = verbose ? '--verbose' : '';
const useCacheOption = `--use-cache=${Boolean(useCache)}`;

return exec(`npm run docs-build -- ${verboseOption} ${useCacheOption}`)
return exec(`npm run docs-build -- ${verboseOption}`)
.then(() => console.log('Built: '.cyan + 'docs'.green));
}

export default function Build({verbose, useCache} = {}) {
export default function Build(options) {
return Promise.all([
lib(),
bower(),
dist({useCache}),
forkAndBuildDocs({verbose, useCache})
dist(),
forkAndBuildDocs(options)
])
.then(() => copy(distRoot, bowerRoot));
}
8 changes: 3 additions & 5 deletions tools/dist/build.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import { exec } from '../exec';
import { distRoot } from '../constants';

export default function BuildDistributable({useCache}) {
export default function BuildDistributable() {
console.log('Building: '.cyan + 'distributable'.green);

const useCacheOption = `--use-cache=${Boolean(useCache)}`;

return exec(`rimraf ${distRoot}`)
.then(() => Promise.all([
exec(`webpack ${useCacheOption} --bail`),
exec(`webpack ${useCacheOption} --bail -p`)
exec(`webpack --bail`),
exec(`webpack --bail -p`)
]))
.then(() => console.log('Built: '.cyan + 'distributable'.green));
}
21 changes: 1 addition & 20 deletions webpack/base.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,13 @@ import yargs from 'yargs';
export const options = yargs
.alias('p', 'optimize-minimize')
.alias('d', 'debug')
.option('use-cache', {
type: 'boolean',
default: true
})
.option('port', {
default: '8080',
type: 'string'
})
.argv;

export let jsLoader = 'babel';
if (options.useCache) {
const babelCache = path.resolve(path.join(__dirname, '../.babel-cache'));

if (!fs.existsSync(babelCache)) {
try {
fs.mkdirSync(babelCache);
} catch (err) {
if (err.code !== 'EEXIST') {
console.error(err.stack);
}
}
}

jsLoader += `?cacheDirectory=${babelCache}`;
}
export const jsLoader = 'babel?cacheDirectory';

const baseConfig = {
entry: undefined,
Expand Down

0 comments on commit e89b9bc

Please sign in to comment.