Skip to content

Commit

Permalink
Revert "move all deps to dependencies instead of devDependencies"
Browse files Browse the repository at this point in the history
This reverts commit be4bf6f.
  • Loading branch information
yyx990803 committed Jan 10, 2018
1 parent 3848530 commit cc35923
Show file tree
Hide file tree
Showing 14 changed files with 28 additions and 34 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,4 @@ cd test-app
yarn dev
```

## Plugin Development Guide

See [dedicated section in docs](https://github.com/vuejs/vue-cli/tree/next/docs/Plugin.md).
2 changes: 1 addition & 1 deletion packages/@vue/cli-plugin-babel/generator.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = api => {
api.extendPackage({
dependencies: {
devDependencies: {
'@vue/babel-preset-app': '^3.0.0-alpha.1'
},
babel: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ test('base', async () => {
expect(pkg.eslintConfig).toEqual({
extends: ['plugin:vue/essential', 'eslint:recommended']
})
expect(pkg.dependencies).toHaveProperty('eslint-plugin-vue')
expect(pkg.devDependencies).toHaveProperty('eslint-plugin-vue')
})

test('airbnb', async () => {
Expand All @@ -27,8 +27,8 @@ test('airbnb', async () => {
expect(pkg.eslintConfig).toEqual({
extends: ['plugin:vue/essential', '@vue/airbnb']
})
expect(pkg.dependencies).toHaveProperty('eslint-plugin-vue')
expect(pkg.dependencies).toHaveProperty('@vue/eslint-config-airbnb')
expect(pkg.devDependencies).toHaveProperty('eslint-plugin-vue')
expect(pkg.devDependencies).toHaveProperty('@vue/eslint-config-airbnb')
})

test('standard', async () => {
Expand All @@ -44,8 +44,8 @@ test('standard', async () => {
expect(pkg.eslintConfig).toEqual({
extends: ['plugin:vue/essential', '@vue/standard']
})
expect(pkg.dependencies).toHaveProperty('eslint-plugin-vue')
expect(pkg.dependencies).toHaveProperty('@vue/eslint-config-standard')
expect(pkg.devDependencies).toHaveProperty('eslint-plugin-vue')
expect(pkg.devDependencies).toHaveProperty('@vue/eslint-config-standard')
})

test('lint on save', async () => {
Expand Down
14 changes: 5 additions & 9 deletions packages/@vue/cli-plugin-eslint/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,17 @@ module.exports = (api, { config, lintOn }) => {
eslintConfig: {
extends: ['plugin:vue/essential']
},
dependencies: {
devDependencies: {
'eslint-plugin-vue': '^4.1.0'
}
}

if (config === 'airbnb') {
pkg.eslintConfig.extends.push('@vue/airbnb')
Object.assign(pkg.dependencies, {
'@vue/eslint-config-airbnb': '^3.0.0-alpha.1'
})
pkg.devDependencies['@vue/eslint-config-airbnb'] = '^0.1.0'
} else if (config === 'standard') {
pkg.eslintConfig.extends.push('@vue/standard')
Object.assign(pkg.dependencies, {
'@vue/eslint-config-standard': '^3.0.0-alpha.1'
})
pkg.devDependencies['@vue/eslint-config-standard'] = '^0.1.0'
} else if (config === 'prettier') {
// TODO
} else {
Expand All @@ -35,9 +31,9 @@ module.exports = (api, { config, lintOn }) => {
}

if (lintOn === 'commit') {
pkg.devDependencies = {
Object.assign(pkg.devDependencies, {
'lint-staged': '^6.0.0'
}
})
pkg.gitHooks = {
'pre-commit': 'lint-staged'
}
Expand Down
Empty file.
Empty file.
2 changes: 1 addition & 1 deletion packages/@vue/cli-plugin-unit-jest/generator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module.exports = (api, options) => {
scripts: {
test: 'vue-cli-service test'
},
dependencies: {
devDependencies: {
'@vue/test-utils': '^1.0.0-beta.10'
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ test('base', async () => {
])

expect(pkg.scripts.test).toBeTruthy()
expect(pkg.dependencies).toHaveProperty('@vue/test-utils')
expect(pkg.devDependencies).toHaveProperty('@vue/test-utils')
expect(files['test/unit/.eslintrc']).toMatch('"mocha": true')
expect(files['test/unit/HelloWorld.spec.js']).toMatch('// assert wrapper.text() equals msg')
})
Expand All @@ -33,7 +33,7 @@ test('chai', async () => {
])

expect(pkg.scripts.test).toBeTruthy()
expect(pkg.dependencies).toHaveProperty('@vue/test-utils')
expect(pkg.devDependencies).toHaveProperty('@vue/test-utils')

const spec = files['test/unit/HelloWorld.spec.js']
expect(spec).toMatch(`import { expect } from 'chai'`)
Expand All @@ -52,7 +52,7 @@ test('expect', async () => {
])

expect(pkg.scripts.test).toBeTruthy()
expect(pkg.dependencies).toHaveProperty('@vue/test-utils')
expect(pkg.devDependencies).toHaveProperty('@vue/test-utils')

const spec = files['test/unit/HelloWorld.spec.js']
expect(spec).toMatch(`import expect from 'expect'`)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
module.exports = (api, options) => {
api.render('./template')

const dependencies = {
const devDependencies = {
'@vue/test-utils': '^1.0.0-beta.10'
}
if (options.assertionLibrary === 'chai') {
dependencies.chai = '^4.1.2'
devDependencies.chai = '^4.1.2'
} else if (options.assertionLibrary === 'expect') {
dependencies.expect = '^22.0.3'
devDependencies.expect = '^22.0.3'
}

api.extendPackage({
dependencies,
devDependencies,
scripts: {
test: 'vue-cli-service test'
}
Expand Down
2 changes: 1 addition & 1 deletion packages/@vue/cli-service/__tests__/Service.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ test('env loading', () => {

test('loading plugins from package.json', () => {
mockPkg({
dependencies: {
devDependencies: {
'bar': '^1.0.0',
'@vue/cli-plugin-babel': '^3.0.0-alpha.1',
'vue-cli-plugin-foo': '^1.0.0'
Expand Down
6 changes: 4 additions & 2 deletions packages/@vue/cli-service/generator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ module.exports = (api, options) => {
'build': 'vue-cli-service build'
},
dependencies: {
'vue': '^2.5.13',
'vue': '^2.5.13'
},
devDependencies: {
'vue-template-compiler': '^2.5.13'
},
'postcss': {
Expand Down Expand Up @@ -60,7 +62,7 @@ module.exports = (api, options) => {
}

api.extendPackage({
dependencies: deps[options.cssPreprocessor]
devDependencies: deps[options.cssPreprocessor]
})
}
}
3 changes: 1 addition & 2 deletions packages/@vue/cli/lib/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ exports.defaults = {
plugins: {
'@vue/cli-plugin-babel': {},
'@vue/cli-plugin-eslint': { config: 'base', lintOn: 'save' },
'@vue/cli-plugin-unit-mocha-webpack': { assertionLibrary: 'chai' },
'@vue/cli-plugin-pwa': {}
'@vue/cli-plugin-unit-mocha-webpack': { assertionLibrary: 'chai' }
}
}

Expand Down
4 changes: 2 additions & 2 deletions packages/@vue/cli/lib/util/installDeps.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ module.exports = async function installDeps (targetDir, command, deps, cliRegist
if (command === 'npm') {
args.push('install', '--loglevel', 'error')
if (deps) {
args.push('--save')
args.push('--save-dev')
}
} else if (command === 'yarn') {
if (deps) {
args.push('add')
args.push('add', '--dev')
}
} else {
throw new Error(`unknown package manager: ${command}`)
Expand Down
3 changes: 1 addition & 2 deletions packages/@vue/cli/lib/util/setupDevProject.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ const mkdirp = require('mkdirp')

module.exports = function setupDevProject (targetDir, deps) {
const pkg = require(path.resolve(targetDir, 'package.json'))
pkg.dependencies = {}
pkg.devDependencies = {}
deps.forEach(dep => {
pkg.dependencies[dep] = require(path.resolve(
pkg.devDependencies[dep] = require(path.resolve(
__dirname,
'../../../../',
dep,
Expand Down

0 comments on commit cc35923

Please sign in to comment.