Browse Source

good night

master
Daniel Hübleitner 2 years ago
parent
commit
48b3951a28
1 changed files with 29 additions and 12 deletions
  1. 29
    12
      src/backend/UpdateManger.ts

+ 29
- 12
src/backend/UpdateManger.ts View File

@@ -143,7 +143,9 @@ export abstract class FSExtension<Status extends FSStatus> extends Extension<FSS
143 143
 }
144 144
 
145 145
 type NPMStatus = FSStatus & {
146
-    version?: string
146
+    latest?: string,
147
+    current?: string, // TODO
148
+    author?: string
147 149
 }
148 150
 
149 151
 export class NPMExtension extends FSExtension<NPMStatus>{
@@ -157,17 +159,32 @@ export class NPMExtension extends FSExtension<NPMStatus>{
157 159
     public async status(): Promise<NPMStatus> {
158 160
 
159 161
         const fsStatus = await super.status()
160
-        const { error, 
161
-                stdout, 
162
-                stderr } = await exec('npm info --prefix ' + this.prefix + ' ' + this.name + " version")
162
+        const { 
163
+            latestError, 
164
+            latest, 
165
+            latestStdErr } = await exec('npm view --prefix ' + this.prefix + ' ' + this.name + " version")
163 166
 
164
-        if(error){
165
-            logger.warn(stderr)
167
+        if(latestError){
168
+            logger.warn(latestStdErr)
166 169
             return fsStatus
167 170
         }
171
+
172
+        const { 
173
+            authorError, 
174
+            author, 
175
+            authorStdErr } = await exec('npm author ls --prefix ' + this.prefix + ' ' + this.name)
176
+
177
+        if(authorError){
178
+            logger.warn(authorStdErr)
179
+            return { 
180
+                ...fsStatus, 
181
+                latest: latest} 
182
+        }
183
+
168 184
         return {  
169 185
             ...fsStatus, 
170
-            version: stdout
186
+            latest: latest,
187
+            author: author
171 188
         }
172 189
     }
173 190
 
@@ -232,22 +249,22 @@ export class NPMExtension extends FSExtension<NPMStatus>{
232 249
 }
233 250
 
234 251
 export type GitStatus = FSStatus & {
235
-    current?: string
236
-    wanted?: string
252
+    branch?: string
253
+    remote?: string
237 254
     latest?: string
238 255
 }
239 256
 
240 257
 export class GitExtension extends FSExtension<GitStatus>{
241 258
     constructor(
242 259
         name:string,
243
-        version = "latest", 
244
-        public localPrefix:string,
260
+        prefix:string,
261
+        protected gitCloneURL: URL
245 262
     ){
246 263
         super(name, version)
247 264
     }
248 265
 
249 266
     public async status(): Promise<GitStatus>{
250
-
267
+        //TODO tomorrow
251 268
     }
252 269
 
253 270
     public async install(): Promise<boolean> {

Loading…
Cancel
Save