@@ -90,7 +90,7 @@ async function getCredential() {
9090 } ;
9191 }
9292 }
93- throw new error_1 . TcbError ( '无有效身份信息,请使用 tcb login 登录' ) ;
93+ throw new error_1 . TcbError ( '无有效身份信息,请使用 cloudbase login 登录' ) ;
9494}
9595exports . getCredential = getCredential ;
9696function getSSHConfig ( ) {
@@ -121,25 +121,31 @@ async function getSSH() {
121121 return sshConfig ;
122122}
123123exports . getSSH = getSSH ;
124- function getTcbConfig ( ) {
124+ function getCloudBaseConfig ( ) {
125125 return configstore_1 . configStore . all ( ) ;
126126}
127- exports . getTcbConfig = getTcbConfig ;
128- async function resolveTcbrcConfig ( ) {
127+ exports . getCloudBaseConfig = getCloudBaseConfig ;
128+ async function resolveCloudBaseConfig ( ) {
129129 const tcbrcPath = path_1 . default . join ( process . cwd ( ) , 'tcbrc.json' ) ;
130- if ( ! fs_1 . default . existsSync ( tcbrcPath ) ) {
130+ if ( fs_1 . default . existsSync ( tcbrcPath ) ) {
131+ throw new error_1 . TcbError ( 'tcrbrc.josn 配置文件已废弃,请使用 cloudbaserc.json 或 cloudbaserc.js 配置文件!' ) ;
132+ }
133+ const cloudbaseJSONPath = path_1 . default . join ( process . cwd ( ) , 'cloudbaserc.json' ) ;
134+ const cloudbaseJSPath = path_1 . default . join ( process . cwd ( ) , 'cloudbaserc.js' ) ;
135+ const cloudbasePath = [ cloudbaseJSPath , cloudbaseJSONPath ] . find ( item => fs_1 . default . existsSync ( item ) ) ;
136+ if ( ! cloudbasePath || ! fs_1 . default . existsSync ( cloudbasePath ) ) {
131137 return { } ;
132138 }
133- const tcbrc = await Promise . resolve ( ) . then ( ( ) => __importStar ( require ( tcbrcPath ) ) ) ;
134- if ( ! tcbrc . envId ) {
139+ const cloudbaseConfig = await Promise . resolve ( ) . then ( ( ) => __importStar ( require ( cloudbasePath ) ) ) ;
140+ if ( ! cloudbaseConfig . envId ) {
135141 throw new error_1 . TcbError ( '配置文件无效,配置文件必须包含含环境 Id' ) ;
136142 }
137- return tcbrc ;
143+ return cloudbaseConfig ;
138144}
139- exports . resolveTcbrcConfig = resolveTcbrcConfig ;
145+ exports . resolveCloudBaseConfig = resolveCloudBaseConfig ;
140146async function getEnvId ( envId ) {
141- const tcbrc = await resolveTcbrcConfig ( ) ;
142- const assignEnvId = envId || tcbrc . envId ;
147+ const cloudbaseConfig = await resolveCloudBaseConfig ( ) ;
148+ const assignEnvId = envId || cloudbaseConfig . envId ;
143149 if ( ! assignEnvId ) {
144150 throw new error_1 . TcbError ( '未识别到有效的环境 Id 变量,请在项目根目录进行操作或通过 envId 参数指定环境 Id' ) ;
145151 }
0 commit comments