Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 27 additions & 47 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions packages/apple-settings/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
12 changes: 7 additions & 5 deletions packages/apple-settings/src/base-mods/strings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion packages/apple-settings/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export {
MultiValue,
} from "./models";

export { StaticSettings, AppleLocale };
export type { StaticSettings, AppleLocale };

export * from "./schema/SettingsPlist";

Expand Down
6 changes: 5 additions & 1 deletion packages/apple-settings/src/withLinkedSettingsBundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions packages/apple-settings/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"extends": "expo-module-scripts/tsconfig.plugin",
"compilerOptions": {
"outDir": "./build",
"rootDir": "./src",
"resolveJsonModule": true
},
"include": ["./src"],
Expand Down
1 change: 1 addition & 0 deletions packages/ios-stickers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
9 changes: 5 additions & 4 deletions packages/ios-stickers/src/xcodeSticker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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",
Expand All @@ -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: [],
Expand Down Expand Up @@ -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<string, string> = {
application: "com.apple.product-type.application",
app_extension: "com.apple.product-type.app-extension",
Expand Down
1 change: 1 addition & 0 deletions packages/ios-stickers/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"extends": "expo-module-scripts/tsconfig.plugin",
"compilerOptions": {
"outDir": "./build",
"rootDir": "./src",
"resolveJsonModule": true
},
"include": ["./src"],
Expand Down
1 change: 1 addition & 0 deletions packages/react-native-adjust/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
3 changes: 2 additions & 1 deletion packages/react-native-adjust/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"extends": "expo-module-scripts/tsconfig.plugin",
"compilerOptions": {
"outDir": "./build"
"outDir": "./build",
"rootDir": "./src"
},
"include": ["./src"],
"exclude": ["**/__mocks__/*", "**/__tests__/*"]
Expand Down
1 change: 1 addition & 0 deletions packages/react-native-blob-util/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
1 change: 1 addition & 0 deletions packages/react-native-branch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
14 changes: 1 addition & 13 deletions packages/react-native-branch/src/withBranchAndroid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,22 +68,10 @@ function requireBranchApiKey(apiKey?: string): string {
}

export const withBranchAndroid: ConfigPlugin<ConfigData> = (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 },
Expand Down
14 changes: 1 addition & 13 deletions packages/react-native-branch/src/withBranchIOS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,6 @@ export const withBranchIOS: ConfigPlugin<ConfigData> = (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
Expand Down Expand Up @@ -106,9 +96,7 @@ export const withBranchIOS: ConfigPlugin<ConfigData> = (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 },
Expand Down
1 change: 1 addition & 0 deletions packages/react-native-callkeep/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
8 changes: 4 additions & 4 deletions packages/react-native-callkeep/src/ensureHeaderSearchPath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ const COMMENT_KEY = /_comment$/;

function unquote(str: string) {
if (str) return str.replace(/^"(.*)"$/, "$1");
return str;
}
function nonComments(obj: Record<string, any>) {
const keys = Object.keys(obj);
const newObj: Record<string, any> = {};

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];
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-callkeep/src/withCallkeep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions packages/react-native-pdf/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
1 change: 1 addition & 0 deletions packages/react-native-siri-shortcut/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
3 changes: 2 additions & 1 deletion packages/react-native-siri-shortcut/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"extends": "expo-module-scripts/tsconfig.plugin",
"compilerOptions": {
"outDir": "./build"
"outDir": "./build",
"rootDir": "./src"
},
"include": ["./src"],
"exclude": ["**/__mocks__/*", "**/__tests__/*"]
Expand Down
1 change: 1 addition & 0 deletions packages/react-native-webrtc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
2 changes: 1 addition & 1 deletion scripts/template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
Loading