Skip to content
This repository has been archived by the owner on Apr 25, 2021. It is now read-only.

Commit

Permalink
Merge pull request #33 from AlecAivazis/new-build
Browse files Browse the repository at this point in the history
New build artifacts
  • Loading branch information
AlecAivazis authored Jul 16, 2016
2 parents 27befb0 + 5b64361 commit 47b4d88
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 60 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
coverage/
build
index.js
/react.js
9 changes: 9 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.gitignore
.travis.yml
gulpfile.babel.js
package.json
config/
coverage/
node_modules/
src/
tests/
3 changes: 2 additions & 1 deletion config/projectPaths.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ module.exports = {
rootDir: rute,
sourceDir: sourceDir,
testsDir: testsDir,
buildDir: buildDir,
buildDir: rute,
// entry points
entry: path.join(sourceDir, 'index.js'),
reactEntry: path.join(sourceDir, 'react.js'),
// globs
testsGlob: path.join(testsDir, 'test_*.js'),
// configuration files
Expand Down
62 changes: 16 additions & 46 deletions gulpfile.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,55 +10,26 @@ import projectPaths from './config/projectPaths'


/**
* Build entry point.
* Build entry points.
*/
gulp.task('build', ['clean'], () => {
return gulp.src(projectPaths.entry)
.pipe(named())
.pipe(webpack(require(projectPaths.webpackConfig)))
.pipe(gulp.dest(projectPaths.buildDir))
})


/**
* Watch entry point.
*/
gulp.task('watch', ['clean'], () => {
const config = {
...require(projectPaths.webpackConfig),
watch: true,
}
gulp.task('build', ['build:core', 'build:react'])
gulp.task('build:prod', ['production', 'build'])

return gulp.src(projectPaths.entry)
.pipe(named())
.pipe(webpack(config))
.pipe(gulp.dest(projectPaths.buildDir))
})
gulp.task('build:core', () => buildFile(projectPaths.entry, 'index'))
gulp.task('build:react', () => buildFile(projectPaths.reactEntry, 'react'))


/**
* Build entry point for production.
* Sets the current chain of tasks to 'production mode'.
*/
gulp.task('build-production', ['clean'], () => {

gulp.task('production', () => {
// set the environment variable
env({
vars: {
NODE_ENV: 'production',
},
})
// build the client
return gulp.src(projectPaths.entry)
.pipe(named())
.pipe(webpack(require(projectPaths.webpackConfig)))
.pipe(gulp.dest(projectPaths.buildDir))
})


/**
* Remove all ouptut files from previous builds.
*/
gulp.task('clean', () => {
del.sync(projectPaths.buildDir)
})


Expand All @@ -75,16 +46,15 @@ gulp.task('test', (cb) => {
})


/**
* Watch source and tests for changes, run tests on change.
*/
gulp.task('tdd', () => {
const server = new karma.Server({
configFile: projectPaths.karmaConfig,
})

server.start()
})
// Utilities

const buildFile = (source, name) => (
gulp.src(source)
.pipe(named(() => name))
.pipe(webpack(require(projectPaths.webpackConfig)))
.pipe(gulp.dest(projectPaths.buildDir))
)


// end of file
1 change: 0 additions & 1 deletion index.js

This file was deleted.

11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "redux-responsive",
"version": "2.2.0",
"version": "3.0.0",
"description": "Utilities for easily creating responsive designs in a redux architecture.",
"main": "build/index.js",
"main": "index.js",
"repository": {
"type": "git",
"url": "https://github.com/aaivazis/redux-responsive.git"
Expand All @@ -12,8 +12,8 @@
"Monte Mishkin"
],
"scripts": {
"test": "node_modules/gulp/bin/gulp.js test",
"prepublish": "node_modules/gulp/bin/gulp.js build-production"
"test": "gulp test",
"prepublish": "gulp build:prod"
},
"license": "MIT",
"devDependencies": {
Expand All @@ -28,7 +28,7 @@
"eslint-plugin-react": "^3.5.1",
"gulp": "^3.9.0",
"gulp-env": "^0.2.0",
"karma": "^0.13.22",
"karma": "^1.1.1",
"karma-chrome-launcher": "^0.2.1",
"karma-coverage": "^0.5.5",
"karma-firefox-launcher": "^0.1.6",
Expand All @@ -49,6 +49,7 @@
"webpack-stream": "^2.1.1"
},
"dependencies": {
"karma": "^1.1.1",
"lodash": "^4.2.1",
"mediaquery": "0.0.3",
"redux": "^3.5.2"
Expand Down
4 changes: 2 additions & 2 deletions src/components/stylesheet.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// external imports
import {connect} from 'react-redux'
// import {connect} from 'react-redux'
import mapValues from 'lodash/mapValues'
import sortBy from 'lodash/sortBy'

Expand Down Expand Up @@ -126,7 +126,7 @@ const defaultOptions = {

// export a higher order component
export default (stylesheet, opts) => (component) => (
connect(
require('react-redux').connect( // eslint-disable-line no-undef
mapStateToPropsFactory(stylesheet, {...defaultOptions, ...opts})
)(component)
)
1 change: 0 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import _createResponsiveStateReducer from './util/createResponsiveStateReducer'
import _createResponsiveStoreEnhancer from './util/createResponsiveStoreEnhancer'
export {CALCULATE_RESPONSIVE_STATE} from './actions/types'
export {calculateResponsiveState} from './actions/creators'
export StyleSheet from './components/stylesheet'


export const createResponsiveStateReducer = _createResponsiveStateReducer
Expand Down
1 change: 1 addition & 0 deletions src/react.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export StyleSheet from './components/stylesheet'
9 changes: 6 additions & 3 deletions tests/test_stylesheet.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@

import 'babel-polyfill'

// local imports
import {
parsePattern,
browserMatches,
sortKeys,
transformStyle,
} from '../src/components/stylesheet'

// fix the testing environment
import 'babel-polyfill'
// import {parsePattern} from 'components/stylesheet'
// // fix the testing environment
// import foo from 'components/stylesheet'

describe('ReactStyleSheet', function () {
it("can parse the relevant data from style patterns", function() {
Expand Down

0 comments on commit 47b4d88

Please sign in to comment.