diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1a2721a1..7c6a550f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,64 +3,44 @@ on: push: branches: [main] pull_request: - types: [opened, synchronize] + paths: + - packages/** jobs: - build: - runs-on: ubuntu-latest - strategy: - matrix: - node: ["20", "22"] - name: Build with Node ${{ matrix.node }} - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 1 - - uses: pnpm/action-setup@v4 - - name: Setup node - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node }} - cache: pnpm - - run: pnpm install --frozen-lockfile - - run: pnpm --filter './packages/*' --parallel run prepare - - uses: actions/cache@v4 - with: - path: "*" - key: v2-${{ github.sha }}-${{ matrix.node }} test: runs-on: ubuntu-latest - needs: build strategy: fail-fast: false matrix: node: ["20", "22"] - package: [ - # Manually add packages here - ios-stickers, - react-native-blob-util, - react-native-branch, - react-native-siri-shortcut, - react-native-pdf, - ] - name: Test ${{ matrix.package }} on Node ${{ matrix.node }} + name: Build and test on Node ${{ matrix.node }} steps: - - uses: actions/cache@v4 + - name: 👀 Checkout + uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 with: - path: "*" - key: v2-${{ github.sha }}-${{ matrix.node }} - - uses: pnpm/action-setup@v4 - - name: Set up Node - uses: actions/setup-node@v4 + fetch-depth: 1 + + - name: 🔨 Install pnpm + uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4 + with: + version: 10 + + - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 with: - node-version: ${{ matrix.node }} - cache: pnpm - - name: Lint ${{ matrix.package }} - run: pnpm lint --max-warnings 0 - working-directory: packages/${{ matrix.package }} - - name: Test ${{ matrix.package }} - run: pnpm test - working-directory: packages/${{ matrix.package }} + node-version: 20 + cache: 'pnpm' + + - name: Install packages + run: pnpm install --frozen-lockfile + + - name: Build all packages + run: pnpm --filter './packages/*' run build + + - name: Lint all packages + run: pnpm --filter './packages/*' run lint --max-warnings 0 + + - name: Test all packages + run: pnpm --filter './packages/*' run test --passWithNoTests env: CI: true EXPO_DEBUG: true diff --git a/package.json b/package.json index cc7d8996..fb9e03eb 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,6 @@ "name": "@config-plugins/repo", "version": "1.0.0", "private": true, - "packageManager": "pnpm@10.7.0", "scripts": { "gen": "tsx ./scripts/generate-plugin.ts", "update-issue-template": "tsx ./scripts/gh-issues-config.ts", diff --git a/packages/apple-settings/package.json b/packages/apple-settings/package.json index 0f43d23e..1b8bd88f 100644 --- a/packages/apple-settings/package.json +++ b/packages/apple-settings/package.json @@ -21,6 +21,7 @@ "test": "expo-module test", "generate-types": "json2ts -i ./src/schema/SettingsPlist.json -o ./src/schema/SettingsPlist.ts --additionalProperties=false --unknownAny=false", "prepare": "pnpm generate-types", + "prepublishOnly": "pnpm generate-types && expo-module prepublishOnly", "expo-module": "expo-module" }, "keywords": [ diff --git a/packages/apple-settings/src/base-mods/strings.ts b/packages/apple-settings/src/base-mods/strings.ts index 6597fb5b..c8b82e72 100644 --- a/packages/apple-settings/src/base-mods/strings.ts +++ b/packages/apple-settings/src/base-mods/strings.ts @@ -19,16 +19,18 @@ export function parse(data: string, wantComments?: boolean): ParsedStrings { if (m.index === re.lastIndex) { re.lastIndex++; } - if (m[2].substring(0, 1) === '"') { - m[2] = m[2].trim().slice(1, -1); + let key = m[2]!; + const value = m[3]!; + if (key.substring(0, 1) === '"') { + key = key.trim().slice(1, -1); } if (wantComments) { - res[m[2]] = { - value: unescapeString(m[3]), + res[key] = { + value: unescapeString(value), comment: m[1] || "", }; } else { - res[m[2]] = unescapeString(m[3]); + res[key] = unescapeString(value); } } return res; diff --git a/packages/apple-settings/src/index.tsx b/packages/apple-settings/src/index.tsx index cd2c5f4f..485fde72 100644 --- a/packages/apple-settings/src/index.tsx +++ b/packages/apple-settings/src/index.tsx @@ -11,7 +11,7 @@ export { MultiValue, } from "./models"; -export { StaticSettings, AppleLocale }; +export type { StaticSettings, AppleLocale }; export * from "./schema/SettingsPlist"; diff --git a/packages/apple-settings/src/withLinkedSettingsBundle.ts b/packages/apple-settings/src/withLinkedSettingsBundle.ts index 26a4a8cd..9c64b119 100644 --- a/packages/apple-settings/src/withLinkedSettingsBundle.ts +++ b/packages/apple-settings/src/withLinkedSettingsBundle.ts @@ -32,7 +32,11 @@ function getMainAppTarget(project: XcodeProject): PBXNativeTarget { ); } - return mainAppTarget[0]; + const target = mainAppTarget[0]; + if (!target) { + throw new Error("No main app target found in Xcode project"); + } + return target; } function getDefaultBuildConfigurationForTarget(target: PBXNativeTarget) { diff --git a/packages/apple-settings/tsconfig.json b/packages/apple-settings/tsconfig.json index ffcd87d6..d38626bb 100644 --- a/packages/apple-settings/tsconfig.json +++ b/packages/apple-settings/tsconfig.json @@ -2,6 +2,7 @@ "extends": "expo-module-scripts/tsconfig.plugin", "compilerOptions": { "outDir": "./build", + "rootDir": "./src", "resolveJsonModule": true }, "include": ["./src"], diff --git a/packages/ios-stickers/package.json b/packages/ios-stickers/package.json index 4e47b527..0d8f23ec 100644 --- a/packages/ios-stickers/package.json +++ b/packages/ios-stickers/package.json @@ -19,6 +19,7 @@ "clean": "expo-module clean", "lint": "expo-module lint", "test": "expo-module test", + "prepublishOnly": "expo-module prepublishOnly", "expo-module": "expo-module" }, "keywords": [ diff --git a/packages/ios-stickers/src/xcodeSticker.ts b/packages/ios-stickers/src/xcodeSticker.ts index 5aa67484..9e917e1d 100644 --- a/packages/ios-stickers/src/xcodeSticker.ts +++ b/packages/ios-stickers/src/xcodeSticker.ts @@ -109,7 +109,8 @@ export function addStickersTarget( } // Check type against list of allowed target types - if (!producttypeForTargettype(targetType)) { + const computedProductType = producttypeForTargettype(targetType); + if (!computedProductType) { throw new Error("Target type invalid: " + targetType); } @@ -189,7 +190,7 @@ export function addStickersTarget( // Product: Create const productName = targetName; - const productType = producttypeForTargettype(targetType); + const productType = computedProductType; const productFileType = filetypeForProducttype(productType); const productFile = proj.addProductFile(productName, { group: "Embed App Extensions", @@ -215,7 +216,7 @@ export function addStickersTarget( name: quotedTargetName, productName: quotedTargetName, productReference: productFile.fileRef, - productType: quoted(producttypeForTargettype(targetType)), + productType: quoted(computedProductType), buildConfigurationList: buildConfigurations.uuid, buildPhases: [], buildRules: [], @@ -316,7 +317,7 @@ function addToPbxCopyfilesBuildPhase( sources.files.push(pbxBuildPhaseObj(file)); } -function producttypeForTargettype(targetType: string): string { +function producttypeForTargettype(targetType: string): string | undefined { const PRODUCTTYPE_BY_TARGETTYPE: Record = { application: "com.apple.product-type.application", app_extension: "com.apple.product-type.app-extension", diff --git a/packages/ios-stickers/tsconfig.json b/packages/ios-stickers/tsconfig.json index ffcd87d6..d38626bb 100644 --- a/packages/ios-stickers/tsconfig.json +++ b/packages/ios-stickers/tsconfig.json @@ -2,6 +2,7 @@ "extends": "expo-module-scripts/tsconfig.plugin", "compilerOptions": { "outDir": "./build", + "rootDir": "./src", "resolveJsonModule": true }, "include": ["./src"], diff --git a/packages/react-native-adjust/package.json b/packages/react-native-adjust/package.json index 84e3b1c8..3edb815e 100644 --- a/packages/react-native-adjust/package.json +++ b/packages/react-native-adjust/package.json @@ -16,6 +16,7 @@ "clean": "expo-module clean", "lint": "expo-module lint", "test": "expo-module test", + "prepublishOnly": "expo-module prepublishOnly", "expo-module": "expo-module" }, "keywords": [ diff --git a/packages/react-native-adjust/tsconfig.json b/packages/react-native-adjust/tsconfig.json index 901571ed..9acb7eea 100644 --- a/packages/react-native-adjust/tsconfig.json +++ b/packages/react-native-adjust/tsconfig.json @@ -1,7 +1,8 @@ { "extends": "expo-module-scripts/tsconfig.plugin", "compilerOptions": { - "outDir": "./build" + "outDir": "./build", + "rootDir": "./src" }, "include": ["./src"], "exclude": ["**/__mocks__/*", "**/__tests__/*"] diff --git a/packages/react-native-blob-util/package.json b/packages/react-native-blob-util/package.json index 2bbd9985..05efc849 100644 --- a/packages/react-native-blob-util/package.json +++ b/packages/react-native-blob-util/package.json @@ -20,6 +20,7 @@ "clean": "expo-module clean", "lint": "expo-module lint", "test": "expo-module test", + "prepublishOnly": "expo-module prepublishOnly", "expo-module": "expo-module" }, "keywords": [ diff --git a/packages/react-native-branch/package.json b/packages/react-native-branch/package.json index c936c941..f9f06cd7 100644 --- a/packages/react-native-branch/package.json +++ b/packages/react-native-branch/package.json @@ -20,6 +20,7 @@ "clean": "expo-module clean", "lint": "expo-module lint", "test": "expo-module test", + "prepublishOnly": "expo-module prepublishOnly", "expo-module": "expo-module" }, "keywords": [ diff --git a/packages/react-native-branch/src/withBranchAndroid.ts b/packages/react-native-branch/src/withBranchAndroid.ts index 94552e59..36314c0e 100644 --- a/packages/react-native-branch/src/withBranchAndroid.ts +++ b/packages/react-native-branch/src/withBranchAndroid.ts @@ -68,22 +68,10 @@ function requireBranchApiKey(apiKey?: string): string { } export const withBranchAndroid: ConfigPlugin = (config, data) => { - // Fall back to the Expo Config `branch.apiKey` if not provided in plugin - // config. The `branch` property in the Expo Config is deprecated and will be - // removed in SDK 56. - // TODO(@hassankhan): Remove fallback when updating for SDK 56 - if (config.android?.config?.branch?.apiKey) { - console.warn( - "react-native-branch: Using `config.android.config.branch.apiKey` is deprecated. " + - "Pass `apiKey` directly in the plugin config instead.", - ); - } const { testApiKey, enableTestEnvironment = false } = data; config = withAndroidManifest(config, (config) => { - const apiKey = requireBranchApiKey( - data.apiKey ?? config.android?.config?.branch?.apiKey, - ); + const apiKey = requireBranchApiKey(data.apiKey); config.modResults = setBranchApiKeys( { apiKey, testApiKey }, diff --git a/packages/react-native-branch/src/withBranchIOS.ts b/packages/react-native-branch/src/withBranchIOS.ts index b600b5c3..28570800 100644 --- a/packages/react-native-branch/src/withBranchIOS.ts +++ b/packages/react-native-branch/src/withBranchIOS.ts @@ -62,16 +62,6 @@ export const withBranchIOS: ConfigPlugin = (config, data) => { config.ios = {}; } - // Fall back to the Expo Config `branch.apiKey` if not provided in plugin - // config. The `branch` property in the Expo Config is deprecated and will be - // removed in SDK 56. - // TODO(@hassankhan): Remove fallback when updating for SDK 56 - if (config.ios?.config?.branch?.apiKey) { - console.warn( - "react-native-branch: Using `config.ios.config.branch.apiKey` is deprecated. " + - "Pass `apiKey` directly in the plugin config instead.", - ); - } const { testApiKey, enableTestEnvironment = false } = data; // Add `React/RCTBridge` to bridging header @@ -106,9 +96,7 @@ export const withBranchIOS: ConfigPlugin = (config, data) => { // Update the infoPlist with the branch key and branch domain config = withInfoPlist(config, (config) => { - const apiKey = requireBranchApiKey( - data.apiKey ?? config.ios?.config?.branch?.apiKey, - ); + const apiKey = requireBranchApiKey(data.apiKey); config.modResults = setBranchApiKeys( { apiKey, testApiKey }, diff --git a/packages/react-native-callkeep/package.json b/packages/react-native-callkeep/package.json index 3f0327ac..126aaea4 100644 --- a/packages/react-native-callkeep/package.json +++ b/packages/react-native-callkeep/package.json @@ -20,6 +20,7 @@ "clean": "expo-module clean", "lint": "expo-module lint", "test": "expo-module test", + "prepublishOnly": "expo-module prepublishOnly", "expo-module": "expo-module" }, "keywords": [ diff --git a/packages/react-native-callkeep/src/ensureHeaderSearchPath.ts b/packages/react-native-callkeep/src/ensureHeaderSearchPath.ts index 3eb666b9..214d9298 100644 --- a/packages/react-native-callkeep/src/ensureHeaderSearchPath.ts +++ b/packages/react-native-callkeep/src/ensureHeaderSearchPath.ts @@ -4,14 +4,14 @@ const COMMENT_KEY = /_comment$/; function unquote(str: string) { if (str) return str.replace(/^"(.*)"$/, "$1"); + return str; } function nonComments(obj: Record) { - const keys = Object.keys(obj); const newObj: Record = {}; - for (let i = 0; i < keys.length; i++) { - if (!COMMENT_KEY.test(keys[i])) { - newObj[keys[i]] = obj[keys[i]]; + for (const key of Object.keys(obj)) { + if (!COMMENT_KEY.test(key)) { + newObj[key] = obj[key]; } } diff --git a/packages/react-native-callkeep/src/withCallkeep.ts b/packages/react-native-callkeep/src/withCallkeep.ts index e7f6a629..4550e762 100644 --- a/packages/react-native-callkeep/src/withCallkeep.ts +++ b/packages/react-native-callkeep/src/withCallkeep.ts @@ -121,7 +121,7 @@ const withCallkeep: ConfigPlugin = (config) => { "android.permission.READ_PHONE_STATE", "android.permission.READ_PHONE_NUMBERS", "android.permission.CALL_PHONE", - "android.permission.RECORD_AUDIO" + "android.permission.RECORD_AUDIO", ]); config = withAndroidManifestService(config); diff --git a/packages/react-native-pdf/package.json b/packages/react-native-pdf/package.json index 2170ae33..e3b3fc47 100644 --- a/packages/react-native-pdf/package.json +++ b/packages/react-native-pdf/package.json @@ -20,6 +20,7 @@ "clean": "expo-module clean", "lint": "expo-module lint", "test": "expo-module test", + "prepublishOnly": "expo-module prepublishOnly", "expo-module": "expo-module" }, "keywords": [ diff --git a/packages/react-native-siri-shortcut/package.json b/packages/react-native-siri-shortcut/package.json index 7455bcdb..7f84c277 100644 --- a/packages/react-native-siri-shortcut/package.json +++ b/packages/react-native-siri-shortcut/package.json @@ -16,6 +16,7 @@ "clean": "expo-module clean", "lint": "expo-module lint", "test": "expo-module test", + "prepublishOnly": "expo-module prepublishOnly", "expo-module": "expo-module" }, "keywords": [ diff --git a/packages/react-native-siri-shortcut/tsconfig.json b/packages/react-native-siri-shortcut/tsconfig.json index 901571ed..9acb7eea 100644 --- a/packages/react-native-siri-shortcut/tsconfig.json +++ b/packages/react-native-siri-shortcut/tsconfig.json @@ -1,7 +1,8 @@ { "extends": "expo-module-scripts/tsconfig.plugin", "compilerOptions": { - "outDir": "./build" + "outDir": "./build", + "rootDir": "./src" }, "include": ["./src"], "exclude": ["**/__mocks__/*", "**/__tests__/*"] diff --git a/packages/react-native-webrtc/package.json b/packages/react-native-webrtc/package.json index ec5b75d9..2097441d 100644 --- a/packages/react-native-webrtc/package.json +++ b/packages/react-native-webrtc/package.json @@ -20,6 +20,7 @@ "clean": "expo-module clean", "lint": "expo-module lint", "test": "expo-module test", + "prepublishOnly": "expo-module prepublishOnly", "expo-module": "expo-module" }, "keywords": [ diff --git a/scripts/template/package.json b/scripts/template/package.json index 47841fa8..e45b47d4 100644 --- a/scripts/template/package.json +++ b/scripts/template/package.json @@ -15,7 +15,7 @@ "clean": "expo-module clean", "lint": "expo-module lint", "test": "expo-module test", - "prepare": "expo-module prepare", + "prepublishOnly": "expo-module prepublishOnly", "expo-module": "expo-module" }, "keywords": [