Skip to content

Commit

Permalink
feat(web): add version suffix to cesiumBaseUrl (#1203)
Browse files Browse the repository at this point in the history
feat: add version suffix to cesiumBaseUrl
  • Loading branch information
nourbalaha authored and yk-eukarya committed Oct 1, 2024
1 parent 5a55547 commit dbf53f1
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 45 deletions.
2 changes: 1 addition & 1 deletion web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"ts-node": "10.9.2",
"typescript": "5.4.5",
"vite": "5.2.12",
"vite-plugin-cesium": "1.2.22",
"vite-plugin-cesium": "1.2.23",
"vitest": "1.6.0"
},
"dependencies": {
Expand Down
87 changes: 50 additions & 37 deletions web/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,47 +12,60 @@ import cesium from "vite-plugin-cesium";
import { configDefaults } from "vitest/config";

// https://vitejs.dev/config/
export default defineConfig(() => ({
server: {
port: 3000,
open: true,
host: "127.0.0.1",
},
envPrefix: "REEARTH_CMS_",
plugins: [react(), yaml(), cesium(), serverHeaders(), config()],
css: {
preprocessorOptions: {
less: {
javascriptEnabled: true,
},
export default defineConfig(() => {
const packageJson = JSON.parse(readFileSync(resolve(__dirname, "package.json"), "utf-8"));
const cesiumVersion = packageJson.dependencies?.["cesium"];

return {
server: {
port: 3000,
open: true,
host: "127.0.0.1",
},
},
resolve: {
alias: [
{ find: "@reearth-cms", replacement: resolve(__dirname, "src") },
{
find: /^~/,
replacement: "",
},
envPrefix: "REEARTH_CMS_",
plugins: [
react(),
yaml(),
cesium({
cesiumBaseUrl: `cesium-${cesiumVersion}/`,
}),
serverHeaders(),
config(),
],
},
test: {
environment: "jsdom",
setupFiles: "./src/test/setup.ts",
exclude: [...configDefaults.exclude, "e2e/**/*"],
coverage: {
all: true,
include: ["src/**/*.ts", "src/**/*.tsx"],
exclude: [
"src/**/*.d.ts",
"src/**/*.stories.tsx",
"src/gql/graphql-client-api.tsx",
"src/test/**/*",
css: {
preprocessorOptions: {
less: {
javascriptEnabled: true,
},
},
},
resolve: {
alias: [
{ find: "@reearth-cms", replacement: resolve(__dirname, "src") },
{
find: /^~/,
replacement: "",
},
],
reporter: ["text", "json", "lcov"],
},
},
}));
test: {
environment: "jsdom",
setupFiles: "./src/test/setup.ts",
exclude: [...configDefaults.exclude, "e2e/**/*"],
coverage: {
all: true,
include: ["src/**/*.ts", "src/**/*.tsx"],
exclude: [
"src/**/*.d.ts",
"src/**/*.stories.tsx",
"src/gql/graphql-client-api.tsx",
"src/test/**/*",
],
reporter: ["text", "json", "lcov"],
},
},
};
});

function serverHeaders(): Plugin {
return {
Expand Down
39 changes: 32 additions & 7 deletions web/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -19679,7 +19679,16 @@ string-length@^4.0.1:
char-regex "^1.0.2"
strip-ansi "^6.0.0"

"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
"string-width-cjs@npm:string-width@^4.2.0":
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
dependencies:
emoji-regex "^8.0.0"
is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.1"

string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
Expand Down Expand Up @@ -19811,7 +19820,14 @@ string_decoder@~1.1.1:
dependencies:
safe-buffer "~5.1.0"

"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
dependencies:
ansi-regex "^5.0.1"

strip-ansi@^6.0.0, strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
Expand Down Expand Up @@ -20981,10 +20997,10 @@ [email protected]:
picocolors "^1.0.0"
vite "^5.0.0"

[email protected].22:
version "1.2.22"
resolved "https://registry.yarnpkg.com/vite-plugin-cesium/-/vite-plugin-cesium-1.2.22.tgz#55dc6d7dba6f8c28ee815e0d70359d67ef763694"
integrity sha512-OnS+VKNGck4kUu4/67Fdfhz0/zF9mDVNUp9hUWtX19C38O0mJsJy2MH1ev2QcrVLf6VieJ7vCGxkLchdB1n1HQ==
[email protected].23:
version "1.2.23"
resolved "https://registry.yarnpkg.com/vite-plugin-cesium/-/vite-plugin-cesium-1.2.23.tgz#fa6ef37c045fe7863901b383a23e7f72e59e7539"
integrity sha512-x9A8ZCEoegceXg/E+LnxKr0XBsI9CR4cgYWQ2Dd3cUEYwKcTnHQ3kBfpol7BUcGtgQnQos/mtVrRmuVQBXFjHw==
dependencies:
fs-extra "^9.1.0"
rollup-plugin-external-globals "^0.6.1"
Expand Down Expand Up @@ -21302,7 +21318,7 @@ wordwrap@^1.0.0:
resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb"
integrity sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==

"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
Expand All @@ -21320,6 +21336,15 @@ wrap-ansi@^6.2.0:
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
dependencies:
ansi-styles "^4.0.0"
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^8.1.0:
version "8.1.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"
Expand Down

0 comments on commit dbf53f1

Please sign in to comment.