alurkerja-cli 1.0.17 → 1.0.19

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/index.js CHANGED
@@ -56,10 +56,13 @@ function getVersion() {
56
56
  */
57
57
  async function downloadBinary(version, platform) {
58
58
  const binaryName = `alurkerja-${platform.os}-${platform.arch}${platform.os === 'windows' ? '.exe' : ''}`;
59
- // Use GitLab API to download repository file (works with PRIVATE-TOKEN
60
- const downloadUrl = `${GITLAB_BASE}/-/raw/master/dist/${binaryName}?private_token=${GITLAB_TOKEN}&inline=false`;
61
59
 
62
- console.log(`📥 Downloading Alurkerja CLI For ${platform.os}-${platform.arch} ${version}...`);
60
+ // Use GitLab API v4 to get raw file with PRIVATE-TOKEN authentication
61
+ const projectPath = encodeURIComponent('alurkerja/on-premises/toolkits/alurkerja-cli');
62
+ const filePath = encodeURIComponent(`dist/${binaryName}`);
63
+ const downloadUrl = `https://gitlab.javan.co.id/api/v4/projects/${projectPath}/repository/files/${filePath}/raw?ref=master`;
64
+
65
+ console.log(`📥 Downloading Alurkerja CLI ${version} for ${platform.os}-${platform.arch}...`);
63
66
 
64
67
  // Ensure install directory exists
65
68
  fs.mkdirSync(INSTALL_DIR, { recursive: true });
@@ -75,15 +78,20 @@ async function downloadBinary(version, platform) {
75
78
  const url = new URL(targetUrl);
76
79
  const options = {
77
80
  hostname: url.hostname,
78
- path: url.pathname + url.search
81
+ path: url.pathname + url.search,
82
+ headers: {
83
+ 'PRIVATE-TOKEN': GITLAB_TOKEN
84
+ },
85
+ followRedirect: true
79
86
  };
80
87
 
81
88
  const req = https.get(options, (res) => {
82
89
  if (res.statusCode === 302 || res.statusCode === 301) {
83
- // Follow redirect
90
+ // Follow redirect with PRIVATE-TOKEN header
84
91
  const redirectUrl = res.headers.location.startsWith('http')
85
92
  ? res.headers.location
86
93
  : `https://${url.hostname}${res.headers.location}`;
94
+
87
95
  return downloadFile(redirectUrl);
88
96
  }
89
97
 
package/index.js.backup CHANGED
@@ -56,10 +56,13 @@ function getVersion() {
56
56
  */
57
57
  async function downloadBinary(version, platform) {
58
58
  const binaryName = `alurkerja-${platform.os}-${platform.arch}${platform.os === 'windows' ? '.exe' : ''}`;
59
- // Use GitLab API to download repository file (works with PRIVATE-TOKEN
60
- const downloadUrl = `${GITLAB_BASE}/-/raw/master/dist/${binaryName}?private_token=${GITLAB_TOKEN}&inline=false`;
61
59
 
62
- console.log(`📥 Downloading Alurkerja CLI For ${platform.os}-${platform.arch} ${version}...`);
60
+ // Use GitLab API v4 to get raw file with PRIVATE-TOKEN authentication
61
+ const projectPath = encodeURIComponent('alurkerja/on-premises/toolkits/alurkerja-cli');
62
+ const filePath = encodeURIComponent(`dist/${binaryName}`);
63
+ const downloadUrl = `https://gitlab.javan.co.id/api/v4/projects/${projectPath}/repository/files/${filePath}/raw?ref=master`;
64
+
65
+ console.log(`📥 Downloading Alurkerja CLI ${version} for ${platform.os}-${platform.arch}...`);
63
66
 
64
67
  // Ensure install directory exists
65
68
  fs.mkdirSync(INSTALL_DIR, { recursive: true });
@@ -75,15 +78,20 @@ async function downloadBinary(version, platform) {
75
78
  const url = new URL(targetUrl);
76
79
  const options = {
77
80
  hostname: url.hostname,
78
- path: url.pathname + url.search
81
+ path: url.pathname + url.search,
82
+ headers: {
83
+ 'PRIVATE-TOKEN': GITLAB_TOKEN
84
+ },
85
+ followRedirect: true
79
86
  };
80
87
 
81
88
  const req = https.get(options, (res) => {
82
89
  if (res.statusCode === 302 || res.statusCode === 301) {
83
- // Follow redirect
90
+ // Follow redirect with PRIVATE-TOKEN header
84
91
  const redirectUrl = res.headers.location.startsWith('http')
85
92
  ? res.headers.location
86
93
  : `https://${url.hostname}${res.headers.location}`;
94
+
87
95
  return downloadFile(redirectUrl);
88
96
  }
89
97
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alurkerja-cli",
3
- "version": "1.0.17",
3
+ "version": "1.0.19",
4
4
  "description": "Alurkerja CLI - npx wrapper for Go binary",
5
5
  "main": "index.js",
6
6
  "private": false,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alurkerja-cli",
3
- "version": "1.0.16",
3
+ "version": "1.0.15",
4
4
  "description": "Alurkerja CLI - npx wrapper for Go binary",
5
5
  "main": "index.js",
6
6
  "private": false,