feat: v1 release#285
Merged
Merged
Conversation
…low permissions, and apply minor code formatting and dependency updates across projects.
|
Deploying astro with
|
| Latest commit: |
571a724
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://9cf882ac.astro-e3t.pages.dev |
| Branch Preview URL: | https://v1-release.astro-e3t.pages.dev |
commit: |
3 plans across 3 waves for the upgrade command: - Plan 01: Types, preflight, UpgradeCommand skeleton - Plan 02: Core migration pipeline - Plan 03: Dry-run report and summary output
…git check - validateProject detects astro + qwik packages in package.json - checkGitStatus runs git status --porcelain to detect dirty working tree - Returns structured result with hasOldQwik/hasNewQwik/hasAstro booleans - Non-git repos return isDirty: false (not a blocker)
- Types: DetectionOutcome, FrameworkInfo, ConfigEdit, MultiFrameworkResult, SourceSignal - Tests: 5 cases for detectConfigFrameworks (react, preact+solid, none, already-configured, unsafe)
- detectConfigFrameworks using oxc-parser parseSync for static analysis - Detects @astrojs/react, @astrojs/preact, @astrojs/solid-js imports - Handles already-configured (include/exclude) and unsafe (spread) cases - Adds oxc-parser dependency
…and preflight wiring - UpgradeCommand extends Program with configure/validate/interact/execute lifecycle - configure() registers directory positional arg and dryRun option with --yes/--no support - validate() runs validateProject() and panics if not valid Astro+Qwik project - interact() prompts for directory, runs preflight, checks git dirty state with warning prompt - --yes skips git dirty prompt (continues anyway), --no aborts on dirty git - execute() is skeleton with intro/step/outro and commented placeholder sections - Export upgrade() factory function and default export
- 5 test cases: react import, pragma, useState hook, empty dir, node_modules excluded - Tests use mkdtemp for isolated temp directories
- detectSourceFrameworks scans src/ directory recursively for framework signals - Regex-based detection: import statements, @jsxImportSource pragma - Skips node_modules, dist, .astro directories - Reads first 2KB per file for performance - Deduplicates signals per framework per file
…c pattern scanning
- PACKAGE_MAP covers all @builder.io/qwik subpaths and @qwikdev/astro -> @qwik.dev/* mappings
- walkFiles() recursive walker skipping node_modules/dist/.astro/.git
- rewriteFileImports() replaces package specifiers in a single file (longest-key-first to avoid partial replacement)
- rewriteImports() scans all source files (.ts/.tsx/.js/.jsx/.mjs/.mts/.astro/.mdx) and calls rewriteFileImports
- rewriteTsconfig() updates compilerOptions.jsxImportSource in tsconfig.json
- rewriteAstroConfig() finds astro.config.{mjs,ts,mts,js} and rewrites @qwikdev/astro import
- rewritePragmaComments() tracks files with @jsxImportSource pragma changes
- scanForAsyncPatterns() detects useComputed$(async and useResource$(async patterns (warning-only)
- All functions accept dryRun parameter and return structured results
Remove unused imports/variables, fix AST node type casts, add explicit types to test callbacks.
- Import pm from panam/pm, rewrite functions from upgrade-rewrite, getPackageJson from utils - Step 1: delegate to @astrojs/upgrade via pm.x (warns and continues on failure) - Step 2: detect and remove old packages (@builder.io/qwik, @builder.io/qwik-city, @qwikdev/astro), install @qwik.dev/astro@latest and @qwik.dev/core@latest - Step 3-4: rewrite astro.config.* and tsconfig.json jsxImportSource - Step 5: rewrite all source file imports via rewriteImports - Step 6: update @jsxImportSource pragma comments via rewritePragmaComments - Step 7: scan and warn on async useComputed$/useResource$ patterns - All steps respect dryRun flag (log what would happen, write nothing) - Results collected in local aggregate for Plan 03 summary - Full pipeline wrapped in try/catch; returns 0 on success, 1 on failure
- Create stubs/templates/qwik-component/Counter.tsx as the scaffold template - No @jsxImportSource pragma (added conditionally at scaffold time) - Uses component$ and useSignal from @qwik.dev/core
- 7 test cases covering add-include, add-exclude, unsafe/none/already-configured outcomes - formatting preservation tests for tabs and 4-space indent - generateWarning tests for human-readable explanations
…ding - 5 test cases covering determineJsxStrategy primary/secondary - Scaffold tests verify pragma presence/absence and directory creation - Tests fail as expected (RED phase)
…olding - determineJsxStrategy: pure function mapping primary/secondary to JsxStrategy - scaffoldQwikComponent: reads Counter.tsx template and conditionally prepends pragma - Creates src/components/qwik/ directory in target project - All 5 tests pass
- rewriteConfig: applies add-include/add-exclude edits using MagicString character positions
- generateWarning: returns human-readable explanations for unsafe/already-configured/none outcomes
- Handles react() (no args) and react({ ssr: true }) (existing args) patterns
- Returns null for non-safe outcomes (caller uses generateWarning instead)
- All 20 test assertions pass
- Add 02-03-SUMMARY.md with all task commits, decisions, and file inventory - Update STATE.md: progress 83%, decisions logged, session updated - Update ROADMAP.md: phase 02 marked Complete (3/3 summaries) - Mark requirements MFD-07, MFD-08, MFD-09 complete
- 02-02-SUMMARY.md: magic-string config rewriter with 20 passing assertions - STATE.md: updated progress to 83%, added decisions, advanced session - ROADMAP.md: phase 02 marked Complete (3/3 plans with summaries) - REQUIREMENTS.md: MFD-04, MFD-05, MFD-06 marked complete
…n execute() - Export UpgradeResults type with dryRun, astroUpgradeRan, removedPackages, installedPackages, configChanges, tsconfigChanged, sourceFilesChanged, asyncWarnings - Replace untyped results object in execute() with typed UpgradeResults - Merge unique changed files from rewriteImports and rewritePragmaComments into sourceFilesChanged - Call this.printSummary(results) at end of execute() (stub in place for Task 2)
…ummary - Add MIGRATION_DOCS_URL constant (https://qwik.dev/docs/migration/v2/) - Dry-run mode: box titled "Dry Run Report" listing each planned action with [would] prefix, async warnings, and "No files were modified" footer - Actual run: box titled "Upgrade Summary" with Packages section (removed/installed), Files changed list, Warnings section (only when asyncWarnings present), and Next steps with pm.name run dev command and migration docs link - Use this.note() for consistent @clack/prompts box styling; this.outro() for completion line - Color: this.cyan() for section headings, this.yellow() for warnings, this.gray() for secondary info
1 task
- Exported function checks if qwik() is in the integrations array via AST - Collects import bindings from @qwik.dev/astro then scans integrations array - Conservative: only returns true for inline defineConfig — variable and callback patterns return false (safe fallback) - Reuses oxc-parser pattern already established by hasQwikImport and detectConfigFrameworks
- app.ts runAdd: reads config source once, checks both hasQwikImport and isQwikRegistered; skips astro add when qwik() is already in integrations array - command.ts installQwik: adds qwikRegistered boolean parameter; skips astro add when registered; dry-run logs distinct messages for skip vs run - Both callers in command.ts execute() pass qwikRegistered computed from configSource - Prevents duplicate qwik() integration entries when --add runs on a project that already has @qwik.dev/astro configured
…duplicate prevention - isQwikRegistered group: 5 unit tests covering inline (true), variable/callback (false-conservative), stale-import (false), clean-config (false) - Regression test: asserts config after --add on a project with INLINE_CONFIG contains exactly 1 qwik() call and no qwikDev alias - All 14 tests pass
- 10-SUMMARY.md: documents isQwikRegistered() implementation, conservative detection rationale, test coverage - STATE.md: updated last_activity, stopped_at, quick tasks table, decisions
- Regression test proving --add on React+Astro project skips framework detection - Test expects exclude patterns, JSX pragma, and Counter.tsx scaffolding - Currently FAILS because runAdd doesn't call detectConfigFrameworks
…logic - runAdd now calls detectConfigFrameworks, rewriteConfig, scaffoldQwikComponent - Prompts for JSX strategy when other frameworks detected (safe outcome) - Adds exclude patterns to existing framework integrations - Scaffolds Counter.tsx with pragma when Qwik is secondary - Preserves existing pre-install and duplicate-prevention logic - Adds persistTsconfigForAdd helper method
…sconfigForAdd - Add writeReactAstroProjectJsoncTsconfig helper with // and /* */ comments - New test: JSONC tsconfig with comments does not crash --add flow (RED) - Tests expect persistTsconfigForAdd to strip comments before parsing - Existing exclude/pragma test unchanged
…TsconfigForAdd - Add exported stripJsonComments() to utils.ts (handles //, /* */, strings, trailing commas) - Fix app.ts persistTsconfigForAdd: use stripJsonComments before JSON.parse - Fix command.ts persistTsconfig: import stripJsonComments from utils, remove private copy - All 121 tests pass
…plan - SUMMARY.md with TDD approach, deviation explanation, self-check - STATE.md updated with quick task 12 entry and session continuity
…resolution - Add test 'template resolves to real Counter.tsx with Qwik component content' - Verifies scaffoldQwikComponent reads real template (component$, import, length > 50) - Documents expected behavior for dist/ bundled path resolution
…dist/ CLI - Remove local fileURLToPath/dirname/__dirname computation (broken in dist/) - Import shared __dirname from utils.ts (proven stable entry-point pattern) - Change COUNTER_TEMPLATE_PATH from '../..' to '..' traversal, matching app.ts - Remove unused fileURLToPath (node:url) and dirname (node:path) imports
- Add 13-SUMMARY.md with task results, deviations, and self-check - Update STATE.md: record quick task 13 completion
… package.json Reproduces: non-empty dir (leftover from failed run) triggers getPackageJson(outDir) → ENOENT at app.ts:322 in interact().
…kage.json When a non-empty directory lacks package.json (e.g. leftover from a failed previous run), interact() line 322 crashed with ENOENT. Now checks fs.existsSync before calling getPackageJson, falling back to the sanitized directory name.
…-app instead of ./ When --add is used without a positional destination, interact() defaults to "./qwik-astro-app" (new project) instead of "./" (current project). This causes pnpm dlx --add to target the wrong directory.
…o-app When --add is used without a positional arg, the prompt default is now "./" (current project) instead of "./qwik-astro-app" (new subdirectory). Also improves the prompt text to say "add @qwik.dev/astro" vs "create".
…eractive) The previous fix only covered interact(). validate() still resolved --add to ./qwik-astro-app in CI/--yes/--no mode. Now both paths normalize the default to "./" when --add is active.
- Add assertPmResult import to upgrade.ts - Capture dlxResult and assert in pm.dlx call - Capture removeResult and assert in pm.remove call - Capture addResult and assert in pm.add call - Wrap pm.install in app.ts runInstall with assertPmResult and try/catch
…pgrade test - Import stripJsonComments in upgrade-rewrite.ts - Use stripJsonComments before JSON.parse on tsconfig content - Update scaffoldOldProject fixture tsconfig to use JSONC comments - Fix dry-run test to not JSON.parse JSONC fixture directly - Add unit test 'rewriteTsconfig handles JSONC comments in tsconfig' - Biome format fixes in upgrade.ts and app.ts
- 2 tasks complete: assertPmResult coverage in upgrade.ts/app.ts; JSONC tsconfig parsing - All 13 upgrade tests pass, TypeScript clean, biome lint clean
…nally - Remove if/else silent failure branch from "full upgrade swaps packages and rewrites files" - Replace with unconditional assert.isTrue(result.isSuccess()) with debug exit code in message - Fix JSONC tsconfig parsing: wrap readFileSync with stripJsonComments before JSON.parse - Add import for stripJsonComments from ../src/utils.js
- Add writeReactAstroProjectNoQwik() helper: React+Astro fixture without qwik registered so the full astro add pipeline runs (not short-circuited) - Add "--add e2e with real install (React project)" test group - Test runs pm.install() before --add --yes so astro add @qwik.dev/astro executes with real node_modules - Asserts: qwik() added to config, react() preserved, exclude pattern present, tsconfig jsxImportSource stays "react" (secondary strategy), Counter.tsx scaffolded with @jsxImportSource pragma
- SUMMARY.md for quick task 16: upgrade test hardening + React e2e add test - STATE.md updated: last activity, stopped_at, quick tasks table row
…entations Add smoke-pack.spec.ts that builds, packs, and installs the tarball, then exercises the exact __dirname → stubs/templates/qwik-component/Counter.tsx path from the installed dist. This catches the class of packaging regression where Counter.tsx was unreachable at runtime. Also add missing declare module augmentations for @japa/runner/core TestContext in upgrade.spec.ts, detect-config.spec.ts, jsx-strategy.spec.ts, and rewrite-config.spec.ts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.