Skip to content

Commit

Permalink
V1.0.1 (#21)
Browse files Browse the repository at this point in the history
* paths are all now within `constants/paths`
* Fix email signup in redux example
* Fix deploy to firebase errors
* Build folders removed from `gitignore`
* New project dialog fixed in redux example
* Empty user image being copied correctly (not templated)
  • Loading branch information
prescottprue authored Nov 4, 2016
1 parent 1a84100 commit a3afaab
Show file tree
Hide file tree
Showing 96 changed files with 1,888 additions and 503 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
node_modules
example/node_modules
**/node_modules/**
coverage
npm-debug.log
.DS_Store
**/.DS_Store
**/build/**
6 changes: 6 additions & 0 deletions examples/react-firebase-redux/.firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"projects": {
"stage": "redux-firebasev3",
"prod": "redux-firebasev3"
}
}
21 changes: 21 additions & 0 deletions examples/react-firebase-redux/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2015 David Zukowski

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
10 changes: 5 additions & 5 deletions examples/react-firebase-redux/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,12 @@ Build code before deployment by running `npm run build`. There are multiple opti

[npm-image]: https://img.shields.io/npm/v/react-firebase-redux.svg?style=flat-square
[npm-url]: https://npmjs.org/package/react-firebase-redux
[travis-image]: https://img.shields.io/travis/testuser/react-firebase-redux/master.svg?style=flat-square
[travis-url]: https://travis-ci.org/testuser/react-firebase-redux
[daviddm-image]: https://img.shields.io/david/testuser/react-firebase-redux.svg?style=flat-square
[daviddm-url]: https://david-dm.org/testuser/react-firebase-redux
[travis-image]: https://img.shields.io/travis/prescottprue/react-firebase-redux/master.svg?style=flat-square
[travis-url]: https://travis-ci.org/prescottprue/react-firebase-redux
[daviddm-image]: https://img.shields.io/david/prescottprue/react-firebase-redux.svg?style=flat-square
[daviddm-url]: https://david-dm.org/prescottprue/react-firebase-redux

[license-image]: https://img.shields.io/npm/l/react-firebase-redux.svg?style=flat-square
[license-url]: https://github.com/testuser/react-firebase-redux/blob/master/LICENSE
[license-url]: https://github.com/prescottprue/react-firebase-redux/blob/master/LICENSE
[code-style-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square
[code-style-url]: http://standardjs.com/
35 changes: 35 additions & 0 deletions examples/react-firebase-redux/build/create-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
const debug = require('debug')('app:build:config')
const fs = require('fs')
const path = require('path')
const pkg = require('../package.json')
const outputPath = path.join(__dirname, '..', 'src/config.js')

const createConfigFile = (cb) => {
const configObj = {
version: pkg.version,
env: 'dev'
}

if (process.env.TRAVIS_PULL_REQUEST === false) {
if (process.env.TRAVIS_BRANCH === 'prod') {
configObj.env = 'prod'
}
}

const fileString = `export default ${JSON.stringify(configObj, null, 2)}`

fs.writeFile(outputPath, fileString, 'utf8', (err) => {
if (err) {
debug('Error writing config file:', err)
if (cb) cb(err, null)
return
}
if (cb) cb()
})
}

(function () {
createConfigFile(() => {
debug('Config file successfully written to src/config.js')
})
})()
53 changes: 53 additions & 0 deletions examples/react-firebase-redux/build/deploy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
const _debug = require('debug') // eslint-disable-line no-underscore-dangle
const exec = require('child_process').exec
const {
TRAVIS_BRANCH,
TRAVIS_PULL_REQUEST,
FIREBASE_TOKEN
} = process.env
const debug = _debug('app:build:deploy')

const deployToFirebase = (cb) => {
debug('Travis Variables:', { TRAVIS_PULL_REQUEST, TRAVIS_BRANCH })
if (!!TRAVIS_PULL_REQUEST && TRAVIS_PULL_REQUEST !== 'false') {
debug('Skipping Firebase Deploy - Build is a Pull Request')
return
}

if (TRAVIS_BRANCH !== 'prod' && TRAVIS_BRANCH !== 'stage' && TRAVIS_BRANCH !== 'master') {
debug('Skipping Firebase Deploy - Build is a not a Build Branch', TRAVIS_BRANCH)
return
}

if (!FIREBASE_TOKEN) {
debug('Error: FIREBASE_TOKEN env variable not found')
cb('Error: FIREBASE_TOKEN env variable not found', null)
return
}

debug('Deploying to Firebase...')

exec(`firebase deploy --token ${FIREBASE_TOKEN}`, (error, stdout) => {
if (error !== null) {
if (cb) {
cb(error, null)
console.log('error deploying', error)
return
}
}
if (cb) {
cb(null, stdout)
}
})
}

(function () {
deployToFirebase((err, stdout) => {
if (err || !stdout) {
debug('error deploying to Firebase: ', err)
return
}
debug(stdout) // log output of firebase cli
debug('\nSuccessfully deployed to Firebase')
})
})()
72 changes: 72 additions & 0 deletions examples/react-firebase-redux/build/karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
const argv = require('yargs').argv
const config = require('../config')
const webpackConfig = require('./webpack.config')
const debug = require('debug')('app:karma')

debug('Creating configuration.')
const karmaConfig = {
basePath : '../', // project root in relation to bin/karma.js
files : [
{
pattern : `./${config.dir_test}/test-bundler.js`,
watched : false,
served : true,
included : true
}
],
singleRun : !argv.watch,
frameworks : ['mocha'],
reporters : ['mocha'],
preprocessors : {
[`${config.dir_test}/test-bundler.js`] : ['webpack']
},
browsers : ['PhantomJS'],
webpack : {
devtool : 'cheap-module-source-map',
resolve : Object.assign({}, webpackConfig.resolve, {
alias : Object.assign({}, webpackConfig.resolve.alias, {
sinon : 'sinon/pkg/sinon.js'
})
}),
plugins : webpackConfig.plugins,
module : {
noParse : [
/\/sinon\.js/
],
loaders : webpackConfig.module.loaders.concat([
{
test : /sinon(\\|\/)pkg(\\|\/)sinon\.js/,
loader : 'imports?define=>false,require=>false'
}
])
},
// Enzyme fix, see:
// https://github.com/airbnb/enzyme/issues/47
externals : Object.assign({}, webpackConfig.externals, {
'react/addons' : true,
'react/lib/ExecutionEnvironment' : true,
'react/lib/ReactContext' : 'window'
}),
sassLoader : webpackConfig.sassLoader
},
webpackMiddleware : {
noInfo : true
},
coverageReporter : {
reporters : config.coverage_reporters
}
}

if (config.globals.__COVERAGE__) {
karmaConfig.reporters.push('coverage')
karmaConfig.webpack.module.preLoaders = [{
test : /\.(js|jsx)$/,
include : new RegExp(config.dir_client),
loader : 'babel',
query : Object.assign({}, config.compiler_babel, {
plugins : (config.compiler_babel.plugins || []).concat('istanbul')
})
}]
}

module.exports = (cfg) => cfg.set(karmaConfig)
36 changes: 36 additions & 0 deletions examples/react-firebase-redux/build/webpack-compiler.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
const webpack = require('webpack')
const debug = require('debug')('app:build:webpack-compiler')
const config = require('../config')

function webpackCompiler (webpackConfig, statsFormat) {
statsFormat = statsFormat || config.compiler_stats

return new Promise((resolve, reject) => {
const compiler = webpack(webpackConfig)

compiler.run((err, stats) => {
if (err) {
debug('Webpack compiler encountered a fatal error.', err)
return reject(err)
}

const jsonStats = stats.toJson()
debug('Webpack compile completed.')
debug(stats.toString(statsFormat))

if (jsonStats.errors.length > 0) {
debug('Webpack compiler encountered errors.')
debug(jsonStats.errors.join('\n'))
return reject(new Error('Webpack compiler encountered errors'))
} else if (jsonStats.warnings.length > 0) {
debug('Webpack compiler encountered warnings.')
debug(jsonStats.warnings.join('\n'))
} else {
debug('No errors or warnings encountered.')
}
resolve(jsonStats)
})
})
}

module.exports = webpackCompiler
Loading

0 comments on commit a3afaab

Please sign in to comment.