| docs | docs | ||||
| examples/**/*.js | examples/**/*.js | ||||
| examples/**/*.js.map | examples/**/*.js.map | ||||
| examples/globals.js | |||||
| examples/.env | |||||
| # Logs | # Logs | ||||
| logs | logs |
| export const CESIUM_ION_API_TOKEN: string |
| import {_testFinish, LoadingScreenPlugin, MathUtils, OrbitControls3, ThreeViewer} from 'threepipe' | import {_testFinish, LoadingScreenPlugin, MathUtils, OrbitControls3, ThreeViewer} from 'threepipe' | ||||
| import {TilesRendererPlugin, UnloadTilesPlugin, TileCompressionPlugin} from '@threepipe/plugin-3d-tiles-renderer' | import {TilesRendererPlugin, UnloadTilesPlugin, TileCompressionPlugin} from '@threepipe/plugin-3d-tiles-renderer' | ||||
| import {CESIUM_ION_API_TOKEN} from '../globals.js' | |||||
| async function init() { | async function init() { | ||||
| const result = await tiles.loadCesiumIon({ | const result = await tiles.loadCesiumIon({ | ||||
| assetId: '2275207', | assetId: '2275207', | ||||
| apiToken: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI0M2VkOWIxYy00NGEyLTQ1N2QtOWYxYy01ZDNlYjdkN2U4N2MiLCJpZCI6Mjk5NTY5LCJpYXQiOjE3NDY0MzE1NTl9.iOdIsjY4zSnTfIXBx0Pl-yfsG24OuHTt2CQnIP5JRrQ', | |||||
| apiToken: CESIUM_ION_API_TOKEN, | |||||
| autoRefreshToken: true, | autoRefreshToken: true, | ||||
| }, { | }, { | ||||
| autoCenter: false, | autoCenter: false, |
| import {_testFinish, LoadingScreenPlugin, OrbitControls3, ThreeViewer} from 'threepipe' | import {_testFinish, LoadingScreenPlugin, OrbitControls3, ThreeViewer} from 'threepipe' | ||||
| import {TileCompressionPlugin, TilesRendererPlugin, UnloadTilesPlugin} from '@threepipe/plugin-3d-tiles-renderer' | import {TileCompressionPlugin, TilesRendererPlugin, UnloadTilesPlugin} from '@threepipe/plugin-3d-tiles-renderer' | ||||
| import {CESIUM_ION_API_TOKEN} from '../globals.js' | |||||
| async function init() { | async function init() { | ||||
| const result = await tiles.loadCesiumIon({ | const result = await tiles.loadCesiumIon({ | ||||
| assetId: '2275207', | assetId: '2275207', | ||||
| apiToken: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI0M2VkOWIxYy00NGEyLTQ1N2QtOWYxYy01ZDNlYjdkN2U4N2MiLCJpZCI6Mjk5NTY5LCJpYXQiOjE3NDY0MzE1NTl9.iOdIsjY4zSnTfIXBx0Pl-yfsG24OuHTt2CQnIP5JRrQ', | |||||
| apiToken: CESIUM_ION_API_TOKEN, | |||||
| autoRefreshToken: true, | autoRefreshToken: true, | ||||
| }, { | }, { | ||||
| autoCenter: false, | autoCenter: false, |
| TP_EX_CESIUM_ION_API_TOKEN="CESIUM_ION_API_TOKEN" |
| "@typescript-eslint/parser": "^5.59.5", | "@typescript-eslint/parser": "^5.59.5", | ||||
| "clean-package": "^2.2.0", | "clean-package": "^2.2.0", | ||||
| "copyfiles": "^2.4.1", | "copyfiles": "^2.4.1", | ||||
| "dotenv": "^16.5.0", | |||||
| "eslint": "^8.40.0", | "eslint": "^8.40.0", | ||||
| "eslint-import-resolver-typescript": "^3.5.5", | "eslint-import-resolver-typescript": "^3.5.5", | ||||
| "eslint-plugin-deprecation": "^1.4.1", | "eslint-plugin-deprecation": "^1.4.1", | ||||
| } | } | ||||
| }, | }, | ||||
| "node_modules/dotenv": { | "node_modules/dotenv": { | ||||
| "version": "16.4.7", | |||||
| "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.7.tgz", | |||||
| "integrity": "sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ==", | |||||
| "version": "16.5.0", | |||||
| "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.5.0.tgz", | |||||
| "integrity": "sha512-m/C+AwOAr9/W1UOIZUo232ejMNnJAJtYQjUbHoNTBNTJSvqzzDh7vnrei3o3r3m9blf6ZoDkvcw0VmozNRFJxg==", | |||||
| "dev": true, | "dev": true, | ||||
| "license": "BSD-2-Clause", | "license": "BSD-2-Clause", | ||||
| "engines": { | "engines": { |
| "new:publish": "git diff --exit-code --name-only HEAD * && npm run prepare && clean-package && npm publish && clean-package restore && git tag v$npm_package_version", | "new:publish": "git diff --exit-code --name-only HEAD * && npm run prepare && clean-package && npm publish && clean-package restore && git tag v$npm_package_version", | ||||
| "build": "npm run update-version && npm run compile && vite build", | "build": "npm run update-version && npm run compile && vite build", | ||||
| "dev": "NODE_ENV=development vite build --watch", | "dev": "NODE_ENV=development vite build --watch", | ||||
| "build-examples": "tsc --project examples/tsconfig.build.json", | |||||
| "dev-examples": "tsc --project examples/tsconfig.build.json -w", | |||||
| "build-examples": "npm run generate-example-env && tsc --project examples/tsconfig.build.json", | |||||
| "dev-examples": "npm run generate-example-env && tsc --project examples/tsconfig.build.json -w", | |||||
| "serve-docs": "ws -d docs -p 8080", | "serve-docs": "ws -d docs -p 8080", | ||||
| "serve": "ws -d . -p 9229", | "serve": "ws -d . -p 9229", | ||||
| "docs": "npx typedoc && npm run website:build", | "docs": "npx typedoc && npm run website:build", | ||||
| "website:dev": "vitepress dev website", | "website:dev": "vitepress dev website", | ||||
| "website:build": "vitepress build website", | "website:build": "vitepress build website", | ||||
| "website:preview": "vitepress preview website", | "website:preview": "vitepress preview website", | ||||
| "build-site": "bash ./scripts/build-site.sh" | |||||
| "build-site": "bash ./scripts/build-site.sh", | |||||
| "generate-example-env": "node ./scripts/generate-example-env.mjs" | |||||
| }, | }, | ||||
| "clean-package": { | "clean-package": { | ||||
| "remove": [ | "remove": [ | ||||
| "devDependencies": { | "devDependencies": { | ||||
| "@rollup/plugin-json": "^6.0.0", | "@rollup/plugin-json": "^6.0.0", | ||||
| "@rollup/plugin-replace": "^5.0.2", | "@rollup/plugin-replace": "^5.0.2", | ||||
| "@types/node": "^22.10.2", | |||||
| "@types/stats.js": "^0.17.0", | "@types/stats.js": "^0.17.0", | ||||
| "@typescript-eslint/eslint-plugin": "^5.59.7", | "@typescript-eslint/eslint-plugin": "^5.59.7", | ||||
| "@typescript-eslint/parser": "^5.59.5", | "@typescript-eslint/parser": "^5.59.5", | ||||
| "clean-package": "^2.2.0", | "clean-package": "^2.2.0", | ||||
| "@types/node": "^22.10.2", | |||||
| "copyfiles": "^2.4.1", | "copyfiles": "^2.4.1", | ||||
| "dotenv": "^16.5.0", | |||||
| "eslint": "^8.40.0", | "eslint": "^8.40.0", | ||||
| "eslint-import-resolver-typescript": "^3.5.5", | "eslint-import-resolver-typescript": "^3.5.5", | ||||
| "eslint-plugin-deprecation": "^1.4.1", | "eslint-plugin-deprecation": "^1.4.1", | ||||
| "@types/three": "https://github.com/repalash/three-ts-types/releases/download/v0.157.1005/package.tgz", | "@types/three": "https://github.com/repalash/three-ts-types/releases/download/v0.157.1005/package.tgz", | ||||
| "@types/webxr": "^0.5.1", | "@types/webxr": "^0.5.1", | ||||
| "@types/wicg-file-system-access": "^2020.9.5", | "@types/wicg-file-system-access": "^2020.9.5", | ||||
| "popmotion": "^11.0.5", | |||||
| "stats.js": "^0.17.0", | "stats.js": "^0.17.0", | ||||
| "ts-browser-helpers": "^0.16.2", | "ts-browser-helpers": "^0.16.2", | ||||
| "uiconfig.js": "^0.1.3", | |||||
| "popmotion": "^11.0.5" | |||||
| "uiconfig.js": "^0.1.3" | |||||
| }, | }, | ||||
| "peerDependencies": { | "peerDependencies": { | ||||
| "three": "https://github.com/repalash/three.js-modded/releases/download/v0.157.1007/package.tgz" | "three": "https://github.com/repalash/three.js-modded/releases/download/v0.157.1007/package.tgz" |
| import fs from 'fs' | |||||
| import dotenv from 'dotenv' | |||||
| // read .env file if exists | |||||
| const envFilePath = './examples/.env' | |||||
| if (fs.existsSync(envFilePath)) { | |||||
| dotenv.config({ path: envFilePath }) | |||||
| } | |||||
| // Filter EX_ variables from environment | |||||
| const envVars = Object.entries(process.env) | |||||
| .filter(([key]) => key.startsWith('TP_EX_')) | |||||
| .reduce((acc, [key, value]) => { | |||||
| acc[key.replace('TP_EX_', '')] = value | |||||
| return acc | |||||
| }, {}) | |||||
| // Generate globals.js | |||||
| const jsOutput = Object.entries(envVars) | |||||
| .map(([key, val]) => `export const ${key} = ${JSON.stringify(val)}`) | |||||
| .join('\n') + '\n' | |||||
| fs.writeFileSync('./examples/globals.js', jsOutput, 'utf8') | |||||
| // Generate globals.d.ts | |||||
| const dtsOutput = Object.entries(envVars) | |||||
| .map(([key, value]) => `export const ${key}: ${typeof value}`) | |||||
| .join('\n') + '\n' | |||||
| fs.writeFileSync('./examples/globals.d.ts', dtsOutput, 'utf8') | |||||
| console.log('✅ globals.js and globals.d.ts generated.') |