Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Meta
create-react-app
Commits
06df2ecb
Commit
06df2ecb
authored
8 years ago
by
Kevin Lacker
Committed by
GitHub
8 years ago
Browse files
Options
Download
Plain Diff
Merge pull request #166 from lacker/master
fix cdpath bug
parents
458d3f9e
511668c5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
global-cli/index.js
+4
-3
global-cli/index.js
scripts/init.js
+6
-3
scripts/init.js
with
10 additions
and
6 deletions
+10
-6
global-cli/index.js
+
4
-
3
View file @
06df2ecb
...
@@ -88,15 +88,16 @@ function createApp(name, verbose, version) {
...
@@ -88,15 +88,16 @@ function createApp(name, verbose, version) {
private
:
true
,
private
:
true
,
};
};
fs
.
writeFileSync
(
path
.
join
(
root
,
'
package.json
'
),
JSON
.
stringify
(
packageJson
));
fs
.
writeFileSync
(
path
.
join
(
root
,
'
package.json
'
),
JSON
.
stringify
(
packageJson
));
var
originalDirectory
=
process
.
cwd
();
process
.
chdir
(
root
);
process
.
chdir
(
root
);
console
.
log
(
'
Installing packages. This might take a couple minutes.
'
);
console
.
log
(
'
Installing packages. This might take a couple minutes.
'
);
console
.
log
(
'
Installing react-scripts from npm...
'
);
console
.
log
(
'
Installing react-scripts from npm...
'
);
run
(
root
,
appName
,
version
,
verbose
);
run
(
root
,
appName
,
version
,
verbose
,
originalDirectory
);
}
}
function
run
(
root
,
appName
,
version
,
verbose
)
{
function
run
(
root
,
appName
,
version
,
verbose
,
originalDirectory
)
{
var
args
=
[
var
args
=
[
'
install
'
,
'
install
'
,
verbose
&&
'
--verbose
'
,
verbose
&&
'
--verbose
'
,
...
@@ -121,7 +122,7 @@ function run(root, appName, version, verbose) {
...
@@ -121,7 +122,7 @@ function run(root, appName, version, verbose) {
'
init.js
'
'
init.js
'
);
);
var
init
=
require
(
scriptsPath
);
var
init
=
require
(
scriptsPath
);
init
(
root
,
appName
,
verbose
);
init
(
root
,
appName
,
verbose
,
originalDirectory
);
});
});
}
}
...
...
This diff is collapsed.
Click to expand it.
scripts/init.js
+
6
-
3
View file @
06df2ecb
...
@@ -11,7 +11,7 @@ var fs = require('fs-extra');
...
@@ -11,7 +11,7 @@ var fs = require('fs-extra');
var
path
=
require
(
'
path
'
);
var
path
=
require
(
'
path
'
);
var
spawn
=
require
(
'
cross-spawn
'
);
var
spawn
=
require
(
'
cross-spawn
'
);
module
.
exports
=
function
(
hostPath
,
appName
,
verbose
)
{
module
.
exports
=
function
(
hostPath
,
appName
,
verbose
,
originalDirectory
)
{
var
selfPath
=
path
.
join
(
hostPath
,
'
node_modules
'
,
'
react-scripts
'
);
var
selfPath
=
path
.
join
(
hostPath
,
'
node_modules
'
,
'
react-scripts
'
);
var
hostPackage
=
require
(
path
.
join
(
hostPath
,
'
package.json
'
));
var
hostPackage
=
require
(
path
.
join
(
hostPath
,
'
package.json
'
));
...
@@ -60,9 +60,12 @@ module.exports = function(hostPath, appName, verbose) {
...
@@ -60,9 +60,12 @@ module.exports = function(hostPath, appName, verbose) {
return
;
return
;
}
}
// Make sure to display the right way to cd
// Display the most elegant way to cd.
// This needs to handle an undefined originalDirectory for
// backward compatibility with old global-cli's.
var
cdpath
;
var
cdpath
;
if
(
path
.
join
(
process
.
cwd
(),
appName
)
===
hostPath
)
{
if
(
originalDirectory
&&
path
.
join
(
originalDirectory
,
appName
)
===
hostPath
)
{
cdpath
=
appName
;
cdpath
=
appName
;
}
else
{
}
else
{
cdpath
=
hostPath
;
cdpath
=
hostPath
;
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment