diff --git a/.github/workflows/frontend-ci.yml b/.github/workflows/frontend-ci.yml index b8c77a628..9c58fbfaa 100644 --- a/.github/workflows/frontend-ci.yml +++ b/.github/workflows/frontend-ci.yml @@ -26,7 +26,7 @@ jobs: run: yarn run lint --no-fix - name: Type-check Vue app - run: yarn run type + run: yarn run type-check - name: Build Vue app run: yarn run build @@ -70,9 +70,9 @@ jobs: DANDI_ALLOW_LOCALHOST_URLS: 1 # Web client env vars - VUE_APP_DANDI_API_ROOT: http://localhost:8000/api/ - VUE_APP_OAUTH_API_ROOT: http://localhost:8000/oauth/ - VUE_APP_OAUTH_CLIENT_ID: Dk0zosgt1GAAKfN8LT4STJmLJXwMDPbYWYzfNtAl + VITE_APP_DANDI_API_ROOT: http://localhost:8000/api/ + VITE_APP_OAUTH_API_ROOT: http://localhost:8000/oauth/ + VITE_APP_OAUTH_CLIENT_ID: Dk0zosgt1GAAKfN8LT4STJmLJXwMDPbYWYzfNtAl # E2E tests env vars CLIENT_URL: http://localhost:8085 @@ -82,7 +82,6 @@ jobs: - uses: actions/setup-node@v4 with: - node-version: '16' cache: 'yarn' cache-dependency-path: web/yarn.lock @@ -116,23 +115,23 @@ jobs: - name: Install E2E tests run: yarn install --frozen-lockfile - working-directory: web/test + working-directory: e2e - name: Lint E2E tests run: yarn run lint --no-fix --max-warnings=0 - working-directory: web/test + working-directory: e2e - name: Run E2E tests run: | # start vue dev server and wait for it to start - yarn --cwd .. run serve 2> /dev/null & + yarn --cwd ../web/ run dev 2> /dev/null & while ! nc -z localhost 8085; do sleep 3 done # start the dandi-api server - python ../../manage.py runserver & + python ../manage.py runserver & # run the E2E tests yarn run test - working-directory: web/test + working-directory: e2e diff --git a/doc/design/apex-domain-netlify.md b/doc/design/apex-domain-netlify.md index 00c87ebf2..fae5993e8 100644 --- a/doc/design/apex-domain-netlify.md +++ b/doc/design/apex-domain-netlify.md @@ -7,7 +7,7 @@ Currently, the GUI is served at gui.dandiarchive.org, while the apex domain dand We've decided that our UI is stable enough to warrant serving it directly at dandiarchive.org, leaving just the task of serving a JSON file containing deployment information. Netlify seems capable of performing this task, and this document outlines the proposal to do so. ## Serving the Deployment JSON file -Netlify cannot specify a different set of redirects for a different build context, so a custom plugin is required. Netlify does support custom JS plugins that hook into the build process and modify the Netlify configuration, so we can use that to specify a different redirect based on the `VUE_APP_DANDI_API_ROOT` environment variable. This redirect will proxy `dandiarchive.org/server-info` to `api.dandiarchive/api/server-info`, or the appropriate domains for staging. +Netlify cannot specify a different set of redirects for a different build context, so a custom plugin is required. Netlify does support custom JS plugins that hook into the build process and modify the Netlify configuration, so we can use that to specify a different redirect based on the `VITE_APP_DANDI_API_ROOT` environment variable. This redirect will proxy `dandiarchive.org/server-info` to `api.dandiarchive/api/server-info`, or the appropriate domains for staging. ## Backwards Compatibility diff --git a/web/test/.gitignore b/e2e/.gitignore similarity index 100% rename from web/test/.gitignore rename to e2e/.gitignore diff --git a/web/test/README.md b/e2e/README.md similarity index 100% rename from web/test/README.md rename to e2e/README.md diff --git a/web/test/babel.config.js b/e2e/babel.config.js similarity index 100% rename from web/test/babel.config.js rename to e2e/babel.config.js diff --git a/web/test/jest-puppeteer.config.js b/e2e/jest-puppeteer.config.js similarity index 100% rename from web/test/jest-puppeteer.config.js rename to e2e/jest-puppeteer.config.js diff --git a/web/test/jest.config.js b/e2e/jest.config.js similarity index 100% rename from web/test/jest.config.js rename to e2e/jest.config.js diff --git a/web/test/jest.setup.js b/e2e/jest.setup.js similarity index 100% rename from web/test/jest.setup.js rename to e2e/jest.setup.js diff --git a/web/test/package.json b/e2e/package.json similarity index 100% rename from web/test/package.json rename to e2e/package.json diff --git a/web/test/src/pages/homePage.js b/e2e/src/pages/homePage.js similarity index 100% rename from web/test/src/pages/homePage.js rename to e2e/src/pages/homePage.js diff --git a/web/test/src/pages/searchPage.js b/e2e/src/pages/searchPage.js similarity index 100% rename from web/test/src/pages/searchPage.js rename to e2e/src/pages/searchPage.js diff --git a/web/test/src/tests/account.test.js b/e2e/src/tests/account.test.js similarity index 100% rename from web/test/src/tests/account.test.js rename to e2e/src/tests/account.test.js diff --git a/web/test/src/tests/cookies.test.js b/e2e/src/tests/cookies.test.js similarity index 100% rename from web/test/src/tests/cookies.test.js rename to e2e/src/tests/cookies.test.js diff --git a/web/test/src/tests/dandisetLandingPage.test.js b/e2e/src/tests/dandisetLandingPage.test.js similarity index 100% rename from web/test/src/tests/dandisetLandingPage.test.js rename to e2e/src/tests/dandisetLandingPage.test.js diff --git a/web/test/src/tests/dandisetsPage.test.js b/e2e/src/tests/dandisetsPage.test.js similarity index 100% rename from web/test/src/tests/dandisetsPage.test.js rename to e2e/src/tests/dandisetsPage.test.js diff --git a/web/test/src/tests/homePage.test.js b/e2e/src/tests/homePage.test.js similarity index 100% rename from web/test/src/tests/homePage.test.js rename to e2e/src/tests/homePage.test.js diff --git a/web/test/src/tests/registerDandiset.test.js b/e2e/src/tests/registerDandiset.test.js similarity index 100% rename from web/test/src/tests/registerDandiset.test.js rename to e2e/src/tests/registerDandiset.test.js diff --git a/web/test/src/util.js b/e2e/src/util.js similarity index 100% rename from web/test/src/util.js rename to e2e/src/util.js diff --git a/web/test/yarn.lock b/e2e/yarn.lock similarity index 100% rename from web/test/yarn.lock rename to e2e/yarn.lock diff --git a/web/.env.development b/web/.env.development index a36e562dd..5be34c1fb 100644 --- a/web/.env.development +++ b/web/.env.development @@ -1,3 +1,3 @@ -VUE_APP_DANDI_API_ROOT=http://localhost:8000/api/ -VUE_APP_OAUTH_API_ROOT=http://localhost:8000/oauth/ -VUE_APP_OAUTH_CLIENT_ID=Dk0zosgt1GAAKfN8LT4STJmLJXwMDPbYWYzfNtAl +VITE_APP_DANDI_API_ROOT=http://localhost:8000/api/ +VITE_APP_OAUTH_API_ROOT=http://localhost:8000/oauth/ +VITE_APP_OAUTH_CLIENT_ID=Dk0zosgt1GAAKfN8LT4STJmLJXwMDPbYWYzfNtAl diff --git a/web/.env.production b/web/.env.production index 1d36e2467..0f8762b4f 100644 --- a/web/.env.production +++ b/web/.env.production @@ -1,5 +1,5 @@ -VUE_APP_OAUTH_API_ROOT="https://api.dandiarchive.org/oauth/" -VUE_APP_OAUTH_CLIENT_ID="Dk0zosgt1GAAKfN8LT4STJmLJXwMDPbYWYzfNtAl" -VUE_APP_DANDI_API_ROOT="https://api.dandiarchive.org/api/" -VUE_APP_SENTRY_DSN="https://425b9a012300493d867e97785fae7b88@o308436.ingest.sentry.io/5196549" -VUE_APP_SENTRY_ENVIRONMENT="production" +VITE_APP_OAUTH_API_ROOT="https://api.dandiarchive.org/oauth/" +VITE_APP_OAUTH_CLIENT_ID="Dk0zosgt1GAAKfN8LT4STJmLJXwMDPbYWYzfNtAl" +VITE_APP_DANDI_API_ROOT="https://api.dandiarchive.org/api/" +VITE_APP_SENTRY_DSN="https://425b9a012300493d867e97785fae7b88@o308436.ingest.sentry.io/5196549" +VITE_APP_SENTRY_ENVIRONMENT="production" diff --git a/web/.eslintrc.js b/web/.eslintrc.cjs similarity index 66% rename from web/.eslintrc.js rename to web/.eslintrc.cjs index 93654c895..968d74dad 100644 --- a/web/.eslintrc.js +++ b/web/.eslintrc.cjs @@ -1,16 +1,18 @@ +/* eslint-env node */ +require('@rushstack/eslint-patch/modern-module-resolution'); + module.exports = { root: true, env: { node: true, }, - plugins: [ - 'vuetify', - ], extends: [ + 'plugin:vue/essential', + 'plugin:vuetify/recommended', + 'plugin:import/recommended', + 'plugin:import/typescript', 'eslint:recommended', - 'plugin:vue/recommended', - '@vue/airbnb', - '@vue/typescript', + '@vue/eslint-config-typescript', ], rules: { camelcase: 'off', @@ -37,7 +39,11 @@ module.exports = { 'import/prefer-default-export': 'off', '@typescript-eslint/consistent-type-imports': 'error', }, - parserOptions: { - parser: '@typescript-eslint/parser', + settings: { + 'import/resolver': { + typescript: { + project: '.' + } + }, }, -}; +} diff --git a/web/.gitignore b/web/.gitignore index 1cc0a5591..c31a5be99 100644 --- a/web/.gitignore +++ b/web/.gitignore @@ -1,119 +1,30 @@ -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -.Python -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -wheels/ -*.egg-info/ -.installed.cfg -*.egg -MANIFEST - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*.cover -.hypothesis/ -.pytest_cache/ - -# Translations -*.mo -*.pot - -# Django stuff: +# Logs +logs *.log -local_settings.py -db.sqlite3 - -# Flask stuff: -instance/ -.webassets-cache - -# Scrapy stuff: -.scrapy - -# Sphinx documentation -docs/_build/ - -# PyBuilder -target/ - -# Jupyter Notebook -.ipynb_checkpoints - -# pyenv -.python-version - -# celery beat schedule file -celerybeat-schedule - -# SageMath parsed files -*.sage.py - -# Environments -.env -.venv -env/ -venv/ -ENV/ -env.bak/ -venv.bak/ - -# Spyder project settings -.spyderproject -.spyproject - -# Rope project settings -.ropeproject - -# mkdocs documentation -/site - -# mypy -.mypy_cache/ - -# pycharm -**/.idea - -node_modules/ -/dist - -# local env files -.env.local -.env.*.local - -# Log files npm-debug.log* yarn-debug.log* yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +.DS_Store +dist +dist-ssr +*.local + +/cypress/videos/ +/cypress/screenshots/ + +# Editor directories and files +.vscode +!.vscode/extensions.json +.idea +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? + +# Autogenerated file +components.d.ts diff --git a/web/babel.config.js b/web/babel.config.js deleted file mode 100644 index 757ff9b16..000000000 --- a/web/babel.config.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - presets: [ - '@vue/cli-plugin-babel/preset', - ], -}; diff --git a/web/public/index.html b/web/index.html similarity index 88% rename from web/public/index.html rename to web/index.html index d67790c49..e01dea10a 100644 --- a/web/public/index.html +++ b/web/index.html @@ -4,7 +4,7 @@ - +