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
a171d930
Commit
a171d930
authored
7 years ago
by
Dan Abramov
Browse files
Options
Download
Email Patches
Plain Diff
Reformat source code with Prettier 1.5.2
parent
29c8733e
Changes
49
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
packages/react-scripts/fixtures/kitchensink/src/features/syntax/TemplateInterpolation.js
+5
-1
.../kitchensink/src/features/syntax/TemplateInterpolation.js
packages/react-scripts/fixtures/kitchensink/src/features/webpack/ImageInclusion.js
+2
-3
...xtures/kitchensink/src/features/webpack/ImageInclusion.js
packages/react-scripts/fixtures/kitchensink/src/features/webpack/JsonInclusion.js
+4
-1
...ixtures/kitchensink/src/features/webpack/JsonInclusion.js
packages/react-scripts/fixtures/kitchensink/src/features/webpack/LinkedModules.js
+5
-1
...ixtures/kitchensink/src/features/webpack/LinkedModules.js
packages/react-scripts/fixtures/kitchensink/src/features/webpack/NoExtInclusion.js
+4
-3
...xtures/kitchensink/src/features/webpack/NoExtInclusion.js
packages/react-scripts/fixtures/kitchensink/src/features/webpack/UnknownExtInclusion.js
+4
-3
...s/kitchensink/src/features/webpack/UnknownExtInclusion.js
packages/react-scripts/scripts/build.js
+2
-1
packages/react-scripts/scripts/build.js
packages/react-scripts/scripts/eject.js
+26
-26
packages/react-scripts/scripts/eject.js
packages/react-scripts/scripts/init.js
+6
-7
packages/react-scripts/scripts/init.js
with
58 additions
and
46 deletions
+58
-46
packages/react-scripts/fixtures/kitchensink/src/features/syntax/TemplateInterpolation.js
+
5
-
1
View file @
a171d930
...
@@ -41,7 +41,11 @@ export default class extends Component {
...
@@ -41,7 +41,11 @@ export default class extends Component {
render
()
{
render
()
{
return
(
return
(
<
div
id
=
"
feature-template-interpolation
"
>
<
div
id
=
"
feature-template-interpolation
"
>
{
this
.
state
.
users
.
map
(
user
=>
<
div
key
=
{
user
.
id
}
>
{
user
.
name
}
<
/div>
)
}
{
this
.
state
.
users
.
map
(
user
=>
<
div
key
=
{
user
.
id
}
>
{
user
.
name
}
<
/div
>
)}
<
/div
>
<
/div
>
);
);
}
}
...
...
This diff is collapsed.
Click to expand it.
packages/react-scripts/fixtures/kitchensink/src/features/webpack/ImageInclusion.js
+
2
-
3
View file @
a171d930
...
@@ -10,6 +10,5 @@
...
@@ -10,6 +10,5 @@
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
tiniestCat
from
'
./assets/tiniest-cat.jpg
'
;
import
tiniestCat
from
'
./assets/tiniest-cat.jpg
'
;
export
default
()
=>
(
export
default
()
=>
<
img
id
=
"
feature-image-inclusion
"
src
=
{
tiniestCat
}
alt
=
"
tiniest cat
"
/>
<
img
id
=
"
feature-image-inclusion
"
src
=
{
tiniestCat
}
alt
=
"
tiniest cat
"
/>
;
);
This diff is collapsed.
Click to expand it.
packages/react-scripts/fixtures/kitchensink/src/features/webpack/JsonInclusion.js
+
4
-
1
View file @
a171d930
...
@@ -10,4 +10,7 @@
...
@@ -10,4 +10,7 @@
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
{
abstract
}
from
'
./assets/abstract.json
'
;
import
{
abstract
}
from
'
./assets/abstract.json
'
;
export
default
()
=>
<
summary
id
=
"
feature-json-inclusion
"
>
{
abstract
}
<
/summary>
;
export
default
()
=>
<
summary
id
=
"
feature-json-inclusion
"
>
{
abstract
}
<
/summary>
;
This diff is collapsed.
Click to expand it.
packages/react-scripts/fixtures/kitchensink/src/features/webpack/LinkedModules.js
+
5
-
1
View file @
a171d930
...
@@ -16,5 +16,9 @@ export default () => {
...
@@ -16,5 +16,9 @@ export default () => {
if
(
!
test
()
||
v
!==
'
2.0.0
'
)
{
if
(
!
test
()
||
v
!==
'
2.0.0
'
)
{
throw
new
Error
(
'
Functionality test did not pass.
'
);
throw
new
Error
(
'
Functionality test did not pass.
'
);
}
}
return
<
p
id
=
"
feature-linked-modules
"
>
{
v
}
<
/p>
;
return
(
<
p
id
=
"
feature-linked-modules
"
>
{
v
}
<
/p
>
);
};
};
This diff is collapsed.
Click to expand it.
packages/react-scripts/fixtures/kitchensink/src/features/webpack/NoExtInclusion.js
+
4
-
3
View file @
a171d930
...
@@ -14,6 +14,7 @@ const text = aFileWithoutExt.includes('base64')
...
@@ -14,6 +14,7 @@ const text = aFileWithoutExt.includes('base64')
?
atob
(
aFileWithoutExt
.
split
(
'
base64,
'
)[
1
]).
trim
()
?
atob
(
aFileWithoutExt
.
split
(
'
base64,
'
)[
1
]).
trim
()
:
aFileWithoutExt
;
:
aFileWithoutExt
;
export
default
()
=>
(
export
default
()
=>
<
a
id
=
"
feature-no-ext-inclusion
"
href
=
{
text
}
>
aFileWithoutExt
<
/a
>
<
a
id
=
"
feature-no-ext-inclusion
"
href
=
{
text
}
>
);
aFileWithoutExt
<
/a>
;
This diff is collapsed.
Click to expand it.
packages/react-scripts/fixtures/kitchensink/src/features/webpack/UnknownExtInclusion.js
+
4
-
3
View file @
a171d930
...
@@ -14,6 +14,7 @@ const text = aFileWithExtUnknown.includes('base64')
...
@@ -14,6 +14,7 @@ const text = aFileWithExtUnknown.includes('base64')
?
atob
(
aFileWithExtUnknown
.
split
(
'
base64,
'
)[
1
]).
trim
()
?
atob
(
aFileWithExtUnknown
.
split
(
'
base64,
'
)[
1
]).
trim
()
:
aFileWithExtUnknown
;
:
aFileWithExtUnknown
;
export
default
()
=>
(
export
default
()
=>
<
a
id
=
"
feature-unknown-ext-inclusion
"
href
=
{
text
}
>
aFileWithExtUnknown
<
/a
>
<
a
id
=
"
feature-unknown-ext-inclusion
"
href
=
{
text
}
>
);
aFileWithExtUnknown
<
/a>
;
This diff is collapsed.
Click to expand it.
packages/react-scripts/scripts/build.js
+
2
-
1
View file @
a171d930
...
@@ -35,7 +35,8 @@ const formatWebpackMessages = require('react-dev-utils/formatWebpackMessages');
...
@@ -35,7 +35,8 @@ const formatWebpackMessages = require('react-dev-utils/formatWebpackMessages');
const
printHostingInstructions
=
require
(
'
react-dev-utils/printHostingInstructions
'
);
const
printHostingInstructions
=
require
(
'
react-dev-utils/printHostingInstructions
'
);
const
FileSizeReporter
=
require
(
'
react-dev-utils/FileSizeReporter
'
);
const
FileSizeReporter
=
require
(
'
react-dev-utils/FileSizeReporter
'
);
const
measureFileSizesBeforeBuild
=
FileSizeReporter
.
measureFileSizesBeforeBuild
;
const
measureFileSizesBeforeBuild
=
FileSizeReporter
.
measureFileSizesBeforeBuild
;
const
printFileSizesAfterBuild
=
FileSizeReporter
.
printFileSizesAfterBuild
;
const
printFileSizesAfterBuild
=
FileSizeReporter
.
printFileSizesAfterBuild
;
const
useYarn
=
fs
.
existsSync
(
paths
.
yarnLockFile
);
const
useYarn
=
fs
.
existsSync
(
paths
.
yarnLockFile
);
...
...
This diff is collapsed.
Click to expand it.
packages/react-scripts/scripts/eject.js
+
26
-
26
View file @
a171d930
...
@@ -85,19 +85,16 @@ inquirer
...
@@ -85,19 +85,16 @@ inquirer
const
folders
=
[
'
config
'
,
'
config/jest
'
,
'
scripts
'
];
const
folders
=
[
'
config
'
,
'
config/jest
'
,
'
scripts
'
];
// Make shallow array of files paths
// Make shallow array of files paths
const
files
=
folders
.
reduce
(
const
files
=
folders
.
reduce
((
files
,
folder
)
=>
{
(
files
,
folder
)
=>
{
return
files
.
concat
(
return
files
.
concat
(
fs
fs
.
readdirSync
(
path
.
join
(
ownPath
,
folder
))
.
readdirSync
(
path
.
join
(
ownPath
,
folder
))
// set full path
// set full path
.
map
(
file
=>
path
.
join
(
ownPath
,
folder
,
file
))
.
map
(
file
=>
path
.
join
(
ownPath
,
folder
,
file
))
// omit dirs from file list
// omit dirs from file list
.
filter
(
file
=>
fs
.
lstatSync
(
file
).
isFile
())
.
filter
(
file
=>
fs
.
lstatSync
(
file
).
isFile
())
);
);
},
[]);
},
[]
);
// Ensure that the app folder is clean and we won't override any files
// Ensure that the app folder is clean and we won't override any files
folders
.
forEach
(
verifyAbsent
);
folders
.
forEach
(
verifyAbsent
);
...
@@ -124,18 +121,19 @@ inquirer
...
@@ -124,18 +121,19 @@ inquirer
if
(
content
.
match
(
/
\/\/
@remove-file-on-eject/
))
{
if
(
content
.
match
(
/
\/\/
@remove-file-on-eject/
))
{
return
;
return
;
}
}
content
=
content
content
=
// Remove dead code from .js files on eject
content
.
replace
(
// Remove dead code from .js files on eject
/
\/\/
@remove-on-eject-begin
([\s\S]
*
?)\/\/
@remove-on-eject-end/mg
,
.
replace
(
''
/
\/\/
@remove-on-eject-begin
([\s\S]
*
?)\/\/
@remove-on-eject-end/gm
,
)
''
// Remove dead code from .applescript files on eject
)
.
replace
(
// Remove dead code from .applescript files on eject
/-- @remove-on-eject-begin
([\s\S]
*
?)
-- @remove-on-eject-end/mg
,
.
replace
(
''
/-- @remove-on-eject-begin
([\s\S]
*
?)
-- @remove-on-eject-end/gm
,
)
''
.
trim
()
+
'
\n
'
;
)
.
trim
()
+
'
\n
'
;
console
.
log
(
` Adding
${
cyan
(
file
.
replace
(
ownPath
,
''
))}
to the project`
);
console
.
log
(
` Adding
${
cyan
(
file
.
replace
(
ownPath
,
''
))}
to the project`
);
fs
.
writeFileSync
(
file
.
replace
(
ownPath
,
appPath
),
content
);
fs
.
writeFileSync
(
file
.
replace
(
ownPath
,
appPath
),
content
);
});
});
...
@@ -187,7 +185,9 @@ inquirer
...
@@ -187,7 +185,9 @@ inquirer
'
node scripts/$1.js
'
'
node scripts/$1.js
'
);
);
console
.
log
(
console
.
log
(
` Replacing
${
cyan
(
`"
${
binKey
}
${
key
}
"`
)}
with
${
cyan
(
`"node scripts/
${
key
}
.js"`
)}
`
` Replacing
${
cyan
(
`"
${
binKey
}
${
key
}
"`
)}
with
${
cyan
(
`"node scripts/
${
key
}
.js"`
)}
`
);
);
});
});
});
});
...
...
This diff is collapsed.
Click to expand it.
packages/react-scripts/scripts/init.js
+
6
-
7
View file @
a171d930
...
@@ -28,11 +28,8 @@ module.exports = function(
...
@@ -28,11 +28,8 @@ module.exports = function(
originalDirectory
,
originalDirectory
,
template
template
)
{
)
{
const
ownPackageName
=
require
(
path
.
join
(
const
ownPackageName
=
require
(
path
.
join
(
__dirname
,
'
..
'
,
'
package.json
'
))
__dirname
,
.
name
;
'
..
'
,
'
package.json
'
)).
name
;
const
ownPath
=
path
.
join
(
appPath
,
'
node_modules
'
,
ownPackageName
);
const
ownPath
=
path
.
join
(
appPath
,
'
node_modules
'
,
ownPackageName
);
const
appPackage
=
require
(
path
.
join
(
appPath
,
'
package.json
'
));
const
appPackage
=
require
(
path
.
join
(
appPath
,
'
package.json
'
));
const
useYarn
=
fs
.
existsSync
(
path
.
join
(
appPath
,
'
yarn.lock
'
));
const
useYarn
=
fs
.
existsSync
(
path
.
join
(
appPath
,
'
yarn.lock
'
));
...
@@ -192,6 +189,8 @@ module.exports = function(
...
@@ -192,6 +189,8 @@ module.exports = function(
function
isReactInstalled
(
appPackage
)
{
function
isReactInstalled
(
appPackage
)
{
const
dependencies
=
appPackage
.
dependencies
||
{};
const
dependencies
=
appPackage
.
dependencies
||
{};
return
typeof
dependencies
.
react
!==
'
undefined
'
&&
return
(
typeof
dependencies
[
'
react-dom
'
]
!==
'
undefined
'
;
typeof
dependencies
.
react
!==
'
undefined
'
&&
typeof
dependencies
[
'
react-dom
'
]
!==
'
undefined
'
);
}
}
This diff is collapsed.
Click to expand it.
Prev
1
2
3
Next
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