Skip to content

Commit 368024e

Browse files
Merge pull request #113 from vuejs/dev
Compare changes across branches, commits, tags, and more below.
2 parents fb67f76 + 96dfd58 commit 368024e

File tree

5 files changed

+59
-20
lines changed

5 files changed

+59
-20
lines changed

packages/@vue/cli-plugin-eslint/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ module.exports = (api, options) => {
2525
'.eslintrc.yml',
2626
'.eslintrc.json',
2727
'.eslintrc',
28+
'.eslintignore',
2829
'package.json'
2930
]
3031
)

packages/@vue/cli-service/lib/commands/build/index.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ module.exports = (api, options) => {
3737
'--report': `generate report.html to help analyze bundle content`,
3838
'--report-json': 'generate report.json to help analyze bundle content',
3939
'--skip-plugins': `comma-separated list of plugin names to skip for this run`,
40-
'--watch': `watch for changes`
40+
'--watch': `watch for changes`,
41+
'--stdin': `close when stdin ends`
4142
}
4243
}, async (args, rawArgs) => {
4344
for (const key in defaults) {
@@ -155,6 +156,13 @@ async function build (args, api, options) {
155156
})
156157
}
157158

159+
if (args.stdin) {
160+
process.stdin.on('end', () => {
161+
process.exit(0)
162+
})
163+
process.stdin.resume()
164+
}
165+
158166
// Expose advanced stats
159167
if (args.dashboard) {
160168
const DashboardPlugin = require('../../webpack/DashboardPlugin')

packages/@vue/cli-service/lib/commands/serve.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,10 @@ module.exports = (api, options) => {
127127

128128
// inject dev & hot-reload middleware entries
129129
if (!isProduction) {
130+
const sockPath = projectDevServerOptions.sockPath || '/sockjs-node'
130131
const sockjsUrl = publicUrl
131132
// explicitly configured via devServer.public
132-
? `?${publicUrl}/sockjs-node`
133+
? `?${publicUrl}&sockPath=${sockPath}`
133134
: isInContainer
134135
// can't infer public network url if inside a container...
135136
// use client-side inference (note this would break with non-root publicPath)
@@ -138,9 +139,8 @@ module.exports = (api, options) => {
138139
: `?` + url.format({
139140
protocol,
140141
port,
141-
hostname: urls.lanUrlForConfig || 'localhost',
142-
pathname: '/sockjs-node'
143-
})
142+
hostname: urls.lanUrlForConfig || 'localhost'
143+
}) + `&sockPath=${sockPath}`
144144
const devClients = [
145145
// dev server client
146146
require.resolve(`webpack-dev-server/client`) + sockjsUrl,

packages/@vue/cli/lib/GeneratorAPI.js

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const mergeDeps = require('./util/mergeDeps')
88
const runCodemod = require('./util/runCodemod')
99
const stringifyJS = require('./util/stringifyJS')
1010
const ConfigTransform = require('./ConfigTransform')
11-
const { semver, getPluginLink, toShortPluginId, loadModule } = require('@vue/cli-shared-utils')
11+
const { semver, error, getPluginLink, toShortPluginId, loadModule } = require('@vue/cli-shared-utils')
1212

1313
const isString = val => typeof val === 'string'
1414
const isFunction = val => typeof val === 'function'
@@ -81,6 +81,20 @@ class GeneratorAPI {
8181
this.generator.fileMiddlewares.push(middleware)
8282
}
8383

84+
/**
85+
* Normalize absolute path, Windows-style path
86+
* to the relative path used as index in this.files
87+
* @param {string} p the path to normalize
88+
*/
89+
_normalizePath (p) {
90+
if (path.isAbsolute(p)) {
91+
p = path.relative(this.generator.context, p)
92+
}
93+
// The `files` tree always use `/` in its index.
94+
// So we need to normalize the path string in case the user passes a Windows path.
95+
return p.replace(/\\/g, '/')
96+
}
97+
8498
/**
8599
* Resolve path for a project.
86100
*
@@ -373,10 +387,20 @@ class GeneratorAPI {
373387
* @param {object} options additional options for the codemod
374388
*/
375389
transformScript (file, codemod, options) {
390+
const normalizedPath = this._normalizePath(file)
391+
376392
this._injectFileMiddleware(files => {
377-
files[file] = runCodemod(
393+
if (typeof files[normalizedPath] === 'undefined') {
394+
error(`Cannot find file ${normalizedPath}`)
395+
return
396+
}
397+
398+
files[normalizedPath] = runCodemod(
378399
codemod,
379-
{ path: this.resolve(file), source: files[file] },
400+
{
401+
path: this.resolve(normalizedPath),
402+
source: files[normalizedPath]
403+
},
380404
options
381405
)
382406
})

packages/@vue/cli/lib/util/ProjectPackageManager.js

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -290,20 +290,26 @@ class PackageManager {
290290
}
291291

292292
async upgrade (packageName) {
293-
const realname = stripVersion(packageName)
294-
if (
295-
isTestOrDebug &&
296-
(packageName === '@vue/cli-service' || isOfficialPlugin(resolvePluginId(realname)))
297-
) {
298-
// link packages in current repo for test
299-
const src = path.resolve(__dirname, `../../../../${realname}`)
300-
const dest = path.join(this.context, 'node_modules', realname)
301-
await fs.remove(dest)
302-
await fs.symlink(src, dest, 'dir')
303-
return
293+
// manage multiple packages separated by spaces
294+
const packageNamesArray = []
295+
296+
for (const packname of packageName.split(' ')) {
297+
const realname = stripVersion(packname)
298+
if (
299+
isTestOrDebug &&
300+
(packname === '@vue/cli-service' || isOfficialPlugin(resolvePluginId(realname)))
301+
) {
302+
// link packages in current repo for test
303+
const src = path.resolve(__dirname, `../../../../${realname}`)
304+
const dest = path.join(this.context, 'node_modules', realname)
305+
await fs.remove(dest)
306+
await fs.symlink(src, dest, 'dir')
307+
} else {
308+
packageNamesArray.push(packname)
309+
}
304310
}
305311

306-
return await this.runCommand('add', [packageName])
312+
if (packageNamesArray.length) return await this.runCommand('add', packageNamesArray)
307313
}
308314
}
309315

0 commit comments

Comments
 (0)