react-native-cache-build-gitlab 1.0.4 → 1.0.5

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.
package/README.md CHANGED
@@ -21,37 +21,46 @@ yarn add react-native-cache-build-gitlab
21
21
 
22
22
  In your `rock.config.mjs`:
23
23
 
24
- ```javascript
25
- import { platformIOS } from "@rock-js/platform-ios";
26
- import { platformAndroid } from "@rock-js/platform-android";
27
- import { providerGitLab } from "react-native-cache-build-gitlab";
28
- import { pluginMetro } from "@rock-js/plugin-metro";
24
+ ```ts
25
+ import {platformIOS} from "@rock-js/platform-ios";
26
+ import {platformAndroid} from "@rock-js/platform-android";
27
+ import {providerGitLab} from "react-native-cache-build-gitlab";
28
+ import {pluginMetro} from "@rock-js/plugin-metro";
29
29
 
30
30
  export default {
31
- bundler: pluginMetro(),
32
- platforms: {
33
- ios: platformIOS(),
34
- android: platformAndroid(),
35
- },
36
- remoteCacheProvider: providerGitLab({
37
- packageName: "mobile-artifacts",
38
- baseUrl: "https://gitlab.example.com",
39
- projectId: 1234,
40
- token: process.env.CI_JOB_TOKEN,
41
- tokenHeader: process.env.CI ? "JOB-TOKEN" : "PRIVATE-TOKEN",
42
- }),
31
+ bundler: pluginMetro(),
32
+ platforms: {
33
+ ios: platformIOS(),
34
+ android: platformAndroid(),
35
+ },
36
+ remoteCacheProvider: providerGitLab({
37
+ packageName: "mobile-artifacts",
38
+ baseUrl: "https://gitlab.example.com",
39
+ projectId: 1234,
40
+ token: process.env.CI_JOB_TOKEN,
41
+ tokenHeader: process.env.CI ? "JOB-TOKEN" : "PRIVATE-TOKEN",
42
+ }),
43
+ fingerprint: {
44
+ ignorePaths: [
45
+ "ios/Podfile.lock",
46
+ "ios/**/xcuserdata",
47
+ "ios/**/project.pbxproj",
48
+ // Add more paths to ignore as needed
49
+ ],
50
+ },
43
51
  };
44
52
  ```
45
53
 
46
54
  ## Configuration
47
55
 
48
- | Option | Type | Description |
49
- | ------------- | -------------------------------- | ----------------------------------------------- |
50
- | `packageName` | `string` | Package name in GitLab Generic Package Registry |
51
- | `baseUrl` | `string` | GitLab instance URL |
52
- | `projectId` | `number` | GitLab project ID |
53
- | `token` | `string` | GitLab access token (`CI_JOB_TOKEN` on CI) |
54
- | `tokenHeader` | `"JOB-TOKEN" \| "PRIVATE-TOKEN"` | Token type |
56
+ | Option | Type | Description |
57
+ | ------------- | -------------------------------- |-------------------------------------------------------------------------------------------------|
58
+ | `packageName` | `string` | Package name in GitLab Generic Package Registry |
59
+ | `baseUrl` | `string` | GitLab instance URL |
60
+ | `projectId` | `number` | GitLab project ID |
61
+ | `token` | `string` | GitLab personal access token (`CI_JOB_TOKEN` on CI), You have to export `CI_JOB_TOKEN` in local |
62
+ | | | |
63
+ | `tokenHeader` | `"JOB-TOKEN" \| "PRIVATE-TOKEN"` | Token type |
55
64
 
56
65
  ## How It Works
57
66
 
@@ -6,8 +6,8 @@ export declare class GitLabBuildCache implements RemoteBuildCache {
6
6
  constructor(config?: {
7
7
  baseUrl: string;
8
8
  projectId: number | string;
9
- token: string;
10
- tokenHeader: "JOB-TOKEN" | "PRIVATE-TOKEN";
9
+ token?: string;
10
+ tokenHeader?: "JOB-TOKEN" | "PRIVATE-TOKEN";
11
11
  packageName: string;
12
12
  });
13
13
  getRepoDetails(): Promise<GitLabRepoDetails>;
@@ -30,7 +30,7 @@ export declare class GitLabBuildCache implements RemoteBuildCache {
30
30
  export declare const providerGitLab: (options?: {
31
31
  baseUrl: string;
32
32
  projectId: number;
33
- token: string;
34
- tokenHeader: "PRIVATE-TOKEN" | "JOB-TOKEN";
33
+ token?: string;
34
+ tokenHeader?: "PRIVATE-TOKEN" | "JOB-TOKEN";
35
35
  packageName: string;
36
36
  }) => () => RemoteBuildCache;
@@ -13,7 +13,8 @@ export class GitLabBuildCache {
13
13
  repoDetails = null;
14
14
  constructor(config) {
15
15
  if (config) {
16
- const token = process.env.CI_JOB_TOKEN;
16
+ const token = config.token ?? process.env.CI_JOB_TOKEN;
17
+ const tokenHeader = config.tokenHeader ?? (process.env.CI ? "JOB-TOKEN" : "PRIVATE-TOKEN");
17
18
  if (!token) {
18
19
  throw new Error("GitLab token is required. Set CI_JOB_TOKEN (CI) or GITLAB_PRIVATE_TOKEN/PRIVATE_TOKEN (local).");
19
20
  }
@@ -21,8 +22,8 @@ export class GitLabBuildCache {
21
22
  packageName: config.packageName,
22
23
  baseUrl: config.baseUrl,
23
24
  projectId: config.projectId,
24
- token: config.token,
25
- tokenHeader: config.tokenHeader,
25
+ token,
26
+ tokenHeader,
26
27
  };
27
28
  }
28
29
  }
@@ -44,7 +45,6 @@ export class GitLabBuildCache {
44
45
  }
45
46
  async download({ artifactName, }) {
46
47
  const repo = await this.getRepoDetails();
47
- // const { name, version } = parseName(artifactName);
48
48
  const { fingerprint } = parseRockArtifact(artifactName);
49
49
  if (!fingerprint)
50
50
  throw new Error("artifactName is required");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-cache-build-gitlab",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "main": "dist/index.js",
5
5
  "type": "module",
6
6
  "types": "dist/index.d.ts",