Skip to content

Commit 15a9427

Browse files
committed
chore: tab to spaces
1 parent ebce8ab commit 15a9427

File tree

1 file changed

+39
-39
lines changed

1 file changed

+39
-39
lines changed

packages/create-nextjs/index.js

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -6,56 +6,56 @@ const readPkgUp = require('read-pkg-up')
66
const writePkg = require('write-pkg')
77

88
module.exports = async (options = {}) => {
9-
const packageResult = readPkgUp.sync({
10-
cwd: options.cwd,
11-
normalize: false
12-
}) || {}
13-
const packageJson = packageResult.package || {}
14-
const packagePath = packageResult.path || path.resolve(options.cwd || process.cwd(), 'package.json')
15-
const packageCwd = path.dirname(packagePath)
16-
17-
packageJson.scripts = packageJson.scripts || {}
18-
19-
const s = packageJson.scripts
20-
s['build:nextjs'] = 'taro build --type nextjs'
9+
const packageResult = readPkgUp.sync({
10+
cwd: options.cwd,
11+
normalize: false
12+
}) || {}
13+
const packageJson = packageResult.package || {}
14+
const packagePath = packageResult.path || path.resolve(options.cwd || process.cwd(), 'package.json')
15+
const packageCwd = path.dirname(packagePath)
16+
17+
packageJson.scripts = packageJson.scripts || {}
18+
19+
const s = packageJson.scripts
20+
s['build:nextjs'] = 'taro build --type nextjs'
2121
s['dev:nextjs'] = 'npm run build:nextjs -- --watch'
2222

23-
writePkg.sync(packagePath, packageJson, {normalize: false})
23+
writePkg.sync(packagePath, packageJson, {normalize: false})
2424

25-
if (options.skipInstall) {
26-
return
27-
}
25+
if (options.skipInstall) {
26+
return
27+
}
2828

2929
const nextTag = 'next'
30-
const pluginTag = 'tarojs-plugin-platform-nextjs'
30+
const pluginTag = 'tarojs-plugin-platform-nextjs'
3131

32-
if (hasYarn(packageCwd)) {
33-
const yarnArguments = ['add', nextTag, pluginTag]
32+
if (hasYarn(packageCwd)) {
33+
const yarnArguments = ['add', nextTag, pluginTag]
3434

35-
try {
36-
await execa('yarn', yarnArguments, {
37-
cwd: packageCwd,
38-
stdio: 'inherit'
39-
})
40-
} catch (error) {
41-
if (error.code === 'ENOENT') {
42-
console.error('This project uses Yarn but you don\'t seem to have Yarn installed.\nRun `npm install --global yarn` to install it.')
43-
return
44-
}
35+
try {
36+
await execa('yarn', yarnArguments, {
37+
cwd: packageCwd,
38+
stdio: 'inherit'
39+
})
40+
} catch (error) {
41+
if (error.code === 'ENOENT') {
42+
console.error('This project uses Yarn but you don\'t seem to have Yarn installed.\nRun `npm install --global yarn` to install it.')
43+
return
44+
}
4545

46-
throw error
47-
}
46+
throw error
47+
}
4848

49-
return
50-
}
49+
return
50+
}
5151

52-
const npmArguments = ['install']
52+
const npmArguments = ['install']
5353

5454
npmArguments.push(nextTag)
55-
npmArguments.push(pluginTag)
55+
npmArguments.push(pluginTag)
5656

57-
await execa('npm', npmArguments, {
58-
cwd: packageCwd,
59-
stdio: 'inherit'
60-
})
57+
await execa('npm', npmArguments, {
58+
cwd: packageCwd,
59+
stdio: 'inherit'
60+
})
6161
}

0 commit comments

Comments
 (0)