vue-cli.ts 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Copyright 2019-2021 Tauri Programme within The Commons Conservancy
  2. // SPDX-License-Identifier: Apache-2.0
  3. // SPDX-License-Identifier: MIT
  4. import { Recipe } from '..'
  5. import { join } from 'path'
  6. import { shell } from '../shell'
  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 }) => {
  18. // Vue CLI creates the folder for you
  19. await shell('npx', ['@vue/cli', 'create', `${cfg.appName}`], { cwd })
  20. await shell(
  21. 'npx',
  22. [
  23. '@vue/cli',
  24. 'add',
  25. 'tauri',
  26. '--appName',
  27. `${cfg.appName}`,
  28. '--windowTitle',
  29. `${cfg.windowTitle}`
  30. ],
  31. {
  32. cwd: join(cwd, cfg.appName)
  33. }
  34. )
  35. },
  36. postInit: async () => {
  37. console.log(completeLogMsg)
  38. return await Promise.resolve()
  39. }
  40. }
  41. export { vuecli }