Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support node 7 and directories with spaces #762

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: node_js
node_js:
- 6
- node
cache:
directories:
- node_modules
Expand Down
3 changes: 2 additions & 1 deletion packages/generator-react-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
"yeoman-test": "^1.0.0",
"babel-eslint": "^7.0.0",
"eslint": "^3.8.1",
"eslint-plugin-react": "^6.4.1"
"eslint-plugin-react": "^6.4.1",
"shell-escape": "^0.2.0"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the indentation is off here

},
"repository": "redfin/react-server",
"scripts": {
Expand Down
3 changes: 2 additions & 1 deletion packages/generator-react-server/test/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import path from 'path';
import test from 'ava';
import helpers from 'yeoman-test';
import { defaultOptions } from 'react-server-cli';
import shellescape from 'shell-escape';

test('generator-react-server:app creates default files', async t => {
let testDir;
Expand Down Expand Up @@ -129,7 +130,7 @@ function installDeps() {
} else {
const localDeps = ['react-server-cli', 'react-server']
.map(dep => path.resolve(path.join(__dirname, '../..', dep)));
cp.exec('npm install ' + localDeps.join(' '), (error) => {
cp.exec(shellescape(['npm', 'install'].concat(localDeps)), (error) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, is there a deps that needs escaping, or is this defensive in case we add one? I think the change is good either way

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when the current path has spaces in it, it screws up the cp.exec() call. Example:

cp.exec('npm install /my path with spaces/react-server-cli')

What should happen instead is something like this:

cp.exec('npm install /my\ path\ with\ spaces/react-server-cli')

Same thing would happen if there were a ' in the path...it would mess up the JavaScript string.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoa, nice extra fix here!

if (error) {
reject(error);
} else {
Expand Down
2 changes: 0 additions & 2 deletions packages/react-server-test-pages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"prepublish": "gulp build",
"start": "react-server start",
"test": "gulp test",
"debug": "node-debug --debug-brk=0 -p 9000 react-server start",
"clean": "rimraf npm-debug.log* __clientTemp target"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure we want to keep the debug target for test pages -- it's purpose is a place to repro and debug issues.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually suggested on slack that we just drop it for now and re-add with node --inspect once someone figures out how to do that.

Didn't want to put that on @drewpc for this PR, since getting node 7 working is already tangential to what he's actually trying to do. 😆

},
"author": "Bo Borgerson",
Expand All @@ -30,7 +29,6 @@
"eslint": "^3.8.1",
"gulp": "^3.9.1",
"gulp-eslint": "^3.0.1",
"node-inspector": "^0.12.8",
"rimraf": "^2.5.4",
"gulp-nsp": "^2.4.2"
}
Expand Down