From 787946a6dd01e3a4ca7d3c07ea2d293004c1bc89 Mon Sep 17 00:00:00 2001 From: lights0123 Date: Tue, 6 Oct 2020 10:48:41 -0400 Subject: [PATCH] Add web version --- .github/workflows/ci.yml | 24 +++++ desktop/package.json | 6 +- desktop/src/components/devices.ts | 4 +- n-link-core/components/FileBrowser.vue | 15 ++- n-link-core/package.json | 8 +- n-link-core/postcss.config.js | 1 + n-link-core/tailwind.config.js | 12 ++- yarn.lock | 125 ++++++++++++++++++------- 8 files changed, 144 insertions(+), 51 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5b000c9..7e50d99 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -69,3 +69,27 @@ jobs: with: name: my-artifact-${{ runner.os }} path: desktop/src-tauri/target/release/bundle + test-web: + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" + - uses: actions/cache@v2 + id: yarn-cache + with: + path: | + ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ matrix.platform }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ matrix.platform }}-yarn- + - name: setup node + uses: actions/setup-node@v1 + with: + node-version: 12 + - name: install app dependencies + run: yarn + - name: Build + run: | + yarn workspace web run generate diff --git a/desktop/package.json b/desktop/package.json index a5a0616..8ca45c7 100644 --- a/desktop/package.json +++ b/desktop/package.json @@ -19,12 +19,12 @@ "vue": "^2.6.11", "vue-async-computed": "^3.9.0", "vue-class-component": "^7.2.3", - "vue-property-decorator": "^8.4.2", + "vue-property-decorator": "^9.0.2", "vue-router": "^3.2.0" }, "devDependencies": { - "@typescript-eslint/eslint-plugin": "^2.33.0", - "@typescript-eslint/parser": "^2.33.0", + "@typescript-eslint/eslint-plugin": "^4.4.0", + "@typescript-eslint/parser": "^4.4.0", "@vue/cli-plugin-babel": "~4.5.0", "@vue/cli-plugin-eslint": "~4.5.0", "@vue/cli-plugin-router": "~4.5.0", diff --git a/desktop/src/components/devices.ts b/desktop/src/components/devices.ts index 5dbb775..86b6a44 100644 --- a/desktop/src/components/devices.ts +++ b/desktop/src/components/devices.ts @@ -275,11 +275,11 @@ class Devices extends Vue implements GenericDevices { this.addToQueue(dev, {action: 'move', src, dest}); } - uploadFiles(dev: DevId | string, path: string, files: File[]): Promise { + uploadFiles(): Promise { return Promise.resolve(undefined); } - uploadOsFile(dev: DevId | string, file: File): Promise { + uploadOsFile(): Promise { return Promise.resolve(undefined); } } diff --git a/n-link-core/components/FileBrowser.vue b/n-link-core/components/FileBrowser.vue index 9424da2..2977e8f 100644 --- a/n-link-core/components/FileBrowser.vue +++ b/n-link-core/components/FileBrowser.vue @@ -37,11 +37,16 @@ import DeviceQueue from "./DeviceQueue.vue"; asyncComputed: { files: { async get(this: FileBrowser) { - this.updateIndex; - return (await this.$devices.listDir(this.dev, this.path)).map(file => ({ - ...file, - path: `${this.path}/${file.path}` - })); + try { + this.updateIndex; + return (await this.$devices.listDir(this.dev, this.path)).map(file => ({ + ...file, + path: `${this.path}/${file.path}` + })); + } catch (e) { + console.error(e); + throw e; + } }, default: null, } diff --git a/n-link-core/package.json b/n-link-core/package.json index 7736baa..13458ed 100644 --- a/n-link-core/package.json +++ b/n-link-core/package.json @@ -5,14 +5,14 @@ "element-ui": "^2.13.2", "vue": "^2.6.11", "vue-class-component": "^7.2.3", - "vue-property-decorator": "^8.4.2" + "vue-property-decorator": "^9.0.2" }, "devDependencies": { - "@typescript-eslint/eslint-plugin": "^2.33.0", - "@typescript-eslint/parser": "^2.33.0", + "@typescript-eslint/eslint-plugin": "^4.4.0", + "@typescript-eslint/parser": "^4.4.0", + "@vue/eslint-config-typescript": "^5.1.0", "eslint": "^6.7.2", "eslint-plugin-vue": "^6.2.2", - "@vue/eslint-config-typescript": "^5.1.0", "tailwindcss": "^1.8.9" } } diff --git a/n-link-core/postcss.config.js b/n-link-core/postcss.config.js index c55d142..a8f65bd 100644 --- a/n-link-core/postcss.config.js +++ b/n-link-core/postcss.config.js @@ -3,6 +3,7 @@ module.exports = { tailwindcss: {}, 'vue-cli-plugin-tailwind/purgecss': { whitelistPatternsChildren: [/^el-/], + content: ['./public/**/*.html', './src/**/*.vue', '../n-link-core/components/**/*.vue'], }, autoprefixer: {} } diff --git a/n-link-core/tailwind.config.js b/n-link-core/tailwind.config.js index 401bc21..73129cd 100644 --- a/n-link-core/tailwind.config.js +++ b/n-link-core/tailwind.config.js @@ -50,5 +50,15 @@ module.exports = { }, variants: {}, plugins: [require('@tailwindcss/custom-forms')], - purge: false, + purge: process.env.npm_package_name === 'web' && { + enabled: process.env.NODE_ENV === 'production', + content: [ + 'components/**/*.vue', + 'layouts/**/*.vue', + 'pages/**/*.vue', + 'plugins/**/*.js', + 'nuxt.config.js', + '../n-link-core/components/**/*.vue' + ] + }, }; diff --git a/yarn.lock b/yarn.lock index bb09a90..5a1ef8d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1806,16 +1806,6 @@ "@types/webpack-sources" "*" source-map "^0.6.0" -"@typescript-eslint/eslint-plugin@^2.33.0": - version "2.34.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.34.0.tgz#6f8ce8a46c7dea4a6f1d171d2bb8fbae6dac2be9" - integrity sha512-4zY3Z88rEE99+CNvTbXSyovv2z9PNOVffTWD2W8QF5s2prBQtwN2zadqERcrHpcR7O/+KMI3fcTAmUUhK/iQcQ== - dependencies: - "@typescript-eslint/experimental-utils" "2.34.0" - functional-red-black-tree "^1.0.1" - regexpp "^3.0.0" - tsutils "^3.17.1" - "@typescript-eslint/eslint-plugin@^3.7.0": version "3.10.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-3.10.1.tgz#7e061338a1383f59edc204c605899f93dc2e2c8f" @@ -1828,15 +1818,18 @@ semver "^7.3.2" tsutils "^3.17.1" -"@typescript-eslint/experimental-utils@2.34.0", "@typescript-eslint/experimental-utils@^2.5.0": - version "2.34.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-2.34.0.tgz#d3524b644cdb40eebceca67f8cf3e4cc9c8f980f" - integrity sha512-eS6FTkq+wuMJ+sgtuNTtcqavWXqsflWcfBnlYhg/nS4aZ1leewkXGbvBhaapn1q6qf4M71bsR1tez5JTRMuqwA== +"@typescript-eslint/eslint-plugin@^4.4.0": + version "4.4.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.4.0.tgz#0321684dd2b902c89128405cf0385e9fe8561934" + integrity sha512-RVt5wU9H/2H+N/ZrCasTXdGbUTkbf7Hfi9eLiA8vPQkzUJ/bLDCC3CsoZioPrNcnoyN8r0gT153dC++A4hKBQQ== dependencies: - "@types/json-schema" "^7.0.3" - "@typescript-eslint/typescript-estree" "2.34.0" - eslint-scope "^5.0.0" - eslint-utils "^2.0.0" + "@typescript-eslint/experimental-utils" "4.4.0" + "@typescript-eslint/scope-manager" "4.4.0" + debug "^4.1.1" + functional-red-black-tree "^1.0.1" + regexpp "^3.0.0" + semver "^7.3.2" + tsutils "^3.17.1" "@typescript-eslint/experimental-utils@3.10.1": version "3.10.1" @@ -1849,15 +1842,27 @@ eslint-scope "^5.0.0" eslint-utils "^2.0.0" -"@typescript-eslint/parser@^2.33.0": - version "2.34.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-2.34.0.tgz#50252630ca319685420e9a39ca05fe185a256bc8" - integrity sha512-03ilO0ucSD0EPTw2X4PntSIRFtDPWjrVq7C3/Z3VQHRC7+13YB55rcJI3Jt+YgeHbjUdJPcPa7b23rXCBokuyA== +"@typescript-eslint/experimental-utils@4.4.0": + version "4.4.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-4.4.0.tgz#62a05d3f543b8fc5dec4982830618ea4d030e1a9" + integrity sha512-01+OtK/oWeSJTjQcyzDztfLF1YjvKpLFo+JZmurK/qjSRcyObpIecJ4rckDoRCSh5Etw+jKfdSzVEHevh9gJ1w== dependencies: - "@types/eslint-visitor-keys" "^1.0.0" - "@typescript-eslint/experimental-utils" "2.34.0" + "@types/json-schema" "^7.0.3" + "@typescript-eslint/scope-manager" "4.4.0" + "@typescript-eslint/types" "4.4.0" + "@typescript-eslint/typescript-estree" "4.4.0" + eslint-scope "^5.0.0" + eslint-utils "^2.0.0" + +"@typescript-eslint/experimental-utils@^2.5.0": + version "2.34.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-2.34.0.tgz#d3524b644cdb40eebceca67f8cf3e4cc9c8f980f" + integrity sha512-eS6FTkq+wuMJ+sgtuNTtcqavWXqsflWcfBnlYhg/nS4aZ1leewkXGbvBhaapn1q6qf4M71bsR1tez5JTRMuqwA== + dependencies: + "@types/json-schema" "^7.0.3" "@typescript-eslint/typescript-estree" "2.34.0" - eslint-visitor-keys "^1.1.0" + eslint-scope "^5.0.0" + eslint-utils "^2.0.0" "@typescript-eslint/parser@^3.7.0": version "3.10.1" @@ -1870,11 +1875,34 @@ "@typescript-eslint/typescript-estree" "3.10.1" eslint-visitor-keys "^1.1.0" +"@typescript-eslint/parser@^4.4.0": + version "4.4.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-4.4.0.tgz#65974db9a75f23b036f17b37e959b5f99b659ec0" + integrity sha512-yc14iEItCxoGb7W4Nx30FlTyGpU9r+j+n1LUK/exlq2eJeFxczrz/xFRZUk2f6yzWfK+pr1DOTyQnmDkcC4TnA== + dependencies: + "@typescript-eslint/scope-manager" "4.4.0" + "@typescript-eslint/types" "4.4.0" + "@typescript-eslint/typescript-estree" "4.4.0" + debug "^4.1.1" + +"@typescript-eslint/scope-manager@4.4.0": + version "4.4.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-4.4.0.tgz#2f3dd27692a12cc9a046a90ba6a9d8cb7731190a" + integrity sha512-r2FIeeU1lmW4K3CxgOAt8djI5c6Q/5ULAgdVo9AF3hPMpu0B14WznBAtxrmB/qFVbVIB6fSx2a+EVXuhSVMEyA== + dependencies: + "@typescript-eslint/types" "4.4.0" + "@typescript-eslint/visitor-keys" "4.4.0" + "@typescript-eslint/types@3.10.1": version "3.10.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-3.10.1.tgz#1d7463fa7c32d8a23ab508a803ca2fe26e758727" integrity sha512-+3+FCUJIahE9q0lDi1WleYzjCwJs5hIsbugIgnbB+dSCYUxl8L6PwmsyOPFZde2hc1DlTo/xnkOgiTLSyAbHiQ== +"@typescript-eslint/types@4.4.0": + version "4.4.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.4.0.tgz#63440ef87a54da7399a13bdd4b82060776e9e621" + integrity sha512-nU0VUpzanFw3jjX+50OTQy6MehVvf8pkqFcURPAE06xFNFenMj1GPEI6IESvp7UOHAnq+n/brMirZdR+7rCrlA== + "@typescript-eslint/typescript-estree@2.34.0": version "2.34.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-2.34.0.tgz#14aeb6353b39ef0732cc7f1b8285294937cf37d5" @@ -1902,6 +1930,20 @@ semver "^7.3.2" tsutils "^3.17.1" +"@typescript-eslint/typescript-estree@4.4.0": + version "4.4.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.4.0.tgz#16a2df7c16710ddd5406b32b86b9c1124b1ca526" + integrity sha512-Fh85feshKXwki4nZ1uhCJHmqKJqCMba+8ZicQIhNi5d5jSQFteWiGeF96DTjO8br7fn+prTP+t3Cz/a/3yOKqw== + dependencies: + "@typescript-eslint/types" "4.4.0" + "@typescript-eslint/visitor-keys" "4.4.0" + debug "^4.1.1" + globby "^11.0.1" + is-glob "^4.0.1" + lodash "^4.17.15" + semver "^7.3.2" + tsutils "^3.17.1" + "@typescript-eslint/visitor-keys@3.10.1": version "3.10.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-3.10.1.tgz#cd4274773e3eb63b2e870ac602274487ecd1e931" @@ -1909,6 +1951,14 @@ dependencies: eslint-visitor-keys "^1.1.0" +"@typescript-eslint/visitor-keys@4.4.0": + version "4.4.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.4.0.tgz#0a9118344082f14c0f051342a74b42dfdb012640" + integrity sha512-oBWeroUZCVsHLiWRdcTXJB7s1nB3taFY8WGvS23tiAlT6jXVvsdAV4rs581bgdEjOhn43q6ro7NkOiLKu6kFqA== + dependencies: + "@typescript-eslint/types" "4.4.0" + eslint-visitor-keys "^2.0.0" + "@vue/babel-helper-vue-jsx-merge-props@^1.0.0": version "1.0.0" resolved "https://registry.yarnpkg.com/@vue/babel-helper-vue-jsx-merge-props/-/babel-helper-vue-jsx-merge-props-1.0.0.tgz#048fe579958da408fb7a8b2a3ec050b50a661040" @@ -5287,6 +5337,11 @@ eslint-visitor-keys@^1.0.0, eslint-visitor-keys@^1.1.0, eslint-visitor-keys@^1.3 resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz#30ebd1ef7c2fdff01c3a4f151044af25fab0523e" integrity sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ== +eslint-visitor-keys@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz#21fdc8fbcd9c795cc0321f0563702095751511a8" + integrity sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ== + eslint@^6.7.2: version "6.8.0" resolved "https://registry.yarnpkg.com/eslint/-/eslint-6.8.0.tgz#62262d6729739f9275723824302fb227c8c93ffb" @@ -12923,7 +12978,7 @@ vue-async-computed@^3.9.0: resolved "https://registry.yarnpkg.com/vue-async-computed/-/vue-async-computed-3.9.0.tgz#af3181c25168bfe9d86d8ffbc7033bf9e484fe84" integrity sha512-ac6m/9zxHHNGGKNOU1en8qNk+fAmEbJLuWL7qyQTFuH3vjv3V4urv//QHcVzCobROM6btnaDG2b+XYMncF/ETA== -vue-class-component@^7.1.0, vue-class-component@^7.2.3: +vue-class-component@^7.2.3: version "7.2.6" resolved "https://registry.yarnpkg.com/vue-class-component/-/vue-class-component-7.2.6.tgz#8471e037b8e4762f5a464686e19e5afc708502e4" integrity sha512-+eaQXVrAm/LldalI272PpDe3+i4mPis0ORiMYxF6Ae4hyuCh15W8Idet7wPUEs4N4YptgFHGys4UrgNQOMyO6w== @@ -12999,12 +13054,10 @@ vue-no-ssr@^1.1.1: resolved "https://registry.yarnpkg.com/vue-no-ssr/-/vue-no-ssr-1.1.1.tgz#875f3be6fb0ae41568a837f3ac1a80eaa137b998" integrity sha512-ZMjqRpWabMPqPc7gIrG0Nw6vRf1+itwf0Itft7LbMXs2g3Zs/NFmevjZGN1x7K3Q95GmIjWbQZTVerxiBxI+0g== -vue-property-decorator@^8.4.2: - version "8.5.1" - resolved "https://registry.yarnpkg.com/vue-property-decorator/-/vue-property-decorator-8.5.1.tgz#571a91cf8d2b507f537d79bf8275af3184572fff" - integrity sha512-O6OUN2OMsYTGPvgFtXeBU3jPnX5ffQ9V4I1WfxFQ6dqz6cOUbR3Usou7kgFpfiXDvV7dJQSFcJ5yUPgOtPPm1Q== - dependencies: - vue-class-component "^7.1.0" +vue-property-decorator@^9.0.2: + version "9.0.2" + resolved "https://registry.yarnpkg.com/vue-property-decorator/-/vue-property-decorator-9.0.2.tgz#118459d77b4d5613ab2bbccba2edd5d7af685d30" + integrity sha512-mxuJHfUGs/3rUyFj2vykDIvYXCUKBrzhemm7mT8dE9QYTbNA/4qVQ5gwhNCIkKyQc8RQIXQ+0jriqinUDuuU9w== vue-router@^3.2.0, vue-router@^3.4.3: version "3.4.5" @@ -13102,10 +13155,10 @@ wcwidth@^1.0.1: dependencies: defaults "^1.0.3" -web-libnspire@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/web-libnspire/-/web-libnspire-0.1.0.tgz#113d5cba1c00add557b18ceb3d85101df078aac0" - integrity sha512-pprvYj+NtmBpZKACGEetH93kMnGc9uGE23FaAIhePd1b27zifB4gkyWujjw1na0aHl8L82VKV6UeYQBITL2S0A== +web-libnspire@^0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/web-libnspire/-/web-libnspire-0.1.3.tgz#46a11dfdf4ac21f684964da4987079cc00211c14" + integrity sha512-pjs1JoJ7hj3mlZMfjwD98Pgm77iwbWqr4nCIvHYMPWZTZab/8uwJlo7363q8zS4xqDxrVBv6l/XaY6j8S/v8Fw== webidl-conversions@^5.0.0: version "5.0.0"