Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
c0a07aa9
Unverified
Commit
c0a07aa9
authored
May 19, 2021
by
JJ Kasper
Committed by
GitHub
May 19, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure CNA install succeeds with npm and example flags (#25267)
* Ensure CNA install succeeds with npm and example flags
parent
ece07f60
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
4 deletions
+63
-4
install.ts
packages/create-next-app/helpers/install.ts
+1
-1
index.test.js
test/integration/create-next-app/index.test.js
+62
-3
No files found.
packages/create-next-app/helpers/install.ts
View file @
c0a07aa9
...
@@ -30,7 +30,7 @@ export function install(
...
@@ -30,7 +30,7 @@ export function install(
/**
/**
* NPM-specific command-line flags.
* NPM-specific command-line flags.
*/
*/
const
npmFlags
:
string
[]
=
[
'--logLevel'
,
'error'
]
const
npmFlags
:
string
[]
=
[]
/**
/**
* Yarn-specific command-line flags.
* Yarn-specific command-line flags.
*/
*/
...
...
test/integration/create-next-app/index.test.js
View file @
c0a07aa9
...
@@ -17,7 +17,7 @@ async function usingTempDir(fn, options) {
...
@@ -17,7 +17,7 @@ async function usingTempDir(fn, options) {
const
folder
=
path
.
join
(
os
.
tmpdir
(),
Math
.
random
().
toString
(
36
).
substring
(
2
))
const
folder
=
path
.
join
(
os
.
tmpdir
(),
Math
.
random
().
toString
(
36
).
substring
(
2
))
await
fs
.
mkdirp
(
folder
,
options
)
await
fs
.
mkdirp
(
folder
,
options
)
try
{
try
{
return
await
fn
(
folder
)
await
fn
(
folder
)
}
finally
{
}
finally
{
await
fs
.
remove
(
folder
)
await
fs
.
remove
(
folder
)
}
}
...
@@ -52,6 +52,9 @@ describe('create next app', () => {
...
@@ -52,6 +52,9 @@ describe('create next app', () => {
expect
(
expect
(
fs
.
existsSync
(
path
.
join
(
cwd
,
projectName
,
'pages/index.js'
))
fs
.
existsSync
(
path
.
join
(
cwd
,
projectName
,
'pages/index.js'
))
).
toBeTruthy
()
).
toBeTruthy
()
expect
(
fs
.
existsSync
(
path
.
join
(
cwd
,
projectName
,
'node_modules/next'
))
).
toBe
(
true
)
})
})
})
})
}
}
...
@@ -88,6 +91,9 @@ describe('create next app', () => {
...
@@ -88,6 +91,9 @@ describe('create next app', () => {
expect
(
expect
(
fs
.
existsSync
(
path
.
join
(
cwd
,
projectName
,
'.gitignore'
))
fs
.
existsSync
(
path
.
join
(
cwd
,
projectName
,
'.gitignore'
))
).
toBeTruthy
()
).
toBeTruthy
()
expect
(
fs
.
existsSync
(
path
.
join
(
cwd
,
projectName
,
'node_modules/next'
))
).
toBe
(
true
)
})
})
})
})
...
@@ -115,6 +121,9 @@ describe('create next app', () => {
...
@@ -115,6 +121,9 @@ describe('create next app', () => {
expect
(
expect
(
fs
.
existsSync
(
path
.
join
(
cwd
,
projectName
,
'next-env.d.ts'
))
fs
.
existsSync
(
path
.
join
(
cwd
,
projectName
,
'next-env.d.ts'
))
).
toBeTruthy
()
).
toBeTruthy
()
expect
(
fs
.
existsSync
(
path
.
join
(
cwd
,
projectName
,
'node_modules/next'
))
).
toBe
(
true
)
// check we copied default `.gitignore`
// check we copied default `.gitignore`
expect
(
expect
(
fs
.
existsSync
(
path
.
join
(
cwd
,
projectName
,
'.gitignore'
))
fs
.
existsSync
(
path
.
join
(
cwd
,
projectName
,
'.gitignore'
))
...
@@ -154,6 +163,9 @@ describe('create next app', () => {
...
@@ -154,6 +163,9 @@ describe('create next app', () => {
expect
(
expect
(
fs
.
existsSync
(
path
.
join
(
cwd
,
projectName
,
'.gitignore'
))
fs
.
existsSync
(
path
.
join
(
cwd
,
projectName
,
'.gitignore'
))
).
toBeTruthy
()
).
toBeTruthy
()
expect
(
fs
.
existsSync
(
path
.
join
(
cwd
,
projectName
,
'node_modules/next'
))
).
toBe
(
true
)
})
})
})
})
...
@@ -177,6 +189,9 @@ describe('create next app', () => {
...
@@ -177,6 +189,9 @@ describe('create next app', () => {
expect
(
expect
(
fs
.
existsSync
(
path
.
join
(
cwd
,
projectName
,
'.gitignore'
))
fs
.
existsSync
(
path
.
join
(
cwd
,
projectName
,
'.gitignore'
))
).
toBeTruthy
()
).
toBeTruthy
()
expect
(
fs
.
existsSync
(
path
.
join
(
cwd
,
projectName
,
'node_modules/next'
))
).
toBe
(
true
)
})
})
})
})
...
@@ -206,6 +221,9 @@ describe('create next app', () => {
...
@@ -206,6 +221,9 @@ describe('create next app', () => {
expect
(
expect
(
fs
.
existsSync
(
path
.
join
(
cwd
,
projectName
,
'.gitignore'
))
fs
.
existsSync
(
path
.
join
(
cwd
,
projectName
,
'.gitignore'
))
).
toBeTruthy
()
).
toBeTruthy
()
expect
(
fs
.
existsSync
(
path
.
join
(
cwd
,
projectName
,
'node_modules/next'
))
).
toBe
(
true
)
})
})
})
})
...
@@ -248,6 +266,9 @@ describe('create next app', () => {
...
@@ -248,6 +266,9 @@ describe('create next app', () => {
expect
(
expect
(
fs
.
existsSync
(
path
.
join
(
cwd
,
projectName
,
'.gitignore'
))
fs
.
existsSync
(
path
.
join
(
cwd
,
projectName
,
'.gitignore'
))
).
toBeTruthy
()
).
toBeTruthy
()
expect
(
fs
.
existsSync
(
path
.
join
(
cwd
,
projectName
,
'node_modules/next'
))
).
toBe
(
true
)
})
})
})
})
...
@@ -283,7 +304,12 @@ describe('create next app', () => {
...
@@ -283,7 +304,12 @@ describe('create next app', () => {
const
res
=
await
run
([
'.'
],
{
cwd
})
const
res
=
await
run
([
'.'
],
{
cwd
})
expect
(
res
.
exitCode
).
toBe
(
0
)
expect
(
res
.
exitCode
).
toBe
(
0
)
const
files
=
[
'package.json'
,
'pages/index.js'
,
'.gitignore'
]
const
files
=
[
'package.json'
,
'pages/index.js'
,
'.gitignore'
,
'node_modules/next'
,
]
files
.
forEach
((
file
)
=>
files
.
forEach
((
file
)
=>
expect
(
fs
.
existsSync
(
path
.
join
(
cwd
,
file
))).
toBeTruthy
()
expect
(
fs
.
existsSync
(
path
.
join
(
cwd
,
file
))).
toBeTruthy
()
)
)
...
@@ -296,7 +322,12 @@ describe('create next app', () => {
...
@@ -296,7 +322,12 @@ describe('create next app', () => {
const
res
=
await
run
([],
{
cwd
,
input
:
`
${
projectName
}
\n`
})
const
res
=
await
run
([],
{
cwd
,
input
:
`
${
projectName
}
\n`
})
expect
(
res
.
exitCode
).
toBe
(
0
)
expect
(
res
.
exitCode
).
toBe
(
0
)
const
files
=
[
'package.json'
,
'pages/index.js'
,
'.gitignore'
]
const
files
=
[
'package.json'
,
'pages/index.js'
,
'.gitignore'
,
'node_modules/next'
,
]
files
.
forEach
((
file
)
=>
files
.
forEach
((
file
)
=>
expect
(
fs
.
existsSync
(
path
.
join
(
cwd
,
projectName
,
file
))).
toBeTruthy
()
expect
(
fs
.
existsSync
(
path
.
join
(
cwd
,
projectName
,
file
))).
toBeTruthy
()
)
)
...
@@ -314,6 +345,34 @@ describe('create next app', () => {
...
@@ -314,6 +345,34 @@ describe('create next app', () => {
'pages/index.js'
,
'pages/index.js'
,
'.gitignore'
,
'.gitignore'
,
'package-lock.json'
,
'package-lock.json'
,
'node_modules/next'
,
]
files
.
forEach
((
file
)
=>
expect
(
fs
.
existsSync
(
path
.
join
(
cwd
,
projectName
,
file
))).
toBeTruthy
()
)
})
})
it
(
'should use npm as the package manager on supplying --use-npm with example'
,
async
()
=>
{
await
usingTempDir
(
async
(
cwd
)
=>
{
const
projectName
=
'use-npm'
const
res
=
await
run
(
[
projectName
,
'--use-npm'
,
'--example'
,
'https://github.com/vercel/next-learn-starter/tree/master/learn-starter'
,
],
{
cwd
}
)
expect
(
res
.
exitCode
).
toBe
(
0
)
const
files
=
[
'package.json'
,
'pages/index.js'
,
'.gitignore'
,
'package-lock.json'
,
'node_modules/next'
,
]
]
files
.
forEach
((
file
)
=>
files
.
forEach
((
file
)
=>
expect
(
fs
.
existsSync
(
path
.
join
(
cwd
,
projectName
,
file
))).
toBeTruthy
()
expect
(
fs
.
existsSync
(
path
.
join
(
cwd
,
projectName
,
file
))).
toBeTruthy
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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