diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 10d32f8..58d3fa8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,36 +1,36 @@ name: CI on: - push: - branches-ignore: - - 'main' # main is protected - - 'gh-pages' + push: + branches-ignore: + - 'main' # main is protected + - 'gh-pages' permissions: - contents: read + contents: read jobs: - build: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, windows-latest, macos-latest] - node-version: [22.x] + build: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + node-version: [22.x] - steps: - - name: Checkout repository - uses: actions/checkout@v4 + steps: + - name: Checkout repository + uses: actions/checkout@v4 - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - cache: npm + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: npm - - name: Install dependencies - run: npm ci - if: hashFiles('package-lock.json') != '' + - name: Install dependencies + run: npm ci + if: hashFiles('package-lock.json') != '' - - name: Run tests - run: npm test + - name: Run build, lint, and test + run: npm run validate diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 06d7c2f..f27aaf6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,60 +1,60 @@ name: Publish release on: - push: - branches: - - main + push: + branches: + - main jobs: - release: - runs-on: ubuntu-latest - - permissions: - contents: write - id-token: write - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - token: ${{ secrets.GH_PAT }} - fetch-depth: 0 # important for lerna to detect tags - - name: Configure Git - run: | - git config --global user.name "github-actions[bot]" - git config --global user.email "github-actions[bot]@users.noreply.github.com" - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: 22 - cache: npm - registry-url: 'https://registry.npmjs.org/' - always-auth: true - - - name: Install dependencies - run: npm ci - - - name: Create versions & changelogs - run: npx lerna version --no-private --create-release github --yes - env: - GH_TOKEN: ${{ secrets.GH_PAT }} - - - name: Build - run: npm run www - - - name: Publish to NPMJS - uses: JS-DevTools/npm-publish@v3 - with: - token: ${{ secrets.NPM_TOKEN }} - package: ./packages/three-particles - - - name: Deploy JS to GitHub Pages - uses: JamesIves/github-pages-deploy-action@v4 - with: - token: ${{ secrets.GITHUB_TOKEN }} - branch: gh-pages - folder: www - clean: true - single-commit: true - commit-message: 'ci: update www' + release: + runs-on: ubuntu-latest + + permissions: + contents: write + id-token: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + token: ${{ secrets.GH_PAT }} + fetch-depth: 0 # important for lerna to detect tags + - name: Configure Git + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: npm + registry-url: 'https://registry.npmjs.org/' + always-auth: true + + - name: Install dependencies + run: npm ci + + - name: Create versions & changelogs + run: npx lerna version --no-private --create-release github --yes + env: + GH_TOKEN: ${{ secrets.GH_PAT }} + + - name: Build + run: npm run www + + - name: Publish to NPMJS + uses: JS-DevTools/npm-publish@v3 + with: + token: ${{ secrets.NPM_TOKEN }} + package: ./packages/three-particles + + - name: Deploy JS to GitHub Pages + uses: JamesIves/github-pages-deploy-action@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + branch: gh-pages + folder: www + clean: true + single-commit: true + commit-message: 'ci: update www' diff --git a/.prettierrc b/.prettierrc index ef2ab10..a212cc7 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,5 +1,5 @@ { - "semi": false, - "singleQuote": true, - "tabWidth": 4 + "semi": false, + "singleQuote": true, + "tabWidth": 4 } diff --git a/package-lock.json b/package-lock.json index 849413a..517d5b9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -29,7 +29,8 @@ "vite": "^7.0.6" }, "optionalDependencies": { - "@rollup/rollup-linux-x64-gnu": "^4.52.0" + "@rollup/rollup-linux-x64-gnu": "^4.52.0", + "@rollup/rollup-win32-x64-msvc": "^4.52.0" } }, "node_modules/@babel/code-frame": { @@ -3067,6 +3068,19 @@ "linux" ] }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.53.3.tgz", + "integrity": "sha512-UhTd8u31dXadv0MopwGgNOBpUVROFKWVQgAg5N1ESyCz8AuBcMqm4AuTjrwgQKGDfoFuz02EuMRHQIw/frmYKQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, "node_modules/@sigstore/bundle": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/@sigstore/bundle/-/bundle-4.0.0.tgz", @@ -13477,10 +13491,10 @@ }, "packages/example": { "name": "@polyforest/three-particles-example", - "version": "0.11.0", + "version": "0.0.0", "license": "ISC", "dependencies": { - "three-particles": "^0.15.0" + "three-particles": "*" }, "devDependencies": { "@types/fs-extra": "^11.0.4", diff --git a/package.json b/package.json index c94fe42..83bebba 100644 --- a/package.json +++ b/package.json @@ -19,18 +19,22 @@ "vite": "^7.0.6" }, "optionalDependencies": { - "@rollup/rollup-linux-x64-gnu": "^4.52.0" + "@rollup/rollup-linux-x64-gnu": "^4.52.0", + "@rollup/rollup-win32-x64-msvc": "^4.52.0" }, "scripts": { "clean": "rimraf www && lerna run clean", "@eslint/js": "^9.22.0", - "lint": "lerna run lint", - "lint:write": "lerna run lint:write", + "lint": "npm run prettier:check && eslint .", + "lint:write": "npm run prettier:write && eslint . --fix", + "prettier:check": "prettier . --check", + "prettier:write": "prettier . --write", "build": "lerna run build", "watch": "lerna run watch --parallel", "prewww": "lerna run build", "www": "tsx ./buildSrc/build.ts", "test": "lerna run test", + "validate": "lerna run build && lerna run lint && lerna run test", "serve": "npm run www && http-server www" }, "repository": { diff --git a/packages/example/package.json b/packages/example/package.json index 3242f15..2e914ec 100644 --- a/packages/example/package.json +++ b/packages/example/package.json @@ -4,10 +4,6 @@ "private": true, "scripts": { "clean": "rimraf dist", - "lint": "npm run prettier:check && eslint .", - "lint:write": "npm run prettier:write && eslint . --fix", - "prettier:check": "prettier . --ignore-path ../../.prettierignore --cache --check", - "prettier:write": "prettier . --ignore-path ../../.prettierignore --cache --write", "build": "vite build", "dev": "vite" }, diff --git a/packages/example/src/index.ts b/packages/example/src/index.ts index 7714fbb..faa343e 100644 --- a/packages/example/src/index.ts +++ b/packages/example/src/index.ts @@ -11,7 +11,6 @@ import { PerspectiveCamera, PlaneGeometry, Scene, - TextureLoader, Vector3, WebGLRenderer, } from 'three' diff --git a/packages/three-particles/package.json b/packages/three-particles/package.json index 55730d1..ad31544 100644 --- a/packages/three-particles/package.json +++ b/packages/three-particles/package.json @@ -8,12 +8,8 @@ "access": "public" }, "scripts": { - "lint": "npm run prettier:check && eslint .", - "lint:write": "npm run prettier:write && eslint . --fix", - "prettier:check": "prettier . --ignore-path ../../.prettierignore --cache --check", - "prettier:write": "prettier . --ignore-path ../../.prettierignore --cache --write", "test": "jest", - "build": "tsx buildSrc/build.ts && tsc && npm run lint", + "build": "tsx buildSrc/build.ts", "watch": "tsx buildSrc/build.ts -w" }, "files": [ diff --git a/resources/example.html b/resources/example.html new file mode 100644 index 0000000..32818cb --- /dev/null +++ b/resources/example.html @@ -0,0 +1,8 @@ + + +
+ +