index.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. module.exports = (api, options) => {
  2. api.render('./template', {
  3. doesCompile: api.hasPlugin('babel') || api.hasPlugin('typescript')
  4. })
  5. api.extendPackage({
  6. scripts: {
  7. 'serve': 'vue-cli-service serve',
  8. 'build': 'vue-cli-service build'
  9. },
  10. dependencies: {
  11. 'vue': '^2.6.10'
  12. },
  13. devDependencies: {
  14. 'vue-template-compiler': '^2.5.21'
  15. },
  16. 'postcss': {
  17. 'plugins': {
  18. 'autoprefixer': {}
  19. }
  20. },
  21. browserslist: [
  22. '> 1%',
  23. 'last 2 versions'
  24. ]
  25. })
  26. if (options.router) {
  27. require('./router')(api, options)
  28. }
  29. if (options.vuex) {
  30. require('./vuex')(api, options)
  31. }
  32. if (options.cssPreprocessor) {
  33. const deps = {
  34. // TODO: remove 'sass' option in v4 or rename 'dart-sass' to 'sass'
  35. sass: {
  36. 'node-sass': '^4.9.0',
  37. 'sass-loader': '^7.1.0'
  38. },
  39. 'node-sass': {
  40. 'node-sass': '^4.9.0',
  41. 'sass-loader': '^7.1.0'
  42. },
  43. 'dart-sass': {
  44. sass: '^1.18.0',
  45. 'sass-loader': '^7.1.0'
  46. },
  47. less: {
  48. 'less': '^3.0.4',
  49. 'less-loader': '^4.1.0'
  50. },
  51. stylus: {
  52. 'stylus': '^0.54.5',
  53. 'stylus-loader': '^3.0.2'
  54. }
  55. }
  56. api.extendPackage({
  57. devDependencies: deps[options.cssPreprocessor]
  58. })
  59. }
  60. // additional tooling configurations
  61. if (options.configs) {
  62. api.extendPackage(options.configs)
  63. }
  64. }