refactor(builder): replace vue-cli by parcel (wip)

This commit is contained in:
wryk 2019-03-11 17:46:21 +01:00
parent 7dbdc405a2
commit a363a81f39
34 changed files with 1319 additions and 5736 deletions

1
.gitignore vendored
View file

@ -1,5 +1,6 @@
.DS_Store .DS_Store
node_modules node_modules
.cache
/dist /dist
# local env files # local env files

View file

@ -1,5 +1 @@
module.exports = { module.exports = {}
presets: [
'@vue/app'
]
}

6931
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -3,9 +3,8 @@
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"scripts": { "scripts": {
"serve": "vue-cli-service serve", "serve": "parcel src/index.html",
"build": "vue-cli-service build", "build": "parcel build src/index.html"
"lint": "vue-cli-service lint"
}, },
"dependencies": { "dependencies": {
"gif-writer": "^0.9.3", "gif-writer": "^0.9.3",
@ -14,15 +13,15 @@
"vuex": "^3.0.1" "vuex": "^3.0.1"
}, },
"devDependencies": { "devDependencies": {
"@vue/cli-plugin-babel": "^3.5.0", "@vue/component-compiler-utils": "^2.6.0",
"@vue/cli-plugin-eslint": "^3.5.0", "autoprefixer": "^9.4.10",
"@vue/cli-plugin-pwa": "^3.5.0", "parcel-bundler": "^1.12.0",
"@vue/cli-service": "^3.5.0", "parcel-plugin-static-files-copy": "^2.0.0",
"@vue/eslint-config-standard": "^4.0.0", "vue-hot-reload-api": "^2.3.3",
"babel-eslint": "^10.0.1", "vue-template-compiler": "^2.6.8"
"eslint": "^5.8.0", },
"eslint-plugin-vue": "^5.0.0", "staticFiles": {
"vue-template-compiler": "^2.5.21", "staticPath": "public",
"worker-loader": "^2.0.0" "watcherGlob": "**"
} }
} }

View file

@ -8,9 +8,9 @@
<script> <script>
import welcomeScreen from '@/views/welcome' import welcomeScreen from '/views/welcome'
import captureScreen from '@/views/capture' import captureScreen from '/views/capture'
import downloadScreen from '@/views/download' import downloadScreen from '/views/download'
import { mapState } from 'vuex' import { mapState } from 'vuex'
@ -30,4 +30,7 @@ export default {
} }
</script> </script>
<style src="@/assets/css/style.css" lang="css"></style>
<style lang="css">
@import '/assets/css/style.css';
</style>

View file

@ -2,60 +2,60 @@
/* == config */ /* == config */
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
@import "colors.css"; @import "/assets/css/colors.css";
@import "config.css"; @import "/assets/css/config.css";
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
/* == core */ /* == core */
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
@import "1-core/_00-reset.css"; @import "/assets/css/1-core/_00-reset.css";
@import "1-core/_01-typography.css"; @import "/assets/css/1-core/_01-typography.css";
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
/* == components */ /* == components */
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
@import "2-components/_buttons.css"; @import "/assets/css/2-components/_buttons.css";
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
/* == base */ /* == base */
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
@import "3-base/_01-fonts.css"; @import "/assets/css/3-base/_01-fonts.css";
@import "3-base/_02-main.css"; @import "/assets/css/3-base/_02-main.css";
@import "3-base/_03-layout.css"; @import "/assets/css/3-base/_03-layout.css";
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
/* == modules */ /* == modules */
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
@import "4-modules/options.css"; @import "/assets/css/4-modules/options.css";
@import "4-modules/preview.css"; @import "/assets/css/4-modules/preview.css";
@import "4-modules/progress-bar.css"; @import "/assets/css/4-modules/progress-bar.css";
@import "4-modules/encoding.css"; @import "/assets/css/4-modules/encoding.css";
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
/* == screens */ /* == screens */
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
@import "5-screens/welcome.css"; @import "/assets/css/5-screens/welcome.css";
@import "5-screens/capture.css"; @import "/assets/css/5-screens/capture.css";
@import "5-screens/download.css"; @import "/assets/css/5-screens/download.css";
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
/* == helpers */ /* == helpers */
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
@import "6-helpers/_alignment.css"; @import "/assets/css/6-helpers/_alignment.css";
@import "6-helpers/_spacing.css"; @import "/assets/css/6-helpers/_spacing.css";
@import "6-helpers/_width.css"; @import "/assets/css/6-helpers/_width.css";
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
/* == rwd */ /* == rwd */
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
@import "7-rwd/_rwd-xsmall.css"; @import "/assets/css/7-rwd/_rwd-xsmall.css";
@import "7-rwd/_rwd-small.css"; @import "/assets/css/7-rwd/_rwd-small.css";
@import "7-rwd/_rwd-medium.css"; @import "/assets/css/7-rwd/_rwd-medium.css";
@import "7-rwd/_rwd-large.css"; @import "/assets/css/7-rwd/_rwd-large.css";

View file

@ -12,7 +12,7 @@
<script> <script>
import { mapState } from 'vuex' import { mapState } from 'vuex'
import iconSwitch from '@/icons/ico-switch' import iconSwitch from '/icons/ico-switch'
export default { export default {
name: 'captureOptions', name: 'captureOptions',

View file

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

View file

Before

Width:  |  Height:  |  Size: 150 B

After

Width:  |  Height:  |  Size: 150 B

View file

Before

Width:  |  Height:  |  Size: 495 B

After

Width:  |  Height:  |  Size: 495 B

View file

Before

Width:  |  Height:  |  Size: 660 B

After

Width:  |  Height:  |  Size: 660 B

View file

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View file

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View file

Before

Width:  |  Height:  |  Size: 640 B

After

Width:  |  Height:  |  Size: 640 B

View file

Before

Width:  |  Height:  |  Size: 781 B

After

Width:  |  Height:  |  Size: 781 B

View file

Before

Width:  |  Height:  |  Size: 642 B

After

Width:  |  Height:  |  Size: 642 B

View file

Before

Width:  |  Height:  |  Size: 448 B

After

Width:  |  Height:  |  Size: 448 B

View file

Before

Width:  |  Height:  |  Size: 482 B

After

Width:  |  Height:  |  Size: 482 B

View file

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

Before

Width:  |  Height:  |  Size: 728 B

After

Width:  |  Height:  |  Size: 728 B

View file

Before

Width:  |  Height:  |  Size: 761 B

After

Width:  |  Height:  |  Size: 761 B

View file

@ -4,7 +4,8 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0"> <meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico"> <link rel="icon" href="/favicon.ico">
<link rel="manifest" href="/manifest.webmanifest">
<title>Souvenir ∴ Capture few seconds as a gif for souvenir</title> <title>Souvenir ∴ Capture few seconds as a gif for souvenir</title>
</head> </head>
<body> <body>
@ -12,6 +13,6 @@
<strong>We're sorry but souvenir doesn't work properly without JavaScript enabled. Please enable it to continue.</strong> <strong>We're sorry but souvenir doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript> </noscript>
<div id="app"></div> <div id="app"></div>
<!-- built files will be auto injected --> <script src="/main.js"></script>
</body> </body>
</html> </html>

View file

@ -1,7 +1,7 @@
import Vue from 'vue' import Vue from 'vue'
import App from './App.vue' import App from '/App.vue'
import store from './store' import store from '/store'
import './registerServiceWorker' import '/registerServiceWorker'
Vue.config.productionTip = false Vue.config.productionTip = false

View file

@ -3,17 +3,17 @@
"short_name": "Souvenir", "short_name": "Souvenir",
"icons": [ "icons": [
{ {
"src": "./img/icons/android-chrome-192x192.png", "src": "/img/icons/android-chrome-192x192.png",
"sizes": "192x192", "sizes": "192x192",
"type": "image/png" "type": "image/png"
}, },
{ {
"src": "./img/icons/android-chrome-512x512.png", "src": "/img/icons/android-chrome-512x512.png",
"sizes": "512x512", "sizes": "512x512",
"type": "image/png" "type": "image/png"
} }
], ],
"start_url": "./index.html", "start_url": "/index.html",
"display": "standalone", "display": "standalone",
"background_color": "#212045", "background_color": "#212045",
"theme_color": "#8420a7" "theme_color": "#8420a7"

View file

@ -1,7 +1,7 @@
import { import {
makeRectangle, makeRectangle,
crop crop
} from '@/services/rectangle.js' } from '/services/rectangle.js'
const FRAMES_PER_SECOND = 10 const FRAMES_PER_SECOND = 10
const WIDTH = 200 const WIDTH = 200

View file

@ -1,10 +1,10 @@
import EncodeWorker from '@/services/encode.worker.js' // import EncodeWorker from './encode.worker.js'
const PALETTE_SIZE = 255 const PALETTE_SIZE = 255
export function encode ({ imageDataList, imageWidth, imageHeight, delayTime }) { export function encode ({ imageDataList, imageWidth, imageHeight, delayTime }) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const worker = new EncodeWorker() const worker = new Worker('/services/encode.worker.js')
worker.onerror = error => reject(error) worker.onerror = error => reject(error)
@ -13,7 +13,7 @@ export function encode ({ imageDataList, imageWidth, imageHeight, delayTime }) {
switch (type) { switch (type) {
default: default:
reject(new Error(`Unexpected EncodeWorker message with type ${type}`)) reject(new Error(`Unexpected worker message with type ${type}`))
break break
case 'progress': case 'progress':

View file

@ -1,8 +1,8 @@
import Vue from 'vue' import Vue from 'vue'
import Vuex from 'vuex' import Vuex from 'vuex'
import { capture } from '@/services/capture.js' import { capture } from '/services/capture.js'
import { encode } from '@/services/encode.js' import { encode } from '/services/encode.js'
Vue.use(Vuex) Vue.use(Vuex)

View file

@ -16,9 +16,9 @@
</template> </template>
<script> <script>
import captureOptions from '@/components/capture-options' import captureOptions from '/components/capture-options'
import captureProgress from '@/components/capture-progress' import captureProgress from '/components/capture-progress'
import encodingOverlay from '@/components/encoding' import encodingOverlay from '/components/encoding'
import { mapState } from 'vuex' import { mapState } from 'vuex'