@codifycli/plugin-core 1.2.1 → 1.2.2-beta.1
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.
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
declare class CodifyCliSenderImpl {
|
|
5
5
|
private readonly validateIpcMessageV2;
|
|
6
6
|
requestPressKeyToContinuePrompt(message?: string): Promise<void>;
|
|
7
|
-
sendApplyNote(message: string, resourceType?: string):
|
|
7
|
+
sendApplyNote(message: string, resourceType?: string): void;
|
|
8
8
|
getCodifyCliCredentials(): Promise<string>;
|
|
9
9
|
private sendAndWaitForResponse;
|
|
10
10
|
}
|
package/dist/messages/sender.js
CHANGED
|
@@ -17,16 +17,17 @@ class CodifyCliSenderImpl {
|
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
sendApplyNote(message, resourceType) {
|
|
21
21
|
if (!process.send || !process.connected) {
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
process.send({
|
|
25
25
|
cmd: MessageCmd.APPLY_NOTE_REQUEST,
|
|
26
26
|
data: {
|
|
27
27
|
message,
|
|
28
28
|
...(resourceType && { resourceType }),
|
|
29
|
-
}
|
|
29
|
+
},
|
|
30
|
+
requestId: nanoid(8),
|
|
30
31
|
});
|
|
31
32
|
}
|
|
32
33
|
async getCodifyCliCredentials() {
|
package/dist/utils/file-utils.js
CHANGED
|
@@ -24,7 +24,7 @@ export class FileUtils {
|
|
|
24
24
|
await FileUtils.createShellRcIfNotExists();
|
|
25
25
|
const lineToInsert = addLeadingSpacer(addTrailingSpacer(line));
|
|
26
26
|
await fs.appendFile(Utils.getPrimaryShellRc(), lineToInsert);
|
|
27
|
-
|
|
27
|
+
CodifyCliSender.sendApplyNote(ApplyNotes.sourceShellRc());
|
|
28
28
|
function addLeadingSpacer(line) {
|
|
29
29
|
return line.startsWith('\n')
|
|
30
30
|
? line
|
|
@@ -43,7 +43,7 @@ export class FileUtils {
|
|
|
43
43
|
console.log(`Adding to ${path.basename(shellRc)}:
|
|
44
44
|
${lines.join('\n')}`);
|
|
45
45
|
await fs.appendFile(shellRc, formattedLines);
|
|
46
|
-
|
|
46
|
+
CodifyCliSender.sendApplyNote(ApplyNotes.sourceShellRc());
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
49
|
* This method adds a directory path to the shell rc file if it doesn't already exist.
|
|
@@ -64,7 +64,7 @@ ${lines.join('\n')}`);
|
|
|
64
64
|
else {
|
|
65
65
|
await fs.appendFile(shellRc, `\nexport PATH=${value}:$PATH;`, { encoding: 'utf8' });
|
|
66
66
|
}
|
|
67
|
-
|
|
67
|
+
CodifyCliSender.sendApplyNote(ApplyNotes.sourceShellRc());
|
|
68
68
|
}
|
|
69
69
|
static async removeFromFile(filePath, search) {
|
|
70
70
|
const contents = await fs.readFile(filePath, 'utf8');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codifycli/plugin-core",
|
|
3
|
-
"version": "1.2.1",
|
|
3
|
+
"version": "1.2.2-beta.1",
|
|
4
4
|
"description": "TypeScript library for building Codify plugins to manage system resources (applications, CLI tools, settings) through infrastructure-as-code",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
package/src/messages/sender.ts
CHANGED
|
@@ -27,17 +27,18 @@ class CodifyCliSenderImpl {
|
|
|
27
27
|
})
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
sendApplyNote(message: string, resourceType?: string): void {
|
|
31
31
|
if (!process.send || !process.connected) {
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
process.send(<IpcMessageV2>{
|
|
36
36
|
cmd: MessageCmd.APPLY_NOTE_REQUEST,
|
|
37
37
|
data: <ApplyNoteRequestData>{
|
|
38
38
|
message,
|
|
39
39
|
...(resourceType && { resourceType }),
|
|
40
|
-
}
|
|
40
|
+
},
|
|
41
|
+
requestId: nanoid(8),
|
|
41
42
|
});
|
|
42
43
|
}
|
|
43
44
|
|
package/src/utils/file-utils.ts
CHANGED
|
@@ -35,7 +35,7 @@ export class FileUtils {
|
|
|
35
35
|
);
|
|
36
36
|
|
|
37
37
|
await fs.appendFile(Utils.getPrimaryShellRc(), lineToInsert)
|
|
38
|
-
|
|
38
|
+
CodifyCliSender.sendApplyNote(ApplyNotes.sourceShellRc());
|
|
39
39
|
|
|
40
40
|
function addLeadingSpacer(line: string): string {
|
|
41
41
|
return line.startsWith('\n')
|
|
@@ -60,7 +60,7 @@ export class FileUtils {
|
|
|
60
60
|
${lines.join('\n')}`)
|
|
61
61
|
|
|
62
62
|
await fs.appendFile(shellRc, formattedLines)
|
|
63
|
-
|
|
63
|
+
CodifyCliSender.sendApplyNote(ApplyNotes.sourceShellRc());
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
/**
|
|
@@ -85,7 +85,7 @@ ${lines.join('\n')}`)
|
|
|
85
85
|
await fs.appendFile(shellRc, `\nexport PATH=${value}:$PATH;`, { encoding: 'utf8' });
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
|
|
88
|
+
CodifyCliSender.sendApplyNote(ApplyNotes.sourceShellRc());
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
static async removeFromFile(filePath: string, search: string): Promise<void> {
|