Bump version to 1.0.13 #12
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Release macOS App | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| # Add explicit permissions | |
| permissions: | |
| contents: write # This is needed for creating releases | |
| jobs: | |
| release: | |
| runs-on: macos-latest | |
| steps: | |
| - name: Check out Git repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Fetch all history and tags | |
| - name: Verify TanStack packages | |
| run: | | |
| if [ ! -f "fixed-tanstack-query-devtools.tgz" ] || [ ! -f "fixed-tanstack-react-query-devtools.tgz" ]; then | |
| echo "❌ Fixed TanStack package files are missing! Cannot proceed." | |
| exit 1 | |
| fi | |
| echo "📦 Fixed TanStack packages found:" | |
| ls -la fixed-*.tgz | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 18 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v3 | |
| with: | |
| version: 10 | |
| - name: Configure pnpm for Electron Forge | |
| run: | | |
| # Create .npmrc file with required settings for Electron Forge | |
| echo "node-linker=hoisted" > .npmrc | |
| echo "frozen-lockfile=false" >> .npmrc | |
| echo "save-exact=true" >> .npmrc | |
| echo "Content of .npmrc:" | |
| cat .npmrc | |
| - name: Install dependencies | |
| run: | | |
| # Temporarily remove TanStack packages from package.json using Node.js | |
| echo "Creating temporary package.json without TanStack references..." | |
| cp package.json package.json.original | |
| node -e ' | |
| const fs = require("fs"); | |
| const pkg = JSON.parse(fs.readFileSync("package.json", "utf8")); | |
| // Store original dependencies | |
| const originalDeps = {...pkg.dependencies}; | |
| // Remove TanStack packages | |
| if (pkg.dependencies) { | |
| delete pkg.dependencies["@tanstack/query-devtools"]; | |
| delete pkg.dependencies["@tanstack/react-query-devtools"]; | |
| } | |
| // Write modified package.json | |
| fs.writeFileSync("package.json", JSON.stringify(pkg, null, 2)); | |
| console.log("TanStack packages removed from package.json"); | |
| ' | |
| # Install dependencies without the problematic packages | |
| echo "Installing dependencies..." | |
| pnpm install --no-frozen-lockfile --unsafe-perm=true | |
| # Restore original package.json | |
| echo "Restoring original package.json..." | |
| mv package.json.original package.json | |
| echo "Basic dependencies installed" | |
| - name: Setup TanStack Packages | |
| run: | | |
| echo "Setting up TanStack packages..." | |
| mkdir -p temp | |
| echo "Extracting @tanstack/react-query-devtools..." | |
| tar -xzf fixed-tanstack-react-query-devtools.tgz -C temp/ | |
| mkdir -p node_modules/@tanstack/react-query-devtools | |
| echo "Moving @tanstack/react-query-devtools files..." | |
| cp -r temp/package/* node_modules/@tanstack/react-query-devtools/ | |
| echo "Extracting @tanstack/query-devtools..." | |
| rm -rf temp | |
| mkdir -p temp | |
| tar -xzf fixed-tanstack-query-devtools.tgz -C temp/ | |
| mkdir -p node_modules/@tanstack/query-devtools | |
| echo "Moving @tanstack/query-devtools files..." | |
| cp -r temp/package/* node_modules/@tanstack/query-devtools/ | |
| echo "Creating stub for @tanstack/react-query..." | |
| mkdir -p node_modules/@tanstack/react-query/build/lib | |
| echo "Creating package.json for react-query..." | |
| cat > node_modules/@tanstack/react-query/package.json << 'EOF' | |
| { | |
| "name": "@tanstack/react-query", | |
| "version": "5.71.1", | |
| "main": "build/lib/index.js", | |
| "module": "build/lib/index.esm.js", | |
| "browser": "build/lib/index.js", | |
| "exports": { | |
| ".": { | |
| "import": "./build/lib/index.esm.js", | |
| "require": "./build/lib/index.js" | |
| } | |
| }, | |
| "dependencies": {}, | |
| "peerDependencies": { | |
| "react": "^18.0.0" | |
| } | |
| } | |
| EOF | |
| echo "Creating CJS stub implementation..." | |
| cat > node_modules/@tanstack/react-query/build/lib/index.js << 'EOF' | |
| 'use strict'; | |
| // Stub implementation of react-query | |
| const QueryClient = function() { | |
| return { | |
| prefetchQuery: () => Promise.resolve(), | |
| getQueryCache: () => ({}), | |
| getQueryData: () => ({}), | |
| setQueryData: () => ({}), | |
| getQueryState: () => ({}), | |
| fetchQuery: () => Promise.resolve({}), | |
| fetchInfiniteQuery: () => Promise.resolve({}), | |
| invalidateQueries: () => Promise.resolve(), | |
| cancelQueries: () => Promise.resolve(), | |
| refetchQueries: () => Promise.resolve(), | |
| executeMutation: () => Promise.resolve(), | |
| getDefaultOptions: () => ({}), | |
| setDefaultOptions: () => {}, | |
| getQueryDefaults: () => ({}), | |
| setQueryDefaults: () => {}, | |
| getMutationDefaults: () => ({}), | |
| setMutationDefaults: () => {}, | |
| defaultQueryOptions: (options) => options, | |
| defaultMutationOptions: (options) => options, | |
| clear: () => {}, | |
| }; | |
| }; | |
| const QueryClientProvider = function() { | |
| return null; | |
| }; | |
| exports.QueryClient = QueryClient; | |
| exports.QueryClientProvider = QueryClientProvider; | |
| exports.useQuery = () => ({ data: null, isLoading: false, error: null }); | |
| exports.useMutation = () => [() => {}, { isLoading: false, error: null }]; | |
| exports.useInfiniteQuery = () => ({ data: null, isLoading: false, error: null, fetchNextPage: () => {} }); | |
| exports.useQueryClient = () => new QueryClient(); | |
| EOF | |
| echo "Creating ESM stub implementation..." | |
| cat > node_modules/@tanstack/react-query/build/lib/index.esm.js << 'EOF' | |
| // Stub implementation of react-query | |
| export const QueryClient = function() { | |
| return { | |
| prefetchQuery: () => Promise.resolve(), | |
| getQueryCache: () => ({}), | |
| getQueryData: () => ({}), | |
| setQueryData: () => ({}), | |
| getQueryState: () => ({}), | |
| fetchQuery: () => Promise.resolve({}), | |
| fetchInfiniteQuery: () => Promise.resolve({}), | |
| invalidateQueries: () => Promise.resolve(), | |
| cancelQueries: () => Promise.resolve(), | |
| refetchQueries: () => Promise.resolve(), | |
| executeMutation: () => Promise.resolve(), | |
| getDefaultOptions: () => ({}), | |
| setDefaultOptions: () => {}, | |
| getQueryDefaults: () => ({}), | |
| setQueryDefaults: () => {}, | |
| getMutationDefaults: () => ({}), | |
| setMutationDefaults: () => {}, | |
| defaultQueryOptions: (options) => options, | |
| defaultMutationOptions: (options) => options, | |
| clear: () => {}, | |
| }; | |
| }; | |
| export const QueryClientProvider = function() { | |
| return null; | |
| }; | |
| export const useQuery = () => ({ data: null, isLoading: false, error: null }); | |
| export const useMutation = () => [() => {}, { isLoading: false, error: null }]; | |
| export const useInfiniteQuery = () => ({ data: null, isLoading: false, error: null, fetchNextPage: () => {} }); | |
| export const useQueryClient = () => new QueryClient(); | |
| EOF | |
| echo "TanStack packages setup complete" | |
| - name: Update Vite Configuration | |
| run: | | |
| echo "Updating Vite configuration to handle TanStack packages..." | |
| cat > vite.renderer.config.ts << 'EOF' | |
| import { defineConfig } from "vite"; | |
| import react from "@vitejs/plugin-react"; | |
| import { builtinModules } from 'module'; | |
| import * as path from 'path'; | |
| // https://vitejs.dev/config | |
| export default defineConfig({ | |
| plugins: [react()], | |
| build: { | |
| rollupOptions: { | |
| external: [ | |
| '@tanstack/query-devtools', | |
| '@tanstack/react-query-devtools', | |
| '@tanstack/react-query', | |
| ...builtinModules, | |
| ], | |
| }, | |
| }, | |
| resolve: { | |
| alias: { | |
| '@tanstack/react-query-devtools': path.resolve(__dirname, 'node_modules/@tanstack/react-query-devtools'), | |
| '@tanstack/query-devtools': path.resolve(__dirname, 'node_modules/@tanstack/query-devtools'), | |
| '@tanstack/react-query': path.resolve(__dirname, 'node_modules/@tanstack/react-query'), | |
| }, | |
| }, | |
| }); | |
| EOF | |
| echo "Vite configuration updated" | |
| - name: Build and package Electron app | |
| run: pnpm run make | |
| - name: Install archiver and compress the app | |
| run: | | |
| # Install archiver package for better compression | |
| pnpm add -D archiver | |
| # Run the compression script | |
| pnpm run compress | |
| # Check the results | |
| ls -la out/make/zip/darwin/arm64/ | |
| # Get file sizes for comparison | |
| echo "Original app size:" | |
| du -h out/make/zip/darwin/arm64/React\ Native\ DevTools-darwin-arm64-*.zip | grep -v compressed | |
| echo "Compressed app size:" | |
| du -h out/make/zip/darwin/arm64/React\ Native\ DevTools-darwin-arm64-*-compressed.zip | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: macos-app | |
| path: out/make/zip/darwin/arm64/*-compressed.zip | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: | | |
| out/make/zip/darwin/arm64/*-compressed.zip | |
| draft: true | |
| generate_release_notes: true |