Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build standalone to dist (closes #8)
- Loading branch information
tanem
committed
Dec 29, 2015
1 parent
1370878
commit 1fea6e1
Showing
11 changed files
with
144 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
coverage/ | ||
dist/ | ||
lib/ |
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,9 @@ | ||
{ | ||
"env": { | ||
"shelljs": true | ||
}, | ||
"rules": { | ||
"no-console": 0, | ||
"no-var": 0 | ||
} | ||
} |
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,39 @@ | ||
import 'shelljs/global'; | ||
config.fatal = true; | ||
|
||
import path from 'path'; | ||
import fs from 'fs'; | ||
import semver from 'semver'; | ||
import packageJSON from '../package.json'; | ||
|
||
const [ , , newVersion] = process.argv; | ||
const newSemver = getNewSemver(packageJSON.version, newVersion); | ||
|
||
exec('npm run test:local'); | ||
exec('npm run build'); | ||
|
||
writePackageJSONVersion(newSemver); | ||
|
||
exec('git add -A'); | ||
exec(`git commit -am "Release v${newSemver}"`); | ||
exec(`git tag v${newSemver}`); | ||
exec('git push'); | ||
exec('git push --tags'); | ||
|
||
function getNewSemver(currentVersion, newVersion) { | ||
let newSemver = semver.valid(newVersion); | ||
if (!newSemver) newSemver = semver.inc(currentVersion, newVersion); | ||
if (!newSemver) { | ||
echo('Invalid new version'); | ||
exit(1); | ||
} | ||
return newSemver; | ||
} | ||
|
||
function writePackageJSONVersion(newSemver) { | ||
packageJSON.version = newSemver; | ||
fs.writeFileSync( | ||
path.join(process.cwd(), 'package.json'), | ||
JSON.stringify(packageJSON, null, 2) | ||
); | ||
} |
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,12 @@ | ||
import webpack from 'webpack'; | ||
import WebpackDevServer from 'webpack-dev-server'; | ||
import config from '../webpack.config.dev'; | ||
|
||
const devServerConfig = config.devServer; | ||
const { port, hostname } = devServerConfig; | ||
|
||
new WebpackDevServer(webpack(config), devServerConfig) | ||
.listen(port, hostname, (err) => { | ||
if (err) console.log(err); | ||
console.log(`Listening at localhost:${port}`); | ||
}); |
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
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,22 @@ | ||
/*eslint no-var: 0*/ | ||
|
||
var webpack = require('webpack'); | ||
|
||
var config = Object.create(require('./webpack.config.umd')); | ||
|
||
config.output.filename = 'Salvager.min.js'; | ||
|
||
config.plugins = [ | ||
new webpack.optimize.OccurenceOrderPlugin(), | ||
new webpack.DefinePlugin({ | ||
'process.env.NODE_ENV': JSON.stringify('production') | ||
}), | ||
new webpack.optimize.UglifyJsPlugin({ | ||
compressor: { | ||
screw_ie8: true, | ||
warnings: false | ||
} | ||
}) | ||
]; | ||
|
||
module.exports = config; |
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,48 @@ | ||
/*eslint no-var: 0*/ | ||
|
||
var webpack = require('webpack'); | ||
|
||
module.exports = { | ||
|
||
entry: './src/Salvager.js', | ||
|
||
externals: { | ||
react: { | ||
root: 'React', | ||
commonjs: 'react', | ||
commonjs2: 'react', | ||
amd: 'react' | ||
}, | ||
'react-dom': { | ||
root: 'ReactDOM', | ||
commonjs: 'react-dom', | ||
commonjs2: 'react-dom', | ||
amd: 'react-dom' | ||
} | ||
}, | ||
|
||
module: { | ||
loaders: [ | ||
{ | ||
test: /\.js$/, | ||
loader: 'babel', | ||
exclude: /node_modules/ | ||
} | ||
] | ||
}, | ||
|
||
output: { | ||
library: 'Salvager', | ||
libraryTarget: 'umd', | ||
path: 'dist', | ||
filename: 'Salvager.js' | ||
}, | ||
|
||
plugins: [ | ||
new webpack.optimize.OccurenceOrderPlugin(), | ||
new webpack.DefinePlugin({ | ||
'process.env.NODE_ENV': JSON.stringify('development') | ||
}) | ||
] | ||
|
||
}; |