@momo-kits/native-kits 0.156.1-test.4-debug → 0.156.1-test.5-debug

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.
@@ -40,7 +40,7 @@ kotlin {
40
40
  }
41
41
 
42
42
  cocoapods {
43
- version = "0.156.1-test.4-debug"
43
+ version = "0.156.1-test.5-debug"
44
44
  summary = "IOS Shared module"
45
45
  homepage = "https://momo.vn"
46
46
  ios.deploymentTarget = "15.0"
package/gradle.properties CHANGED
@@ -18,7 +18,7 @@ kotlin.apple.xcodeCompatibility.nowarn=true
18
18
  name="ComposeKits"
19
19
  group=vn.momo.kits
20
20
  artifact.id=kits
21
- version=0.156.1-test.4
21
+ version=0.156.1-test.5
22
22
 
23
23
  repo=GitLab
24
24
  url=https://gitlab.mservice.com.vn/api/v4/projects/5400/packages/maven
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/native-kits",
3
- "version": "0.156.1-test.4-debug",
3
+ "version": "0.156.1-test.5-debug",
4
4
  "private": false,
5
5
  "dependencies": {},
6
6
  "devDependencies": {},
@@ -0,0 +1,153 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -e # Exit on error
4
+
5
+ echo "🔍 Reading version from local package.json..."
6
+
7
+ # Get the version from local package.json
8
+ VERSION=$(node -p "require('./package.json').version")
9
+
10
+ if [ -z "$VERSION" ]; then
11
+ echo "❌ Error: Could not read version from package.json"
12
+ exit 1
13
+ fi
14
+
15
+ echo "📦 Version from package.json: $VERSION"
16
+
17
+ # Update gradle.properties with the same version
18
+ echo "📝 Updating gradle.properties..."
19
+ # Get current gradle version
20
+ CURRENT_GRADLE_VERSION=$(grep "^version=" gradle.properties | cut -d'=' -f2 | tr -d '"')
21
+
22
+ # Update version in gradle.properties using sed
23
+ if [[ "$OSTYPE" == "darwin"* ]]; then
24
+ # macOS
25
+ sed -i '' "s/^version=.*/version=$VERSION/" gradle.properties
26
+ else
27
+ # Linux
28
+ sed -i "s/^version=.*/version=$VERSION/" gradle.properties
29
+ fi
30
+
31
+ echo " Gradle version updated: $CURRENT_GRADLE_VERSION → $VERSION"
32
+
33
+ export VERSION="$VERSION"
34
+
35
+ echo "✅ Using version: $VERSION"
36
+ echo "📦 Publishing KMP artifacts to Maven (version ${VERSION})..."
37
+
38
+ ./gradlew clean
39
+
40
+ # First publish: normal version (compose/ is excluded via .npmignore)
41
+ echo "📤 Publishing normal version (without compose)..."
42
+ npm publish --tag beta --access=public
43
+
44
+ ./gradlew :compose:publishAllPublicationsToGitLabPackagesRepository
45
+
46
+ echo "✅ Normal version published successfully!"
47
+
48
+ # Second publish: debug version with compose kits included
49
+ echo ""
50
+ echo "🔧 Preparing debug version with compose kits..."
51
+
52
+ # Create debug version
53
+ DEBUG_VERSION="${VERSION}-debug"
54
+ echo "📦 Debug version: $DEBUG_VERSION"
55
+
56
+ # Update package.json version to debug version
57
+ if [[ "$OSTYPE" == "darwin"* ]]; then
58
+ # macOS
59
+ sed -i '' "s/\"version\": \"$VERSION\"/\"version\": \"$DEBUG_VERSION\"/" package.json
60
+ else
61
+ # Linux
62
+ sed -i "s/\"version\": \"$VERSION\"/\"version\": \"$DEBUG_VERSION\"/" package.json
63
+ fi
64
+
65
+ # Backup compose/build.gradle.kts
66
+ echo "? Backing up compose/build.gradle.kts..."
67
+ cp compose/build.gradle.kts compose/build.gradle.kts.backup
68
+
69
+ # Comment out maven publish in compose/build.gradle.kts
70
+ echo "💬 Commenting out maven publish in compose/build.gradle.kts..."
71
+ if [[ "$OSTYPE" == "darwin"* ]]; then
72
+ # macOS - Comment out imports
73
+ sed -i '' 's/^import com\.vanniktech\.maven\.publish\.JavadocJar$/\/\/ &/' compose/build.gradle.kts
74
+ sed -i '' 's/^import com\.vanniktech\.maven\.publish\.KotlinMultiplatform$/\/\/ &/' compose/build.gradle.kts
75
+ # Comment out plugin
76
+ sed -i '' 's/^ alias(libs\.plugins\.vanniktech\.mavenPublish)$/\/\/ &/' compose/build.gradle.kts
77
+ # Comment out publishing block
78
+ sed -i '' '/^publishing {$/,/^}$/s/^/\/\/ /' compose/build.gradle.kts
79
+ # Comment out entire mavenPublishing block (lines starting from mavenPublishing { to its closing })
80
+ sed -i '' '/^mavenPublishing {$/,/^}$/s/^/\/\/ /' compose/build.gradle.kts
81
+ else
82
+ # Linux - Comment out imports
83
+ sed -i 's/^import com\.vanniktech\.maven\.publish\.JavadocJar$/\/\/ &/' compose/build.gradle.kts
84
+ sed -i 's/^import com\.vanniktech\.maven\.publish\.KotlinMultiplatform$/\/\/ &/' compose/build.gradle.kts
85
+ # Comment out plugin
86
+ sed -i 's/^ alias(libs\.plugins\.vanniktech\.mavenPublish)$/\/\/ &/' compose/build.gradle.kts
87
+ # Comment out publishing block
88
+ sed -i '/^publishing {$/,/^}$/s/^/\/\/ /' compose/build.gradle.kts
89
+ # Comment out entire mavenPublishing block
90
+ sed -i '/^mavenPublishing {$/,/^}$/s/^/\/\/ /' compose/build.gradle.kts
91
+ fi
92
+
93
+ # Modify android configuration for debug version
94
+ echo "🔧 Modifying android configuration for debug version..."
95
+ if [[ "$OSTYPE" == "darwin"* ]]; then
96
+ # macOS
97
+ sed -i '' 's/namespace = "\$gitlabGroup\.\$gitlabArtifactId"/namespace = "vn.momo.kits.kits"/' compose/build.gradle.kts
98
+ sed -i '' 's/compileSdk = libs\.versions\.android\.compileSdk\.get()\.toInt()/compileSdk = 35/' compose/build.gradle.kts
99
+ sed -i '' 's/minSdk = libs\.versions\.android\.minSdk\.get()\.toInt()/minSdk = 24/' compose/build.gradle.kts
100
+ sed -i '' "s/version = gitlabVersion/version = \"$DEBUG_VERSION\"/" compose/build.gradle.kts
101
+ else
102
+ # Linux
103
+ sed -i 's/namespace = "\$gitlabGroup\.\$gitlabArtifactId"/namespace = "vn.momo.kits.kits"/' compose/build.gradle.kts
104
+ sed -i 's/compileSdk = libs\.versions\.android\.compileSdk\.get()\.toInt()/compileSdk = 35/' compose/build.gradle.kts
105
+ sed -i 's/minSdk = libs\.versions\.android\.minSdk\.get()\.toInt()/minSdk = 24/' compose/build.gradle.kts
106
+ sed -i "s/version = gitlabVersion/version = \"$DEBUG_VERSION\"/" compose/build.gradle.kts
107
+ fi
108
+
109
+ # Backup .npmignore
110
+ cp .npmignore .npmignore.backup
111
+
112
+ # Create minimal .npmignore for debug version (only exclude build artifacts and IDE configs)
113
+ cat > .npmignore << 'EOF'
114
+ sample/
115
+ build/
116
+
117
+ .fleet
118
+ .gradle
119
+ .idea
120
+ .kotlin
121
+ .run
122
+
123
+ .gitattributes
124
+ .gitlab-ci.yml
125
+ .npmignore.backup
126
+ EOF
127
+
128
+ echo "📤 Publishing debug version (with compose)..."
129
+ npm publish --tag beta --access=public
130
+
131
+ # Restore .npmignore
132
+ mv .npmignore.backup .npmignore
133
+ echo "✅ .npmignore restored"
134
+
135
+ # Restore compose/build.gradle.kts
136
+ mv compose/build.gradle.kts.backup compose/build.gradle.kts
137
+ echo "✅ compose/build.gradle.kts restored"
138
+
139
+ # Restore package.json version to original
140
+ if [[ "$OSTYPE" == "darwin"* ]]; then
141
+ # macOS
142
+ sed -i '' "s/\"version\": \"$DEBUG_VERSION\"/\"version\": \"$VERSION\"/" package.json
143
+ else
144
+ # Linux
145
+ sed -i "s/\"version\": \"$DEBUG_VERSION\"/\"version\": \"$VERSION\"/" package.json
146
+ fi
147
+
148
+ echo "✅ package.json version restored"
149
+
150
+ echo ""
151
+ echo "🎉 Publishing completed successfully!"
152
+ echo " 📦 Normal version: $VERSION (without compose)"
153
+ echo " 🐛 Debug version: $DEBUG_VERSION (with compose)"
@@ -14,6 +14,43 @@ fi
14
14
 
15
15
  echo "📦 Version from package.json: $VERSION"
16
16
 
17
+ # Check if this version already exists on npm
18
+ PACKAGE_NAME=$(node -p "require('./package.json').name")
19
+ echo "🔎 Checking if version $VERSION already exists on npm for package $PACKAGE_NAME..."
20
+
21
+ # Try to get the version info from npm
22
+ NPM_VERSION_INFO=$(npm view "$PACKAGE_NAME@$VERSION" version 2>/dev/null || echo "")
23
+
24
+ if [ -n "$NPM_VERSION_INFO" ]; then
25
+ echo "⚠️ Version $VERSION already exists on npm. Auto-incrementing patch version..."
26
+
27
+ # Split version into parts (e.g., 1.2.0 -> 1.2.0)
28
+ # Extract major.minor.patch
29
+ MAJOR=$(echo "$VERSION" | cut -d'.' -f1)
30
+ MINOR=$(echo "$VERSION" | cut -d'.' -f2)
31
+ PATCH=$(echo "$VERSION" | cut -d'.' -f3 | cut -d'-' -f1)
32
+
33
+ # Increment patch version
34
+ NEW_PATCH=$((PATCH + 1))
35
+ NEW_VERSION="$MAJOR.$MINOR.$NEW_PATCH"
36
+
37
+ echo " Version incremented: $VERSION → $NEW_VERSION"
38
+
39
+ # Update package.json with new version
40
+ if [[ "$OSTYPE" == "darwin"* ]]; then
41
+ # macOS
42
+ sed -i '' "s/\"version\": \"$VERSION\"/\"version\": \"$NEW_VERSION\"/" package.json
43
+ else
44
+ # Linux
45
+ sed -i "s/\"version\": \"$VERSION\"/\"version\": \"$NEW_VERSION\"/" package.json
46
+ fi
47
+
48
+ VERSION="$NEW_VERSION"
49
+ echo "✅ Version updated to: $VERSION"
50
+ else
51
+ echo "✅ Version $VERSION does not exist on npm. Using current version."
52
+ fi
53
+
17
54
  # Update gradle.properties with the same version
18
55
  echo "📝 Updating gradle.properties..."
19
56
  # Get current gradle version
@@ -39,7 +76,7 @@ echo "📦 Publishing KMP artifacts to Maven (version ${VERSION})..."
39
76
 
40
77
  # First publish: normal version (compose/ is excluded via .npmignore)
41
78
  echo "📤 Publishing normal version (without compose)..."
42
- npm publish --tag beta --access=public
79
+ npm publish --tag latest --access=public
43
80
 
44
81
  ./gradlew :compose:publishAllPublicationsToGitLabPackagesRepository
45
82
 
@@ -63,7 +100,7 @@ else
63
100
  fi
64
101
 
65
102
  # Backup compose/build.gradle.kts
66
- echo "? Backing up compose/build.gradle.kts..."
103
+ echo "📦 Backing up compose/build.gradle.kts..."
67
104
  cp compose/build.gradle.kts compose/build.gradle.kts.backup
68
105
 
69
106
  # Comment out maven publish in compose/build.gradle.kts
@@ -126,7 +163,7 @@ build/
126
163
  EOF
127
164
 
128
165
  echo "📤 Publishing debug version (with compose)..."
129
- npm publish --tag beta --access=public
166
+ npm publish --tag latest --access=public
130
167
 
131
168
  # Restore .npmignore
132
169
  mv .npmignore.backup .npmignore