diff --git a/.gitleaksignore b/.gitleaksignore new file mode 100644 index 00000000..f69fa48f --- /dev/null +++ b/.gitleaksignore @@ -0,0 +1 @@ +0667e44428be97bc3f5c7aac0def6bb0b9083ab8:.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs:agora-appid:433 \ No newline at end of file diff --git a/.yarnrc.yml b/.yarnrc.yml index d95b48b9..63f67601 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -2,6 +2,7 @@ nodeLinker: node-modules nmHoistingLimits: workspaces plugins: + - path: scripts/bootstrap.cjs - path: scripts/pod-install.cjs - path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs spec: "@yarnpkg/plugin-interactive-tools" diff --git a/example/babel.config.js b/example/babel.config.js index adea77bd..53e20530 100644 --- a/example/babel.config.js +++ b/example/babel.config.js @@ -1,4 +1,5 @@ const path = require('path'); + const pak = require('../package.json'); module.exports = { diff --git a/example/metro.config.js b/example/metro.config.js index b8232145..7dd71d4d 100644 --- a/example/metro.config.js +++ b/example/metro.config.js @@ -1,7 +1,9 @@ -const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config'); const path = require('path'); + +const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config'); const escape = require('escape-string-regexp'); const exclusionList = require('metro-config/src/defaults/exclusionList'); + const pak = require('../package.json'); const root = path.resolve(__dirname, '..'); diff --git a/example/react-native.config.js b/example/react-native.config.js index a5166956..3c1cc55b 100644 --- a/example/react-native.config.js +++ b/example/react-native.config.js @@ -1,4 +1,5 @@ const path = require('path'); + const pak = require('../package.json'); module.exports = { diff --git a/package.json b/package.json index ac56353e..321fecaa 100644 --- a/package.json +++ b/package.json @@ -33,11 +33,10 @@ "example": "yarn workspace react-native-agora-example", "test": "jest", "typecheck": "tsc --noEmit", - "lint": "eslint \"**/*.{js,ts,tsx}\"", + "lint": "eslint \"**/*.{cjs,js,ts,tsx}\"", "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib", "prepare": "bob build", "release": "release-it", - "ts_interface_builder": "yarn ts-interface-builder src/*.ts -o src/ti/", "doc": "typedoc src --out ./docs --exclude \"example/**\"" }, "keywords": [ diff --git a/scripts/bootstrap.cjs b/scripts/bootstrap.cjs new file mode 100644 index 00000000..61b2f925 --- /dev/null +++ b/scripts/bootstrap.cjs @@ -0,0 +1,52 @@ +const child_process = require('child_process'); + +module.exports = { + name: 'bootstrap', + factory() { + return { + hooks: { + afterAllInstalled(project, options) { + if (process.env.POD_INSTALL === '0') { + return; + } + + if ( + options && + (options.mode === 'update-lockfile' || + options.mode === 'skip-build') + ) { + return; + } + + if ( + child_process.spawnSync('yarn', ['patch-package'], { + cwd: project.cwd, + env: process.env, + stdio: 'inherit', + encoding: 'utf-8', + shell: true, + }).status !== 0 + ) { + throw new Error('Failed to run patch-package'); + } + + if ( + child_process.spawnSync( + 'yarn', + ['ts-interface-builder', 'src/*.ts', '-o', 'src/ti/'], + { + cwd: project.cwd, + env: process.env, + stdio: 'inherit', + encoding: 'utf-8', + shell: true, + } + ).status !== 0 + ) { + throw new Error('Failed to run pod-install'); + } + }, + }, + }; + }, +}; diff --git a/tsconfig.json b/tsconfig.json index 46ff9ce0..29142fda 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -18,11 +18,11 @@ "noStrictGenericChecks": false, "noUncheckedIndexedAccess": true, "noUnusedLocals": true, - "noUnusedParameters": true, + "noUnusedParameters": false, "resolveJsonModule": true, "skipLibCheck": true, "strict": true, "target": "esnext", - "verbatimModuleSyntax": true + "verbatimModuleSyntax": false } }