Skip to content

Commit

Permalink
When installed globally, use compiled version of code. When installed…
Browse files Browse the repository at this point in the history
… locally, use the babelscript version
  • Loading branch information
KyleAMathews committed Dec 20, 2015
1 parent a8056dd commit f6a9c09
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ node_modules
examples/biz-website/public/
examples/blog/public/
*.un~
build
dist
8 changes: 7 additions & 1 deletion bin/build.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@ program = require 'commander'
path = require 'path'

packageJson = require '../package.json'
build = require '../lib/utils/build'

# Use compiled version of code when installed globally, otherwise use
# babelscript version.
if !!process.env.npm_config_global
build = require '../dist/utils/build'
else
build = require '../lib/utils/build'

program
.version(packageJson.version)
Expand Down
8 changes: 7 additions & 1 deletion bin/develop.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@ program = require 'commander'
path = require 'path'

packageJson = require '../package.json'
develop = require '../lib/utils/develop'

# Use compiled version of code when installed globally, otherwise use
# babelscript version.
if !!process.env.npm_config_global
develop = require '../dist/utils/develop'
else
develop = require '../lib/utils/develop'

program
.version(packageJson.version)
Expand Down
8 changes: 7 additions & 1 deletion bin/new.coffee
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
program = require 'commander'
initStarter = require '../lib/utils/init-starter'
loggy = require 'loggy'

packageJson = require '../package.json'

# Use compiled version of code when installed globally, otherwise use
# babelscript version.
if !!process.env.npm_config_global
initStarter = require '../dist/utils/init-starter'
else
initStarter = require '../lib/utils/init-starter'

program
.version(packageJson.version)
.parse(process.argv)
Expand Down
7 changes: 6 additions & 1 deletion lib/utils/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ import webpack from 'webpack'
import StaticSiteGeneratorPlugin from 'static-site-generator-webpack-plugin'
import Config from 'webpack-configurator'

const gatsbyLib = /(gatsby.lib)/i
let gatsbyLib = /(gatsby.lib)/i
// If installed globally, look for "dist" directory instead.
if (!!process.env.npm_config_global) {
gatsbyLib = /(gatsby.dist)/i
}

const libDirs = /(node_modules|bower_components)/i
const babelExcludeTest = (absPath) => {
let result = false
Expand Down
2 changes: 1 addition & 1 deletion scripts/build.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
node_modules/.bin/babel lib/ --out-dir build
node_modules/.bin/babel lib/ --out-dir dist

0 comments on commit f6a9c09

Please sign in to comment.