heartraite 1.0.6 → 1.0.10

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.
@@ -110,7 +110,9 @@ export type GetUserRequest = undefined;
110
110
  export type UpdateUserRequest = {
111
111
  profile?: DeepPartial<UserProfile>;
112
112
  preferences?: DeepPartial<DatingPreferences>;
113
- notifications?: DeepPartial<UserNotifications>;
113
+ notifications?: DeepPartial<UserNotifications & {
114
+ expoPushToken?: Partial<string>;
115
+ }>;
114
116
  };
115
117
  export type AddImagesRequest = {
116
118
  images: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "heartraite",
3
- "version": "1.0.6",
3
+ "version": "1.0.10",
4
4
  "description": "Heartraite npm package for common functionality",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -8,7 +8,7 @@
8
8
  "scripts": {
9
9
  "test": "jest",
10
10
  "build": "tsc",
11
- "prepublishOnly": "npm run build"
11
+ "prepublishOnly": "node version-bump.js && npm run build"
12
12
  },
13
13
  "repository": {
14
14
  "type": "git",
@@ -28,4 +28,4 @@
28
28
  "typescript": "^5.6.3",
29
29
  "firebase": "^11.0.1"
30
30
  }
31
- }
31
+ }
@@ -112,7 +112,9 @@ export type GetUserRequest = undefined;
112
112
  export type UpdateUserRequest = {
113
113
  profile?: DeepPartial<UserProfile>;
114
114
  preferences?: DeepPartial<DatingPreferences>;
115
- notifications?: DeepPartial<UserNotifications>;
115
+ notifications?: DeepPartial<
116
+ UserNotifications & { expoPushToken?: Partial<string> }
117
+ >;
116
118
  };
117
119
 
118
120
  // storage
package/version-bump.js CHANGED
@@ -1,21 +1,65 @@
1
1
  const fs = require("fs");
2
2
  const execSync = require("child_process").execSync;
3
3
 
4
- // Get the current version from package.json
5
- const packageJson = require("./package.json");
6
- const currentVersion = packageJson.version;
4
+ try {
5
+ // Load current version from package.json
6
+ const packageJson = JSON.parse(fs.readFileSync("package.json", "utf8"));
7
+ const currentVersion = packageJson.version;
7
8
 
8
- // Get the latest published version from npm registry
9
- const latestVersion = execSync("npm show heartraite version").toString().trim();
9
+ // Fetch the latest version from the registry
10
+ let latestVersion;
11
+ try {
12
+ latestVersion = execSync("npm show heartraite version", {
13
+ encoding: "utf8",
14
+ }).trim();
15
+ } catch (error) {
16
+ console.warn(
17
+ "Could not fetch latest version from npm. Defaulting to current version."
18
+ );
19
+ latestVersion = currentVersion;
20
+ }
10
21
 
11
- // Increment the version based on the latest version
12
- const versionParts = latestVersion.split(".");
13
- versionParts[2] = (parseInt(versionParts[2]) + 1).toString(); // Increment patch version
14
- const newVersion = versionParts.join(".");
22
+ console.log(`Current version: ${currentVersion}`);
23
+ console.log(`Latest published version: ${latestVersion}`);
15
24
 
16
- packageJson.version = newVersion;
25
+ // Determine the base version to increment
26
+ const baseVersion =
27
+ compareVersions(currentVersion, latestVersion) >= 0
28
+ ? currentVersion
29
+ : latestVersion;
17
30
 
18
- // Update the package.json with the new version
19
- fs.writeFileSync("package.json", JSON.stringify(packageJson, null, 2));
31
+ // Increment the patch version
32
+ const versionParts = baseVersion.split(".");
33
+ versionParts[2] = (parseInt(versionParts[2], 10) + 1).toString();
34
+ const newVersion = versionParts.join(".");
20
35
 
21
- console.log(`Version bumped from ${currentVersion} to ${newVersion}`);
36
+ if (newVersion === currentVersion) {
37
+ console.log("Version is already up-to-date. No changes made.");
38
+ process.exit(0);
39
+ }
40
+
41
+ // Update package.json with the new version
42
+ packageJson.version = newVersion;
43
+ fs.writeFileSync(
44
+ "package.json",
45
+ JSON.stringify(packageJson, null, 2) + "\n",
46
+ "utf8"
47
+ );
48
+
49
+ console.log(`Version bumped from ${currentVersion} to ${newVersion}`);
50
+ } catch (error) {
51
+ console.error("Error bumping version:", error.message);
52
+ process.exit(1);
53
+ }
54
+
55
+ // Compare two version strings (semver)
56
+ function compareVersions(v1, v2) {
57
+ const parts1 = v1.split(".").map(Number);
58
+ const parts2 = v2.split(".").map(Number);
59
+
60
+ for (let i = 0; i < parts1.length; i++) {
61
+ if (parts1[i] > parts2[i]) return 1;
62
+ if (parts1[i] < parts2[i]) return -1;
63
+ }
64
+ return 0;
65
+ }