@@ -13,10 +13,6 @@ var path = require('path');
1313var fs = require ( 'fs' ) ;
1414var url = require ( 'url' ) ;
1515
16- // @remove -on-eject-begin
17- var isReactScriptsLinked = require ( '../utils/isReactScriptsLinked' ) ;
18- // @remove -on-eject-end
19-
2016// Make sure any symlinks in the project folder are resolved:
2117// https://github.com/facebookincubator/create-react-app/issues/637
2218var appDirectory = fs . realpathSync ( process . cwd ( ) ) ;
@@ -95,11 +91,13 @@ module.exports = {
9591
9692// @remove -on-eject-begin
9793function resolveOwn ( relativePath ) {
98- return path . resolve ( __dirname , relativePath ) ;
94+ return path . resolve ( __dirname , '..' , relativePath ) ;
9995}
10096
10197// config before eject: we're in ./node_modules/react-scripts/config/
10298module . exports = {
99+ appPath : resolveApp ( '.' ) ,
100+ ownPath : resolveOwn ( '.' ) ,
103101 appBuild : resolveApp ( 'build' ) ,
104102 appPublic : resolveApp ( 'public' ) ,
105103 appHtml : resolveApp ( 'public/index.html' ) ,
@@ -110,28 +108,34 @@ module.exports = {
110108 testsSetup : resolveApp ( 'src/setupTests.js' ) ,
111109 appNodeModules : resolveApp ( 'node_modules' ) ,
112110 // this is empty with npm3 but node resolution searches higher anyway:
113- ownNodeModules : resolveOwn ( '../ node_modules' ) ,
111+ ownNodeModules : resolveOwn ( 'node_modules' ) ,
114112 nodePaths : nodePaths ,
115113 publicUrl : getPublicUrl ( resolveApp ( 'package.json' ) ) ,
116114 servedPath : getServedPath ( resolveApp ( 'package.json' ) )
117115} ;
118116
117+
118+ var reactScriptsPath = path . resolve ( 'node_modules/react-scripts' ) ;
119+ var reactScriptsLinked = fs . existsSync ( reactScriptsPath ) && fs . lstatSync ( reactScriptsPath ) . isSymbolicLink ( ) ;
120+
119121// config before publish: we're in ./packages/react-scripts/config/
120- if ( ! isReactScriptsLinked ( ) && __dirname . indexOf ( path . join ( 'packages' , 'react-scripts' , 'config' ) ) !== - 1 ) {
122+ if ( ! reactScriptsLinked && __dirname . indexOf ( path . join ( 'packages' , 'react-scripts' , 'config' ) ) !== - 1 ) {
121123 module . exports = {
122- appBuild : resolveOwn ( '../../../build' ) ,
123- appPublic : resolveOwn ( '../template/public' ) ,
124- appHtml : resolveOwn ( '../template/public/index.html' ) ,
125- appIndexJs : resolveOwn ( '../template/src/index.js' ) ,
126- appPackageJson : resolveOwn ( '../package.json' ) ,
127- appSrc : resolveOwn ( '../template/src' ) ,
128- yarnLockFile : resolveOwn ( '../template/yarn.lock' ) ,
129- testsSetup : resolveOwn ( '../template/src/setupTests.js' ) ,
130- appNodeModules : resolveOwn ( '../node_modules' ) ,
131- ownNodeModules : resolveOwn ( '../node_modules' ) ,
124+ appPath : resolveApp ( '.' ) ,
125+ ownPath : resolveOwn ( '.' ) ,
126+ appBuild : resolveOwn ( '../../build' ) ,
127+ appPublic : resolveOwn ( 'template/public' ) ,
128+ appHtml : resolveOwn ( 'template/public/index.html' ) ,
129+ appIndexJs : resolveOwn ( 'template/src/index.js' ) ,
130+ appPackageJson : resolveOwn ( 'package.json' ) ,
131+ appSrc : resolveOwn ( 'template/src' ) ,
132+ yarnLockFile : resolveOwn ( 'template/yarn.lock' ) ,
133+ testsSetup : resolveOwn ( 'template/src/setupTests.js' ) ,
134+ appNodeModules : resolveOwn ( 'node_modules' ) ,
135+ ownNodeModules : resolveOwn ( 'node_modules' ) ,
132136 nodePaths : nodePaths ,
133- publicUrl : getPublicUrl ( resolveOwn ( '../ package.json' ) ) ,
134- servedPath : getServedPath ( resolveOwn ( '../ package.json' ) )
137+ publicUrl : getPublicUrl ( resolveOwn ( 'package.json' ) ) ,
138+ servedPath : getServedPath ( resolveOwn ( 'package.json' ) )
135139 } ;
136140}
137141// @remove -on-eject-end
0 commit comments