-
-
Notifications
You must be signed in to change notification settings - Fork 486
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make the .bootstraprc location customizable
- Loading branch information
Andrew Ralston
committed
Jul 29, 2016
1 parent
5c51234
commit 179d492
Showing
28 changed files
with
214 additions
and
201 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file was deleted.
Oops, something went wrong.
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
'use strict'; | ||
const fs = require('fs'); | ||
|
||
function getBootstraprcCustomLocation() { | ||
const matchedArgument = process.argv.find(val => val.includes('--bootstraprc-location')); | ||
return matchedArgument && matchedArgument.split('=')[1]; | ||
} | ||
|
||
const bootstraprcCustomLocation = getBootstraprcCustomLocation(); | ||
|
||
let defaultBootstraprcFileExists; | ||
|
||
try { | ||
fs.statSync('./.bootstraprc'); | ||
defaultBootstraprcFileExists = true; | ||
} catch (e) { | ||
defaultBootstraprcFileExists = false; | ||
} | ||
|
||
if (!bootstraprcCustomLocation && !defaultBootstraprcFileExists) { | ||
throw new Error('This script requires a \'bootstraprc-location\' arg or a ./.boostraprc file in the root.'); | ||
} | ||
|
||
// DEV and PROD have slightly different configurations | ||
let bootstrapDevEntryPoint; | ||
if (bootstraprcCustomLocation) { | ||
bootstrapDevEntryPoint = 'bootstrap-loader/lib/bootstrap.loader?' + | ||
`configFilePath=${__dirname}/${bootstraprcCustomLocation}` + | ||
'!bootstrap-loader/no-op.js'; | ||
} else { | ||
bootstrapDevEntryPoint = 'bootstrap-loader'; | ||
} | ||
|
||
let bootstrapProdEntryPoint; | ||
if (bootstraprcCustomLocation) { | ||
bootstrapProdEntryPoint = 'bootstrap-loader/lib/bootstrap.loader?extractStyles' + | ||
`&configFilePath=${__dirname}/${bootstraprcCustomLocation}` + | ||
'!bootstrap-loader/no-op.js'; | ||
} else { | ||
bootstrapProdEntryPoint = 'bootstrap-loader/extractStyles'; | ||
} | ||
|
||
module.exports = { | ||
dev: bootstrapDevEntryPoint, | ||
prod: bootstrapProdEntryPoint, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/sh | ||
|
||
echo "Running JS tests in node" | ||
$(npm bin)/babel-tape-runner node_package/tests/*.js | $(npm bin)/tap-spec | ||
# $(npm bin)/babel-tape-runner node_package/tests/*.js | $(npm bin)/faucet | ||
|
||
# If we want to run tests in the browser | ||
# echo "Running JS tests in browser" | ||
# $(npm bin)/browserify -t babelify node_package/tests/*.js | tape-run | $(npm bin)/faucet | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import test from 'tape'; | ||
import { userConfigFileExists } from '../../src/bootstrap.config.js'; | ||
|
||
test('userConfigFileExists returns true for files that exist', (assert) => { | ||
const result = userConfigFileExists(`${__dirname}/configCreation.test.js`); | ||
|
||
assert.plan(1); | ||
assert.equal(result, true); | ||
assert.end(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.