Skip to content

Commit

Permalink
NPM Package updates and improved babel compiling (nfl#179)
Browse files Browse the repository at this point in the history
* Replaced `config/clean.js` script with `rm -rf`

No need to use gulp for this.
Removed devDependencies `del`

* FIX - gulpfile require clean removed

* editorconfig for package.json

* gitignore eslintcache

* eslint improvements - removed need for gulp

using eslint cli instead of a gulp task
removed all `gulp` devDependencies
moved eslintconfig into package.json

* `babel` & `eslint` updates

moved babel config into `package.json`
removed `.babelrc`
update `babel` setup to use presets
fixed new lint errors from updates

* FIX - compile for commonjs

* Unit test packages updated

* `isparta-instrumenter-loader` switched to `isparta-loader`

as `isparta-instrumenter-loader` is deprecated

* switched `phantomjs` to `phantomjs-prebuilt`

`phantomjs` package was renamed to `phantomjs-prebuilt`

* FIX - commonjs compile

* babel compile `es` version for webpack2 and jspm use

As you can use es6 versions of packages in compilers now.

* `karma-babel-preprocessor` not needed

* `nvm` support added for node version control

* `engines` added to `package.json`

`”node”: “6.6.0”`
`”npm”:”3.10.3”`

* npm ignore nvm file

* travis node versions updated

eslint `3.6.1` only support node `>=4`
https://github.com/eslint/eslint/blob/66adac172510e173e63db18689762e27cf6cf149/package.json#L119

cache node_modules to speed up travis builds

* Chrome Unit test on travis enabled

* FIX - travis chrome unit test

* `rimraf` & `cross-env` for windows support
  • Loading branch information
Andy Kenward authored and cwelch5 committed Oct 29, 2016
1 parent b6329ad commit af13c9c
Show file tree
Hide file tree
Showing 15 changed files with 156 additions and 147 deletions.
4 changes: 0 additions & 4 deletions .babelrc

This file was deleted.

8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,11 @@ end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[package.json]
indent_style = space
indent_size = 2

[.travis.yml]
indent_style = space
indent_size = 2
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

3 changes: 0 additions & 3 deletions .eslintrc

This file was deleted.

8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
node_modules/
lib/
build/
node_modules
lib
build
npm-debug.log
.DS_Store

.idea
.eslintcache
es
14 changes: 10 additions & 4 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
node_modules/
src/
build/
node_modules
src
build
.arcconfig
.babelrc
*.yml
.editorconfig
karma.config.js
travis.yml
CHANGELOG.md
CONTRIBUTING.md
lib/test
.nvmrc
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v6.6.0
23 changes: 14 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
language: node_js

node_js:
- '0.12'
- '0.10'
- 'stable'
- 'node'
- 6
- 5
- 4

install:
- npm i -g npm@latest
- npm install

before_install:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- npm install -g npm
- export CHROME_BIN=chromium-browser
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start

script:
- npm run lint
- npm test -- --browsers PhantomJS
cache:
directories:
- node_modules
8 changes: 0 additions & 8 deletions config/clean.js

This file was deleted.

38 changes: 0 additions & 38 deletions config/eslint.js

This file was deleted.

15 changes: 0 additions & 15 deletions gulpfile.js

This file was deleted.

16 changes: 11 additions & 5 deletions karma.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ module.exports = function (config) {
test: /(\.js(x)?)$/,
// exclude this dirs from coverage
exclude: /(node_modules|bower_components)\//,
loader: "isparta-instrumenter-loader"
loader: "isparta"
}]
},
resolve: {
Expand Down Expand Up @@ -97,10 +97,16 @@ module.exports = function (config) {
// - Safari (only Mac; has to be installed with `npm install karma-safari-launcher`)
// - PhantomJS
// - IE (only Windows; has to be installed with `npm install karma-ie-launcher`)
browsers: [
"Chrome",
"PhantomJS"
],
browsers: process.env.TRAVIS
? ["ChromeTravis", "PhantomJS"]
: ["Chrome", "PhantomJS"],

customLaunchers: {
ChromeTravis: {
base: "Chrome",
flags: ["--no-sandbox"]
}
},

// If browser does not capture in given timeout [ms], kill it
captureTimeout: 60000,
Expand Down
124 changes: 87 additions & 37 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"description": "A document head manager for React",
"version": "3.1.0",
"main": "./lib/Helmet.js",
"module": "es/Helmet.js",
"jsnext:main": "es/Helmet.js",
"author": "NFL <engineers@nfl.com>",
"contributors": [
"Chris Welch <chris.welch@nfl.com>"
Expand All @@ -12,6 +14,10 @@
"type": "git",
"url": "https://github.com/nfl/react-helmet"
},
"engines": {
"node": "6.6.0",
"npm": "3.10.3"
},
"keywords": [
"react-helmet",
"nfl",
Expand All @@ -29,57 +35,101 @@
"object-assign": "^4.0.1",
"react-side-effect": "1.0.2",
"shallowequal": "0.2.2",
"warning": "2.1.0"
"warning": "3.0.0"
},
"devDependencies": {
"babel": "5.8.34",
"babel-eslint": "5.0.0",
"babel-loader": "5.4.0",
"chai": "3.4.1",
"chalk": "1.1.1",
"del": "2.2.0",
"eslint": "2.4.0",
"eslint-config-nfl": "6.1.0",
"eslint-plugin-react": "4.2.2",
"estraverse": "^4.2.0",
"estraverse-fb": "^1.3.1",
"gulp": "3.9.0",
"gulp-cached": "1.1.0",
"gulp-debug": "2.1.2",
"gulp-eslint": "2.0.0",
"gulp-if": "2.0.0",
"gulp-notify": "2.2.0",
"gulp-util": "3.0.7",
"isparta-instrumenter-loader": "0.2.1",
"karma": "0.13.19",
"babel-cli": "6.16.0",
"babel-core": "6.16.0",
"babel-eslint": "7.0.0",
"babel-plugin-add-module-exports": "0.2.1",
"babel-plugin-transform-es2015-modules-commonjs": "6.16.0",
"babel-preset-latest": "6.16.0",
"babel-preset-react": "6.16.0",
"babel-preset-stage-0": "6.16.0",
"chai": "3.5.0",
"cross-env": "3.0.0",
"eslint": "3.6.1",
"eslint-config-nfl": "10.0.0",
"eslint-plugin-import": "1.16.0",
"eslint-plugin-jsx-a11y": "2.2.2",
"eslint-plugin-mocha": "4.5.1",
"eslint-plugin-react": "6.3.0",
"estraverse": "4.2.0",
"estraverse-fb": "1.3.1",
"isparta-loader": "2.0.0",
"karma": "1.3.0",
"karma-chai": "0.1.0",
"karma-chai-sinon": "0.1.5",
"karma-chrome-launcher": "0.2.2",
"karma-cli": "0.1.2",
"karma-coverage": "0.5.3",
"karma-chrome-launcher": "2.0.0",
"karma-coverage": "1.1.1",
"karma-html-reporter": "0.2.7",
"karma-mocha": "0.2.1",
"karma-phantomjs-launcher": "0.2.3",
"karma-phantomjs-shim": "1.2.0",
"karma-sourcemap-loader": "0.3.6",
"karma-spec-reporter": "0.0.23",
"karma-mocha": "1.2.0",
"karma-phantomjs-launcher": "1.0.2",
"karma-phantomjs-shim": "1.4.0",
"karma-sourcemap-loader": "0.3.7",
"karma-spec-reporter": "0.0.26",
"karma-tap-reporter": "0.0.6",
"karma-webpack": "1.7.0",
"mocha": "2.3.4",
"phantomjs": "1.9.19",
"karma-webpack": "1.8.0",
"mocha": "3.1.0",
"phantomjs-prebuilt": "2.1.12",
"react": "15.x",
"react-dom": "15.x",
"sinon": "1.17.2",
"rimraf": "2.5.4",
"sinon": "1.17.6",
"sinon-chai": "2.8.0",
"webpack": "1.12.11"
"webpack": "1.13.2"
},
"scripts": {
"clean": "gulp clean",
"lint": "gulp eslint",
"clean": "rimraf lib build es",
"lint": "eslint --ignore-path .gitignore -- .",
"test": "karma start karma.config.js",
"posttest": "cat ./build/reports/coverage/text.txt",
"pretest": "npm run clean && npm run lint && npm run compile",
"compile": "babel src --out-dir lib",
"compile": "npm run compile:commonjs && npm run compile:es",
"compile:commonjs": "cross-env BABEL_ENV=commonjs babel src --out-dir lib",
"compile:es": "cross-env BABEL_ENV=es babel src --out-dir es --ignore test.js",
"prepublish": "npm run compile"
},
"eslintConfig": {
"extends": [
"nfl"
],
"env": {
"browser": true,
"mocha": true,
"es6": true
},
"globals": {
"expect": false,
"sinon": false
}
},
"babel": {
"presets": [
[
"latest",
{
"es2015": {
"modules": false
}
}
],
"react",
"stage-0"
],
"env": {
"commonjs": {
"plugins": [
"add-module-exports",
[
"transform-es2015-modules-commonjs",
{
"loose": true,
"strict": false
}
]
]
}
}
}
}
10 changes: 5 additions & 5 deletions src/Helmet.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const getTitleFromPropsList = (propsList) => {

if (innermostTemplate && innermostTitle) {
// use function arg to avoid need to escape $ characters
return innermostTemplate.replace(/\%s/g, () => innermostTitle);
return innermostTemplate.replace(/%s/g, () => innermostTitle);
}

const innermostDefaultTitle = getInnermostProperty(propsList, "defaultTitle");
Expand Down Expand Up @@ -390,10 +390,6 @@ const Helmet = (Component) => {
onChangeClientState: React.PropTypes.func
}

shouldComponentUpdate(nextProps) {
return !deepEqual(this.props, nextProps);
}

// Component.peek comes from react-side-effect:
// For testing, you may use a static peek() method available on the returned component.
// It lets you get the current state without resetting the mounted instance stack.
Expand Down Expand Up @@ -423,6 +419,10 @@ const Helmet = (Component) => {
Component.canUseDOM = canUseDOM;
}

shouldComponentUpdate(nextProps) {
return !deepEqual(this.props, nextProps);
}

render() {
return <Component {...this.props} />;
}
Expand Down
Loading

0 comments on commit af13c9c

Please sign in to comment.