@robylon/react-native-sdk 2.0.21 → 2.0.22-dev.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/lib/commonjs/config.js +1 -1
  2. package/lib/commonjs/config.js.map +1 -1
  3. package/lib/commonjs/constants.js +1 -1
  4. package/lib/commonjs/constants.js.map +1 -1
  5. package/lib/commonjs/openChatbot.js +2 -1
  6. package/lib/commonjs/openChatbot.js.map +1 -1
  7. package/lib/commonjs/version.js +1 -1
  8. package/lib/commonjs/versions/version.dev.js +1 -1
  9. package/lib/module/config.js +1 -1
  10. package/lib/module/config.js.map +1 -1
  11. package/lib/module/constants.js +1 -1
  12. package/lib/module/constants.js.map +1 -1
  13. package/lib/module/openChatbot.js.map +1 -1
  14. package/lib/module/version.js +1 -1
  15. package/lib/module/versions/version.dev.js +1 -1
  16. package/lib/typescript/version.d.ts +1 -1
  17. package/lib/typescript/version.d.ts.map +1 -1
  18. package/lib/typescript/versions/version.dev.d.ts +1 -1
  19. package/package.json +1 -1
  20. package/usage/react-native-ios-docs.md +185 -0
  21. package/.npmignore.development +0 -18
  22. package/.npmignore.production +0 -8
  23. package/.npmignore.staging +0 -7
  24. package/babel.config.js +0 -17
  25. package/scripts/create-branch.js +0 -577
  26. package/scripts/create-version-tag.js +0 -29
  27. package/scripts/get-next-version.js +0 -29
  28. package/scripts/husky-setup.js +0 -32
  29. package/scripts/prevent-direct-branch.js +0 -37
  30. package/scripts/publish-version.js +0 -13
  31. package/scripts/release.js +0 -77
  32. package/scripts/setup-git-hooks.js +0 -18
  33. package/scripts/update-version.js +0 -28
  34. package/scripts/validate-branch-name.sh +0 -65
  35. package/scripts/validate-publish.js +0 -48
  36. package/tsconfig.build.json +0 -16
  37. package/tsconfig.json +0 -26
@@ -1,37 +0,0 @@
1
- const { execSync } = require("child_process");
2
-
3
- // Get command line arguments passed by Git
4
- // In post-checkout hook, Git passes 3 arguments:
5
- // 1. Previous HEAD ref
6
- // 2. New HEAD ref
7
- // 3. Flag (1 for branch checkout, 0 for file checkout)
8
- const [prevHead, newHead, checkoutFlag] = process.argv.slice(2);
9
-
10
- try {
11
- // Get the current branch name
12
- const currentBranch = execSync("git rev-parse --abbrev-ref HEAD")
13
- .toString()
14
- .trim();
15
-
16
- // Only check for branch creation (when prevHead and newHead are different and checkoutFlag is 1)
17
- const isBranchCreation = prevHead !== newHead && checkoutFlag === "1";
18
-
19
- // Check if this was a direct branch creation
20
- if (
21
- isBranchCreation && // Only check actual branch creation
22
- !currentBranch.includes("temp-version-update")
23
- ) {
24
- // If we moved from one branch to a new one, it was likely created directly
25
- if (!process.env.BRANCH_CREATION_ALLOWED) {
26
- console.error("\n❌ Direct branch creation is not allowed.");
27
- console.error("Please use: npm run branch");
28
- console.error(
29
- "This ensures proper version control and naming conventions."
30
- );
31
- process.exit(1);
32
- }
33
- }
34
- } catch (error) {
35
- // If we can't determine, let it pass
36
- process.exit(0);
37
- }
@@ -1,13 +0,0 @@
1
- const { execSync } = require("child_process");
2
-
3
- // Get current branch name
4
- const branch = execSync("git rev-parse --abbrev-ref HEAD").toString().trim();
5
-
6
- // If we're on a release branch, don't increment version
7
- if (branch.startsWith("release/v")) {
8
- console.log("On release branch - skipping version increment");
9
- process.exit(0);
10
- } else {
11
- // For other branches, increment patch version
12
- execSync("npm version patch", { stdio: "inherit" });
13
- }
@@ -1,77 +0,0 @@
1
- const { execSync } = require("child_process");
2
- const readline = require("readline");
3
-
4
- const rl = readline.createInterface({
5
- input: process.stdin,
6
- output: process.stdout,
7
- });
8
-
9
- const release = async () => {
10
- try {
11
- // 1. Validate current branch is a release branch
12
- const currentBranch = execSync("git rev-parse --abbrev-ref HEAD")
13
- .toString()
14
- .trim();
15
-
16
- if (!currentBranch.startsWith("release/v")) {
17
- throw new Error(
18
- "Release process must be started from a release branch.\n" +
19
- `Current branch: ${currentBranch}\n` +
20
- "Expected format: release/v{version}"
21
- );
22
- }
23
-
24
- // 2. Check if version is already published
25
- const version = currentBranch.split("/v")[1];
26
- const publishedVersions = execSync(
27
- "npm view @robylon/web-react-sdk versions --json"
28
- ).toString();
29
-
30
- if (publishedVersions.includes(version)) {
31
- throw new Error(
32
- `Version ${version} is already published to npm.\n` +
33
- "Please create a new release branch with a different version."
34
- );
35
- }
36
-
37
- // 3. Confirm release process
38
- console.log("\n📦 Starting release process for version", version);
39
- console.log("\nThis will:");
40
- console.log("1. Publish to npm");
41
- console.log("2. Create git tag");
42
- console.log("3. Merge to main");
43
-
44
- const proceed = await new Promise((resolve) =>
45
- rl.question("\nProceed with release? (y/N): ", resolve)
46
- );
47
-
48
- if (proceed.toLowerCase() !== "y") {
49
- throw new Error("Release cancelled by user");
50
- }
51
-
52
- // 4. Run publish
53
- console.log("\n🚀 Publishing to npm...");
54
- execSync("npm run publish:production", { stdio: "inherit" });
55
-
56
- // 5. Merge to main
57
- console.log("\n🔄 Merging to main...");
58
- execSync("git checkout main");
59
- execSync("git pull origin main");
60
- execSync(
61
- `git merge ${currentBranch} --no-ff -m "chore: release version ${version}"`
62
- );
63
- execSync("git push origin main");
64
-
65
- console.log("\n✅ Release completed successfully!");
66
- console.log(`Version ${version} is now available on npm`);
67
- console.log("Changes have been merged to main");
68
- } catch (error) {
69
- console.error("\n❌ Release failed:");
70
- console.error(error.message);
71
- process.exit(1);
72
- } finally {
73
- rl.close();
74
- }
75
- };
76
-
77
- release();
@@ -1,18 +0,0 @@
1
- const fs = require("fs");
2
- const path = require("path");
3
- const { execSync } = require("child_process");
4
-
5
- // Create .git/hooks directory if it doesn't exist
6
- const hooksDir = path.join(__dirname, "../.git/hooks");
7
- if (!fs.existsSync(hooksDir)) {
8
- fs.mkdirSync(hooksDir, { recursive: true });
9
- }
10
-
11
- // Copy the validate-branch-name script
12
- const sourcePath = path.join(__dirname, "validate-branch-name.sh");
13
- const targetPath = path.join(hooksDir, "commit-msg");
14
-
15
- fs.copyFileSync(sourcePath, targetPath);
16
- fs.chmodSync(targetPath, "755");
17
-
18
- console.log("Git hooks installed successfully!");
@@ -1,28 +0,0 @@
1
- const fs = require("fs");
2
- const path = require("path");
3
-
4
- function updateVersion(env) {
5
- const packageJson = require("../package.json");
6
- const version = packageJson.version;
7
-
8
- const content = `// This file is auto-generated. Do not modify it manually.
9
- export const SDK_VERSION = '${version}';\n`;
10
-
11
- const versionFile = path.join(__dirname, `../src/versions/version.${env}.ts`);
12
- fs.writeFileSync(versionFile, content);
13
-
14
- // Create/update the main version file that imports the correct version
15
- const mainVersionContent = `// This file is auto-generated. Do not modify it manually.
16
- export { SDK_VERSION } from './versions/version.${env}';\n`;
17
-
18
- fs.writeFileSync(
19
- path.join(__dirname, "../src/version.ts"),
20
- mainVersionContent
21
- );
22
-
23
- console.log(`Updated ${env} SDK_VERSION to ${version}`);
24
- }
25
-
26
- // Get environment from command line argument or default to 'staging'
27
- const env = process.argv[2] || "staging";
28
- updateVersion(env);
@@ -1,65 +0,0 @@
1
- #!/bin/bash
2
-
3
- echo "DEBUG: Script executed from: $0"
4
- echo "DEBUG: PWD: $(pwd)"
5
-
6
- # Get the full version including staging suffix if present
7
- FULL_VERSION=$(node -p "require('./package.json').version")
8
-
9
- # Check if this is a staging version before any other operations
10
- if [[ $FULL_VERSION == *"-staging."* ]]; then
11
- echo "Staging version detected. Skipping branch name validation."
12
- exit 0
13
- fi
14
-
15
- # Get base version without pre-release tags (e.g., 1.1.14 from 1.1.14-staging.0)
16
- BASE_VERSION=$(echo $FULL_VERSION | cut -d'-' -f1)
17
-
18
- # Get the branch name
19
- BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
20
-
21
- # Get latest published version from npm
22
- LATEST_VERSION=$(npm view @robylon/web-react-sdk version 2>/dev/null || echo "0.0.0")
23
-
24
- # Regular expression for valid branch names
25
- FEATURE_PATTERN="^feature/v[0-9]+\.[0-9]+\.[0-9]+/[a-z0-9-]+$"
26
- RELEASE_PATTERN="^release/v${BASE_VERSION}$"
27
- HOTFIX_PATTERN="^hotfix/v[0-9]+\.[0-9]+\.[0-9]+(-patch\.[0-9]+)?$"
28
-
29
- echo "Validating branch: $BRANCH_NAME"
30
- echo "Current version: $BASE_VERSION"
31
- echo "Latest published version: $LATEST_VERSION"
32
-
33
- # For release branches, ensure version matches branch exactly
34
- if [[ $BRANCH_NAME =~ ^release/v ]]; then
35
- # Extract version from branch name
36
- BRANCH_VERSION=$(echo $BRANCH_NAME | sed 's/release\/v//')
37
-
38
- # Check if branch version matches package version
39
- if [[ "$BRANCH_VERSION" != "$BASE_VERSION" ]]; then
40
- echo "Error: Release branch version ($BRANCH_VERSION) must match package.json version ($BASE_VERSION)"
41
- exit 1
42
- fi
43
-
44
- # Check if trying to publish a version behind latest
45
- if [[ $(node -p "require('semver').lt('$BASE_VERSION', '$LATEST_VERSION')") == "true" ]]; then
46
- echo "Error: Cannot publish version $BASE_VERSION as it is behind the latest published version $LATEST_VERSION"
47
- exit 1
48
- fi
49
-
50
- echo "✅ Valid release branch name and version"
51
- exit 0
52
- fi
53
-
54
- # Validate other branch types
55
- if [[ $BRANCH_NAME =~ $FEATURE_PATTERN ]] || [[ $BRANCH_NAME =~ $HOTFIX_PATTERN ]]; then
56
- echo "✅ Valid branch name"
57
- exit 0
58
- else
59
- echo "Error: Invalid branch name format."
60
- echo "Branch names must follow these formats:"
61
- echo "- For feature branches: feature/v{version}/{feature-name}"
62
- echo "- For release branches: release/v{version}"
63
- echo "- For hotfix branches: hotfix/v{version}-patch.{number}"
64
- exit 1
65
- fi
@@ -1,48 +0,0 @@
1
- const { execSync } = require("child_process");
2
-
3
- const validatePublish = () => {
4
- try {
5
- // Get current branch
6
- const currentBranch = execSync("git rev-parse --abbrev-ref HEAD")
7
- .toString()
8
- .trim();
9
- console.log("Validating branch:", currentBranch);
10
-
11
- if (!currentBranch.startsWith("release/v")) {
12
- throw new Error("Publishing is only allowed from release branches");
13
- }
14
-
15
- // Get version from branch name
16
- const branchVersion = currentBranch.split("/v")[1];
17
-
18
- // Get version from package.json
19
- const packageVersion = require("../package.json").version;
20
- console.log("Current version:", packageVersion);
21
-
22
- // Get latest published version
23
- const latestVersion = execSync("npm view @robylon/react-native-sdk version")
24
- .toString()
25
- .trim();
26
- console.log("Latest published version:", latestVersion);
27
-
28
- // Ensure branch version matches package.json version
29
- if (branchVersion !== packageVersion) {
30
- throw new Error(
31
- `Release branch version (${branchVersion}) must match package.json version (${packageVersion})`
32
- );
33
- }
34
-
35
- // Validate version is greater than latest published
36
- const semver = require("semver");
37
- if (!semver.gt(packageVersion, latestVersion)) {
38
- throw new Error(
39
- `New version (${packageVersion}) must be greater than latest published version (${latestVersion})`
40
- );
41
- }
42
- } catch (error) {
43
- console.error("Error:", error.message);
44
- process.exit(1);
45
- }
46
- };
47
-
48
- validatePublish();
@@ -1,16 +0,0 @@
1
- {
2
- "extends": "./tsconfig",
3
- "compilerOptions": {
4
- "declaration": true,
5
- "outDir": "./lib/typescript"
6
- },
7
- "exclude": [
8
- "**/__tests__",
9
- "**/__mocks__",
10
- "**/__fixtures__",
11
- "node_modules",
12
- "babel.config.js",
13
- "metro.config.js",
14
- "jest.config.js"
15
- ]
16
- }
package/tsconfig.json DELETED
@@ -1,26 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "esnext",
4
- "module": "esnext",
5
- "lib": ["esnext"],
6
- "jsx": "react-native",
7
- "strict": true,
8
- "moduleResolution": "node",
9
- "allowSyntheticDefaultImports": true,
10
- "esModuleInterop": true,
11
- "skipLibCheck": true,
12
- "forceConsistentCasingInFileNames": true,
13
- "resolveJsonModule": true,
14
- "isolatedModules": true,
15
- "noEmit": false,
16
- "emitDeclarationOnly": true,
17
- "declaration": true,
18
- "types": ["react-native", "node"]
19
- },
20
- "exclude": [
21
- "node_modules",
22
- "babel.config.js",
23
- "metro.config.js",
24
- "jest.config.js"
25
- ]
26
- }