From 7d36bdd863e0bea774879dcc12a25c701b24fb28 Mon Sep 17 00:00:00 2001 From: Ryan Vandersmith Date: Thu, 7 Nov 2024 08:19:40 -0700 Subject: [PATCH] chore: update agent deps in frontend projects (alternate approach) (#3975) * Bump agent-js in React starter project * Bump agent-js in other starter projects * Update changelog * Remove lockfiles --- CHANGELOG.md | 2 ++ .../react/src/__frontend_name__/package.json | 6 +++--- .../react/src/__frontend_name__/vite.config.js | 1 + .../svelte/src/__frontend_name__/package.json | 6 +++--- .../svelte/src/__frontend_name__/vite.config.js | 1 + .../vanilla_js/src/__frontend_name__/package.json | 6 +++--- .../vanilla_js/src/__frontend_name__/vite.config.js | 1 + .../vue/src/__frontend_name__/package.json | 6 +++--- .../vue/src/__frontend_name__/vite.config.js | 3 ++- 9 files changed, 19 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 85eddac7ac..169c256710 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ # UNRELEASED +### chore: update agent version in frontend templates, and include `resolve.dedupe` in Vite config + ### chore: improve error message when trying to use the local replica when it is not running ### Frontend canister diff --git a/src/dfx/assets/project_templates/react/src/__frontend_name__/package.json b/src/dfx/assets/project_templates/react/src/__frontend_name__/package.json index 04d9cd02c5..6c1c237ecd 100644 --- a/src/dfx/assets/project_templates/react/src/__frontend_name__/package.json +++ b/src/dfx/assets/project_templates/react/src/__frontend_name__/package.json @@ -13,9 +13,9 @@ "dependencies": { "react": "^18.2.0", "react-dom": "^18.2.0", - "@dfinity/agent": "^1.4.0", - "@dfinity/candid": "^1.4.0", - "@dfinity/principal": "^1.4.0" + "@dfinity/agent": "^2.1.3", + "@dfinity/candid": "^2.1.3", + "@dfinity/principal": "^2.1.3" }, "devDependencies": { "@types/react": "^18.2.14", diff --git a/src/dfx/assets/project_templates/react/src/__frontend_name__/vite.config.js b/src/dfx/assets/project_templates/react/src/__frontend_name__/vite.config.js index 670b0347b6..9755aa9919 100644 --- a/src/dfx/assets/project_templates/react/src/__frontend_name__/vite.config.js +++ b/src/dfx/assets/project_templates/react/src/__frontend_name__/vite.config.js @@ -39,5 +39,6 @@ export default defineConfig({ ), }, ], + dedupe: ['@dfinity/agent'], }, }); diff --git a/src/dfx/assets/project_templates/svelte/src/__frontend_name__/package.json b/src/dfx/assets/project_templates/svelte/src/__frontend_name__/package.json index 69b8edd5af..85cf87751c 100644 --- a/src/dfx/assets/project_templates/svelte/src/__frontend_name__/package.json +++ b/src/dfx/assets/project_templates/svelte/src/__frontend_name__/package.json @@ -11,9 +11,9 @@ "format": "prettier --write \"src/**/*.{json,js,jsx,ts,tsx,css,scss}\"" }, "dependencies": { - "@dfinity/agent": "^1.4.0", - "@dfinity/candid": "^1.4.0", - "@dfinity/principal": "^1.4.0" + "@dfinity/agent": "^2.1.3", + "@dfinity/candid": "^2.1.3", + "@dfinity/principal": "^2.1.3" }, "devDependencies": { "@sveltejs/adapter-static": "^3.0.4", diff --git a/src/dfx/assets/project_templates/svelte/src/__frontend_name__/vite.config.js b/src/dfx/assets/project_templates/svelte/src/__frontend_name__/vite.config.js index 51010df640..70d491d6cd 100644 --- a/src/dfx/assets/project_templates/svelte/src/__frontend_name__/vite.config.js +++ b/src/dfx/assets/project_templates/svelte/src/__frontend_name__/vite.config.js @@ -39,5 +39,6 @@ export default defineConfig({ ), }, ], + dedupe: ['@dfinity/agent'], }, }); diff --git a/src/dfx/assets/project_templates/vanilla_js/src/__frontend_name__/package.json b/src/dfx/assets/project_templates/vanilla_js/src/__frontend_name__/package.json index e96aeb2059..36d9b2fef0 100644 --- a/src/dfx/assets/project_templates/vanilla_js/src/__frontend_name__/package.json +++ b/src/dfx/assets/project_templates/vanilla_js/src/__frontend_name__/package.json @@ -21,9 +21,9 @@ "vitest": "^2.0.5" }, "dependencies": { - "@dfinity/agent": "^1.4.0", - "@dfinity/candid": "^1.4.0", - "@dfinity/principal": "^1.4.0", + "@dfinity/agent": "^2.1.3", + "@dfinity/candid": "^2.1.3", + "@dfinity/principal": "^2.1.3", "lit-html": "^2.8.0" } } diff --git a/src/dfx/assets/project_templates/vanilla_js/src/__frontend_name__/vite.config.js b/src/dfx/assets/project_templates/vanilla_js/src/__frontend_name__/vite.config.js index 18ceb500c7..9d6f44396e 100644 --- a/src/dfx/assets/project_templates/vanilla_js/src/__frontend_name__/vite.config.js +++ b/src/dfx/assets/project_templates/vanilla_js/src/__frontend_name__/vite.config.js @@ -38,5 +38,6 @@ export default defineConfig({ ), }, ], + dedupe: ['@dfinity/agent'], }, }); diff --git a/src/dfx/assets/project_templates/vue/src/__frontend_name__/package.json b/src/dfx/assets/project_templates/vue/src/__frontend_name__/package.json index daa41481a1..8367abd0d5 100644 --- a/src/dfx/assets/project_templates/vue/src/__frontend_name__/package.json +++ b/src/dfx/assets/project_templates/vue/src/__frontend_name__/package.json @@ -23,8 +23,8 @@ "dependencies": { "pinia": "^2.1.6", "vue": "^3.3.4", - "@dfinity/agent": "^1.4.0", - "@dfinity/candid": "^1.4.0", - "@dfinity/principal": "^1.4.0" + "@dfinity/agent": "^2.1.3", + "@dfinity/candid": "^2.1.3", + "@dfinity/principal": "^2.1.3" } } \ No newline at end of file diff --git a/src/dfx/assets/project_templates/vue/src/__frontend_name__/vite.config.js b/src/dfx/assets/project_templates/vue/src/__frontend_name__/vite.config.js index 014c37999a..92afec3511 100644 --- a/src/dfx/assets/project_templates/vue/src/__frontend_name__/vite.config.js +++ b/src/dfx/assets/project_templates/vue/src/__frontend_name__/vite.config.js @@ -34,6 +34,7 @@ export default defineConfig({ alias: [ { find: 'declarations', replacement: fileURLToPath(new URL('../declarations', import.meta.url)) }, { find: '@', replacement: fileURLToPath(new URL('./src', import.meta.url)) }, - ] + ], + dedupe: ['@dfinity/agent'], } });