diff --git a/.changeset/dependencies-GH-100.md b/.changeset/dependencies-GH-100.md index 2519422..681208f 100644 --- a/.changeset/dependencies-GH-100.md +++ b/.changeset/dependencies-GH-100.md @@ -5,16 +5,19 @@ :arrow_up: Bump react-dom from 19.2.3 to 19.2.4 Bumps [react-dom](https://github.com/facebook/react/tree/HEAD/packages/react-dom) from 19.2.3 to 19.2.4. + - [Release notes](https://github.com/facebook/react/releases) - [Changelog](https://github.com/facebook/react/blob/main/CHANGELOG.md) - [Commits](https://github.com/facebook/react/commits/v19.2.4/packages/react-dom) --- + updated-dependencies: + - dependency-name: react-dom dependency-version: 19.2.4 dependency-type: direct:production update-type: version-update:semver-patch -... + ... Signed-off-by: dependabot[bot] diff --git a/.changeset/dependencies-GH-101.md b/.changeset/dependencies-GH-101.md index ef5b6b1..c1a47fb 100644 --- a/.changeset/dependencies-GH-101.md +++ b/.changeset/dependencies-GH-101.md @@ -5,16 +5,19 @@ :arrow_up: Bump maplibre-gl from 5.16.0 to 5.17.0 Bumps [maplibre-gl](https://github.com/maplibre/maplibre-gl-js) from 5.16.0 to 5.17.0. + - [Release notes](https://github.com/maplibre/maplibre-gl-js/releases) - [Changelog](https://github.com/maplibre/maplibre-gl-js/blob/main/CHANGELOG.md) - [Commits](https://github.com/maplibre/maplibre-gl-js/compare/v5.16.0...v5.17.0) --- + updated-dependencies: + - dependency-name: maplibre-gl dependency-version: 5.17.0 dependency-type: direct:production update-type: version-update:semver-minor -... + ... Signed-off-by: dependabot[bot] diff --git a/.changeset/dependencies-GH-102.md b/.changeset/dependencies-GH-102.md index ba92934..0e30076 100644 --- a/.changeset/dependencies-GH-102.md +++ b/.changeset/dependencies-GH-102.md @@ -5,15 +5,18 @@ :arrow_up: Bump baseline-browser-mapping from 2.9.17 to 2.9.19 Bumps [baseline-browser-mapping](https://github.com/web-platform-dx/baseline-browser-mapping) from 2.9.17 to 2.9.19. + - [Release notes](https://github.com/web-platform-dx/baseline-browser-mapping/releases) - [Commits](https://github.com/web-platform-dx/baseline-browser-mapping/compare/v2.9.17...v2.9.19) --- + updated-dependencies: + - dependency-name: baseline-browser-mapping dependency-version: 2.9.19 dependency-type: direct:development update-type: version-update:semver-patch -... + ... Signed-off-by: dependabot[bot] diff --git a/.changeset/dependencies-GH-103.md b/.changeset/dependencies-GH-103.md index 4eec82d..a03e54a 100644 --- a/.changeset/dependencies-GH-103.md +++ b/.changeset/dependencies-GH-103.md @@ -5,16 +5,19 @@ :arrow_up: Bump eslint-config-next from 16.1.4 to 16.1.6 Bumps [eslint-config-next](https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next) from 16.1.4 to 16.1.6. + - [Release notes](https://github.com/vercel/next.js/releases) - [Changelog](https://github.com/vercel/next.js/blob/canary/release.js) - [Commits](https://github.com/vercel/next.js/commits/v16.1.6/packages/eslint-config-next) --- + updated-dependencies: + - dependency-name: eslint-config-next dependency-version: 16.1.6 dependency-type: direct:development update-type: version-update:semver-patch -... + ... Signed-off-by: dependabot[bot] diff --git a/.changeset/dependencies-GH-104.md b/.changeset/dependencies-GH-104.md index 827628a..88cac0a 100644 --- a/.changeset/dependencies-GH-104.md +++ b/.changeset/dependencies-GH-104.md @@ -5,15 +5,18 @@ :arrow_up: Bump lucide-react from 0.562.0 to 0.563.0 Bumps [lucide-react](https://github.com/lucide-icons/lucide/tree/HEAD/packages/lucide-react) from 0.562.0 to 0.563.0. + - [Release notes](https://github.com/lucide-icons/lucide/releases) - [Commits](https://github.com/lucide-icons/lucide/commits/0.563.0/packages/lucide-react) --- + updated-dependencies: + - dependency-name: lucide-react dependency-version: 0.563.0 dependency-type: direct:production update-type: version-update:semver-minor -... + ... Signed-off-by: dependabot[bot] diff --git a/.changeset/dependencies-GH-96.md b/.changeset/dependencies-GH-96.md index ab43848..b8bd5b4 100644 --- a/.changeset/dependencies-GH-96.md +++ b/.changeset/dependencies-GH-96.md @@ -6,18 +6,20 @@ Bumps the npm_and_yarn group with 1 update in the / directory: [next](https://github.com/vercel/next.js). - Updates `next` from 16.1.4 to 16.1.5 + - [Release notes](https://github.com/vercel/next.js/releases) - [Changelog](https://github.com/vercel/next.js/blob/canary/release.js) - [Commits](https://github.com/vercel/next.js/compare/v16.1.4...v16.1.5) --- + updated-dependencies: + - dependency-name: next dependency-version: 16.1.5 dependency-type: direct:production dependency-group: npm_and_yarn -... + ... Signed-off-by: dependabot[bot] diff --git a/.changeset/dependencies-GH-98.md b/.changeset/dependencies-GH-98.md index 09b6285..ff1f4ec 100644 --- a/.changeset/dependencies-GH-98.md +++ b/.changeset/dependencies-GH-98.md @@ -7,16 +7,20 @@ Bumps [react](https://github.com/facebook/react/tree/HEAD/packages/react) and [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react). These dependencies needed to be updated together. Updates `react` from 19.2.3 to 19.2.4 + - [Release notes](https://github.com/facebook/react/releases) - [Changelog](https://github.com/facebook/react/blob/main/CHANGELOG.md) - [Commits](https://github.com/facebook/react/commits/v19.2.4/packages/react) Updates `@types/react` from 19.2.9 to 19.2.10 + - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react) --- + updated-dependencies: + - dependency-name: react dependency-version: 19.2.4 dependency-type: direct:production @@ -25,6 +29,6 @@ updated-dependencies: dependency-version: 19.2.10 dependency-type: direct:development update-type: version-update:semver-patch -... + ... Signed-off-by: dependabot[bot] diff --git a/.changeset/dependencies-GH-99.md b/.changeset/dependencies-GH-99.md index 9e574e2..cedc61b 100644 --- a/.changeset/dependencies-GH-99.md +++ b/.changeset/dependencies-GH-99.md @@ -5,15 +5,18 @@ :arrow_up: Bump simple-icons from 16.6.0 to 16.6.1 Bumps [simple-icons](https://github.com/simple-icons/simple-icons) from 16.6.0 to 16.6.1. + - [Release notes](https://github.com/simple-icons/simple-icons/releases) - [Commits](https://github.com/simple-icons/simple-icons/compare/16.6.0...16.6.1) --- + updated-dependencies: + - dependency-name: simple-icons dependency-version: 16.6.1 dependency-type: direct:production update-type: version-update:semver-patch -... + ... Signed-off-by: dependabot[bot] diff --git a/.github/scripts/create-release.ts b/.github/scripts/create-release.ts index 72d989c..c53bea9 100644 --- a/.github/scripts/create-release.ts +++ b/.github/scripts/create-release.ts @@ -50,6 +50,43 @@ async function createGitHubRelease() { console.log(`\nšŸš€ Pushing changes...`); execSync("git push origin prod", { stdio: "inherit" }); console.log(`āœ… Successfully pushed changes`); + + // Trigger the deployment workflow via repository_dispatch + console.log(`\nšŸ”” Triggering deployment workflow...`); + try { + // Validate GITHUB_TOKEN is available + if (!process.env.GITHUB_TOKEN) { + throw new Error( + "GITHUB_TOKEN is required to trigger deployment workflow", + ); + } + + const dispatchOctokit = new Octokit({ + auth: process.env.GITHUB_TOKEN, + }); + + await dispatchOctokit.rest.repos.createDispatchEvent({ + owner, + repo, + event_type: "deploy-to-pages", + client_payload: { + source: "release-workflow", + branch: "prod", + }, + }); + console.log(`āœ… Deployment workflow triggered successfully`); + } catch (dispatchError) { + const errorMessage = + dispatchError instanceof Error + ? dispatchError.message + : String(dispatchError); + console.warn( + `āš ļø Failed to trigger deployment workflow: ${errorMessage}`, + ); + console.log( + "You can manually trigger the deployment from the Actions tab", + ); + } } catch (gitError) { console.error("āŒ Git operation failed:", gitError); process.exit(1); diff --git a/.github/workflows/nextjs.yml b/.github/workflows/nextjs.yml index a4edacf..ffe0550 100644 --- a/.github/workflows/nextjs.yml +++ b/.github/workflows/nextjs.yml @@ -9,6 +9,10 @@ on: push: branches: ["prod"] + # Triggered by repository dispatch event from Release workflow + repository_dispatch: + types: [deploy-to-pages] + # Allows you to run this workflow manually from the Actions tab workflow_dispatch: @@ -30,6 +34,9 @@ jobs: steps: - name: Checkout uses: actions/checkout@v6 + with: + # Checkout prod branch for repository_dispatch events, otherwise use default + ref: ${{ github.event_name == 'repository_dispatch' && 'prod' || github.ref }} - name: Setup Node uses: actions/setup-node@v6 with: @@ -46,6 +53,9 @@ jobs: steps: - name: Checkout uses: actions/checkout@v6 + with: + # Checkout prod branch for repository_dispatch events, otherwise use default + ref: ${{ github.event_name == 'repository_dispatch' && 'prod' || github.ref }} - name: Detect package manager id: detect-package-manager run: | diff --git a/README.md b/README.md index 99b1428..3c7e8bd 100644 --- a/README.md +++ b/README.md @@ -136,13 +136,32 @@ npm run dev ## šŸ“¦ Build & Deploy -Build for production: +### Production Build (for GitHub Pages) + +Build for production deployment: ```bash npm run build ``` -The app is automatically deployed to GitHub Pages on every push to the `main` branch. +This creates an optimized static export in the `out` directory with the `/geo-invaders` base path configured for GitHub Pages. + +### Local Testing Build + +To build and test the production build locally: + +```bash +npm run build:local +npm run start +``` + +The `build:local` script creates a build without the GitHub Pages base path, making it suitable for local testing at `http://localhost:3000`. + +**Note:** Don't use `npm run build` followed by `npm run start` for local testing, as the production build includes the `/geo-invaders` base path and won't work correctly on localhost. + +### Deployment + +The app is automatically deployed to GitHub Pages on every push to the `prod` branch. ## šŸ¤ Contributing diff --git a/next.config.mjs b/next.config.mjs index 566141d..db71875 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -1,8 +1,11 @@ -const isProduction = process.env.NODE_ENV === "production"; +// Use NODE_ENV to determine if this is a production build for GitHub Pages +// When NODE_ENV is "production", we're building for deployment to GitHub Pages +// Otherwise (including undefined/development), we're building for local testing +const isGitHubPagesBuild = process.env.NODE_ENV === "production"; const nextConfig = { output: "export", - basePath: isProduction ? "/geo-invaders" : "", + basePath: isGitHubPagesBuild ? "/geo-invaders" : "", }; export default nextConfig; diff --git a/package-lock.json b/package-lock.json index 7cf7d26..dd74bee 100644 --- a/package-lock.json +++ b/package-lock.json @@ -41,6 +41,7 @@ "eslint-config-next": "^16.1.6", "eslint-plugin-react": "^7.37.5", "husky": "^9.1.7", + "octokit": "^5.0.5", "prettier": "^3.8.1", "tailwindcss": "^4", "tsx": "^4.21.0", @@ -2716,6 +2717,95 @@ "node": ">=12.4.0" } }, + "node_modules/@octokit/app": { + "version": "16.1.2", + "resolved": "https://registry.npmjs.org/@octokit/app/-/app-16.1.2.tgz", + "integrity": "sha512-8j7sEpUYVj18dxvh0KWj6W/l6uAiVRBl1JBDVRqH1VHKAO/G5eRVl4yEoYACjakWers1DjUkcCHyJNQK47JqyQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/auth-app": "^8.1.2", + "@octokit/auth-unauthenticated": "^7.0.3", + "@octokit/core": "^7.0.6", + "@octokit/oauth-app": "^8.0.3", + "@octokit/plugin-paginate-rest": "^14.0.0", + "@octokit/types": "^16.0.0", + "@octokit/webhooks": "^14.0.0" + }, + "engines": { + "node": ">= 20" + } + }, + "node_modules/@octokit/auth-app": { + "version": "8.1.2", + "resolved": "https://registry.npmjs.org/@octokit/auth-app/-/auth-app-8.1.2.tgz", + "integrity": "sha512-db8VO0PqXxfzI6GdjtgEFHY9tzqUql5xMFXYA12juq8TeTgPAuiiP3zid4h50lwlIP457p5+56PnJOgd2GGBuw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/auth-oauth-app": "^9.0.3", + "@octokit/auth-oauth-user": "^6.0.2", + "@octokit/request": "^10.0.6", + "@octokit/request-error": "^7.0.2", + "@octokit/types": "^16.0.0", + "toad-cache": "^3.7.0", + "universal-github-app-jwt": "^2.2.0", + "universal-user-agent": "^7.0.0" + }, + "engines": { + "node": ">= 20" + } + }, + "node_modules/@octokit/auth-oauth-app": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/@octokit/auth-oauth-app/-/auth-oauth-app-9.0.3.tgz", + "integrity": "sha512-+yoFQquaF8OxJSxTb7rnytBIC2ZLbLqA/yb71I4ZXT9+Slw4TziV9j/kyGhUFRRTF2+7WlnIWsePZCWHs+OGjg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/auth-oauth-device": "^8.0.3", + "@octokit/auth-oauth-user": "^6.0.2", + "@octokit/request": "^10.0.6", + "@octokit/types": "^16.0.0", + "universal-user-agent": "^7.0.0" + }, + "engines": { + "node": ">= 20" + } + }, + "node_modules/@octokit/auth-oauth-device": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/@octokit/auth-oauth-device/-/auth-oauth-device-8.0.3.tgz", + "integrity": "sha512-zh2W0mKKMh/VWZhSqlaCzY7qFyrgd9oTWmTmHaXnHNeQRCZr/CXy2jCgHo4e4dJVTiuxP5dLa0YM5p5QVhJHbw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/oauth-methods": "^6.0.2", + "@octokit/request": "^10.0.6", + "@octokit/types": "^16.0.0", + "universal-user-agent": "^7.0.0" + }, + "engines": { + "node": ">= 20" + } + }, + "node_modules/@octokit/auth-oauth-user": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/@octokit/auth-oauth-user/-/auth-oauth-user-6.0.2.tgz", + "integrity": "sha512-qLoPPc6E6GJoz3XeDG/pnDhJpTkODTGG4kY0/Py154i/I003O9NazkrwJwRuzgCalhzyIeWQ+6MDvkUmKXjg/A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/auth-oauth-device": "^8.0.3", + "@octokit/oauth-methods": "^6.0.2", + "@octokit/request": "^10.0.6", + "@octokit/types": "^16.0.0", + "universal-user-agent": "^7.0.0" + }, + "engines": { + "node": ">= 20" + } + }, "node_modules/@octokit/auth-token": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-6.0.0.tgz", @@ -2726,6 +2816,20 @@ "node": ">= 20" } }, + "node_modules/@octokit/auth-unauthenticated": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/@octokit/auth-unauthenticated/-/auth-unauthenticated-7.0.3.tgz", + "integrity": "sha512-8Jb1mtUdmBHL7lGmop9mU9ArMRUTRhg8vp0T1VtZ4yd9vEm3zcLwmjQkhNEduKawOOORie61xhtYIhTDN+ZQ3g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/request-error": "^7.0.2", + "@octokit/types": "^16.0.0" + }, + "engines": { + "node": ">= 20" + } + }, "node_modules/@octokit/core": { "version": "7.0.6", "resolved": "https://registry.npmjs.org/@octokit/core/-/core-7.0.6.tgz", @@ -2774,6 +2878,52 @@ "node": ">= 20" } }, + "node_modules/@octokit/oauth-app": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/@octokit/oauth-app/-/oauth-app-8.0.3.tgz", + "integrity": "sha512-jnAjvTsPepyUaMu9e69hYBuozEPgYqP4Z3UnpmvoIzHDpf8EXDGvTY1l1jK0RsZ194oRd+k6Hm13oRU8EoDFwg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/auth-oauth-app": "^9.0.2", + "@octokit/auth-oauth-user": "^6.0.1", + "@octokit/auth-unauthenticated": "^7.0.2", + "@octokit/core": "^7.0.5", + "@octokit/oauth-authorization-url": "^8.0.0", + "@octokit/oauth-methods": "^6.0.1", + "@types/aws-lambda": "^8.10.83", + "universal-user-agent": "^7.0.0" + }, + "engines": { + "node": ">= 20" + } + }, + "node_modules/@octokit/oauth-authorization-url": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/@octokit/oauth-authorization-url/-/oauth-authorization-url-8.0.0.tgz", + "integrity": "sha512-7QoLPRh/ssEA/HuHBHdVdSgF8xNLz/Bc5m9fZkArJE5bb6NmVkDm3anKxXPmN1zh6b5WKZPRr3697xKT/yM3qQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 20" + } + }, + "node_modules/@octokit/oauth-methods": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/@octokit/oauth-methods/-/oauth-methods-6.0.2.tgz", + "integrity": "sha512-HiNOO3MqLxlt5Da5bZbLV8Zarnphi4y9XehrbaFMkcoJ+FL7sMxH/UlUsCVxpddVu4qvNDrBdaTVE2o4ITK8ng==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/oauth-authorization-url": "^8.0.0", + "@octokit/request": "^10.0.6", + "@octokit/request-error": "^7.0.2", + "@octokit/types": "^16.0.0" + }, + "engines": { + "node": ">= 20" + } + }, "node_modules/@octokit/openapi-types": { "version": "27.0.0", "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-27.0.0.tgz", @@ -2781,6 +2931,26 @@ "dev": true, "license": "MIT" }, + "node_modules/@octokit/openapi-webhooks-types": { + "version": "12.1.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-webhooks-types/-/openapi-webhooks-types-12.1.0.tgz", + "integrity": "sha512-WiuzhOsiOvb7W3Pvmhf8d2C6qaLHXrWiLBP4nJ/4kydu+wpagV5Fkz9RfQwV2afYzv3PB+3xYgp4mAdNGjDprA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@octokit/plugin-paginate-graphql": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-graphql/-/plugin-paginate-graphql-6.0.0.tgz", + "integrity": "sha512-crfpnIoFiBtRkvPqOyLOsw12XsveYuY2ieP6uYDosoUegBJpSVxGwut9sxUgFFcll3VTOTqpUf8yGd8x1OmAkQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 20" + }, + "peerDependencies": { + "@octokit/core": ">=6" + } + }, "node_modules/@octokit/plugin-paginate-rest": { "version": "14.0.0", "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-14.0.0.tgz", @@ -2826,6 +2996,41 @@ "@octokit/core": ">=6" } }, + "node_modules/@octokit/plugin-retry": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/@octokit/plugin-retry/-/plugin-retry-8.0.3.tgz", + "integrity": "sha512-vKGx1i3MC0za53IzYBSBXcrhmd+daQDzuZfYDd52X5S0M2otf3kVZTVP8bLA3EkU0lTvd1WEC2OlNNa4G+dohA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/request-error": "^7.0.2", + "@octokit/types": "^16.0.0", + "bottleneck": "^2.15.3" + }, + "engines": { + "node": ">= 20" + }, + "peerDependencies": { + "@octokit/core": ">=7" + } + }, + "node_modules/@octokit/plugin-throttling": { + "version": "11.0.3", + "resolved": "https://registry.npmjs.org/@octokit/plugin-throttling/-/plugin-throttling-11.0.3.tgz", + "integrity": "sha512-34eE0RkFCKycLl2D2kq7W+LovheM/ex3AwZCYN8udpi6bxsyjZidb2McXs69hZhLmJlDqTSP8cH+jSRpiaijBg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/types": "^16.0.0", + "bottleneck": "^2.15.3" + }, + "engines": { + "node": ">= 20" + }, + "peerDependencies": { + "@octokit/core": "^7.0.0" + } + }, "node_modules/@octokit/request": { "version": "10.0.7", "resolved": "https://registry.npmjs.org/@octokit/request/-/request-10.0.7.tgz", @@ -2882,6 +3087,31 @@ "@octokit/openapi-types": "^27.0.0" } }, + "node_modules/@octokit/webhooks": { + "version": "14.2.0", + "resolved": "https://registry.npmjs.org/@octokit/webhooks/-/webhooks-14.2.0.tgz", + "integrity": "sha512-da6KbdNCV5sr1/txD896V+6W0iamFWrvVl8cHkBSPT+YlvmT3DwXa4jxZnQc+gnuTEqSWbBeoSZYTayXH9wXcw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/openapi-webhooks-types": "12.1.0", + "@octokit/request-error": "^7.0.0", + "@octokit/webhooks-methods": "^6.0.0" + }, + "engines": { + "node": ">= 20" + } + }, + "node_modules/@octokit/webhooks-methods": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@octokit/webhooks-methods/-/webhooks-methods-6.0.0.tgz", + "integrity": "sha512-MFlzzoDJVw/GcbfzVC1RLR36QqkTLUf79vLVO3D+xn7r0QgxnFoLZgtrzxiQErAjFUOdH6fas2KeQJ1yr/qaXQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 20" + } + }, "node_modules/@radix-ui/primitive": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/@radix-ui/primitive/-/primitive-1.1.3.tgz", @@ -3803,6 +4033,13 @@ "tslib": "^2.4.0" } }, + "node_modules/@types/aws-lambda": { + "version": "8.10.160", + "resolved": "https://registry.npmjs.org/@types/aws-lambda/-/aws-lambda-8.10.160.tgz", + "integrity": "sha512-uoO4QVQNWFPJMh26pXtmtrRfGshPUSpMZGUyUQY20FhfHEElEBOPKgVmFs1z+kbpyBsRs2JnoOPT7++Z4GA9pA==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/conventional-commits-parser": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/@types/conventional-commits-parser/-/conventional-commits-parser-5.0.2.tgz", @@ -4837,6 +5074,13 @@ "readable-stream": "^3.4.0" } }, + "node_modules/bottleneck": { + "version": "2.19.5", + "resolved": "https://registry.npmjs.org/bottleneck/-/bottleneck-2.19.5.tgz", + "integrity": "sha512-VHiNCbI1lKdl44tGrhNfU3lup0Tj/ZBMJB5/2ZbNXRCPuRCO7ed2mgcK4r17y+KB2EfuYuRaVlwNbAeaWGSpbw==", + "dev": true, + "license": "MIT" + }, "node_modules/brace-expansion": { "version": "1.1.12", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", @@ -8742,6 +8986,29 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/octokit": { + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/octokit/-/octokit-5.0.5.tgz", + "integrity": "sha512-4+/OFSqOjoyULo7eN7EA97DE0Xydj/PW5aIckxqQIoFjFwqXKuFCvXUJObyJfBF9Khu4RL/jlDRI9FPaMGfPnw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/app": "^16.1.2", + "@octokit/core": "^7.0.6", + "@octokit/oauth-app": "^8.0.3", + "@octokit/plugin-paginate-graphql": "^6.0.0", + "@octokit/plugin-paginate-rest": "^14.0.0", + "@octokit/plugin-rest-endpoint-methods": "^17.0.0", + "@octokit/plugin-retry": "^8.0.3", + "@octokit/plugin-throttling": "^11.0.3", + "@octokit/request-error": "^7.0.2", + "@octokit/types": "^16.0.0", + "@octokit/webhooks": "^14.0.0" + }, + "engines": { + "node": ">= 20" + } + }, "node_modules/onetime": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", @@ -10273,6 +10540,16 @@ "node": ">=8.0" } }, + "node_modules/toad-cache": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/toad-cache/-/toad-cache-3.7.0.tgz", + "integrity": "sha512-/m8M+2BJUpoJdgAHoG+baCwBT+tf2VraSfkBgl0Y00qIWt41DJ8R5B8nsEw0I58YwF5IZH6z24/2TobDKnqSWw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + } + }, "node_modules/tr46": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", @@ -10536,6 +10813,13 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/universal-github-app-jwt": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/universal-github-app-jwt/-/universal-github-app-jwt-2.2.2.tgz", + "integrity": "sha512-dcmbeSrOdTnsjGjUfAlqNDJrhxXizjAz94ija9Qw8YkZ1uu0d+GoZzyH+Jb9tIIqvGsadUfwg+22k5aDqqwzbw==", + "dev": true, + "license": "MIT" + }, "node_modules/universal-user-agent": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-7.0.3.tgz", diff --git a/package.json b/package.json index 5e31df9..2cceef7 100644 --- a/package.json +++ b/package.json @@ -2,13 +2,15 @@ "name": "geo-invaders", "version": "0.4.0", "private": true, - "type": "commonjs", + "type": "module", "scripts": { - "predev": "NODE_ENV=development node scripts/generate-version.ts", + "predev": "NODE_ENV=development npx tsx scripts/generate-version.ts", "dev": "next dev --turbopack", - "prebuild": "NODE_ENV=production node scripts/generate-version.ts", + "prebuild": "NODE_ENV=production npx tsx scripts/generate-version.ts", "build": "next build", - "start": "npx serve@latest out", + "prebuild:local": "npx tsx scripts/generate-version.ts", + "build:local": "next build", + "start": "npx serve@latest out -s", "lint": "eslint .", "format": "prettier --write .", "version-packages": "npx @changesets/cli version", @@ -51,6 +53,7 @@ "eslint-config-next": "^16.1.6", "eslint-plugin-react": "^7.37.5", "husky": "^9.1.7", + "octokit": "^5.0.5", "prettier": "^3.8.1", "tailwindcss": "^4", "tsx": "^4.21.0", diff --git a/scripts/generate-version.ts b/scripts/generate-version.ts index 3414994..ee7a6c4 100755 --- a/scripts/generate-version.ts +++ b/scripts/generate-version.ts @@ -5,12 +5,15 @@ * that can be imported by the application. */ -const fs = require("fs"); -const path = require("path"); +import fs from "fs"; +import path from "path"; +import { fileURLToPath } from "url"; -const __dirname = path.dirname(new URL(import.meta.url).pathname); +// Get the directory of the current script +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); -// Read package.jsons +// Read package.json const packageJson = JSON.parse( fs.readFileSync(path.join(__dirname, "..", "package.json"), "utf8"), ); diff --git a/scripts/setup-labels.ts b/scripts/setup-labels.ts index 8f8227f..0f45477 100755 --- a/scripts/setup-labels.ts +++ b/scripts/setup-labels.ts @@ -6,7 +6,7 @@ * Requires GITHUB_TOKEN environment variable */ -const { Octokit } = require("octokit"); +import { Octokit } from "octokit"; const owner = "notthebestdev"; const repo = "geo-invaders";