diff --git a/.changeset/config.json b/.changeset/config.json new file mode 100644 index 00000000..018479f8 --- /dev/null +++ b/.changeset/config.json @@ -0,0 +1,15 @@ +{ + "$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json", + "changelog": "@changesets/cli/changelog", + "commit": false, + "fixed": [], + "linked": [], + "access": "public", + "baseBranch": "vnext", + "updateInternalDependencies": "patch", + "ignore": [], + "privatePackages": { + "version": false, + "tag": false + } +} diff --git a/.changeset/pink-pots-carry.md b/.changeset/pink-pots-carry.md new file mode 100644 index 00000000..f578c7d7 --- /dev/null +++ b/.changeset/pink-pots-carry.md @@ -0,0 +1,5 @@ +--- +'mongo-modeler': minor +--- + +Initial Mongo Modeler VSCode extension scaffolding diff --git a/.eslintrc.cjs b/.eslintrc.cjs deleted file mode 100644 index 4c99537a..00000000 --- a/.eslintrc.cjs +++ /dev/null @@ -1,18 +0,0 @@ -module.exports = { - root: true, - env: { browser: true, es2020: true }, - extends: [ - 'eslint:recommended', - 'plugin:@typescript-eslint/recommended', - 'plugin:react-hooks/recommended', - ], - ignorePatterns: ['dist', '.eslintrc.cjs'], - parser: '@typescript-eslint/parser', - plugins: ['react-refresh'], - rules: { - 'react-refresh/only-export-components': [ - 'warn', - { allowConstantExport: true }, - ], - }, -}; diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..6313b56c --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto eol=lf diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..d65f7669 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,25 @@ +version: 2 +updates: + - package-ecosystem: 'npm' + directory: '/' + schedule: + interval: 'weekly' + open-pull-requests-limit: 10 + ignore: + - dependency-name: '@types/node' + update-types: + - 'version-update:semver-major' + groups: + minor-and-patch: + update-types: + - 'minor' + - 'patch' + + - package-ecosystem: 'github-actions' + directory: '/' + schedule: + interval: 'weekly' + groups: + github-actions: + patterns: + - '*' diff --git a/.github/workflows/publish-app.yml b/.github/workflows/cd.yml similarity index 62% rename from .github/workflows/publish-app.yml rename to .github/workflows/cd.yml index 8944ebf1..5c24d595 100644 --- a/.github/workflows/publish-app.yml +++ b/.github/workflows/cd.yml @@ -1,4 +1,4 @@ -name: Publish app +name: CD Workflow on: push: @@ -6,26 +6,34 @@ on: - main jobs: - deploy-react-app: + cd: environment: name: 'Website' url: https://www.mongo-modeler.com runs-on: ubuntu-latest + name: Deploy Mongo Modeler steps: - - uses: actions/checkout@v3 + - name: Checkout repository + uses: actions/checkout@v6 + + - name: Use Node.js + uses: actions/setup-node@v6 + with: + node-version-file: '.nvmrc' + cache: 'npm' + - name: Install run: npm ci + - name: Build - run: npm run build + run: node --run build + - name: Deploy uses: Azure/static-web-apps-deploy@v1 with: azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_MANGO_GLACIER_093E76303 }} repo_token: ${{ secrets.GITHUB_TOKEN }} action: 'upload' - app_location: 'dist' - output_location: 'dist' + app_location: 'apps/web/dist' skip_app_build: true skip_api_build: true - env: - NODE_VERSION: 18.16.0 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4b97c492..7206c793 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: CI workflow +name: CI Workflow on: pull_request @@ -7,43 +7,79 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 - - name: Use Node.js 20 - uses: actions/setup-node@v4 + - name: Use Node.js + uses: actions/setup-node@v6 with: - node-version: "20" - cache: "npm" + node-version-file: '.nvmrc' + cache: 'npm' - name: Install dependencies run: npm ci - - name: Check TypeScript Types - run: npm run tsc-check + - name: Install test browsers + run: node --run install:test-browsers + + - name: Lint + run: node --run lint + + - name: Check TypeScript types + run: node --run check-types + + - name: Build + run: node --run build - name: Run tests - run: npm test + run: node --run test e2e-tests: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 - - name: Use Node.js 20 - uses: actions/setup-node@v4 + - name: Use Node.js + uses: actions/setup-node@v6 with: - node-version: "20" - cache: "npm" + node-version-file: '.nvmrc' + cache: 'npm' - name: Install dependencies run: npm ci - - name: Build - run: npm run build + - name: Install test browsers + run: node --run install:test-browsers - - name: Check TypeScript Types - run: npm run tsc-check + - name: Build + run: node --run build - name: Run E2E tests - run: npm run ci:e2e + run: node --run ci:e2e + + changeset-check: + if: github.event.pull_request.base.ref != 'main' + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Check for changeset + run: | + BASE=${{ github.event.pull_request.base.sha }} + HEAD=${{ github.event.pull_request.head.sha }} + + PACKAGES_CHANGED=$(git diff --name-only "$BASE" "$HEAD" -- packages/ | head -1) + + if [ -n "$PACKAGES_CHANGED" ]; then + CHANGESET_ADDED=$(git diff --name-only "$BASE" "$HEAD" -- '.changeset/*.md' | head -1) + if [ -z "$CHANGESET_ADDED" ]; then + echo "::error::This PR modifies packages/ but has no changeset. Run 'node --run changeset' to add one." + exit 1 + fi + echo "Changeset found for package changes." + else + echo "No package changes detected, skipping changeset check." + fi diff --git a/.github/workflows/pkg-publish.yml b/.github/workflows/pkg-publish.yml new file mode 100644 index 00000000..d1e295c0 --- /dev/null +++ b/.github/workflows/pkg-publish.yml @@ -0,0 +1,33 @@ +name: VSCode Extension Publish + +on: + workflow_dispatch: + push: + branches: [main] + paths: + - 'packages/vscode-extension/**' + - '.changeset/**' + +concurrency: ${{ github.workflow }}-${{ github.ref }} + +permissions: + contents: write + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + + - uses: actions/setup-node@v6 + with: + node-version-file: '.nvmrc' + + - run: npm ci + + - run: node --run build + + - name: Publish VS Code extension + run: node --run publish:vscode + env: + VSCE_PAT: ${{ secrets.VSCE_TOKEN }} diff --git a/.github/workflows/pkg-version.yml b/.github/workflows/pkg-version.yml new file mode 100644 index 00000000..0dc33371 --- /dev/null +++ b/.github/workflows/pkg-version.yml @@ -0,0 +1,35 @@ +name: Package Versioning + +on: + workflow_dispatch: + push: + branches: [vnext] + paths: + - 'packages/**' + - '.changeset/**' + +concurrency: ${{ github.workflow }}-${{ github.ref }} + +permissions: + contents: write + pull-requests: write + +jobs: + version: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + + - uses: actions/setup-node@v6 + with: + node-version-file: '.nvmrc' + + - run: npm ci + + - name: Create Version PR + uses: changesets/action@v1 + with: + title: 'chore: version packages' + commit: 'chore: version packages' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index b88c8135..832d341d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,20 @@ +# Dependencies +node_modules + +# Build outputs +dist +dist-ssr + +# Turbo +.turbo + +# Test outputs +coverage +playwright-report/ +test-results/ +blob-report/ +playwright/.cache/ + # Logs logs *.log @@ -7,14 +24,14 @@ yarn-error.log* pnpm-debug.log* lerna-debug.log* -node_modules -dist -dist-ssr +# Local env files *.local # Editor directories and files .vscode/* !.vscode/extensions.json +!.vscode/settings.json +!.vscode/launch.json .idea .DS_Store *.suo @@ -22,7 +39,9 @@ dist-ssr *.njsproj *.sln *.sw? -/test-results/ -/playwright-report/ -/blob-report/ -/playwright/.cache/ + +# Vite +.vite + +# Temporary LICENSE copies (created by publish scripts) +packages/*/LICENSE diff --git a/.husky/pre-commit b/.husky/pre-commit index dfb0999e..fe3d2ac4 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,5 +1,5 @@ #!/usr/bin/env sh . "$(dirname -- "$0")/_/husky.sh" - +npx oxlint . npx lint-staged diff --git a/.husky/pre-push b/.husky/pre-push new file mode 100755 index 00000000..f9d90022 --- /dev/null +++ b/.husky/pre-push @@ -0,0 +1 @@ +node --run check-types diff --git a/.npmrc b/.npmrc new file mode 100644 index 00000000..97b895e2 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +ignore-scripts=true diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 00000000..a45fd52c --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +24 diff --git a/.prettierignore b/.prettierignore index 76add878..ea5856de 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,2 +1,4 @@ node_modules -dist \ No newline at end of file +dist +coverage +.turbo diff --git a/e2e/add-new-collection.spec.ts b/apps/web/e2e/add-new-collection.spec.ts similarity index 100% rename from e2e/add-new-collection.spec.ts rename to apps/web/e2e/add-new-collection.spec.ts diff --git a/e2e/launch-mongodb-designer-link.spec.ts b/apps/web/e2e/launch-mongodb-designer-link.spec.ts similarity index 100% rename from e2e/launch-mongodb-designer-link.spec.ts rename to apps/web/e2e/launch-mongodb-designer-link.spec.ts diff --git a/editor.html b/apps/web/editor.html similarity index 100% rename from editor.html rename to apps/web/editor.html diff --git a/index.html b/apps/web/index.html similarity index 100% rename from index.html rename to apps/web/index.html diff --git a/apps/web/package.json b/apps/web/package.json new file mode 100644 index 00000000..cf238eb3 --- /dev/null +++ b/apps/web/package.json @@ -0,0 +1,44 @@ +{ + "name": "@lemoncode/mongo-modeler-web", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "tsc --noEmit && vite build", + "preview": "vite preview", + "check-types": "tsc --noEmit", + "check-types:watch": "node --run check-types -- --watch --preserveWatchOutput", + "test": "vitest run", + "test:watch": "vitest", + "test:coverage": "vitest run --coverage", + "e2e": "playwright test --ui", + "ci:e2e": "playwright test" + }, + "dependencies": { + "@lemoncode/fonk": "^1.5.4", + "@lemoncode/fonk-formik": "^4.0.1", + "@lemoncode/fonk-is-number-validator": "^1.1.2", + "@lemoncode/fonk-min-number-validator": "^1.2.0", + "@lemoncode/mongo-modeler-bridge-protocol": "*", + "classnames": "^2.5.1", + "formik": "^2.4.5", + "framer-motion": "^11.0.3", + "immer": "^10.0.3", + "react": "^18.2.0", + "react-dom": "^18.2.0" + }, + "devDependencies": { + "@lemoncode/typescript-config": "*", + "@lemoncode/vitest-config": "*", + "@playwright/test": "^1.48.1", + "@testing-library/dom": "^9.3.4", + "@testing-library/react": "^14.2.1", + "@types/react": "^18.2.46", + "@types/react-dom": "^18.2.18", + "@types/wicg-file-system-access": "^2023.10.4", + "@vitejs/plugin-react": "^6.0.1", + "jsdom": "^23.2.0", + "vite": "^8.0.10" + } +} diff --git a/playwright.config.ts b/apps/web/playwright.config.ts similarity index 100% rename from playwright.config.ts rename to apps/web/playwright.config.ts diff --git a/public/android-chrome-128x128.png b/apps/web/public/android-chrome-128x128.png similarity index 100% rename from public/android-chrome-128x128.png rename to apps/web/public/android-chrome-128x128.png diff --git a/public/android-chrome-144x144.png b/apps/web/public/android-chrome-144x144.png similarity index 100% rename from public/android-chrome-144x144.png rename to apps/web/public/android-chrome-144x144.png diff --git a/public/android-chrome-192x192.png b/apps/web/public/android-chrome-192x192.png similarity index 100% rename from public/android-chrome-192x192.png rename to apps/web/public/android-chrome-192x192.png diff --git a/public/android-chrome-512x512.png b/apps/web/public/android-chrome-512x512.png similarity index 100% rename from public/android-chrome-512x512.png rename to apps/web/public/android-chrome-512x512.png diff --git a/public/android-chrome-72x72.png b/apps/web/public/android-chrome-72x72.png similarity index 100% rename from public/android-chrome-72x72.png rename to apps/web/public/android-chrome-72x72.png diff --git a/public/apple-touch-icon.png b/apps/web/public/apple-touch-icon.png similarity index 100% rename from public/apple-touch-icon.png rename to apps/web/public/apple-touch-icon.png diff --git a/public/assets/abel-de-tena.jpeg b/apps/web/public/assets/abel-de-tena.jpeg similarity index 100% rename from public/assets/abel-de-tena.jpeg rename to apps/web/public/assets/abel-de-tena.jpeg diff --git a/public/assets/alberto-santiago.png b/apps/web/public/assets/alberto-santiago.png similarity index 100% rename from public/assets/alberto-santiago.png rename to apps/web/public/assets/alberto-santiago.png diff --git a/public/assets/aridane-martin.jpg b/apps/web/public/assets/aridane-martin.jpg similarity index 100% rename from public/assets/aridane-martin.jpg rename to apps/web/public/assets/aridane-martin.jpg diff --git a/public/assets/cristina-gonzalez.jpg b/apps/web/public/assets/cristina-gonzalez.jpg similarity index 100% rename from public/assets/cristina-gonzalez.jpg rename to apps/web/public/assets/cristina-gonzalez.jpg diff --git a/public/assets/fran-lopez.jpg b/apps/web/public/assets/fran-lopez.jpg similarity index 100% rename from public/assets/fran-lopez.jpg rename to apps/web/public/assets/fran-lopez.jpg diff --git a/public/assets/guste-gaubaite.jpg b/apps/web/public/assets/guste-gaubaite.jpg similarity index 100% rename from public/assets/guste-gaubaite.jpg rename to apps/web/public/assets/guste-gaubaite.jpg diff --git a/public/assets/leticia-de-la-osa.jpeg b/apps/web/public/assets/leticia-de-la-osa.jpeg similarity index 100% rename from public/assets/leticia-de-la-osa.jpeg rename to apps/web/public/assets/leticia-de-la-osa.jpeg diff --git a/public/assets/logo_mongo_modeler_dark_mode.svg b/apps/web/public/assets/logo_mongo_modeler_dark_mode.svg similarity index 100% rename from public/assets/logo_mongo_modeler_dark_mode.svg rename to apps/web/public/assets/logo_mongo_modeler_dark_mode.svg diff --git a/public/assets/logo_mongo_modeler_light_mode.svg b/apps/web/public/assets/logo_mongo_modeler_light_mode.svg similarity index 100% rename from public/assets/logo_mongo_modeler_light_mode.svg rename to apps/web/public/assets/logo_mongo_modeler_light_mode.svg diff --git a/public/assets/manuel-gallego-barra.jpeg b/apps/web/public/assets/manuel-gallego-barra.jpeg similarity index 100% rename from public/assets/manuel-gallego-barra.jpeg rename to apps/web/public/assets/manuel-gallego-barra.jpeg diff --git a/public/assets/marcos-apocada.jpeg b/apps/web/public/assets/marcos-apocada.jpeg similarity index 100% rename from public/assets/marcos-apocada.jpeg rename to apps/web/public/assets/marcos-apocada.jpeg diff --git a/public/assets/miguel-galvez.jpg b/apps/web/public/assets/miguel-galvez.jpg similarity index 100% rename from public/assets/miguel-galvez.jpg rename to apps/web/public/assets/miguel-galvez.jpg diff --git a/public/assets/mobile-development.svg b/apps/web/public/assets/mobile-development.svg similarity index 100% rename from public/assets/mobile-development.svg rename to apps/web/public/assets/mobile-development.svg diff --git a/public/assets/team-work-cuate.svg b/apps/web/public/assets/team-work-cuate.svg similarity index 100% rename from public/assets/team-work-cuate.svg rename to apps/web/public/assets/team-work-cuate.svg diff --git a/public/assets/teresa-milanes.jpeg b/apps/web/public/assets/teresa-milanes.jpeg similarity index 100% rename from public/assets/teresa-milanes.jpeg rename to apps/web/public/assets/teresa-milanes.jpeg diff --git a/public/assets/tony-torres.jpeg b/apps/web/public/assets/tony-torres.jpeg similarity index 100% rename from public/assets/tony-torres.jpeg rename to apps/web/public/assets/tony-torres.jpeg diff --git a/public/assets/veronica-camarzana.jpeg b/apps/web/public/assets/veronica-camarzana.jpeg similarity index 100% rename from public/assets/veronica-camarzana.jpeg rename to apps/web/public/assets/veronica-camarzana.jpeg diff --git a/public/browserconfig.xml b/apps/web/public/browserconfig.xml similarity index 100% rename from public/browserconfig.xml rename to apps/web/public/browserconfig.xml diff --git a/public/favicon-16x16.png b/apps/web/public/favicon-16x16.png similarity index 100% rename from public/favicon-16x16.png rename to apps/web/public/favicon-16x16.png diff --git a/public/favicon-32x32.png b/apps/web/public/favicon-32x32.png similarity index 100% rename from public/favicon-32x32.png rename to apps/web/public/favicon-32x32.png diff --git a/public/favicon.ico b/apps/web/public/favicon.ico similarity index 100% rename from public/favicon.ico rename to apps/web/public/favicon.ico diff --git a/public/favicon.png b/apps/web/public/favicon.png similarity index 100% rename from public/favicon.png rename to apps/web/public/favicon.png diff --git a/public/favicon.svg b/apps/web/public/favicon.svg similarity index 100% rename from public/favicon.svg rename to apps/web/public/favicon.svg diff --git a/public/manifest.json b/apps/web/public/manifest.json similarity index 100% rename from public/manifest.json rename to apps/web/public/manifest.json diff --git a/public/mongo-modeler-app.jpg b/apps/web/public/mongo-modeler-app.jpg similarity index 100% rename from public/mongo-modeler-app.jpg rename to apps/web/public/mongo-modeler-app.jpg diff --git a/public/mstile-150x150.png b/apps/web/public/mstile-150x150.png similarity index 100% rename from public/mstile-150x150.png rename to apps/web/public/mstile-150x150.png diff --git a/public/safari-pinned-tab.svg b/apps/web/public/safari-pinned-tab.svg similarity index 100% rename from public/safari-pinned-tab.svg rename to apps/web/public/safari-pinned-tab.svg diff --git a/src/App.css b/apps/web/src/App.css similarity index 100% rename from src/App.css rename to apps/web/src/App.css diff --git a/src/App.tsx b/apps/web/src/App.tsx similarity index 100% rename from src/App.tsx rename to apps/web/src/App.tsx diff --git a/src/common/a11y/click-outside.hook.ts b/apps/web/src/common/a11y/click-outside.hook.ts similarity index 100% rename from src/common/a11y/click-outside.hook.ts rename to apps/web/src/common/a11y/click-outside.hook.ts diff --git a/src/common/a11y/common.model.ts b/apps/web/src/common/a11y/common.model.ts similarity index 100% rename from src/common/a11y/common.model.ts rename to apps/web/src/common/a11y/common.model.ts diff --git a/src/common/a11y/focus.common-helpers.ts b/apps/web/src/common/a11y/focus.common-helpers.ts similarity index 100% rename from src/common/a11y/focus.common-helpers.ts rename to apps/web/src/common/a11y/focus.common-helpers.ts diff --git a/src/common/a11y/index.ts b/apps/web/src/common/a11y/index.ts similarity index 100% rename from src/common/a11y/index.ts rename to apps/web/src/common/a11y/index.ts diff --git a/src/common/a11y/list/focus.helpers.ts b/apps/web/src/common/a11y/list/focus.helpers.ts similarity index 100% rename from src/common/a11y/list/focus.helpers.ts rename to apps/web/src/common/a11y/list/focus.helpers.ts diff --git a/src/common/a11y/list/index.ts b/apps/web/src/common/a11y/list/index.ts similarity index 100% rename from src/common/a11y/list/index.ts rename to apps/web/src/common/a11y/list/index.ts diff --git a/src/common/a11y/list/list.hooks.ts b/apps/web/src/common/a11y/list/list.hooks.ts similarity index 100% rename from src/common/a11y/list/list.hooks.ts rename to apps/web/src/common/a11y/list/list.hooks.ts diff --git a/src/common/a11y/list/list.model.ts b/apps/web/src/common/a11y/list/list.model.ts similarity index 100% rename from src/common/a11y/list/list.model.ts rename to apps/web/src/common/a11y/list/list.model.ts diff --git a/src/common/a11y/nested-list/index.ts b/apps/web/src/common/a11y/nested-list/index.ts similarity index 100% rename from src/common/a11y/nested-list/index.ts rename to apps/web/src/common/a11y/nested-list/index.ts diff --git a/src/common/a11y/nested-list/nested-list.hooks.ts b/apps/web/src/common/a11y/nested-list/nested-list.hooks.ts similarity index 100% rename from src/common/a11y/nested-list/nested-list.hooks.ts rename to apps/web/src/common/a11y/nested-list/nested-list.hooks.ts diff --git a/src/common/a11y/nested-list/nested-list.mappers.ts b/apps/web/src/common/a11y/nested-list/nested-list.mappers.ts similarity index 95% rename from src/common/a11y/nested-list/nested-list.mappers.ts rename to apps/web/src/common/a11y/nested-list/nested-list.mappers.ts index 72a7ae52..3dc4e5d2 100644 --- a/src/common/a11y/nested-list/nested-list.mappers.ts +++ b/apps/web/src/common/a11y/nested-list/nested-list.mappers.ts @@ -30,7 +30,7 @@ export const mapFlatOptionsToNestedListOptions = < ): A11yNestedListOption