diff --git a/.eslintrc.js b/.eslintrc.js index 67bd79d..26bc4da 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,10 +1,62 @@ module.exports = { + root: true, + parser: 'vue-eslint-parser', + parserOptions: { + parser: '@typescript-eslint/parser', + extraFileExtensions: ['.vue'] + }, + plugins: [ + '@typescript-eslint', + ], extends: [ - "../.eslintrc.js", - "plugin:vue/essential", - "@vue/typescript/recommended" + 'eslint:recommended', + 'plugin:@typescript-eslint/eslint-recommended', + 'plugin:@typescript-eslint/recommended', + 'plugin:vue/essential', + '@vue/typescript/recommended' ], rules: { + "indent": ["error", 2], + "@typescript-eslint/naming-convention": [ + "error", { + selector: ["variable", "memberLike", "function"], + format: ["camelCase"], + leadingUnderscore: "allow" + }, + { + selector: ["variable"], + modifiers: ["global", "const"], + format: ["camelCase", "UPPER_CASE"], + leadingUnderscore: "allow" + }, + { + selector: "typeLike", + format: ["PascalCase"], + leadingUnderscore: "allow" + }, + { + selector: [ + "classProperty", + "objectLiteralProperty", + "typeProperty", + "classMethod", + "objectLiteralMethod", + "typeMethod", + "accessor", + "enumMember" + ], + format: null, + modifiers: ["requiresQuotes"] + } + ], + "@typescript-eslint/no-unused-vars": [ + "error", { + "args": "all", + "argsIgnorePattern": "^_", + "varsIgnorePattern": "^_" + } + ], + "@typescript-eslint/semi": "error", "vue/multi-word-component-names": "off" } }; diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml new file mode 100644 index 0000000..739c706 --- /dev/null +++ b/.github/workflows/build-deploy.yml @@ -0,0 +1,59 @@ +name: Build and Deploy + +on: + push: + branches: + main + +jobs: + build: + if: ${{ github.repository_owner == 'cosmicds' }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + persist-credentials: false + ref: ${{ github.event.pull_request.head.sha }} + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: '18.17.1' + + - name: Yarn install + run: yarn install + + - name: Lint + run: yarn lint + + - name: Build + run: yarn build + env: + VUE_APP_CDS_API_KEY: ${{ secrets.CDS_API_KEY }} + + # - name: BrowserStack env setup + # uses: browserstack/github-actions/setup-env@master + # with: + # username: ${{ secrets.BROWSERSTACK_USERNAME }} + # access-key: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} + + # - name: BrowserStack local tunnel setup + # uses: browserstack/github-actions/setup-local@master + # with: + # local-testing: start + # local-identifier: random + + # - name: Run BrowserStack tests + # run: | + # set -xeuo pipefail + # yarn serve & + # sleep 10 + # yarn test-bslocal -e default,firefox,edge,safari -o reports + + - name: Deploy to GitHub Pages + uses: JamesIves/github-pages-deploy-action@v4 + with: + branch: gh-pages + folder: dist + ssh-key: ${{ secrets.DEPLOY_KEY }} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..5f3bb56 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,56 @@ +name: Build + +on: + pull_request_target: + branches: + main + +permissions: read-all + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + persist-credentials: false + ref: ${{ github.event.pull_request.head.sha }} + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: '18.17.1' + + - name: Yarn install + run: yarn install + + - name: Lint + run: yarn lint + + - name: Build + run: yarn build + + # - name: BrowserStack env setup + # uses: browserstack/github-actions/setup-env@master + # with: + # username: ${{ secrets.BROWSERSTACK_USERNAME }} + # access-key: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} + + # - name: 'BrowserStack local tunnel setup' + # uses: browserstack/github-actions/setup-local@master + # with: + # local-testing: start + # local-identifier: random + + # - name: Run BrowserStack tests + # run: | + # set -xeuo pipefail + # yarn serve & + # sleep 10 + # yarn test-bslocal -e default,firefox,edge,safari -o reports + + # - name: 'BrowserStackLocal Stop' # Terminating the BrowserStackLocal tunnel connection + # uses: browserstack/github-actions/setup-local@master + # with: + # local-testing: stop diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b575ac4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,26 @@ +**/dist/* +!./dist/index.html + +node_modules/ +tsconfig.tsbuildinfo +/.vs/ +*.log + +**/.yarn/* +!**/.yarn/releases +!**/.yarn/patches +!**/.yarn/plugins +!**/.yarn/sdks +!**/.yarn/versions + +.pnp.* +.DS_Store + +.DS_Store +*/.DS_Store +*/*/.DS_Store +.vscode/settings.json + +**/tests_output/** + +*.env diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..2e2844d --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 cosmicds + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/package.json b/package.json index 5869340..e875d34 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,17 @@ { "version": "0.0.0", "dependencies": { + "@cosmicds/vue-toolkit": "^0.1.3", "@fortawesome/fontawesome-svg-core": "^6.4.2", "@fortawesome/free-solid-svg-icons": "^6.4.2", "@fortawesome/vue-fontawesome": "^3.0.3", "@kyvg/vue3-notification": "^3.0.2", - "@minids/common": "workspace:0.0.0", + "@vuepic/vue-datepicker": "^7.4.1", + "@wwtelescope/engine-pinia": "^0.9.0", + "tz-lookup": "^6.1.25", "uuid": "^9.0.1", "vue": "^3.3.4", + "vue-slider-component": "^4.1.0-beta.7", "vuetify": "^3.3.14", "webpack-plugin-vuetify": "^2.0.1" }, @@ -18,6 +22,7 @@ "serve": "./patch.sh; vue-cli-service serve" }, "devDependencies": { + "@types/tz-lookup": "^6.1.2", "@types/uuid": "^9.0.4", "@typescript-eslint/eslint-plugin": "^6.5.0", "@typescript-eslint/parser": "^6.5.0", diff --git a/src/AnnularEclipse2023.vue b/src/AnnularEclipse2023.vue index 679a98d..07391fe 100644 --- a/src/AnnularEclipse2023.vue +++ b/src/AnnularEclipse2023.vue @@ -1247,7 +1247,7 @@ \ No newline at end of file + diff --git a/src/main.ts b/src/main.ts index 19b5419..4251161 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,8 +1,6 @@ import Vue, { createApp } from "vue"; -import { IconButton } from "@minids/common"; -import { LocationSelector } from "@minids/common"; -import { FundingAcknowledgment } from "@minids/common"; +import { FundingAcknowledgment, IconButton, LocationSelector } from "@cosmicds/vue-toolkit"; import AnnularEclipse2023 from "./AnnularEclipse2023.vue"; import TransitionExpand from "./TransitionExpand.vue"; import GifPlayPause from "./GifPlayPause.vue"; @@ -92,7 +90,7 @@ library.add(faStreetView); const update = (el: HTMLElement, binding: Vue.DirectiveBinding) => el.style.visibility = (binding.value) ? "hidden" : ""; createApp(AnnularEclipse2023, { - wwtNamespace: "wwt-minids-annular-eclipse-2023", + wwtNamespace: "annular-eclipse-2023", // wtml: { // use this just as a test for the sun // eclipse: "https://raw.githubusercontent.com/patudom/star-life-cycle/master/content/BUACStellarLifeCycles.wtml", // }, diff --git a/vue.config.js b/vue.config.js index 8c1aee0..49d6f0e 100644 --- a/vue.config.js +++ b/vue.config.js @@ -1,6 +1,8 @@ const { VuetifyPlugin } = require('webpack-plugin-vuetify'); const DotenvWebpack = require("dotenv-webpack"); const { defineConfig } = require("@vue/cli-service") +const webpack = require("webpack"); +const path = require("path"); module.exports = defineConfig({ publicPath: "./", @@ -14,8 +16,17 @@ module.exports = defineConfig({ // See https://stackoverflow.com/questions/67431401/conflicting-values-for-process-env-with-webpack-encore-and-dotenv ignoreStub: true + }), + new webpack.DefinePlugin({ + // https://github.com/vuejs/vue-cli/pull/7443 + __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: 'false', }) - ] + ], + resolve: { + alias: { + vue: path.resolve("./node_modules/vue") + } + } }, // Needed for BrowserStack/Safari testing as of 2023 March. This makes the