From d83d00d089467807fd1f5bdb42a4df761dc44237 Mon Sep 17 00:00:00 2001 From: Alvaro Saburido Date: Sun, 9 Jul 2023 07:48:03 +0200 Subject: [PATCH] fix: remove deconstructive props (#124) * chore: refactor OrbitControls with Defaults and updated deps * chore: combine imports for vue * chore: refactor transform controls with defaults * chore: refactor KeyboardControls with withDefaults * chore: refactor smoke with `withDefaults` * chore: refactor precipitation with `withDefaults` * chore: use `toRefs` on Stars * chore: Text3D refactored * chore: refactor shapes with `withDefaults` * chore: try new cache strategy with pnpm actions for CI --- .github/workflows/lint.yml | 31 +- .prettierrc.cjs | 7 +- package.json | 38 +- playground/auto-imports.d.ts | 1 + playground/package.json | 9 +- .../components/PointerLockControlsDemo.vue | 28 - .../src/components/TransformControlsDemo.vue | 46 - .../src/pages/FirstPersonControlsDemo.vue | 24 + .../OrbitControlsDemo.vue | 0 .../PrecipitationDemo.vue | 0 .../TheSmoke.vue => pages/SmokeDemo.vue} | 0 .../TheStars.vue => pages/StarsDemo.vue} | 3 +- .../TheText3D.vue => pages/Text3DDemo.vue} | 0 .../src/pages/TransformControlsDemo.vue | 114 + playground/src/router.ts | 56 +- playground/vite.config.ts | 12 +- pnpm-lock.yaml | 2083 +++++++++-------- src/core/abstractions/Precipitation.vue | 71 +- src/core/abstractions/Smoke.vue | 41 +- src/core/abstractions/Stars.vue | 60 +- src/core/abstractions/Text3D.vue | 52 +- src/core/controls/KeyboardControls.vue | 64 +- src/core/controls/OrbitControls.vue | 80 +- src/core/controls/TransformControls.vue | 34 +- src/core/shapes/Box.vue | 11 +- src/core/shapes/Circle.vue | 8 +- src/core/shapes/Cone.vue | 13 +- src/core/shapes/Dodecahedron.vue | 7 +- src/core/shapes/Icosahedron.vue | 8 +- src/core/shapes/Octahedron.vue | 8 +- src/core/shapes/Plane.vue | 7 +- src/core/shapes/Ring.vue | 8 +- src/core/shapes/Sphere.vue | 7 +- src/core/shapes/Tetrahedron.vue | 8 +- src/core/shapes/Torus.vue | 7 +- src/core/shapes/TorusKnot.vue | 7 +- src/core/shapes/Tube.vue | 13 +- 37 files changed, 1586 insertions(+), 1380 deletions(-) delete mode 100644 playground/src/components/PointerLockControlsDemo.vue delete mode 100644 playground/src/components/TransformControlsDemo.vue create mode 100644 playground/src/pages/FirstPersonControlsDemo.vue rename playground/src/{components => pages}/OrbitControlsDemo.vue (100%) rename playground/src/{components => pages}/PrecipitationDemo.vue (100%) rename playground/src/{components/TheSmoke.vue => pages/SmokeDemo.vue} (100%) rename playground/src/{components/TheStars.vue => pages/StarsDemo.vue} (90%) rename playground/src/{components/TheText3D.vue => pages/Text3DDemo.vue} (100%) create mode 100644 playground/src/pages/TransformControlsDemo.vue diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 6e0cb904..2a71828f 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -9,33 +9,22 @@ jobs: lint: name: Lint runs-on: ubuntu-20.04 + strategy: + matrix: + node-version: [16] steps: - name: Checkout uses: actions/checkout@v3 - - - name: setup caching - uses: actions/cache@v3 - with: - path: ${{ env.PNPM_CACHE_FOLDER }} - key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm- - - - name: setup pnpm - uses: pnpm/action-setup@v2.2.4 + - name: Setup Pnpm + uses: pnpm/action-setup@v2 with: - version: 7 - - - name: setup node.js + version: 8 + - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v3 with: - node-version: 16.x + node-version: ${{ matrix.node-version }} cache: 'pnpm' - - - name: setup pnpm config - run: pnpm config set store-dir $PNPM_CACHE_FOLDER - - - run: pnpm install --no-frozen-lockfile --shamefully-hoist - + - name: Install dependencies + run: pnpm install - name: Run Lint run: pnpm run lint diff --git a/.prettierrc.cjs b/.prettierrc.cjs index e6859d12..c7e30143 100644 --- a/.prettierrc.cjs +++ b/.prettierrc.cjs @@ -1,5 +1,4 @@ module.exports = { - ...require('@alvarosabu/prettier-config'), - printWidth: 120, - } - \ No newline at end of file + ...require('@alvarosabu/prettier-config'), + printWidth: 120, +} diff --git a/package.json b/package.json index 18efe17a..37e28abe 100644 --- a/package.json +++ b/package.json @@ -51,35 +51,35 @@ }, "devDependencies": { "@alvarosabu/prettier-config": "^1.3.0", - "@release-it/conventional-changelog": "^5.1.1", + "@release-it/conventional-changelog": "^6.0.0", "@tweakpane/plugin-essentials": "^0.1.8", - "@types/node": "^20.3.1", - "@types/three": "^0.152.1", - "@typescript-eslint/eslint-plugin": "^5.59.11", - "@typescript-eslint/parser": "^5.59.11", + "@types/node": "^20.4.1", + "@types/three": "^0.153.0", + "@typescript-eslint/eslint-plugin": "^5.61.0", + "@typescript-eslint/parser": "^5.61.0", "@vitejs/plugin-vue": "^4.2.3", - "eslint": "^8.42.0", + "eslint": "^8.44.0", "eslint-config-prettier": "^8.8.0", - "eslint-plugin-vue": "^9.14.1", - "gsap": "^3.12.1", + "eslint-plugin-vue": "^9.15.1", + "gsap": "^3.12.2", "kolorist": "^1.8.0", "pathe": "^1.1.1", - "prettier": "^2.8.8", - "release-it": "^15.11.0", + "prettier": "^3.0.0", + "release-it": "^16.0.0", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-visualizer": "^5.9.2", - "three": "^0.153.0", - "tweakpane": "^3.1.9", - "typescript": "^5.1.3", - "unocss": "^0.53.1", - "vite": "^4.3.9", + "three": "^0.154.0", + "tweakpane": "^3.1.10", + "typescript": "^5.1.6", + "unocss": "^0.53.4", + "vite": "^4.4.2", "vite-plugin-banner": "^0.7.0", - "vite-plugin-dts": "2.3.0", + "vite-plugin-dts": "3.1.1", "vite-svg-loader": "^4.0.0", - "vitepress": "1.0.0-beta.2" + "vitepress": "1.0.0-beta.5" }, "dependencies": { - "@vueuse/core": "^10.1.2", - "three-stdlib": "^2.23.9" + "@vueuse/core": "^10.2.1", + "three-stdlib": "^2.23.13" } } diff --git a/playground/auto-imports.d.ts b/playground/auto-imports.d.ts index 4259e89c..9959df65 100644 --- a/playground/auto-imports.d.ts +++ b/playground/auto-imports.d.ts @@ -1,6 +1,7 @@ /* eslint-disable */ /* prettier-ignore */ // @ts-nocheck +// noinspection JSUnusedGlobalSymbols // Generated by unplugin-auto-import export {} declare global { diff --git a/playground/package.json b/playground/package.json index 390fbf31..c4ad75a3 100644 --- a/playground/package.json +++ b/playground/package.json @@ -9,13 +9,14 @@ "preview": "vite preview" }, "dependencies": { - "@tresjs/core": "2.3.0", - "vue-router": "^4.2.2" + "@tresjs/core": "2.4.0", + "vue-router": "^4.2.4" }, "devDependencies": { - "unplugin-auto-import": "^0.16.4", + "@tresjs/leches": "^0.4.0", + "unplugin-auto-import": "^0.16.6", "unplugin-vue-components": "^0.25.1", "vite-plugin-glsl": "^1.1.2", - "vue-tsc": "^1.6.5" + "vue-tsc": "^1.8.4" } } diff --git a/playground/src/components/PointerLockControlsDemo.vue b/playground/src/components/PointerLockControlsDemo.vue deleted file mode 100644 index 4e60fe0f..00000000 --- a/playground/src/components/PointerLockControlsDemo.vue +++ /dev/null @@ -1,28 +0,0 @@ - - - diff --git a/playground/src/components/TransformControlsDemo.vue b/playground/src/components/TransformControlsDemo.vue deleted file mode 100644 index 3912bded..00000000 --- a/playground/src/components/TransformControlsDemo.vue +++ /dev/null @@ -1,46 +0,0 @@ - - - diff --git a/playground/src/pages/FirstPersonControlsDemo.vue b/playground/src/pages/FirstPersonControlsDemo.vue new file mode 100644 index 00000000..b728d054 --- /dev/null +++ b/playground/src/pages/FirstPersonControlsDemo.vue @@ -0,0 +1,24 @@ + + + diff --git a/playground/src/components/OrbitControlsDemo.vue b/playground/src/pages/OrbitControlsDemo.vue similarity index 100% rename from playground/src/components/OrbitControlsDemo.vue rename to playground/src/pages/OrbitControlsDemo.vue diff --git a/playground/src/components/PrecipitationDemo.vue b/playground/src/pages/PrecipitationDemo.vue similarity index 100% rename from playground/src/components/PrecipitationDemo.vue rename to playground/src/pages/PrecipitationDemo.vue diff --git a/playground/src/components/TheSmoke.vue b/playground/src/pages/SmokeDemo.vue similarity index 100% rename from playground/src/components/TheSmoke.vue rename to playground/src/pages/SmokeDemo.vue diff --git a/playground/src/components/TheStars.vue b/playground/src/pages/StarsDemo.vue similarity index 90% rename from playground/src/components/TheStars.vue rename to playground/src/pages/StarsDemo.vue index a412e537..0147d617 100644 --- a/playground/src/components/TheStars.vue +++ b/playground/src/pages/StarsDemo.vue @@ -1,7 +1,7 @@