vue-cli.ts 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // Copyright 2019-2021 Tauri Programme within The Commons Conservancy
  2. // SPDX-License-Identifier: Apache-2.0
  3. // SPDX-License-Identifier: MIT
  4. import { join } from 'path'
  5. import { shell } from '../shell'
  6. import { Recipe } from '../types/recipe'
  7. const completeLogMsg = `
  8. Your installation completed.
  9. To start, run yarn tauri:serve
  10. `
  11. const vuecli: Recipe = {
  12. descriptiveName: 'Vue CLI',
  13. shortName: 'vuecli',
  14. extraNpmDevDependencies: [],
  15. extraNpmDependencies: [],
  16. configUpdate: ({ cfg }) => cfg,
  17. preInit: async ({ cwd, cfg, ci, packageManager }) => {
  18. // Vue CLI creates the folder for you
  19. await shell(
  20. 'npx',
  21. [
  22. '@vue/cli',
  23. 'create',
  24. `${cfg.appName}`,
  25. '--packageManager',
  26. packageManager,
  27. ci ? '--default' : ''
  28. ],
  29. { cwd }
  30. )
  31. await shell(
  32. 'npx',
  33. [
  34. '@vue/cli',
  35. 'add',
  36. 'tauri',
  37. '--appName',
  38. `${cfg.appName}`,
  39. '--windowTitle',
  40. `${cfg.windowTitle}`
  41. ],
  42. {
  43. cwd: join(cwd, cfg.appName)
  44. }
  45. )
  46. },
  47. postInit: async () => {
  48. console.log(completeLogMsg)
  49. return await Promise.resolve()
  50. }
  51. }
  52. export { vuecli }