From ac5ecb1d6f9ae0404610e184b13ba1c968566e16 Mon Sep 17 00:00:00 2001 From: xiaoweii Date: Wed, 3 Apr 2024 11:13:35 +0800 Subject: [PATCH 1/2] fix: change the SDK name prefix issue --- README.md | 10 +++++----- example/src/App.tsx | 3 ++- release.sh | 2 +- tsconfig.json | 3 +-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 14a7b79..78daf2b 100644 --- a/README.md +++ b/README.md @@ -284,24 +284,24 @@ ClickstreamAnalytics.enable(); ## How to integrate and test locally -Clone this repository locally and execute the following script to generate `clickstream-react-native-0.0.1.tgz` zip +Clone this repository locally and execute the following script to generate `aws-clickstream-react-native-0.0.1.tgz` zip package, which will be located in the project root folder. ```bash cd clickstream-react-native && yarn && yarn run pack ``` -Copy the `clickstream-react-native-0.0.1.tgz` into your project, then execute the script in your project root folder to +Copy the `aws-clickstream-react-native-0.0.1.tgz` into your project, then execute the script in your project root folder to install the SDK. ```bash -yarn add ./clickstream-react-native-0.0.1.tgz +yarn add ./aws-clickstream-react-native-0.0.1.tgz ``` -**Note**: Please correct the SDK version and change the path to where the `clickstream-react-native-0.0.1.tgz` file is +**Note**: Please correct the SDK version and change the path to where the `aws-clickstream-react-native-0.0.1.tgz` file is located. -You can also find the `clickstream-react-native-0.0.1.tgz` file in +You can also find the `aws-clickstream-react-native-0.0.1.tgz` file in the [Release](https://github.com/awslabs/clickstream-react-native/releases) page. ### Test diff --git a/example/src/App.tsx b/example/src/App.tsx index 8227e17..ed155c6 100644 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -7,7 +7,8 @@ import { ScrollView, SafeAreaView, } from 'react-native'; -import { ClickstreamAnalytics, Item } from 'clickstream-react-native'; +// @ts-ignore +import { ClickstreamAnalytics, Item } from '@aws/clickstream-react-native'; export default function App() { const initSDK = async () => { diff --git a/release.sh b/release.sh index 2aa5f56..0ca1bf9 100755 --- a/release.sh +++ b/release.sh @@ -5,4 +5,4 @@ echo ${version} regex="[0-9]\+\.[0-9]\+\.[0-9]\+" sed -i "s/\"version\": \"${regex}\"/\"version\": \"${version}\"/g" package.json -sed -i "s/clickstream-react-native-${regex}.tgz/clickstream-react-native-${version}.tgz/g" README.md +sed -i "s/aws-clickstream-react-native-${regex}.tgz/aws-clickstream-react-native-${version}.tgz/g" README.md diff --git a/tsconfig.json b/tsconfig.json index 564bd7b..0112570 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "rootDir": "src", "paths": { - "clickstream-react-native": [ + "@aws/clickstream-react-native": [ "./src/index" ] }, @@ -34,7 +34,6 @@ "outDir": "lib" }, "exclude": [ - "**/__tests__", "example" ] } From c454083f700f8c2c55bad21ce7e984c85ff3b536 Mon Sep 17 00:00:00 2001 From: xiaoweii Date: Wed, 3 Apr 2024 12:57:50 +0800 Subject: [PATCH 2/2] feat: use composite project to build example project --- example/package.json | 52 ++++++++++++++++---------------- example/src/App.tsx | 1 - package.json | 9 +++--- tsconfig.json | 71 +++++++++++++++++++++----------------------- 4 files changed, 65 insertions(+), 68 deletions(-) diff --git a/example/package.json b/example/package.json index 62b58c9..e12d913 100644 --- a/example/package.json +++ b/example/package.json @@ -1,28 +1,28 @@ { - "name": "clickstream-react-native-example", - "version": "0.0.1", - "private": true, - "scripts": { - "android": "react-native run-android", - "ios": "react-native run-ios", - "start": "react-native start", - "build:android": "cd android && ./gradlew assembleDebug", - "build:ios": "cd ios && xcodebuild -workspace ClickstreamReactNativeExample.xcworkspace -scheme ClickstreamReactNativeExample -sdk iphonesimulator -configuration Release -destination generic/platform=iOS CODE_SIGN_IDENTITY=\"\" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO clean archive | xcpretty" - }, - "dependencies": { - "react": "18.2.0", - "react-native": "0.73.5" - }, - "devDependencies": { - "@babel/core": "^7.20.0", - "@babel/preset-env": "^7.20.0", - "@babel/runtime": "^7.20.0", - "@react-native/babel-preset": "0.73.21", - "@react-native/metro-config": "0.73.5", - "@react-native/typescript-config": "0.73.1", - "babel-plugin-module-resolver": "^5.0.0" - }, - "engines": { - "node": ">=18" - } + "name": "clickstream-react-native-example", + "version": "0.0.1", + "private": true, + "scripts": { + "android": "react-native run-android", + "ios": "react-native run-ios", + "start": "react-native start", + "build:android": "cd android && ./gradlew assembleDebug", + "build:ios": "cd ios && xcodebuild -workspace ClickstreamReactNativeExample.xcworkspace -scheme ClickstreamReactNativeExample -sdk iphonesimulator -configuration Release -destination generic/platform=iOS CODE_SIGN_IDENTITY=\"\" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO clean archive | xcpretty" + }, + "dependencies": { + "react": "18.2.0", + "react-native": "0.73.5" + }, + "devDependencies": { + "@babel/core": "^7.20.0", + "@babel/preset-env": "^7.20.0", + "@babel/runtime": "^7.20.0", + "@react-native/babel-preset": "0.73.21", + "@react-native/metro-config": "0.73.5", + "@react-native/typescript-config": "0.73.1", + "babel-plugin-module-resolver": "^5.0.0" + }, + "engines": { + "node": ">=18" + } } diff --git a/example/src/App.tsx b/example/src/App.tsx index ed155c6..bc27545 100644 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -7,7 +7,6 @@ import { ScrollView, SafeAreaView, } from 'react-native'; -// @ts-ignore import { ClickstreamAnalytics, Item } from '@aws/clickstream-react-native'; export default function App() { diff --git a/package.json b/package.json index c84fee4..d55f04e 100644 --- a/package.json +++ b/package.json @@ -2,9 +2,9 @@ "name": "@aws/clickstream-react-native", "version": "0.0.1", "description": "ClickstreamAnalytics React Native SDK", - "main": ".lib/index.js", - "module": "./lib-esm/index.js", - "typings": "./lib-esm/index.d.ts", + "main": ".lib/src/index.js", + "module": "./lib-esm/src/index.js", + "typings": "./lib-esm/src/index.d.ts", "react-native": "src/index.ts", "source": "src/index", "scripts": { @@ -101,6 +101,7 @@ "ios/ClickstreamReactNative*", "*.podspec", "!**/__tests__", - "!**/.*" + "!**/.*", + "!**/example" ] } diff --git a/tsconfig.json b/tsconfig.json index 0112570..ea5e006 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,39 +1,36 @@ { - "compilerOptions": { - "rootDir": "src", - "paths": { - "@aws/clickstream-react-native": [ - "./src/index" - ] - }, - "allowUnreachableCode": false, - "allowUnusedLabels": false, - "esModuleInterop": true, - "noImplicitAny": true, - "downlevelIteration": true, - "forceConsistentCasingInFileNames": true, - "jsx": "react", - "lib": [ - "es2020" - ], - "moduleResolution": "node", - "noFallthroughCasesInSwitch": true, - "noImplicitReturns": true, - "noImplicitUseStrict": false, - "noStrictGenericChecks": false, - "noUncheckedIndexedAccess": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "resolveJsonModule": true, - "skipLibCheck": true, - "importHelpers": true, - "noEmitOnError": false, - "declaration": true, - "strict": true, - "target": "es2020", - "outDir": "lib" - }, - "exclude": [ - "example" - ] + "compilerOptions": { + "rootDir": ".", + "paths": { + "@aws/clickstream-react-native": [ + "./src/index" + ] + }, + "allowUnreachableCode": false, + "allowUnusedLabels": false, + "esModuleInterop": true, + "noImplicitAny": true, + "downlevelIteration": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react", + "lib": [ + "es2020" + ], + "moduleResolution": "node", + "noFallthroughCasesInSwitch": true, + "noImplicitReturns": true, + "noImplicitUseStrict": false, + "noStrictGenericChecks": false, + "noUncheckedIndexedAccess": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "resolveJsonModule": true, + "skipLibCheck": true, + "importHelpers": true, + "noEmitOnError": false, + "declaration": true, + "strict": true, + "target": "es2020", + "outDir": "lib" + } }