A simple TypeScript CLI for scaffolding Vue.js projects.
Prerequisites: Node.js (>=4.x, 6.x preferred), npm version 3+ and Git.
$ npm install -g vue-clivue init lawrence998/my-typescript-template <project-name>Example:
$ vue init lawrence998/my-typescript-template my-projectThe above command pulls the template from here, prompts for some information, and generates the project at ./my-project/.
i wrote a vue-typescript-demo project for practice, it recorded how I configured it and how to use vue.js with typescript
add
vuexoption at initialization time, it will createsrc/storefolder, and it had configed, like this:
src
├──store
├──actions.ts
├──mutations.ts
├──getters.ts
├──types.ts
add
vue-class-componetby default, and vue perfect support for it, it will make your code more flat and beautiful, you will like it.
-
npm run dev: first-in-class development experience.- Webpack +
vue-loaderfor single file Vue components. - State preserving hot-reload
- State preserving compilation error overlay
- Lint-on-save with ESLint
- Source maps
- Webpack +
-
npm run build: Production ready build.- JavaScript minified with UglifyJS v3.
- HTML minified with html-minifier.
- CSS across all components extracted into a single file and minified with cssnano.
- Static assets compiled with version hashes for efficient long-term caching, and an auto-generated production
index.htmlwith proper URLs to these generated assets. - Use
npm run build --reportto build with bundle size analytics.
-
npm run unit: Unit tests run in JSDOM with Jest, or in PhantomJS with Karma + Mocha + karma-webpack.- Supports ES2015+ in test files.
- Easy mocking
-
npm run e2e: End-to-end tests with Nightwatch.- Run tests in multiple browsers in parallel.
- Works with one command out of the box:
- Selenium and chromedriver dependencies automatically handled.
- Automatically spawns the Selenium server.