跳至主要內容

apzs...大约 7 分钟

1、yarn create vite

yarn init vite命令只能生成个package.json文件,不能用于生成vue项目

使用Vite快速构建Vue3+ts+pinia脚手架_vite 脚手架_格格巫 MMQ!!的博客-CSDN博客open in new window

D:\test2>yarn create vite
yarn create v1.22.19
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed "[email protected]" with binaries:
      - create-vite
      - cva
√ Project name: ... yarn-create-vite
√ Select a framework: » Vue
√ Select a variant: » Customize with create-vue ↗
yarn create v1.22.19
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...

success Installed "[email protected]" with binaries:
      - create-vue
[####] 4/4
Vue.js - The Progressive JavaScript Framework

√ Add TypeScript? ... No / Yes
√ Add JSX Support? ... No / Yes
√ Add Vue Router for Single Page Application development? ... No / Yes
√ Add Pinia for state management? ... No / Yes
√ Add Vitest for Unit Testing? ... No / Yes
√ Add an End-to-End Testing Solution? » No
√ Add ESLint for code quality? ... No / Yes
√ Add Prettier for code formatting? ... No / Yes

Scaffolding project in D:\test2\yarn-create-vite...

Done. Now run:

  cd yarn-create-vite
  yarn
  yarn format
  yarn dev

Done in 16.70s.
Done in 52.87s.
image-20230328203706875
image-20230328203706875
image-20230328213026108
image-20230328213026108
image-20230328213058494
image-20230328213058494

2、npm init vitenpm create vite

npm init vite

D:\test2>npm init vite
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
Need to install the following packages:
  create-vite
Ok to proceed? (y) y
√ Project name: ... npm-init-vite
√ Select a framework: » Vue
√ Select a variant: » Customize with create-vue ↗
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
Need to install the following packages:
  create-vue@latest
Ok to proceed? (y) y

Vue.js - The Progressive JavaScript Framework

√ Add TypeScript? ... No / Yes
√ Add JSX Support? ... No / Yes
√ Add Vue Router for Single Page Application development? ... No / Yes
√ Add Pinia for state management? ... No / Yes
√ Add Vitest for Unit Testing? ... No / Yes
√ Add an End-to-End Testing Solution? » No
√ Add ESLint for code quality? ... No / Yes
√ Add Prettier for code formatting? ... No / Yes

Scaffolding project in D:\test2\npm-init-vite...

Done. Now run:

  cd npm-init-vite
  npm install
  npm run format
  npm run dev
image-20230328171353507
image-20230328171353507
image-20230328212508325
image-20230328212508325
image-20230328212405311
image-20230328212405311

npm create vite

D:\test2>npm create vite
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
√ Project name: ... npm-create-vite
√ Select a framework: » Vue
√ Select a variant: » Customize with create-vue ↗
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.

Vue.js - The Progressive JavaScript Framework

√ Add TypeScript? ... No / Yes
√ Add JSX Support? ... No / Yes
√ Add Vue Router for Single Page Application development? ... No / Yes
√ Add Pinia for state management? ... No / Yes
√ Add Vitest for Unit Testing? ... No / Yes
√ Add an End-to-End Testing Solution? » No
√ Add ESLint for code quality? ... No / Yes
√ Add Prettier for code formatting? ... No / Yes

Scaffolding project in D:\test2\npm-create-vite...

Done. Now run:

  cd npm-create-vite
  npm install
  npm run format
  npm run dev
image-20230328171511862
image-20230328171511862
image-20230328212556458
image-20230328212556458
image-20230328211949579
image-20230328211949579

3、yarn create vue

D:\test2>yarn create vue
yarn create v1.22.19
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed "[email protected]" with binaries:
      - create-vue
[####] 4/4
Vue.js - The Progressive JavaScript Framework

√ Project name: ... yarn-create-vue
√ Add TypeScript? ... No / Yes
√ Add JSX Support? ... No / Yes
√ Add Vue Router for Single Page Application development? ... No / Yes
√ Add Pinia for state management? ... No / Yes
√ Add Vitest for Unit Testing? ... No / Yes
√ Add an End-to-End Testing Solution? » No
√ Add ESLint for code quality? ... No / Yes
√ Add Prettier for code formatting? ... No / Yes

Scaffolding project in D:\test2\yarn-create-vue...

Done. Now run:

  cd yarn-create-vue
  yarn
  yarn format
  yarn dev

Done in 39.82s.
image-20230328214427401
image-20230328214427401
image-20230328214800105
image-20230328214800105
image-20230328214750469
image-20230328214750469

4、npm init vue

D:\test2>npm init vue
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
Need to install the following packages:
  create-vue
Ok to proceed? (y) y

Vue.js - The Progressive JavaScript Framework

√ Project name: ... npm-init-vue
√ Add TypeScript? ... No / Yes
√ Add JSX Support? ... No / Yes
√ Add Vue Router for Single Page Application development? ... No / Yes
√ Add Pinia for state management? ... No / Yes
√ Add Vitest for Unit Testing? ... No / Yes
√ Add an End-to-End Testing Solution? » No
√ Add ESLint for code quality? ... No / Yes
√ Add Prettier for code formatting? ... No / Yes

Scaffolding project in D:\test2\npm-init-vue...

Done. Now run:

  cd npm-init-vue
  npm install
  npm run format
  npm run dev
image-20230328171618683
image-20230328171618683
image-20230328212823806
image-20230328212823806
image-20230328212811502
image-20230328212811502

5、vue init webpack 项目名(不推荐)

使用该方式创建的仓库为vuex,而不是pinia

image-20230328211513056
image-20230328211513056
D:\test2>vue init webpack vue-init-webpack

? Project name vue-init-webpack
? Project description vue测试项目
? Author apzs <[email protected]>
? Vue build standalone
? Install vue-router? Yes
? Use ESLint to lint your code? Yes
? Pick an ESLint preset Standard
? Set up unit tests No
? Setup e2e tests with Nightwatch? No
? Should we run `npm install` for you after the project has been created? (recommended) npm

   vue-cli · Generated "vue-init-webpack".


##  Installing project dependencies ...
##  ========================

npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated [email protected]: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated [email protected]: flatten is deprecated in favor of utility frameworks such as lodash.
npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated [email protected]: This loader has been deprecated. Please use eslint-webpack-plugin
npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated [email protected]: This is probably built in to whatever tool you're using. If you still need it... idk
npm WARN deprecated [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated [email protected]: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependenciesnpm WARN deprecated [email protected]: CircularJSON is in maintenance only, flatted is its successor.
npm WARN deprecated [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated [email protected]: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependenciesnpm WARN deprecated [email protected]: out of support
npm WARN deprecated [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated [email protected]: Deprecated. Please use https://github.com/webpack-contrib/mini-css-extract-plugin
npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
npm WARN deprecated [email protected]: support for ECMAScript is superseded by `uglify-js` as of v3.13.0
npm WARN deprecated [email protected]: Switch to the `bfj` package for fixes and new features!
npm WARN deprecated [email protected]: This SVGO version is no longer supported. Upgrade to v2.x.x.
npm WARN deprecated [email protected]: This SVGO version is no longer supported. Upgrade to v2.x.x.
npm WARN deprecated [email protected]: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.

added 1482 packages in 2m


Running eslint --fix to comply with chosen preset rules...
##  ========================


> [email protected] lint
> eslint --ext .js,.vue src "--fix"


##  Project initialization finished!
##  ========================

To get started:

  cd vue-init-webpack
  npm run dev

Documentation can be found at https://vuejs-templates.github.io/webpack
image-20230328213220205
image-20230328213220205
image-20230328213224921
image-20230328213224921

6、vue create 项目名(不推荐)

使用该方式创建的仓库为vuex,而不是pinia

D:\test2>vue create vue-create


Vue CLI v5.0.8
? Please pick a preset: Manually select features
? Check the features needed for your project: Babel, TS, PWA, Router, Vuex, CSS Pre-processors, Linter
? Choose a version of Vue.js that you want to start the project with 3.x
? Use class-style component syntax? Yes
? Use Babel alongside TypeScript (required for modern mode, auto-detected polyfills, transpiling JSX)? Yes
? Use history mode for router? (Requires proper server setup for index fallback in production) Yes
? Pick a CSS pre-processor (PostCSS, Autoprefixer and CSS Modules are supported by default): Sass/SCSS (with dart-sass)
? Pick a linter / formatter config: Basic
? Pick additional lint features: Lint on save
? Where do you prefer placing config for Babel, ESLint, etc.? In package.json
? Save this as a preset for future projects? No


Vue CLI v5.0.8
✨  Creating project in D:\test2\vue-create.
🗃  Initializing git repository...
⚙️  Installing CLI plugins. This might take a while...

yarn install v1.22.19
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...

success Saved lockfile.
Done in 69.27s.
🚀  Invoking generators...
📦  Installing additional dependencies...

yarn install v1.22.19
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...

success Saved lockfile.
Done in 21.36s.
⚓  Running completion hooks...

📄  Generating README.md...

🎉  Successfully created project vue-create.
👉  Get started with the following commands:

 $ cd vue-create
 $ yarn serve
image-20230328213624686
image-20230328213624686
image-20230328213802532
image-20230328213802532
image-20230328213806460
image-20230328213806460

7、vue ui

vue ui可以方便地管理项目,包括插件依赖配置运行项目等,但是不能选择打包工具,不能使用pinia(可以选择包管理工具)

D:\test2>vue ui
🚀  Starting GUI...
🌠  Ready on http://localhost:8000
image-20230328215943769
image-20230328215943769
image-20230328215018154
image-20230328215018154
image-20230328215054534
image-20230328215054534
image-20230328215116544
image-20230328215116544
image-20230328215255244
image-20230328215255244
image-20230328215341411
image-20230328215341411
image-20230328215357794
image-20230328215357794

这个过程需要等一会

image-20230328215410226
image-20230328215410226
image-20230328215600577
image-20230328215600577
image-20230328215706790
image-20230328215706790
image-20230328215728854
image-20230328215728854
image-20230328215740960
image-20230328215740960
image-20230328215757821
image-20230328215757821
image-20230328215808670
image-20230328215808670
评论
  • 按正序
  • 按倒序
  • 按热度
Powered by Waline v3.0.0-alpha.8