jcc-express-mvc 1.3.3 → 1.3.4
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/lib/Command-Line/NodeArtisanCommand.d.ts.map +1 -1
- package/lib/Command-Line/NodeArtisanCommand.js +3 -0
- package/lib/Command-Line/command.d.ts.map +1 -1
- package/lib/Command-Line/command.js +10 -4
- package/lib/Command-Line/files/Migration.d.ts.map +1 -1
- package/lib/Command-Line/files/Migration.js +2 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeArtisanCommand.d.ts","sourceRoot":"","sources":["../../../framework/lib/Command-Line/NodeArtisanCommand.ts"],"names":[],"mappings":"AACA;;;;MAIM;AACN,eAAO,MAAM,kBAAkB,gBAAgB,KAAK,CAAC,GAAG,CAAC,KAAQ,
|
|
1
|
+
{"version":3,"file":"NodeArtisanCommand.d.ts","sourceRoot":"","sources":["../../../framework/lib/Command-Line/NodeArtisanCommand.ts"],"names":[],"mappings":"AACA;;;;MAIM;AACN,eAAO,MAAM,kBAAkB,gBAAgB,KAAK,CAAC,GAAG,CAAC,KAAQ,GA6FhE,CAAC"}
|
|
@@ -15,6 +15,9 @@ const NodeArtisanCommand = (commandArg = []) => {
|
|
|
15
15
|
let index = commandArg.findIndex((arg, index) => arg.includes(":")); //commandArg[0].split(":")[1] || commandArg[1].split(":")[1]; // Extract the command type from the first argument
|
|
16
16
|
let command = commandArg[index].split(":")[1];
|
|
17
17
|
// If the command is for creating an API controller with resources
|
|
18
|
+
if (command === "migrate") {
|
|
19
|
+
return command_1.default.runMigration();
|
|
20
|
+
}
|
|
18
21
|
if (commandArg.length === index + 4 &&
|
|
19
22
|
(command === "apiController" || command === "ApiController") &&
|
|
20
23
|
(commandArg[index + 3] === "--resources" ||
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../framework/lib/Command-Line/command.ts"],"names":[],"mappings":"AAcA,cAAM,OAAO;IAGX,MAAM,CAAC,cAAc,EAAE,MAAM,EAAE,SAAS,UAAQ,GAAG,GAAG;IA2BtD,MAAM,CAAC,cAAc,EAAE,MAAM,EAAE,SAAS,UAAQ,GAAG,GAAG;IA+BtD,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,GAAG;IAehC,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,GAAG;IAqBpC,YAAY,CAAC,aAAa,EAAE,MAAM,GAAG,GAAG;IAwBxC,YAAY;
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../framework/lib/Command-Line/command.ts"],"names":[],"mappings":"AAcA,cAAM,OAAO;IAGX,MAAM,CAAC,cAAc,EAAE,MAAM,EAAE,SAAS,UAAQ,GAAG,GAAG;IA2BtD,MAAM,CAAC,cAAc,EAAE,MAAM,EAAE,SAAS,UAAQ,GAAG,GAAG;IA+BtD,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,GAAG;IAehC,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,GAAG;IAqBpC,YAAY,CAAC,aAAa,EAAE,MAAM,GAAG,GAAG;IAwBxC,YAAY;IAqBZ,QAAQ,IAAI,GAAG;CAGhB;;AAED,wBAA6B"}
|
|
@@ -13,6 +13,7 @@ const Request_1 = __importDefault(require("./files/Request"));
|
|
|
13
13
|
const Migration_1 = __importDefault(require("./files/Migration"));
|
|
14
14
|
const colors_1 = __importDefault(require("colors")); // Module for adding color to console output
|
|
15
15
|
const utils_1 = require("./utils");
|
|
16
|
+
const jcc_eloquent_1 = require("jcc-eloquent");
|
|
16
17
|
const rootPath = app_root_path_1.default.path;
|
|
17
18
|
colors_1.default.enable();
|
|
18
19
|
class Command {
|
|
@@ -96,11 +97,11 @@ class Command {
|
|
|
96
97
|
let migrationPath = path_1.default.resolve(`${rootPath}/database/migrations`);
|
|
97
98
|
// Resolve path to request files directory
|
|
98
99
|
const fullName = `${(0, utils_1.formatDate)()}_${migrationName}`;
|
|
99
|
-
if (fs_1.default.existsSync(`${migrationPath}/${fullName}.
|
|
100
|
+
if (fs_1.default.existsSync(`${migrationPath}/${fullName}.js`)) {
|
|
100
101
|
// Check if request file already exists
|
|
101
102
|
return console.log(colors_1.default.yellow(`${tableName} already exist`)); // Log a warning if request file already exists
|
|
102
103
|
}
|
|
103
|
-
fs_1.default.writeFileSync(`${migrationPath}/${fullName}.
|
|
104
|
+
fs_1.default.writeFileSync(`${migrationPath}/${fullName}.js`, (0, Migration_1.default)(tableName));
|
|
104
105
|
return console.log(colors_1.default.green(`${fullName} added successfully`)); // Log success message
|
|
105
106
|
}
|
|
106
107
|
catch (err) {
|
|
@@ -115,8 +116,13 @@ class Command {
|
|
|
115
116
|
const files = fs_1.default.readdirSync(migrationPath);
|
|
116
117
|
for (const file of files) {
|
|
117
118
|
const migrationFile = require(`${migrationPath}/${file}.ts`);
|
|
118
|
-
|
|
119
|
-
|
|
119
|
+
const sql = migrationFile.up();
|
|
120
|
+
jcc_eloquent_1.DB.runQuery(sql)
|
|
121
|
+
.then((res) => {
|
|
122
|
+
console.log(res);
|
|
123
|
+
process.exit();
|
|
124
|
+
})
|
|
125
|
+
.catch((err) => console.log(err));
|
|
120
126
|
}
|
|
121
127
|
}
|
|
122
128
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Migration.d.ts","sourceRoot":"","sources":["../../../../framework/lib/Command-Line/files/Migration.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,eAAe,UAAW,MAAM,KAAG,
|
|
1
|
+
{"version":3,"file":"Migration.d.ts","sourceRoot":"","sources":["../../../../framework/lib/Command-Line/files/Migration.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,eAAe,UAAW,MAAM,KAAG,MAexC,CAAC;AAEF,eAAe,eAAe,CAAC"}
|