@spfn/cli 0.0.8 → 0.0.9

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 (2) hide show
  1. package/lib/login.js +40 -1
  2. package/package.json +1 -1
package/lib/login.js CHANGED
@@ -1,5 +1,8 @@
1
1
  import http from "http";
2
2
  import open from "open";
3
+ import fs from "fs";
4
+ import os from "os";
5
+ import path from "path";
3
6
  import { execSync } from "child_process";
4
7
 
5
8
  const isDev = process.env.NODE_ENV === "development" || process.env.SF_ENV === "local";
@@ -57,6 +60,40 @@ function installGitCredentials(
57
60
  }
58
61
  }
59
62
 
63
+ function persistGradleCredentials(SF_CI_BOT_USER, SF_CI_BOT_TOKEN)
64
+ {
65
+ const gradlePropsPath = path.join(os.homedir(), ".gradle", "gradle.properties");
66
+
67
+ // 기존 내용 읽기
68
+ let lines = [];
69
+ if (fs.existsSync(gradlePropsPath)) {
70
+ lines = fs.readFileSync(gradlePropsPath, "utf8").split(/\r?\n/);
71
+ }
72
+
73
+ // 기존 SF_CI_BOT_USER, SF_CI_BOT_TOKEN 라인 삭제
74
+ const filtered = lines.filter(line =>
75
+ !line.startsWith("SF_CI_BOT_USER=") &&
76
+ !line.startsWith("SF_CI_BOT_TOKEN=") &&
77
+ !line.startsWith("# Superfunctions CLI")
78
+ );
79
+
80
+ // 새 라인 추가
81
+ const exportBlock = [
82
+ "",
83
+ "# Superfunctions CLI - Gitea Maven Auth",
84
+ `SF_CI_BOT_USER=${SF_CI_BOT_USER}`,
85
+ `SF_CI_BOT_TOKEN=${SF_CI_BOT_TOKEN}`,
86
+ ""
87
+ ];
88
+
89
+ const updated = filtered.concat(exportBlock);
90
+ fs.mkdirSync(path.dirname(gradlePropsPath), { recursive: true });
91
+ fs.writeFileSync(gradlePropsPath, updated.join(os.EOL), { encoding: "utf8" });
92
+
93
+ console.log(`✔️ ~/.gradle/gradle.properties에 SF_CI_BOT_USER, SF_CI_BOT_TOKEN 등록/갱신 완료`);
94
+ console.log(` 모든 Gradle 프로젝트에서 Superfunction Maven 인증 자동 적용`);
95
+ }
96
+
60
97
  export async function login()
61
98
  {
62
99
  try
@@ -89,11 +126,13 @@ export async function login()
89
126
  return;
90
127
  }
91
128
 
129
+ persistGradleCredentials(username, token);
130
+
92
131
  // npm registry 설정 (생략)
93
132
  try
94
133
  {
95
134
  execSync(
96
- `npm config set @sf:registry ${GIT_PROTOCOL}://${GIT_HOST}/api/packages/spfn/npm/`,
135
+ `npm config set @spfn:registry ${GIT_PROTOCOL}://${GIT_HOST}/api/packages/spfn/npm/`,
97
136
  { stdio: "inherit", env: process.env }
98
137
  );
99
138
  execSync(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spfn/cli",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "description": "Superfunction CLI",
5
5
  "scripts": {
6
6
  "start": "node lib/index.js",