├── .babelrc ├── .gitignore ├── README.md ├── dev ├── App.vue └── main.js ├── dist ├── index.js ├── index.txt ├── style.css └── style.css.map ├── index.html ├── package.json ├── src ├── easteregg.vue └── index.js ├── test ├── index.js ├── karma.conf.js └── specs │ └── idb.spec.js ├── webpack.config.js └── yarn.lock /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": [ "transform-object-rest-spread", "transform-async-to-generator", "transform-class-properties" ], 3 | "presets": [ "env", "stage-0" ] 4 | } 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # nyc test coverage 21 | .nyc_output 22 | 23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # Bower dependency directory (https://bower.io/) 27 | bower_components 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (http://nodejs.org/api/addons.html) 33 | build/Release 34 | 35 | # Dependency directories 36 | node_modules/ 37 | jspm_packages/ 38 | 39 | # Typescript v1 declaration files 40 | typings/ 41 | 42 | # Optional npm cache directory 43 | .npm 44 | 45 | # Optional eslint cache 46 | .eslintcache 47 | 48 | # Optional REPL history 49 | .node_repl_history 50 | 51 | # Output of 'npm pack' 52 | *.tgz 53 | 54 | # Yarn Integrity file 55 | .yarn-integrity 56 | 57 | # dotenv environment variables file 58 | .env 59 | 60 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # VUE3 Version: https://github.com/ddgll/vue3-easteregg 2 | 3 | 4 | # vue-easteregg 5 | 6 | ADD an easter egg to your vue app ;) 7 | 8 | ``` javascript 9 | 15 | 16 | 44 | ``` 45 | -------------------------------------------------------------------------------- /dev/App.vue: -------------------------------------------------------------------------------- 1 | 15 | 16 | 47 | 48 | 51 | -------------------------------------------------------------------------------- /dev/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App.vue' 3 | 4 | 5 | new Vue({ 6 | el: '#app', 7 | render: h => h(App) 8 | }) 9 | -------------------------------------------------------------------------------- /dist/index.js: -------------------------------------------------------------------------------- 1 | !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.VueEasterEgg=t():e.VueEasterEgg=t()}(this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){return e&&e.__esModule?e:{default:e}}(r(1));t.default=n.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(4),o=r.n(n),i=r(5),u=r(3)(o.a,i.a,!1,function(e){r(2)},null,null);t.default=u.exports},function(e,t){},function(e,t){e.exports=function(e,t,r,n,o,i){var u,s=e=e||{},f=typeof e.default;"object"!==f&&"function"!==f||(u=e,s=e.default);var a="function"==typeof s?s.options:s;t&&(a.render=t.render,a.staticRenderFns=t.staticRenderFns,a._compiled=!0),r&&(a.functional=!0),o&&(a._scopeId=o);var c;if(i?(c=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),n&&n.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(i)},a._ssrRegister=c):n&&(c=n),c){var l=a.functional,d=l?a.render:a.beforeCreate;l?a.render=function(e,t){return c.call(t),d(e,t)}:a.beforeCreate=d?[].concat(d,c):[c]}return{esModule:u,exports:s,options:a}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={name:"easteregg",props:["eggs","duration"],data:function(){return{buffer:[],timer:null,visible:!1}},eggs:[["ArrowUp","ArrowUp","ArrowDown","ArrowDown","ArrowLeft","ArrowRight","ArrowLeft","ArrowRight","b","a"],["ArrowUp","ArrowUp","ArrowDown","ArrowDown","ArrowLeft","ArrowRight","ArrowLeft","ArrowRight","B","A"],["8","8","2","2","4","6","4","6","b","a"],["8","8","2","2","4","6","4","6","B","A"]],methods:{resetBuffer:function(){this.timer&&clearTimeout(this.timer),this.buffer=[]},resetEasterEgg:function(){this.timer&&clearTimeout(this.timer),this.buffer=[],this.visible=!1}},mounted:function(){var e=this;document.addEventListener("keyup",function(t){e.timer&&clearTimeout(e.timer),e.buffer.push(t.key);var r=e.eggs?e.eggs:e.$options.eggs,o=!0,i=!1,u=void 0;try{for(var s,f=r[Symbol.iterator]();!(o=(s=f.next()).done);o=!0){var a=s.value;if(n(e.buffer,a))return e.$emit("easter",a),e.visible=!0,e.buffer=[],void(e.duration&&setTimeout(e.resetEasterEgg,e.duration))}}catch(e){i=!0,u=e}finally{try{!o&&f.return&&f.return()}finally{if(i)throw u}}e.timer=setTimeout(e.resetBuffer,1e3)})}};var n=function(e,t){if(e.length!==t.length)return!1;for(var r=0,n=e.length;r0?i(r(t),9007199254740991):0}},function(t,n,e){var r=e(23);t.exports=function(t){return Object(r(t))}},function(t,n){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,n){var e={}.hasOwnProperty;t.exports=function(t,n){return e.call(t,n)}},function(t,n,e){var r=e(7),i=e(37);t.exports=e(6)?function(t,n,e){return r.f(t,n,i(1,e))}:function(t,n,e){return t[n]=e,t}},function(t,n,e){var r=e(2),i=e(12),o=e(11),u=e(41)("src"),c=Function.toString,a=(""+c).split("toString");e(22).inspectSource=function(t){return c.call(t)},(t.exports=function(t,n,e,c){var f="function"==typeof e;f&&(o(e,"name")||i(e,"name",n)),t[n]!==e&&(f&&(o(e,u)||i(e,u,t[n]?""+t[n]:a.join(String(n)))),t===r?t[n]=e:c?t[n]?t[n]=e:i(t,n,e):(delete t[n],i(t,n,e)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[u]||c.call(this)})},function(t,n,e){var r=e(0),i=e(3),o=e(23),u=/"/g,c=function(t,n,e,r){var i=String(o(t)),c="<"+n;return""!==e&&(c+=" "+e+'="'+String(r).replace(u,""")+'"'),c+">"+i+""};t.exports=function(t,n){var e={};e[t]=n(c),r(r.P+r.F*i(function(){var n=""[t]('"');return n!==n.toLowerCase()||n.split('"').length>3}),"String",e)}},function(t,n,e){var r=e(48),i=e(23);t.exports=function(t){return r(i(t))}},function(t,n,e){var r=e(49),i=e(37),o=e(15),u=e(26),c=e(11),a=e(109),f=Object.getOwnPropertyDescriptor;n.f=e(6)?f:function(t,n){if(t=o(t),n=u(n,!0),a)try{return f(t,n)}catch(t){}if(c(t,n))return i(!r.f.call(t,n),t[n])}},function(t,n,e){var r=e(11),i=e(9),o=e(83)("IE_PROTO"),u=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=i(t),r(t,o)?t[o]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?u:null}},function(t,n){var e={}.toString;t.exports=function(t){return e.call(t).slice(8,-1)}},function(t,n,e){var r=e(10);t.exports=function(t,n,e){if(r(t),void 0===n)return t;switch(e){case 1:return function(e){return t.call(n,e)};case 2:return function(e,r){return t.call(n,e,r)};case 3:return function(e,r,i){return t.call(n,e,r,i)}}return function(){return t.apply(n,arguments)}}},function(t,n,e){"use strict";var r=e(3);t.exports=function(t,n){return!!t&&r(function(){n?t.call(null,function(){},1):t.call(null)})}},function(t,n,e){var r=e(19),i=e(48),o=e(9),u=e(8),c=e(68);t.exports=function(t,n){var e=1==t,a=2==t,f=3==t,s=4==t,l=6==t,h=5==t||l,v=n||c;return function(n,c,p){for(var d,y,g=o(n),_=i(g),m=r(c,p,3),S=u(_.length),b=0,E=e?v(n,S):a?v(n,0):void 0;S>b;b++)if((h||b in _)&&(d=_[b],y=m(d,b,g),t))if(e)E[b]=y;else if(y)switch(t){case 3:return!0;case 5:return d;case 6:return b;case 2:E.push(d)}else if(s)return!1;return l?-1:f||s?s:E}}},function(t,n){var e=t.exports={version:"2.5.0"};"number"==typeof __e&&(__e=e)},function(t,n){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},function(t,n,e){var r=e(0),i=e(22),o=e(3);t.exports=function(t,n){var e=(i.Object||{})[t]||Object[t],u={};u[t]=n(e),r(r.S+r.F*o(function(){e(1)}),"Object",u)}},function(t,n){var e=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:e)(t)}},function(t,n,e){var r=e(4);t.exports=function(t,n){if(!r(t))return t;var e,i;if(n&&"function"==typeof(e=t.toString)&&!r(i=e.call(t)))return i;if("function"==typeof(e=t.valueOf)&&!r(i=e.call(t)))return i;if(!n&&"function"==typeof(e=t.toString)&&!r(i=e.call(t)))return i;throw TypeError("Can't convert object to primitive value")}},function(t,n,e){var r=e(129),i=e(0),o=e(62)("metadata"),u=o.store||(o.store=new(e(132))),c=function(t,n,e){var i=u.get(t);if(!i){if(!e)return;u.set(t,i=new r)}var o=i.get(n);if(!o){if(!e)return;i.set(n,o=new r)}return o},a=function(t,n,e){var r=c(n,e,!1);return void 0!==r&&r.has(t)},f=function(t,n,e){var r=c(n,e,!1);return void 0===r?void 0:r.get(t)},s=function(t,n,e,r){c(e,r,!0).set(t,n)},l=function(t,n){var e=c(t,n,!1),r=[];return e&&e.forEach(function(t,n){r.push(n)}),r},h=function(t){return void 0===t||"symbol"==typeof t?t:String(t)},v=function(t){i(i.S,"Reflect",t)};t.exports={store:u,map:c,has:a,get:f,set:s,keys:l,key:h,exp:v}},function(t,n,e){"use strict";if(e(6)){var r=e(34),i=e(2),o=e(3),u=e(0),c=e(64),a=e(89),f=e(19),s=e(32),l=e(37),h=e(12),v=e(38),p=e(25),d=e(8),y=e(127),g=e(40),_=e(26),m=e(11),S=e(47),b=e(4),E=e(9),w=e(75),x=e(35),O=e(17),P=e(36).f,T=e(91),A=e(41),I=e(5),M=e(21),L=e(50),F=e(63),j=e(92),N=e(43),D=e(57),k=e(39),C=e(67),R=e(101),B=e(7),U=e(16),G=B.f,V=U.f,W=i.RangeError,z=i.TypeError,Y=i.Uint8Array,K=Array.prototype,H=a.ArrayBuffer,q=a.DataView,J=M(0),X=M(2),$=M(3),Z=M(4),Q=M(5),tt=M(6),nt=L(!0),et=L(!1),rt=j.values,it=j.keys,ot=j.entries,ut=K.lastIndexOf,ct=K.reduce,at=K.reduceRight,ft=K.join,st=K.sort,lt=K.slice,ht=K.toString,vt=K.toLocaleString,pt=I("iterator"),dt=I("toStringTag"),yt=A("typed_constructor"),gt=A("def_constructor"),_t=c.CONSTR,mt=c.TYPED,St=c.VIEW,bt=M(1,function(t,n){return Pt(F(t,t[gt]),n)}),Et=o(function(){return 1===new Y(new Uint16Array([1]).buffer)[0]}),wt=!!Y&&!!Y.prototype.set&&o(function(){new Y(1).set({})}),xt=function(t,n){var e=p(t);if(e<0||e%n)throw W("Wrong offset!");return e},Ot=function(t){if(b(t)&&mt in t)return t;throw z(t+" is not a typed array!")},Pt=function(t,n){if(!(b(t)&&yt in t))throw z("It is not a typed array constructor!");return new t(n)},Tt=function(t,n){return At(F(t,t[gt]),n)},At=function(t,n){for(var e=0,r=n.length,i=Pt(t,r);r>e;)i[e]=n[e++];return i},It=function(t,n,e){G(t,n,{get:function(){return this._d[e]}})},Mt=function(t){var n,e,r,i,o,u,c=E(t),a=arguments.length,s=a>1?arguments[1]:void 0,l=void 0!==s,h=T(c);if(void 0!=h&&!w(h)){for(u=h.call(c),r=[],n=0;!(o=u.next()).done;n++)r.push(o.value);c=r}for(l&&a>2&&(s=f(s,arguments[2],2)),n=0,e=d(c.length),i=Pt(this,e);e>n;n++)i[n]=l?s(c[n],n):c[n];return i},Lt=function(){for(var t=0,n=arguments.length,e=Pt(this,n);n>t;)e[t]=arguments[t++];return e},Ft=!!Y&&o(function(){vt.call(new Y(1))}),jt=function(){return vt.apply(Ft?lt.call(Ot(this)):Ot(this),arguments)},Nt={copyWithin:function(t,n){return R.call(Ot(this),t,n,arguments.length>2?arguments[2]:void 0)},every:function(t){return Z(Ot(this),t,arguments.length>1?arguments[1]:void 0)},fill:function(t){return C.apply(Ot(this),arguments)},filter:function(t){return Tt(this,X(Ot(this),t,arguments.length>1?arguments[1]:void 0))},find:function(t){return Q(Ot(this),t,arguments.length>1?arguments[1]:void 0)},findIndex:function(t){return tt(Ot(this),t,arguments.length>1?arguments[1]:void 0)},forEach:function(t){J(Ot(this),t,arguments.length>1?arguments[1]:void 0)},indexOf:function(t){return et(Ot(this),t,arguments.length>1?arguments[1]:void 0)},includes:function(t){return nt(Ot(this),t,arguments.length>1?arguments[1]:void 0)},join:function(t){return ft.apply(Ot(this),arguments)},lastIndexOf:function(t){return ut.apply(Ot(this),arguments)},map:function(t){return bt(Ot(this),t,arguments.length>1?arguments[1]:void 0)},reduce:function(t){return ct.apply(Ot(this),arguments)},reduceRight:function(t){return at.apply(Ot(this),arguments)},reverse:function(){for(var t,n=this,e=Ot(n).length,r=Math.floor(e/2),i=0;i1?arguments[1]:void 0)},sort:function(t){return st.call(Ot(this),t)},subarray:function(t,n){var e=Ot(this),r=e.length,i=g(t,r);return new(F(e,e[gt]))(e.buffer,e.byteOffset+i*e.BYTES_PER_ELEMENT,d((void 0===n?r:g(n,r))-i))}},Dt=function(t,n){return Tt(this,lt.call(Ot(this),t,n))},kt=function(t){Ot(this);var n=xt(arguments[1],1),e=this.length,r=E(t),i=d(r.length),o=0;if(i+n>e)throw W("Wrong length!");for(;o255?255:255&r),i.v[v](e*n+i.o,r,Et)},I=function(t,n){G(t,n,{get:function(){return T(this,n)},set:function(t){return A(this,n,t)},enumerable:!0})};m?(p=e(function(t,e,r,i){s(t,p,f,"_d");var o,u,c,a,l=0,v=0;if(b(e)){if(!(e instanceof H||"ArrayBuffer"==(a=S(e))||"SharedArrayBuffer"==a))return mt in e?At(p,e):Mt.call(p,e);o=e,v=xt(r,n);var g=e.byteLength;if(void 0===i){if(g%n)throw W("Wrong length!");if((u=g-v)<0)throw W("Wrong length!")}else if((u=d(i)*n)+v>g)throw W("Wrong length!");c=u/n}else c=y(e),u=c*n,o=new H(u);for(h(t,"_d",{b:o,o:v,l:u,e:c,v:new q(o)});lm;m++)if((y=n?_(u(p=t[m])[0],p[1]):_(t[m]))===f||y===s)return y}else for(d=g.call(t);!(p=d.next()).done;)if((y=i(d,_,p.value,n))===f||y===s)return y};n.BREAK=f,n.RETURN=s},function(t,n){t.exports=!1},function(t,n,e){var r=e(1),i=e(117),o=e(71),u=e(83)("IE_PROTO"),c=function(){},a=function(){var t,n=e(70)("iframe"),r=o.length;for(n.style.display="none",e(73).appendChild(n),n.src="javascript:",t=n.contentWindow.document,t.open(),t.write(" 11 | 12 | 13 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-easteregg", 3 | "version": "1.0.1", 4 | "description": "Easter egg for vue js apps", 5 | "main": "dist/index.js", 6 | "author": "David Grill ", 7 | "scripts": { 8 | "dev": "cross-env NODE_ENV=development webpack-dev-server --open --inline --hot", 9 | "build": "cross-env NODE_ENV=production webpack --progress --hide-modules", 10 | "test": "cross-env NODE_ENV=test karma start test/karma.conf.js --single-run" 11 | }, 12 | "repository": { 13 | "type": "git", 14 | "url": "git+https://github.com/ddgll/vue-easteregg.git" 15 | }, 16 | "keywords": [ 17 | "easteregg", 18 | "vuejs" 19 | ], 20 | "dependencies": { 21 | "vue": "^2.4.4" 22 | }, 23 | "devDependencies": { 24 | "babel-core": "^6.26.0", 25 | "babel-eslint": "^8.0.1", 26 | "babel-loader": "^7.1.2", 27 | "babel-plugin-transform-async-to-generator": "^6.24.1", 28 | "babel-plugin-transform-class-properties": "^6.24.1", 29 | "babel-plugin-transform-object-rest-spread": "^6.26.0", 30 | "babel-plugin-transform-runtime": "^6.23.0", 31 | "babel-polyfill": "^6.26.0", 32 | "babel-preset-env": "^1.6.0", 33 | "babel-preset-stage-0": "^6.24.1", 34 | "chai": "^4.1.2", 35 | "cross-env": "^5.0.5", 36 | "css-loader": "^0.28.7", 37 | "expect.js": "^0.3.1", 38 | "extract-text-webpack-plugin": "^3.0.1", 39 | "file-loader": "^1.1.5", 40 | "karma": "^1.7.1", 41 | "karma-chrome-launcher": "^2.2.0", 42 | "karma-coverage": "^1.1.1", 43 | "karma-mocha": "^1.3.0", 44 | "karma-phantomjs-launcher": "^1.0.4", 45 | "karma-phantomjs-shim": "^1.5.0", 46 | "karma-sinon-chai": "^1.3.2", 47 | "karma-sourcemap-loader": "^0.3.7", 48 | "karma-spec-reporter": "0.0.31", 49 | "karma-webpack": "^2.0.5", 50 | "mocha": "^4.0.1", 51 | "raw-loader": "^0.5.1", 52 | "sinon": "^4.0.1", 53 | "sinon-chai": "^2.14.0", 54 | "style-loader": "^0.19.0", 55 | "stylus": "^0.54.5", 56 | "stylus-loader": "^3.0.1", 57 | "uglifyjs-webpack-plugin": "^1.0.0-beta.3", 58 | "vue-loader": "^13.2.1", 59 | "vue-router": "^2.7.0", 60 | "vue-style-loader": "^3.0.3", 61 | "vue-template-compiler": "^2.4.4", 62 | "webpack": "^3.6.0", 63 | "webpack-dev-server": "^2.9.1" 64 | }, 65 | "license": "MIT", 66 | "bugs": { 67 | "url": "https://github.com/ddgll/vue-easteregg/issues" 68 | }, 69 | "homepage": "https://github.com/ddgll/vue-easteregg#readme" 70 | } 71 | -------------------------------------------------------------------------------- /src/easteregg.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 76 | 77 | 85 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import easteregg from './easteregg.vue' 2 | 3 | export default easteregg 4 | -------------------------------------------------------------------------------- /test/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | 3 | Vue.config.productionTip = false 4 | 5 | // require all test files (files that ends with .spec.js) 6 | const testsContext = require.context('./specs', true, /\.spec$/) 7 | testsContext.keys().forEach(testsContext) 8 | 9 | // require all src files except main.js for coverage. 10 | // you can also change this to match only the subset of files that 11 | // you want coverage for. 12 | const srcContext = require.context('../src', true, /^\.\/(?!main(\.js)?$)/) 13 | srcContext.keys().forEach(srcContext) 14 | -------------------------------------------------------------------------------- /test/karma.conf.js: -------------------------------------------------------------------------------- 1 | // This is a karma config file. For more details see 2 | // http://karma-runner.github.io/0.13/config/configuration-file.html 3 | // we are also using it with karma-webpack 4 | // https://github.com/webpack/karma-webpack 5 | 6 | var webpackConfig = require('../webpack.config.js') 7 | 8 | module.exports = function (config) { 9 | config.set({ 10 | // to run in additional browsers: 11 | // 1. install corresponding karma launcher 12 | // http://karma-runner.github.io/0.13/config/browsers.html 13 | // 2. add it to the `browsers` array below. 14 | browsers: ['Chrome'], 15 | frameworks: ['mocha', 'sinon-chai'], 16 | reporters: ['spec', 'coverage'], 17 | files: ['./specs/*.spec.js'], 18 | preprocessors: { 19 | './specs/*.spec.js': ['webpack', 'sourcemap'] 20 | }, 21 | webpack: webpackConfig, 22 | webpackMiddleware: { 23 | noInfo: true 24 | }, 25 | coverageReporter: { 26 | dir: './coverage', 27 | reporters: [ 28 | { type: 'lcov', subdir: '.' }, 29 | { type: 'text-summary' } 30 | ] 31 | } 32 | }) 33 | } 34 | -------------------------------------------------------------------------------- /test/specs/idb.spec.js: -------------------------------------------------------------------------------- 1 | // Import Vue and the component being tested 2 | import Vue from 'vue' 3 | import VueIdb from '../../src' 4 | 5 | import expect from 'expect.js' 6 | 7 | // Here are some Jasmine 2.0 tests, though you can 8 | // use any test runner / assertion library combo you prefer 9 | describe('VueIdb', () => { 10 | let vm 11 | beforeEach(() => { 12 | const idb = new VueIdb({ 13 | database: 'test', 14 | schemas: [ 15 | { tests: 'id, title, created_at, updated_at' } 16 | ] 17 | }) 18 | Vue.use(VueIdb) 19 | vm = new Vue({ 20 | idb 21 | }) 22 | }) 23 | // Evaluate the results of functions in 24 | // the raw component options 25 | it('sets the correct default data', () => { 26 | expect(vm.$db).to.be.an('object') 27 | }) 28 | }) 29 | -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var webpack = require('webpack') 3 | var ExtractTextPlugin = require("extract-text-webpack-plugin") 4 | var UglifyJSPlugin = require('uglifyjs-webpack-plugin') 5 | 6 | module.exports = { 7 | entry: './dev/main.js', 8 | output: { 9 | path: path.resolve(__dirname, './dist'), 10 | publicPath: '/dist/', 11 | filename: 'index.js' 12 | }, 13 | module: { 14 | rules: [ 15 | { 16 | test: /\.vue$/, 17 | loader: 'vue-loader', 18 | options: { 19 | loaders: { 20 | 21 | } 22 | } 23 | }, 24 | { 25 | test: /\.js$/, 26 | loader: 'babel-loader', 27 | exclude: /node_modules/ 28 | }, 29 | { 30 | test: /\.css$/, 31 | loader: 'style-loader!css-loader', 32 | exclude: /node_modules/ 33 | }, 34 | { 35 | test: /\.(png|jpg|gif|svg)$/, 36 | loader: 'file-loader', 37 | options: { 38 | name: '[name].[ext]?[hash]' 39 | } 40 | } 41 | ] 42 | }, 43 | resolve: { 44 | alias: { 45 | 'vue$': 'vue/dist/vue.common.js' 46 | } 47 | }, 48 | devServer: { 49 | historyApiFallback: true, 50 | noInfo: true 51 | }, 52 | plugins: [ 53 | new webpack.LoaderOptionsPlugin({ 54 | minimize: false 55 | }) 56 | ], 57 | devtool: '#source-map' 58 | } 59 | 60 | if (process.env.NODE_ENV === 'production') { 61 | module.exports.entry = './src/index.js' 62 | 63 | module.exports.externals = { 64 | "vue": "vue" 65 | } 66 | 67 | module.exports.output = { 68 | path: path.resolve(__dirname, './dist'), 69 | filename: 'index.js', 70 | library: 'VueEasterEgg', 71 | libraryTarget: 'umd' 72 | } 73 | module.exports.devtool = '#source-map' 74 | module.exports.module.rules[0].options.loaders = { 75 | css: ExtractTextPlugin.extract({ 76 | use: 'css-loader', 77 | fallback: 'vue-style-loader' // <- this is a dep of vue-loader, so no need to explicitly install if using npm3 78 | }), 79 | less: ExtractTextPlugin.extract({ 80 | use: 'css-loader!less-loader', 81 | fallback: 'vue-style-loader' 82 | }) 83 | } 84 | module.exports.plugins = (module.exports.plugins || []).concat([ 85 | new webpack.DefinePlugin({ 86 | 'process.env': { 87 | NODE_ENV: '"production"' 88 | } 89 | }), 90 | new webpack.LoaderOptionsPlugin({ 91 | minimize: true 92 | }), 93 | new ExtractTextPlugin("style.css"), 94 | new UglifyJSPlugin() 95 | ]) 96 | } 97 | --------------------------------------------------------------------------------