1010// @remove -on-eject-end
1111'use strict' ;
1212
13- var path = require ( 'path' ) ;
14- var fs = require ( 'fs' ) ;
15- var url = require ( 'url' ) ;
13+ const path = require ( 'path' ) ;
14+ const fs = require ( 'fs' ) ;
15+ const url = require ( 'url' ) ;
1616
1717// Make sure any symlinks in the project folder are resolved:
1818// https://github.com/facebookincubator/create-react-app/issues/637
19- var appDirectory = fs . realpathSync ( process . cwd ( ) ) ;
19+ const appDirectory = fs . realpathSync ( process . cwd ( ) ) ;
2020function resolveApp ( relativePath ) {
2121 return path . resolve ( appDirectory , relativePath ) ;
2222}
@@ -36,20 +36,20 @@ function resolveApp(relativePath) {
3636// Otherwise, we risk importing Node.js core modules into an app instead of Webpack shims.
3737// https://github.com/facebookincubator/create-react-app/issues/1023#issuecomment-265344421
3838
39- var nodePaths = ( process . env . NODE_PATH || '' )
39+ const nodePaths = ( process . env . NODE_PATH || '' )
4040 . split ( process . platform === 'win32' ? ';' : ':' )
4141 . filter ( Boolean )
4242 . filter ( folder => ! path . isAbsolute ( folder ) )
4343 . map ( resolveApp ) ;
4444
45- var envPublicUrl = process . env . PUBLIC_URL ;
45+ const envPublicUrl = process . env . PUBLIC_URL ;
4646
4747function ensureSlash ( path , needsSlash ) {
48- var hasSlash = path . endsWith ( '/' ) ;
48+ const hasSlash = path . endsWith ( '/' ) ;
4949 if ( hasSlash && ! needsSlash ) {
5050 return path . substr ( path , path . length - 1 ) ;
5151 } else if ( ! hasSlash && needsSlash ) {
52- return path + '/' ;
52+ return ` ${ path } /` ;
5353 } else {
5454 return path ;
5555 }
@@ -66,8 +66,8 @@ function getPublicUrl(appPackageJson) {
6666// We can't use a relative path in HTML because we don't want to load something
6767// like /todos/42/static/js/bundle.7289d.js. We have to know the root.
6868function getServedPath ( appPackageJson ) {
69- var publicUrl = getPublicUrl ( appPackageJson ) ;
70- var servedUrl = envPublicUrl || (
69+ const publicUrl = getPublicUrl ( appPackageJson ) ;
70+ const servedUrl = envPublicUrl || (
7171 publicUrl ? url . parse ( publicUrl ) . pathname : '/'
7272 ) ;
7373 return ensureSlash ( servedUrl , true ) ;
@@ -114,9 +114,9 @@ module.exports = {
114114 ownNodeModules : resolveOwn ( 'node_modules' ) , // This is empty on npm 3
115115} ;
116116
117- var ownPackageJson = require ( '../package.json' ) ;
118- var reactScriptsPath = resolveApp ( `node_modules/${ ownPackageJson . name } ` ) ;
119- var reactScriptsLinked = fs . existsSync ( reactScriptsPath ) && fs . lstatSync ( reactScriptsPath ) . isSymbolicLink ( ) ;
117+ const ownPackageJson = require ( '../package.json' ) ;
118+ const reactScriptsPath = resolveApp ( `node_modules/${ ownPackageJson . name } ` ) ;
119+ const reactScriptsLinked = fs . existsSync ( reactScriptsPath ) && fs . lstatSync ( reactScriptsPath ) . isSymbolicLink ( ) ;
120120
121121// config before publish: we're in ./packages/react-scripts/config/
122122if ( ! reactScriptsLinked && __dirname . indexOf ( path . join ( 'packages' , 'react-scripts' , 'config' ) ) !== - 1 ) {
0 commit comments