From 71d4f8486b25ef8160d4b8042f30f9d9b7034f00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20S=C3=A1nchez?= Date: Sun, 3 Nov 2024 13:13:08 +0100 Subject: [PATCH] feat!: update Svelte templates to Svelte 5 (#28) --- package.json | 8 +- pnpm-lock.yaml | 150 +++++++++--------- src/customize/svelte.ts | 8 +- src/customize/sveltekit.ts | 44 +++-- src/prompts.ts | 2 +- .../src/lib/PWABadge-js.svelte | 8 +- .../src/lib/PWABadge-ts.svelte | 8 +- .../src/routes/app-layout.svelte | 5 +- .../src/routes/layout.svelte | 5 +- templates/template-svelte-ts/package.json | 12 +- .../template-svelte-ts/src/lib/Counter.svelte | 4 +- .../src/lib/PWABadge.svelte | 8 +- templates/template-svelte-ts/tsconfig.json | 3 +- .../template-svelte-ts/tsconfig.node.json | 7 +- templates/template-svelte/jsconfig.json | 2 +- templates/template-svelte/package.json | 6 +- .../template-svelte/src/lib/Counter.svelte | 4 +- .../template-svelte/src/lib/PWABadge.svelte | 8 +- 18 files changed, 157 insertions(+), 135 deletions(-) diff --git a/package.json b/package.json index 1718f9c..787ac10 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@vite-pwa/create-pwa", "type": "module", "version": "0.4.3", - "packageManager": "pnpm@9.12.2", + "packageManager": "pnpm@9.12.3", "description": "PWA Templates", "author": "antfu ", "license": "MIT", @@ -42,7 +42,7 @@ "dev": "unbuild --stub", "build": "unbuild", "lint": "eslint .", - "lint-fix": "nr lint --fix", + "lint:fix": "nr lint --fix", "prepublishOnly": "npm run build", "release": "bumpp && npm publish" }, @@ -61,10 +61,10 @@ "kolorist": "^1.8.0", "magicast": "^0.3.4", "minimist": "^1.2.8", - "package-manager-detector": "^0.2.0", + "package-manager-detector": "^0.2.2", "prompts": "^2.4.2", "tsx": "^4.9.1", - "typescript": "^5.4.5", + "typescript": "^5.6.3", "unbuild": "^2.0.0", "vitest": "^1.6.0" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 618dd91..b64defd 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -10,7 +10,7 @@ importers: devDependencies: '@antfu/eslint-config': specifier: ^2.16.1 - version: 2.16.1(@vue/compiler-sfc@3.4.26)(eslint@9.2.0)(typescript@5.4.5)(vitest@1.6.0(@types/node@20.12.8)) + version: 2.16.1(@vue/compiler-sfc@3.4.26)(eslint@9.2.0)(typescript@5.6.3)(vitest@1.6.0(@types/node@20.12.8)) '@antfu/ni': specifier: ^0.21.12 version: 0.21.12 @@ -51,8 +51,8 @@ importers: specifier: ^1.2.8 version: 1.2.8 package-manager-detector: - specifier: ^0.2.0 - version: 0.2.0 + specifier: ^0.2.2 + version: 0.2.2 prompts: specifier: ^2.4.2 version: 2.4.2 @@ -60,11 +60,11 @@ importers: specifier: ^4.9.1 version: 4.9.1 typescript: - specifier: ^5.4.5 - version: 5.4.5 + specifier: ^5.6.3 + version: 5.6.3 unbuild: specifier: ^2.0.0 - version: 2.0.0(typescript@5.4.5) + version: 2.0.0(typescript@5.6.3) vitest: specifier: ^1.6.0 version: 1.6.0(@types/node@20.12.8) @@ -2047,8 +2047,8 @@ packages: resolution: {integrity: sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==} engines: {node: '>=6'} - package-manager-detector@0.2.0: - resolution: {integrity: sha512-E385OSk9qDcXhcM9LNSe4sdhx8a9mAPrZ4sMLW+tmxl5ZuGtPUcdFu+MPP2jbgiWAZ6Pfe5soGFMd+0Db5Vrog==} + package-manager-detector@0.2.2: + resolution: {integrity: sha512-VgXbyrSNsml4eHWIvxxG/nTL4wgybMTXCV2Un/+yEc3aDKKU6nQBZjbeP3Pl3qm9Qg92X/1ng4ffvCeD/zwHgg==} parent-module@1.0.1: resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==} @@ -2579,8 +2579,8 @@ packages: resolution: {integrity: sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==} engines: {node: '>=8'} - typescript@5.4.5: - resolution: {integrity: sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==} + typescript@5.6.3: + resolution: {integrity: sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==} engines: {node: '>=14.17'} hasBin: true @@ -2760,13 +2760,13 @@ snapshots: '@jridgewell/gen-mapping': 0.3.5 '@jridgewell/trace-mapping': 0.3.25 - '@antfu/eslint-config@2.16.1(@vue/compiler-sfc@3.4.26)(eslint@9.2.0)(typescript@5.4.5)(vitest@1.6.0(@types/node@20.12.8))': + '@antfu/eslint-config@2.16.1(@vue/compiler-sfc@3.4.26)(eslint@9.2.0)(typescript@5.6.3)(vitest@1.6.0(@types/node@20.12.8))': dependencies: '@antfu/install-pkg': 0.3.3 '@clack/prompts': 0.7.0 - '@stylistic/eslint-plugin': 1.8.0(eslint@9.2.0)(typescript@5.4.5) - '@typescript-eslint/eslint-plugin': 7.7.1(@typescript-eslint/parser@7.7.1(eslint@9.2.0)(typescript@5.4.5))(eslint@9.2.0)(typescript@5.4.5) - '@typescript-eslint/parser': 7.7.1(eslint@9.2.0)(typescript@5.4.5) + '@stylistic/eslint-plugin': 1.8.0(eslint@9.2.0)(typescript@5.6.3) + '@typescript-eslint/eslint-plugin': 7.7.1(@typescript-eslint/parser@7.7.1(eslint@9.2.0)(typescript@5.6.3))(eslint@9.2.0)(typescript@5.6.3) + '@typescript-eslint/parser': 7.7.1(eslint@9.2.0)(typescript@5.6.3) eslint: 9.2.0 eslint-config-flat-gitignore: 0.1.5 eslint-flat-config-utils: 0.2.4 @@ -2774,17 +2774,17 @@ snapshots: eslint-plugin-antfu: 2.1.2(eslint@9.2.0) eslint-plugin-command: 0.1.8(eslint@9.2.0) eslint-plugin-eslint-comments: 3.2.0(eslint@9.2.0) - eslint-plugin-import-x: 0.5.0(eslint@9.2.0)(typescript@5.4.5) + eslint-plugin-import-x: 0.5.0(eslint@9.2.0)(typescript@5.6.3) eslint-plugin-jsdoc: 48.2.3(eslint@9.2.0) eslint-plugin-jsonc: 2.15.1(eslint@9.2.0) eslint-plugin-markdown: 4.0.1(eslint@9.2.0) eslint-plugin-n: 17.4.0(eslint@9.2.0) eslint-plugin-no-only-tests: 3.1.0 - eslint-plugin-perfectionist: 2.10.0(eslint@9.2.0)(typescript@5.4.5)(vue-eslint-parser@9.4.2(eslint@9.2.0)) + eslint-plugin-perfectionist: 2.10.0(eslint@9.2.0)(typescript@5.6.3)(vue-eslint-parser@9.4.2(eslint@9.2.0)) eslint-plugin-toml: 0.11.0(eslint@9.2.0) eslint-plugin-unicorn: 52.0.0(eslint@9.2.0) - eslint-plugin-unused-imports: 3.2.0(@typescript-eslint/eslint-plugin@7.7.1(@typescript-eslint/parser@7.7.1(eslint@9.2.0)(typescript@5.4.5))(eslint@9.2.0)(typescript@5.4.5))(eslint@9.2.0) - eslint-plugin-vitest: 0.5.4(@typescript-eslint/eslint-plugin@7.7.1(@typescript-eslint/parser@7.7.1(eslint@9.2.0)(typescript@5.4.5))(eslint@9.2.0)(typescript@5.4.5))(eslint@9.2.0)(typescript@5.4.5)(vitest@1.6.0(@types/node@20.12.8)) + eslint-plugin-unused-imports: 3.2.0(@typescript-eslint/eslint-plugin@7.7.1(@typescript-eslint/parser@7.7.1(eslint@9.2.0)(typescript@5.6.3))(eslint@9.2.0)(typescript@5.6.3))(eslint@9.2.0) + eslint-plugin-vitest: 0.5.4(@typescript-eslint/eslint-plugin@7.7.1(@typescript-eslint/parser@7.7.1(eslint@9.2.0)(typescript@5.6.3))(eslint@9.2.0)(typescript@5.6.3))(eslint@9.2.0)(typescript@5.6.3)(vitest@1.6.0(@types/node@20.12.8)) eslint-plugin-vue: 9.25.0(eslint@9.2.0) eslint-plugin-yml: 1.14.0(eslint@9.2.0) eslint-processor-vue-blocks: 0.1.2(@vue/compiler-sfc@3.4.26)(eslint@9.2.0) @@ -3302,31 +3302,31 @@ snapshots: estraverse: 5.3.0 picomatch: 4.0.2 - '@stylistic/eslint-plugin-plus@1.8.0(eslint@9.2.0)(typescript@5.4.5)': + '@stylistic/eslint-plugin-plus@1.8.0(eslint@9.2.0)(typescript@5.6.3)': dependencies: '@types/eslint': 8.56.10 - '@typescript-eslint/utils': 6.21.0(eslint@9.2.0)(typescript@5.4.5) + '@typescript-eslint/utils': 6.21.0(eslint@9.2.0)(typescript@5.6.3) eslint: 9.2.0 transitivePeerDependencies: - supports-color - typescript - '@stylistic/eslint-plugin-ts@1.8.0(eslint@9.2.0)(typescript@5.4.5)': + '@stylistic/eslint-plugin-ts@1.8.0(eslint@9.2.0)(typescript@5.6.3)': dependencies: '@stylistic/eslint-plugin-js': 1.8.0(eslint@9.2.0) '@types/eslint': 8.56.10 - '@typescript-eslint/utils': 6.21.0(eslint@9.2.0)(typescript@5.4.5) + '@typescript-eslint/utils': 6.21.0(eslint@9.2.0)(typescript@5.6.3) eslint: 9.2.0 transitivePeerDependencies: - supports-color - typescript - '@stylistic/eslint-plugin@1.8.0(eslint@9.2.0)(typescript@5.4.5)': + '@stylistic/eslint-plugin@1.8.0(eslint@9.2.0)(typescript@5.6.3)': dependencies: '@stylistic/eslint-plugin-js': 1.8.0(eslint@9.2.0) '@stylistic/eslint-plugin-jsx': 1.8.0(eslint@9.2.0) - '@stylistic/eslint-plugin-plus': 1.8.0(eslint@9.2.0)(typescript@5.4.5) - '@stylistic/eslint-plugin-ts': 1.8.0(eslint@9.2.0)(typescript@5.4.5) + '@stylistic/eslint-plugin-plus': 1.8.0(eslint@9.2.0)(typescript@5.6.3) + '@stylistic/eslint-plugin-ts': 1.8.0(eslint@9.2.0)(typescript@5.6.3) '@types/eslint': 8.56.10 eslint: 9.2.0 transitivePeerDependencies: @@ -3380,13 +3380,13 @@ snapshots: '@types/unist@2.0.10': {} - '@typescript-eslint/eslint-plugin@7.7.1(@typescript-eslint/parser@7.7.1(eslint@9.2.0)(typescript@5.4.5))(eslint@9.2.0)(typescript@5.4.5)': + '@typescript-eslint/eslint-plugin@7.7.1(@typescript-eslint/parser@7.7.1(eslint@9.2.0)(typescript@5.6.3))(eslint@9.2.0)(typescript@5.6.3)': dependencies: '@eslint-community/regexpp': 4.10.0 - '@typescript-eslint/parser': 7.7.1(eslint@9.2.0)(typescript@5.4.5) + '@typescript-eslint/parser': 7.7.1(eslint@9.2.0)(typescript@5.6.3) '@typescript-eslint/scope-manager': 7.7.1 - '@typescript-eslint/type-utils': 7.7.1(eslint@9.2.0)(typescript@5.4.5) - '@typescript-eslint/utils': 7.7.1(eslint@9.2.0)(typescript@5.4.5) + '@typescript-eslint/type-utils': 7.7.1(eslint@9.2.0)(typescript@5.6.3) + '@typescript-eslint/utils': 7.7.1(eslint@9.2.0)(typescript@5.6.3) '@typescript-eslint/visitor-keys': 7.7.1 debug: 4.3.4 eslint: 9.2.0 @@ -3394,22 +3394,22 @@ snapshots: ignore: 5.3.1 natural-compare: 1.4.0 semver: 7.6.0 - ts-api-utils: 1.3.0(typescript@5.4.5) + ts-api-utils: 1.3.0(typescript@5.6.3) optionalDependencies: - typescript: 5.4.5 + typescript: 5.6.3 transitivePeerDependencies: - supports-color - '@typescript-eslint/parser@7.7.1(eslint@9.2.0)(typescript@5.4.5)': + '@typescript-eslint/parser@7.7.1(eslint@9.2.0)(typescript@5.6.3)': dependencies: '@typescript-eslint/scope-manager': 7.7.1 '@typescript-eslint/types': 7.7.1 - '@typescript-eslint/typescript-estree': 7.7.1(typescript@5.4.5) + '@typescript-eslint/typescript-estree': 7.7.1(typescript@5.6.3) '@typescript-eslint/visitor-keys': 7.7.1 debug: 4.3.4 eslint: 9.2.0 optionalDependencies: - typescript: 5.4.5 + typescript: 5.6.3 transitivePeerDependencies: - supports-color @@ -3428,15 +3428,15 @@ snapshots: '@typescript-eslint/types': 7.8.0 '@typescript-eslint/visitor-keys': 7.8.0 - '@typescript-eslint/type-utils@7.7.1(eslint@9.2.0)(typescript@5.4.5)': + '@typescript-eslint/type-utils@7.7.1(eslint@9.2.0)(typescript@5.6.3)': dependencies: - '@typescript-eslint/typescript-estree': 7.7.1(typescript@5.4.5) - '@typescript-eslint/utils': 7.7.1(eslint@9.2.0)(typescript@5.4.5) + '@typescript-eslint/typescript-estree': 7.7.1(typescript@5.6.3) + '@typescript-eslint/utils': 7.7.1(eslint@9.2.0)(typescript@5.6.3) debug: 4.3.4 eslint: 9.2.0 - ts-api-utils: 1.3.0(typescript@5.4.5) + ts-api-utils: 1.3.0(typescript@5.6.3) optionalDependencies: - typescript: 5.4.5 + typescript: 5.6.3 transitivePeerDependencies: - supports-color @@ -3446,7 +3446,7 @@ snapshots: '@typescript-eslint/types@7.8.0': {} - '@typescript-eslint/typescript-estree@6.21.0(typescript@5.4.5)': + '@typescript-eslint/typescript-estree@6.21.0(typescript@5.6.3)': dependencies: '@typescript-eslint/types': 6.21.0 '@typescript-eslint/visitor-keys': 6.21.0 @@ -3455,13 +3455,13 @@ snapshots: is-glob: 4.0.3 minimatch: 9.0.3 semver: 7.6.0 - ts-api-utils: 1.3.0(typescript@5.4.5) + ts-api-utils: 1.3.0(typescript@5.6.3) optionalDependencies: - typescript: 5.4.5 + typescript: 5.6.3 transitivePeerDependencies: - supports-color - '@typescript-eslint/typescript-estree@7.7.1(typescript@5.4.5)': + '@typescript-eslint/typescript-estree@7.7.1(typescript@5.6.3)': dependencies: '@typescript-eslint/types': 7.7.1 '@typescript-eslint/visitor-keys': 7.7.1 @@ -3470,13 +3470,13 @@ snapshots: is-glob: 4.0.3 minimatch: 9.0.4 semver: 7.6.0 - ts-api-utils: 1.3.0(typescript@5.4.5) + ts-api-utils: 1.3.0(typescript@5.6.3) optionalDependencies: - typescript: 5.4.5 + typescript: 5.6.3 transitivePeerDependencies: - supports-color - '@typescript-eslint/typescript-estree@7.8.0(typescript@5.4.5)': + '@typescript-eslint/typescript-estree@7.8.0(typescript@5.6.3)': dependencies: '@typescript-eslint/types': 7.8.0 '@typescript-eslint/visitor-keys': 7.8.0 @@ -3485,48 +3485,48 @@ snapshots: is-glob: 4.0.3 minimatch: 9.0.4 semver: 7.6.0 - ts-api-utils: 1.3.0(typescript@5.4.5) + ts-api-utils: 1.3.0(typescript@5.6.3) optionalDependencies: - typescript: 5.4.5 + typescript: 5.6.3 transitivePeerDependencies: - supports-color - '@typescript-eslint/utils@6.21.0(eslint@9.2.0)(typescript@5.4.5)': + '@typescript-eslint/utils@6.21.0(eslint@9.2.0)(typescript@5.6.3)': dependencies: '@eslint-community/eslint-utils': 4.4.0(eslint@9.2.0) '@types/json-schema': 7.0.15 '@types/semver': 7.5.8 '@typescript-eslint/scope-manager': 6.21.0 '@typescript-eslint/types': 6.21.0 - '@typescript-eslint/typescript-estree': 6.21.0(typescript@5.4.5) + '@typescript-eslint/typescript-estree': 6.21.0(typescript@5.6.3) eslint: 9.2.0 semver: 7.6.0 transitivePeerDependencies: - supports-color - typescript - '@typescript-eslint/utils@7.7.1(eslint@9.2.0)(typescript@5.4.5)': + '@typescript-eslint/utils@7.7.1(eslint@9.2.0)(typescript@5.6.3)': dependencies: '@eslint-community/eslint-utils': 4.4.0(eslint@9.2.0) '@types/json-schema': 7.0.15 '@types/semver': 7.5.8 '@typescript-eslint/scope-manager': 7.7.1 '@typescript-eslint/types': 7.7.1 - '@typescript-eslint/typescript-estree': 7.7.1(typescript@5.4.5) + '@typescript-eslint/typescript-estree': 7.7.1(typescript@5.6.3) eslint: 9.2.0 semver: 7.6.0 transitivePeerDependencies: - supports-color - typescript - '@typescript-eslint/utils@7.8.0(eslint@9.2.0)(typescript@5.4.5)': + '@typescript-eslint/utils@7.8.0(eslint@9.2.0)(typescript@5.6.3)': dependencies: '@eslint-community/eslint-utils': 4.4.0(eslint@9.2.0) '@types/json-schema': 7.0.15 '@types/semver': 7.5.8 '@typescript-eslint/scope-manager': 7.8.0 '@typescript-eslint/types': 7.8.0 - '@typescript-eslint/typescript-estree': 7.8.0(typescript@5.4.5) + '@typescript-eslint/typescript-estree': 7.8.0(typescript@5.6.3) eslint: 9.2.0 semver: 7.6.0 transitivePeerDependencies: @@ -4074,9 +4074,9 @@ snapshots: eslint: 9.2.0 ignore: 5.3.1 - eslint-plugin-import-x@0.5.0(eslint@9.2.0)(typescript@5.4.5): + eslint-plugin-import-x@0.5.0(eslint@9.2.0)(typescript@5.6.3): dependencies: - '@typescript-eslint/utils': 7.8.0(eslint@9.2.0)(typescript@5.4.5) + '@typescript-eslint/utils': 7.8.0(eslint@9.2.0)(typescript@5.6.3) debug: 4.3.4 doctrine: 3.0.0 eslint: 9.2.0 @@ -4136,9 +4136,9 @@ snapshots: eslint-plugin-no-only-tests@3.1.0: {} - eslint-plugin-perfectionist@2.10.0(eslint@9.2.0)(typescript@5.4.5)(vue-eslint-parser@9.4.2(eslint@9.2.0)): + eslint-plugin-perfectionist@2.10.0(eslint@9.2.0)(typescript@5.6.3)(vue-eslint-parser@9.4.2(eslint@9.2.0)): dependencies: - '@typescript-eslint/utils': 7.8.0(eslint@9.2.0)(typescript@5.4.5) + '@typescript-eslint/utils': 7.8.0(eslint@9.2.0)(typescript@5.6.3) eslint: 9.2.0 minimatch: 9.0.4 natural-compare-lite: 1.4.0 @@ -4180,19 +4180,19 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-plugin-unused-imports@3.2.0(@typescript-eslint/eslint-plugin@7.7.1(@typescript-eslint/parser@7.7.1(eslint@9.2.0)(typescript@5.4.5))(eslint@9.2.0)(typescript@5.4.5))(eslint@9.2.0): + eslint-plugin-unused-imports@3.2.0(@typescript-eslint/eslint-plugin@7.7.1(@typescript-eslint/parser@7.7.1(eslint@9.2.0)(typescript@5.6.3))(eslint@9.2.0)(typescript@5.6.3))(eslint@9.2.0): dependencies: eslint: 9.2.0 eslint-rule-composer: 0.3.0 optionalDependencies: - '@typescript-eslint/eslint-plugin': 7.7.1(@typescript-eslint/parser@7.7.1(eslint@9.2.0)(typescript@5.4.5))(eslint@9.2.0)(typescript@5.4.5) + '@typescript-eslint/eslint-plugin': 7.7.1(@typescript-eslint/parser@7.7.1(eslint@9.2.0)(typescript@5.6.3))(eslint@9.2.0)(typescript@5.6.3) - eslint-plugin-vitest@0.5.4(@typescript-eslint/eslint-plugin@7.7.1(@typescript-eslint/parser@7.7.1(eslint@9.2.0)(typescript@5.4.5))(eslint@9.2.0)(typescript@5.4.5))(eslint@9.2.0)(typescript@5.4.5)(vitest@1.6.0(@types/node@20.12.8)): + eslint-plugin-vitest@0.5.4(@typescript-eslint/eslint-plugin@7.7.1(@typescript-eslint/parser@7.7.1(eslint@9.2.0)(typescript@5.6.3))(eslint@9.2.0)(typescript@5.6.3))(eslint@9.2.0)(typescript@5.6.3)(vitest@1.6.0(@types/node@20.12.8)): dependencies: - '@typescript-eslint/utils': 7.8.0(eslint@9.2.0)(typescript@5.4.5) + '@typescript-eslint/utils': 7.8.0(eslint@9.2.0)(typescript@5.6.3) eslint: 9.2.0 optionalDependencies: - '@typescript-eslint/eslint-plugin': 7.7.1(@typescript-eslint/parser@7.7.1(eslint@9.2.0)(typescript@5.4.5))(eslint@9.2.0)(typescript@5.4.5) + '@typescript-eslint/eslint-plugin': 7.7.1(@typescript-eslint/parser@7.7.1(eslint@9.2.0)(typescript@5.6.3))(eslint@9.2.0)(typescript@5.6.3) vitest: 1.6.0(@types/node@20.12.8) transitivePeerDependencies: - supports-color @@ -4723,7 +4723,7 @@ snapshots: mkdirp@1.0.4: {} - mkdist@1.5.1(typescript@5.4.5): + mkdist@1.5.1(typescript@5.6.3): dependencies: autoprefixer: 10.4.19(postcss@8.4.38) citty: 0.1.6 @@ -4741,7 +4741,7 @@ snapshots: postcss-nested: 6.0.1(postcss@8.4.38) semver: 7.6.0 optionalDependencies: - typescript: 5.4.5 + typescript: 5.6.3 mlly@1.7.0: dependencies: @@ -4842,7 +4842,7 @@ snapshots: p-try@2.2.0: {} - package-manager-detector@0.2.0: {} + package-manager-detector@0.2.2: {} parent-module@1.0.1: dependencies: @@ -5128,11 +5128,11 @@ snapshots: reusify@1.0.4: {} - rollup-plugin-dts@6.1.0(rollup@3.29.4)(typescript@5.4.5): + rollup-plugin-dts@6.1.0(rollup@3.29.4)(typescript@5.6.3): dependencies: magic-string: 0.30.10 rollup: 3.29.4 - typescript: 5.4.5 + typescript: 5.6.3 optionalDependencies: '@babel/code-frame': 7.24.2 @@ -5302,9 +5302,9 @@ snapshots: dependencies: eslint-visitor-keys: 3.4.3 - ts-api-utils@1.3.0(typescript@5.4.5): + ts-api-utils@1.3.0(typescript@5.6.3): dependencies: - typescript: 5.4.5 + typescript: 5.6.3 tslib@2.6.2: {} @@ -5327,11 +5327,11 @@ snapshots: type-fest@0.8.1: {} - typescript@5.4.5: {} + typescript@5.6.3: {} ufo@1.5.3: {} - unbuild@2.0.0(typescript@5.4.5): + unbuild@2.0.0(typescript@5.6.3): dependencies: '@rollup/plugin-alias': 5.1.0(rollup@3.29.4) '@rollup/plugin-commonjs': 25.0.7(rollup@3.29.4) @@ -5348,17 +5348,17 @@ snapshots: hookable: 5.5.3 jiti: 1.21.0 magic-string: 0.30.10 - mkdist: 1.5.1(typescript@5.4.5) + mkdist: 1.5.1(typescript@5.6.3) mlly: 1.7.0 pathe: 1.1.2 pkg-types: 1.1.0 pretty-bytes: 6.1.1 rollup: 3.29.4 - rollup-plugin-dts: 6.1.0(rollup@3.29.4)(typescript@5.4.5) + rollup-plugin-dts: 6.1.0(rollup@3.29.4)(typescript@5.6.3) scule: 1.3.0 untyped: 1.4.2 optionalDependencies: - typescript: 5.4.5 + typescript: 5.6.3 transitivePeerDependencies: - sass - supports-color diff --git a/src/customize/svelte.ts b/src/customize/svelte.ts index cae3d01..f917e12 100644 --- a/src/customize/svelte.ts +++ b/src/customize/svelte.ts @@ -30,12 +30,12 @@ export function customize(prompts: PromptsData) { ) .replace('offlineReady.set(false)', '') .replace( - '$: toast = $offlineReady || $needRefresh', - '$: toast = $needRefresh', + 'let toast = $derived($offlineReady || $needRefresh)', + 'let toast = $derived($needRefresh)', ) .replace( - '$: message = $offlineReady ? \'App ready to work offline\' : ($needRefresh ? \'New content available, click on reload button to update.\' : \'\')', - '$: message = $needRefresh ? \'New content available, click on reload button to update.\' : \'\'', + 'let message = $derived($offlineReady ? \'App ready to work offline\' : ($needRefresh ? \'New content available, click on reload button to update.\' : \'\'))', + 'let message = $derived($needRefresh ? \'New content available, click on reload button to update.\' : \'\')', ) } diff --git a/src/customize/sveltekit.ts b/src/customize/sveltekit.ts index d40f327..2488067 100644 --- a/src/customize/sveltekit.ts +++ b/src/customize/sveltekit.ts @@ -8,14 +8,14 @@ import { addPackageObject, editFile } from '../utils' import { includeDependencies } from '../dependencies' import { preparePWAOptions } from '../pwa' import { MagicastSvelteKitOptions } from '../vite' +import { detect } from 'package-manager-detector' import { PWAAssetsVersion, SvelteKitPWAVersion, VitePluginPWAVersion, WorkboxVersion } from '../versions' -export function customize(prompts: PromptsData) { +export async function customize(prompts: PromptsData) { const { cdProjectName, templateDir, rootPath, - pkgManager, prompt, customServiceWorker, pwaAssets, @@ -57,11 +57,23 @@ ${appDts}`, // copy/override src/routes/+layout.svelte const existsLayout = fs.existsSync(path.resolve(rootPath, 'src', 'routes', '+layout.svelte')) + const layoutFile = path.resolve(rootPath, 'src', 'routes', '+layout.svelte') fs.copyFileSync( path.resolve(templateDir, 'src', 'routes', `${existsLayout ? 'app-layout' : 'layout'}.svelte`), - path.resolve(rootPath, 'src', 'routes', '+layout.svelte'), + layoutFile, ) + if (ts) { + editFile(layoutFile, (content) => { + content = content.replace(/ {#if toast} @@ -68,11 +68,11 @@
{#if $needRefresh} - {/if} -
diff --git a/templates/template-custom-svelte-kit/src/lib/PWABadge-ts.svelte b/templates/template-custom-svelte-kit/src/lib/PWABadge-ts.svelte index 377dff9..b04b720 100644 --- a/templates/template-custom-svelte-kit/src/lib/PWABadge-ts.svelte +++ b/templates/template-custom-svelte-kit/src/lib/PWABadge-ts.svelte @@ -48,8 +48,8 @@ needRefresh.set(false) } - $: toast = $offlineReady || $needRefresh - $: message = $offlineReady ? 'App ready to work offline' : ($needRefresh ? 'New content available, click on reload button to update.' : '') + let toast = $derived($offlineReady || $needRefresh) + let message = $derived($offlineReady ? 'App ready to work offline' : ($needRefresh ? 'New content available, click on reload button to update.' : '')) {#if toast} @@ -65,11 +65,11 @@
{#if $needRefresh} - {/if} -
diff --git a/templates/template-custom-svelte-kit/src/routes/app-layout.svelte b/templates/template-custom-svelte-kit/src/routes/app-layout.svelte index 3b0ecfa..7a31a8d 100644 --- a/templates/template-custom-svelte-kit/src/routes/app-layout.svelte +++ b/templates/template-custom-svelte-kit/src/routes/app-layout.svelte @@ -4,7 +4,8 @@ import { pwaInfo } from 'virtual:pwa-info'; import { pwaAssetsHead } from 'virtual:pwa-assets/head'; - $: webManifest = pwaInfo ? pwaInfo.webManifest.linkTag : ''; + let { children } = $props(); + let webManifest = $derived(pwaInfo ? pwaInfo.webManifest.linkTag : '') @@ -21,7 +22,7 @@
- + {@render children?.()}