From db72c5b7f532bfa3475d68c9b2716d90f8dcacd9 Mon Sep 17 00:00:00 2001 From: liyang <1711467488@qq.com> Date: Mon, 16 Jul 2018 10:54:24 +0800 Subject: [PATCH] cli3-init Former-commit-id: c2208822160c869725ca1e2d8090efe8a26ef205 [formerly c2208822160c869725ca1e2d8090efe8a26ef205 [formerly c2208822160c869725ca1e2d8090efe8a26ef205 [formerly c2208822160c869725ca1e2d8090efe8a26ef205 [formerly 9d32806619ec7dfd268d8d1d489788a4b93ef8f2 [formerly a0b8d05dbd65ff11909125a63f47863d9943338b]]]]] Former-commit-id: 5318442d566c59f1669e14f467c8c6308155b2a3 Former-commit-id: 0a29bf225a6b939c13728547e95135d23cd6fbb2 Former-commit-id: 75bc94d9ae5e57f7d78974b65a11c5ec36a7d07d [formerly 8e22212a884eb010c619bf4eac6fa06b52005cf5] Former-commit-id: a00d38cadcd10bae7c00c0a7034dbe6d6b2e2060 Former-commit-id: 4cbc35132e5844bcff3b59c9bfcb505642fecf42 Former-commit-id: c4ab1140d261a2a9193657dc381e5094e007eaa3 Former-commit-id: 56c01e286f6c12116c7075a6a67a19b6d9ad5011 Former-commit-id: 34106a945900d8125f21e803b450b0e9591f0d53 --- .eslintrc.js | 17 ++++++++++ .gitignore | 21 ++++++++++++ .postcssrc.js | 5 +++ babel.config.js | 5 +++ jest.config.js | 22 +++++++++++++ package.json | 34 ++++++++++++++++++++ public/favicon.ico | Bin 0 -> 1150 bytes public/index.html | 17 ++++++++++ src/App.vue | 29 +++++++++++++++++ src/components/HelloWorld.vue | 58 ++++++++++++++++++++++++++++++++++ src/main.js | 12 +++++++ src/router.js | 21 ++++++++++++ src/store.js | 16 ++++++++++ src/views/About.vue | 5 +++ src/views/Home.vue | 18 +++++++++++ tests/unit/.eslintrc.js | 8 +++++ tests/unit/HelloWorld.spec.js | 12 +++++++ yarn.lock.REMOVED.git-id | 1 + 18 files changed, 301 insertions(+) create mode 100644 .eslintrc.js create mode 100644 .gitignore create mode 100644 .postcssrc.js create mode 100644 babel.config.js create mode 100644 jest.config.js create mode 100644 package.json create mode 100644 public/favicon.ico create mode 100644 public/index.html create mode 100644 src/App.vue create mode 100644 src/components/HelloWorld.vue create mode 100644 src/main.js create mode 100644 src/router.js create mode 100644 src/store.js create mode 100644 src/views/About.vue create mode 100644 src/views/Home.vue create mode 100644 tests/unit/.eslintrc.js create mode 100644 tests/unit/HelloWorld.spec.js create mode 100644 yarn.lock.REMOVED.git-id diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 00000000..a1fd69fc --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,17 @@ +module.exports = { + root: true, + env: { + node: true + }, + 'extends': [ + 'plugin:vue/essential', + '@vue/standard' + ], + rules: { + 'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off', + 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off' + }, + parserOptions: { + parser: 'babel-eslint' + } +} \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..185e6631 --- /dev/null +++ b/.gitignore @@ -0,0 +1,21 @@ +.DS_Store +node_modules +/dist + +# local env files +.env.local +.env.*.local + +# Log files +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Editor directories and files +.idea +.vscode +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw* diff --git a/.postcssrc.js b/.postcssrc.js new file mode 100644 index 00000000..100cc012 --- /dev/null +++ b/.postcssrc.js @@ -0,0 +1,5 @@ +module.exports = { + plugins: { + autoprefixer: {} + } +} \ No newline at end of file diff --git a/babel.config.js b/babel.config.js new file mode 100644 index 00000000..ba179669 --- /dev/null +++ b/babel.config.js @@ -0,0 +1,5 @@ +module.exports = { + presets: [ + '@vue/app' + ] +} diff --git a/jest.config.js b/jest.config.js new file mode 100644 index 00000000..40186da6 --- /dev/null +++ b/jest.config.js @@ -0,0 +1,22 @@ +module.exports = { + moduleFileExtensions: [ + 'js', + 'jsx', + 'json', + 'vue' + ], + transform: { + '^.+\\.vue$': 'vue-jest', + '.+\\.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$': 'jest-transform-stub', + '^.+\\.jsx?$': 'babel-jest' + }, + moduleNameMapper: { + '^@/(.*)$': '/src/$1' + }, + snapshotSerializers: [ + 'jest-serializer-vue' + ], + testMatch: [ + '**/tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)' + ] +} diff --git a/package.json b/package.json new file mode 100644 index 00000000..98c51196 --- /dev/null +++ b/package.json @@ -0,0 +1,34 @@ +{ + "name": "d2", + "version": "0.1.0", + "private": true, + "scripts": { + "serve": "vue-cli-service serve", + "build": "vue-cli-service build", + "lint": "vue-cli-service lint", + "test:unit": "vue-cli-service test:unit" + }, + "dependencies": { + "vue": "^2.5.16", + "vue-router": "^3.0.1", + "vuex": "^3.0.1" + }, + "devDependencies": { + "@vue/cli-plugin-babel": "^3.0.0-rc.4", + "@vue/cli-plugin-eslint": "^3.0.0-rc.4", + "@vue/cli-plugin-unit-jest": "^3.0.0-rc.4", + "@vue/cli-service": "^3.0.0-rc.4", + "@vue/eslint-config-standard": "^3.0.0-rc.4", + "@vue/test-utils": "^1.0.0-beta.20", + "babel-core": "7.0.0-bridge.0", + "babel-jest": "^23.0.1", + "node-sass": "^4.9.0", + "sass-loader": "^7.0.1", + "vue-template-compiler": "^2.5.16" + }, + "browserslist": [ + "> 1%", + "last 2 versions", + "not ie <= 8" + ] +} \ No newline at end of file diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..c7b9a43c8cd16d0b434adaf513fcacb340809a11 GIT binary patch literal 1150 zcmchVOGsN$5QZm2NTI$erQpKHrdQX(jn+pVxKN`Ng)RzW5+8_2Xb@Y)Dkd6tq9V8u z3WAh^C@KZ1kA;tohzs}b3NC_*QmUXr$oP*rH(2mdT{z*(KX=aj=bX$9kqMvFRKj;Q zwI&d~A);J>5-PDega~WT5us%#Dc(Y}C4WpP?+fS;FaZ*z_CFzgiW=w{I02=q_TUz( z?=^H2uwoIK1n%|Ay21~QgjV1emYtWttJdz^L#=DjJ@Ex*9UPc*7<=rZo*_NAh4PxA zqkso~Ioa1y$e+3kIkXi29YNLi&lW}vY6C}ut4{8ou(7w=$_=$v{yJ$h?y!&bJfq*( zL_NQRF37$6e>%9erGV?p^lRFD?|5J_eupXaS;QluyrOmBT>PJhirMYb*i?(4Tf=j~?VvnUlY_ zDCVuuk3E&T9aP~Cr-0i-MaKUjf_|U!=R&t}_CfD=d${p~HH`BPaqb9aXT}UI$iGRg z>0^GlZ`vM4?;$*LhfI(RG|XK4GF+@-W*W}YJT5&2N_ZyZuaM_Ry=%PWx>r0P(Rc?> jRc4}SfGA>*agjwN{7E7DEm(*)%rSx{B0<6wBoglxJAy|R literal 0 HcmV?d00001 diff --git a/public/index.html b/public/index.html new file mode 100644 index 00000000..59293660 --- /dev/null +++ b/public/index.html @@ -0,0 +1,17 @@ + + + + + + + + d2 + + + +
+ + + diff --git a/src/App.vue b/src/App.vue new file mode 100644 index 00000000..f300d4b4 --- /dev/null +++ b/src/App.vue @@ -0,0 +1,29 @@ + + + diff --git a/src/components/HelloWorld.vue b/src/components/HelloWorld.vue new file mode 100644 index 00000000..347413ce --- /dev/null +++ b/src/components/HelloWorld.vue @@ -0,0 +1,58 @@ + + + + + + diff --git a/src/main.js b/src/main.js new file mode 100644 index 00000000..f2534569 --- /dev/null +++ b/src/main.js @@ -0,0 +1,12 @@ +import Vue from 'vue' +import App from './App.vue' +import router from './router' +import store from './store' + +Vue.config.productionTip = false + +new Vue({ + router, + store, + render: h => h(App) +}).$mount('#app') diff --git a/src/router.js b/src/router.js new file mode 100644 index 00000000..9e03a620 --- /dev/null +++ b/src/router.js @@ -0,0 +1,21 @@ +import Vue from 'vue' +import Router from 'vue-router' +import Home from './views/Home.vue' +import About from './views/About.vue' + +Vue.use(Router) + +export default new Router({ + routes: [ + { + path: '/', + name: 'home', + component: Home + }, + { + path: '/about', + name: 'about', + component: About + } + ] +}) diff --git a/src/store.js b/src/store.js new file mode 100644 index 00000000..3c7424ed --- /dev/null +++ b/src/store.js @@ -0,0 +1,16 @@ +import Vue from 'vue' +import Vuex from 'vuex' + +Vue.use(Vuex) + +export default new Vuex.Store({ + state: { + + }, + mutations: { + + }, + actions: { + + } +}) diff --git a/src/views/About.vue b/src/views/About.vue new file mode 100644 index 00000000..3fa28070 --- /dev/null +++ b/src/views/About.vue @@ -0,0 +1,5 @@ + diff --git a/src/views/Home.vue b/src/views/Home.vue new file mode 100644 index 00000000..a808facc --- /dev/null +++ b/src/views/Home.vue @@ -0,0 +1,18 @@ + + + diff --git a/tests/unit/.eslintrc.js b/tests/unit/.eslintrc.js new file mode 100644 index 00000000..4e51c63f --- /dev/null +++ b/tests/unit/.eslintrc.js @@ -0,0 +1,8 @@ +module.exports = { + env: { + jest: true + }, + rules: { + 'import/no-extraneous-dependencies': 'off' + } +} \ No newline at end of file diff --git a/tests/unit/HelloWorld.spec.js b/tests/unit/HelloWorld.spec.js new file mode 100644 index 00000000..f84fb39d --- /dev/null +++ b/tests/unit/HelloWorld.spec.js @@ -0,0 +1,12 @@ +import { shallowMount } from '@vue/test-utils' +import HelloWorld from '@/components/HelloWorld.vue' + +describe('HelloWorld.vue', () => { + it('renders props.msg when passed', () => { + const msg = 'new message' + const wrapper = shallowMount(HelloWorld, { + propsData: { msg } + }) + expect(wrapper.text()).toMatch(msg) + }) +}) diff --git a/yarn.lock.REMOVED.git-id b/yarn.lock.REMOVED.git-id new file mode 100644 index 00000000..df942698 --- /dev/null +++ b/yarn.lock.REMOVED.git-id @@ -0,0 +1 @@ +f86be2ff240e43e97e65b73fe64bd79f71780d17 \ No newline at end of file