namirasoft-node 1.3.0 → 1.3.2
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/dist/CommandOperation.d.ts +4 -0
- package/dist/CommandOperation.js +31 -0
- package/dist/CommandOperation.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/CommandOperation.ts +33 -0
- package/src/index.ts +1 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CommandOperation = void 0;
|
|
4
|
+
const child_process_1 = require("child_process");
|
|
5
|
+
const namirasoft_core_1 = require("namirasoft-core");
|
|
6
|
+
class CommandOperation {
|
|
7
|
+
static exec(command, cwd) {
|
|
8
|
+
(0, child_process_1.exec)(command, { cwd }, (error, stdout, stderr) => {
|
|
9
|
+
if (error) {
|
|
10
|
+
namirasoft_core_1.ConsoleOperation.error(`error: ${error.message}`);
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
if (stderr) {
|
|
14
|
+
namirasoft_core_1.ConsoleOperation.error(`stderr: ${stderr}`);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
namirasoft_core_1.ConsoleOperation.log(`stdout:\n${stdout}`);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
static execSync(command, cwd) {
|
|
21
|
+
try {
|
|
22
|
+
return (0, child_process_1.execSync)(command, { cwd, encoding: 'utf-8' });
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
namirasoft_core_1.ConsoleOperation.error(error.stdout);
|
|
26
|
+
throw error;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.CommandOperation = CommandOperation;
|
|
31
|
+
//# sourceMappingURL=CommandOperation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandOperation.js","sourceRoot":"","sources":["../src/CommandOperation.ts"],"names":[],"mappings":";;;AAAA,iDAA8D;AAC9D,qDAAmD;AACnD,MAAa,gBAAgB;IAEzB,MAAM,CAAC,IAAI,CAAC,OAAe,EAAE,GAAuB;QAEhD,IAAA,oBAAI,EAAC,OAAO,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,KAA2B,EAAE,MAAc,EAAE,MAAc,EAAE,EAAE;YAEnF,IAAI,KAAK,EACT;gBACI,kCAAgB,CAAC,KAAK,CAAC,UAAU,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;gBAClD,OAAO;aACV;YACD,IAAI,MAAM,EACV;gBACI,kCAAgB,CAAC,KAAK,CAAC,WAAW,MAAM,EAAE,CAAC,CAAC;gBAC5C,OAAO;aACV;YACD,kCAAgB,CAAC,GAAG,CAAC,YAAY,MAAM,EAAE,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;IACP,CAAC;IACD,MAAM,CAAC,QAAQ,CAAC,OAAe,EAAE,GAAuB;QAEpD,IACA;YACI,OAAO,IAAA,wBAAQ,EAAC,OAAO,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;SACxD;QAAC,OAAO,KAAU,EACnB;YACI,kCAAgB,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YACrC,MAAM,KAAK,CAAC;SACf;IACL,CAAC;CACJ;AA9BD,4CA8BC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export * from "./BaseApplicationLink";
|
|
|
4
4
|
export * from "./BaseController";
|
|
5
5
|
export * from "./BaseDatabase";
|
|
6
6
|
export * from "./BaseTable";
|
|
7
|
+
export * from "./CommandOperation";
|
|
7
8
|
export * from "./EmailService";
|
|
8
9
|
export * from "./EnvService";
|
|
9
10
|
export * from "./IPOperation";
|
package/dist/index.js
CHANGED
|
@@ -20,6 +20,7 @@ __exportStar(require("./BaseApplicationLink"), exports);
|
|
|
20
20
|
__exportStar(require("./BaseController"), exports);
|
|
21
21
|
__exportStar(require("./BaseDatabase"), exports);
|
|
22
22
|
__exportStar(require("./BaseTable"), exports);
|
|
23
|
+
__exportStar(require("./CommandOperation"), exports);
|
|
23
24
|
__exportStar(require("./EmailService"), exports);
|
|
24
25
|
__exportStar(require("./EnvService"), exports);
|
|
25
26
|
__exportStar(require("./IPOperation"), exports);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,oDAAkC;AAClC,wDAAsC;AACtC,mDAAiC;AACjC,iDAA+B;AAC/B,8CAA4B;AAC5B,iDAA+B;AAC/B,+CAA6B;AAC7B,gDAA8B;AAC9B,yCAAuB;AACvB,iDAA+B;AAC/B,yDAAuC;AACvC,4DAA0C"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,oDAAkC;AAClC,wDAAsC;AACtC,mDAAiC;AACjC,iDAA+B;AAC/B,8CAA4B;AAC5B,qDAAmC;AACnC,iDAA+B;AAC/B,+CAA6B;AAC7B,gDAA8B;AAC9B,yCAAuB;AACvB,iDAA+B;AAC/B,yDAAuC;AACvC,4DAA0C"}
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"framework": "npm",
|
|
9
9
|
"application": "package",
|
|
10
10
|
"private": false,
|
|
11
|
-
"version": "1.3.
|
|
11
|
+
"version": "1.3.2",
|
|
12
12
|
"main": "./dist/index.js",
|
|
13
13
|
"types": "./dist/index.d.ts",
|
|
14
14
|
"author": "Amir Abolhasani",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"cors": "^2.8.5",
|
|
28
28
|
"express": "^4.18.3",
|
|
29
29
|
"joi": "^17.12.2",
|
|
30
|
-
"namirasoft-core": "^1.3.
|
|
30
|
+
"namirasoft-core": "^1.3.11",
|
|
31
31
|
"namirasoft-log": "^1.3.0",
|
|
32
32
|
"namirasoft-schema": "^1.3.0",
|
|
33
33
|
"nodemailer": "^6.9.12",
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ExecException, exec, execSync } from 'child_process';
|
|
2
|
+
import { ConsoleOperation } from 'namirasoft-core';
|
|
3
|
+
export class CommandOperation
|
|
4
|
+
{
|
|
5
|
+
static exec(command: string, cwd: string | undefined)
|
|
6
|
+
{
|
|
7
|
+
exec(command, { cwd }, (error: ExecException | null, stdout: string, stderr: string) =>
|
|
8
|
+
{
|
|
9
|
+
if (error)
|
|
10
|
+
{
|
|
11
|
+
ConsoleOperation.error(`error: ${error.message}`);
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
if (stderr)
|
|
15
|
+
{
|
|
16
|
+
ConsoleOperation.error(`stderr: ${stderr}`);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
ConsoleOperation.log(`stdout:\n${stdout}`);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
static execSync(command: string, cwd: string | undefined)
|
|
23
|
+
{
|
|
24
|
+
try
|
|
25
|
+
{
|
|
26
|
+
return execSync(command, { cwd, encoding: 'utf-8' });
|
|
27
|
+
} catch (error: any)
|
|
28
|
+
{
|
|
29
|
+
ConsoleOperation.error(error.stdout);
|
|
30
|
+
throw error;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -4,6 +4,7 @@ export * from "./BaseApplicationLink";
|
|
|
4
4
|
export * from "./BaseController";
|
|
5
5
|
export * from "./BaseDatabase";
|
|
6
6
|
export * from "./BaseTable";
|
|
7
|
+
export * from "./CommandOperation";
|
|
7
8
|
export * from "./EmailService";
|
|
8
9
|
export * from "./EnvService";
|
|
9
10
|
export * from "./IPOperation";
|