@dolphjs/cli 1.4.0 → 2.0.0
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/daemon/watcher.d.ts +4 -0
- package/dist/daemon/watcher.js +82 -53
- package/dist/daemon/watcherConfig.d.ts +1 -0
- package/dist/daemon/watcherConfig.js +13 -9
- package/dist/generators/generate_controller.d.ts +2 -0
- package/dist/generators/generate_controller.js +38 -30
- package/dist/generators/generate_model.d.ts +2 -0
- package/dist/generators/generate_model.js +35 -27
- package/dist/generators/generate_mysql.d.ts +2 -0
- package/dist/generators/generate_mysql.js +33 -25
- package/dist/generators/generate_routes.d.ts +2 -0
- package/dist/generators/generate_routes.js +33 -25
- package/dist/generators/generate_service.d.ts +2 -0
- package/dist/generators/generate_service.js +36 -28
- package/dist/generators/resolvers/resolve_controller_content.d.ts +1 -0
- package/dist/generators/resolvers/resolve_controller_content.js +29 -3
- package/dist/generators/resolvers/resolve_model_content.d.ts +2 -0
- package/dist/generators/resolvers/resolve_model_content.js +32 -5
- package/dist/generators/resolvers/resolve_routes_content.d.ts +1 -0
- package/dist/generators/resolvers/resolve_routes_content.js +29 -3
- package/dist/generators/resolvers/resolve_service_content.d.ts +1 -0
- package/dist/generators/resolvers/resolve_service_content.js +29 -3
- package/dist/generators/spring/generate_spring_component.d.ts +2 -0
- package/dist/generators/spring/generate_spring_component.js +30 -22
- package/dist/generators/spring/generate_spring_controller.d.ts +2 -0
- package/dist/generators/spring/generate_spring_controller.js +30 -22
- package/dist/generators/spring/generate_spring_model.d.ts +2 -0
- package/dist/generators/spring/generate_spring_model.js +30 -22
- package/dist/generators/spring/generate_spring_mysql.d.ts +2 -0
- package/dist/generators/spring/generate_spring_mysql.js +30 -22
- package/dist/generators/spring/generate_spring_service.d.ts +2 -0
- package/dist/generators/spring/generate_spring_service.js +30 -22
- package/dist/generators/spring/generate_spring_socket_service.d.ts +2 -0
- package/dist/generators/spring/generate_spring_socket_service.js +29 -21
- package/dist/generators/templates/controller_template.d.ts +5 -0
- package/dist/generators/templates/controller_template.js +7 -1
- package/dist/generators/templates/model_template.d.ts +5 -0
- package/dist/generators/templates/model_template.js +7 -1
- package/dist/generators/templates/mysql_config_template.d.ts +5 -0
- package/dist/generators/templates/mysql_config_template.js +7 -1
- package/dist/generators/templates/routes_template.d.ts +5 -0
- package/dist/generators/templates/routes_template.js +7 -1
- package/dist/generators/templates/service_template.d.ts +5 -0
- package/dist/generators/templates/service_template.js +7 -1
- package/dist/generators/templates/socket_service_template.d.ts +1 -0
- package/dist/generators/templates/socket_service_template.js +5 -1
- package/dist/generators/templates/spring_component_template.d.ts +1 -0
- package/dist/generators/templates/spring_component_template.js +5 -1
- package/dist/generators/templates/spring_controller_template.d.ts +1 -0
- package/dist/generators/templates/spring_controller_template.js +5 -1
- package/dist/generators/templates/spring_model_template.d.ts +1 -0
- package/dist/generators/templates/spring_model_template.js +5 -1
- package/dist/generators/templates/spring_service_template.d.ts +1 -0
- package/dist/generators/templates/spring_service_template.js +5 -1
- package/dist/get_file_stats.d.ts +1 -0
- package/dist/get_file_stats.js +10 -0
- package/dist/helpers/messages.d.ts +8 -0
- package/dist/helpers/messages.js +14 -8
- package/dist/index.d.ts +2 -0
- package/dist/index.js +110 -29
- package/dist/install.d.ts +1 -0
- package/dist/install.js +149 -0
- package/dist/registers/register_component.d.ts +1 -0
- package/dist/registers/register_component.js +27 -21
- package/dist/registers/register_controllers_in_components.d.ts +1 -0
- package/dist/registers/register_controllers_in_components.js +22 -17
- package/dist/registers/register_routes.d.ts +1 -0
- package/dist/registers/register_routes.js +27 -32
- package/dist/registers/server_file_express.d.ts +1 -0
- package/dist/registers/server_file_express.js +20 -17
- package/dist/registers/server_file_spring.d.ts +1 -0
- package/dist/registers/server_file_spring.js +18 -13
- package/dist/types/config.d.ts +14 -0
- package/dist/types/config.js +2 -1
- package/dist/utils/get_root_dir_path.d.ts +1 -0
- package/dist/utils/get_root_dir_path.js +10 -3
- package/dist/utils/get_user_config_path.d.ts +1 -0
- package/dist/utils/get_user_config_path.js +14 -7
- package/dist/utils/init_helper_function.d.ts +1 -0
- package/dist/utils/init_helper_function.js +50 -44
- package/dist/utils/package_config.d.ts +1 -0
- package/dist/utils/package_config.js +2 -0
- package/dist/utils/package_description.d.ts +1 -0
- package/dist/utils/package_description.js +12 -5
- package/dist/utils/package_generator.d.ts +1 -0
- package/dist/utils/package_generator.js +69 -41
- package/dist/utils/package_init.d.ts +1 -0
- package/dist/utils/package_init.js +9 -5
- package/dist/utils/read_package_json.d.ts +4 -0
- package/dist/utils/read_package_json.js +17 -0
- package/dist/utils/read_user_config.d.ts +1 -0
- package/dist/utils/read_user_config.js +29 -22
- package/dist/utils/read_user_config_path.d.ts +1 -0
- package/dist/utils/read_user_config_path.js +16 -9
- package/dist/utils/write_dolph_config.d.ts +1 -0
- package/dist/utils/write_dolph_config.js +32 -5
- package/dist/utils/write_gitignore.d.ts +1 -0
- package/dist/utils/write_gitignore.js +32 -5
- package/dist/utils/write_package_json.d.ts +1 -0
- package/dist/utils/write_package_json.js +32 -5
- package/dist/utils/write_swrcc.d.ts +1 -0
- package/dist/utils/write_swrcc.js +32 -5
- package/dist/utils/write_tsconfig.d.ts +1 -0
- package/dist/utils/write_tsconfig.js +34 -5
- package/dist/utils/write_user_config.d.ts +1 -0
- package/dist/utils/write_user_config.js +17 -10
- package/package.json +22 -12
|
@@ -1,56 +1,63 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.configurePackage = void 0;
|
|
7
|
+
const commander_1 = require("commander");
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const read_user_config_path_js_1 = require("./read_user_config_path.js");
|
|
10
|
+
const write_user_config_js_1 = require("./write_user_config.js");
|
|
11
|
+
const messages_js_1 = require("../helpers/messages.js");
|
|
6
12
|
const dbOptions = ["mongo", "postgresql", "mysql", "other"];
|
|
7
|
-
|
|
8
|
-
program
|
|
13
|
+
const configurePackage = () => {
|
|
14
|
+
commander_1.program
|
|
9
15
|
.command("config")
|
|
10
16
|
.alias("cf")
|
|
11
17
|
.description("Set default configurations")
|
|
12
|
-
.option("-lg, --language" +
|
|
13
|
-
.option("-pd, --paradigm" +
|
|
14
|
-
.option("-db, --database" +
|
|
15
|
-
.option("-gf, --generateFolder" +
|
|
18
|
+
.option("-lg, --language" + chalk_1.default.bold(chalk_1.default.blue("<language>")), "Set the default coding language (ts or js)")
|
|
19
|
+
.option("-pd, --paradigm" + chalk_1.default.bold(chalk_1.default.blue("<paradigm>")), "Set the default programming paradigm (oop or functional)")
|
|
20
|
+
.option("-db, --database" + chalk_1.default.bold(chalk_1.default.blue("<database>")), "Set the default project database (mongo, mysql, postresql or other)")
|
|
21
|
+
.option("-gf, --generateFolder" + chalk_1.default.bold(chalk_1.default.blue("<boolean>")), "Generates a folder file for the Services, Models, Controllers and Routes (true or false)")
|
|
16
22
|
.action(async (name, options) => {
|
|
17
|
-
let config = readConfig();
|
|
23
|
+
let config = (0, read_user_config_path_js_1.readConfig)();
|
|
18
24
|
Object.entries(name).forEach(([key, value]) => {
|
|
19
25
|
if (key && key.toLocaleLowerCase().includes("language") && value) {
|
|
20
26
|
console.log(value.toString(), value);
|
|
21
27
|
if (value.toString() !== "js" && value.toString() !== "ts") {
|
|
22
|
-
dolphMsg.errorRed(`invalid project language, format must be either ${
|
|
28
|
+
messages_js_1.dolphMsg.errorRed(`invalid project language, format must be either ${chalk_1.default.bold("js")} or ${chalk_1.default.bold("ts")}`);
|
|
23
29
|
return;
|
|
24
30
|
}
|
|
25
31
|
config.language = value;
|
|
26
|
-
writeConfig(config);
|
|
27
|
-
dolphMsg.info(`default project language is now ${
|
|
32
|
+
(0, write_user_config_js_1.writeConfig)(config);
|
|
33
|
+
messages_js_1.dolphMsg.info(`default project language is now ${chalk_1.default.bold(config.language)}`);
|
|
28
34
|
return;
|
|
29
35
|
}
|
|
30
36
|
if (key && key.toLocaleLowerCase().includes("paradigm") && value) {
|
|
31
37
|
if (value.toString() !== "oop" && value.toString() !== "functional") {
|
|
32
|
-
dolphMsg.errorRed(`invalid programming paradigm, must be either ${
|
|
38
|
+
messages_js_1.dolphMsg.errorRed(`invalid programming paradigm, must be either ${chalk_1.default.bold("oop")} or ${chalk_1.default.bold("functional")}`);
|
|
33
39
|
return;
|
|
34
40
|
}
|
|
35
41
|
config.paradigm = value;
|
|
36
|
-
writeConfig(config);
|
|
37
|
-
dolphMsg.info(`default programming paradigm is now ${
|
|
42
|
+
(0, write_user_config_js_1.writeConfig)(config);
|
|
43
|
+
messages_js_1.dolphMsg.info(`default programming paradigm is now ${chalk_1.default.bold(config.paradigm)}`);
|
|
38
44
|
return;
|
|
39
45
|
}
|
|
40
46
|
if (key && key.toLocaleLowerCase().includes("database") && value) {
|
|
41
47
|
if (!dbOptions.includes(value.toString())) {
|
|
42
|
-
dolphMsg.errorRed(`invalid database value, must be either of these: ${dbOptions.join(", ")} `);
|
|
48
|
+
messages_js_1.dolphMsg.errorRed(`invalid database value, must be either of these: ${dbOptions.join(", ")} `);
|
|
43
49
|
return;
|
|
44
50
|
}
|
|
45
51
|
config.database = value;
|
|
46
|
-
writeConfig(config);
|
|
47
|
-
dolphMsg.info(`default project database is now ${
|
|
52
|
+
(0, write_user_config_js_1.writeConfig)(config);
|
|
53
|
+
messages_js_1.dolphMsg.info(`default project database is now ${chalk_1.default.bold(config.database)}`);
|
|
48
54
|
return;
|
|
49
55
|
}
|
|
50
56
|
});
|
|
51
57
|
if (Object.keys(options).length === 0) {
|
|
52
|
-
dolphMsg.errorGray(`no configurations applied, run ${
|
|
58
|
+
messages_js_1.dolphMsg.errorGray(`no configurations applied, run ${chalk_1.default.green("dolph config --help")} to see available commands`);
|
|
53
59
|
}
|
|
54
60
|
process.exit(0);
|
|
55
61
|
});
|
|
56
62
|
};
|
|
63
|
+
exports.configurePackage = configurePackage;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const readConfig: () => any;
|
|
@@ -1,18 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.readConfig = void 0;
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const get_user_config_path_js_1 = require("./get_user_config_path.js");
|
|
9
|
+
const fs_1 = require("fs");
|
|
10
|
+
const js_yaml_1 = __importDefault(require("js-yaml"));
|
|
11
|
+
const filePath = (0, get_user_config_path_js_1.getUserConfigFilePath)();
|
|
12
|
+
const readConfig = () => {
|
|
7
13
|
try {
|
|
8
|
-
const data = readFileSync(filePath, "utf8");
|
|
9
|
-
const yamlData =
|
|
14
|
+
const data = (0, fs_1.readFileSync)(filePath, "utf8");
|
|
15
|
+
const yamlData = js_yaml_1.default.load(data);
|
|
10
16
|
const jsonData = JSON.stringify(yamlData);
|
|
11
17
|
return JSON.parse(jsonData.toString());
|
|
12
18
|
}
|
|
13
19
|
catch (e) {
|
|
14
20
|
console.log(e);
|
|
15
|
-
console.log(
|
|
21
|
+
console.log(chalk_1.default.bold(chalk_1.default.red("Error encountered reading config file, please run 'dolph cf' to initialize config file 🥹")));
|
|
16
22
|
process.exit(1);
|
|
17
23
|
}
|
|
18
24
|
};
|
|
25
|
+
exports.readConfig = readConfig;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function writeDolphConfig(): void;
|
|
@@ -1,9 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.writeDolphConfig = void 0;
|
|
27
|
+
const fs = __importStar(require("fs"));
|
|
28
|
+
const get_root_dir_path_js_1 = require("./get_root_dir_path.js");
|
|
29
|
+
const path_1 = require("path");
|
|
30
|
+
function writeDolphConfig() {
|
|
5
31
|
const dolphConfigContent = `port: 3300
|
|
6
32
|
`;
|
|
7
|
-
const filePath = join(getRootDirectory(), "dolph_config.yaml");
|
|
33
|
+
const filePath = (0, path_1.join)((0, get_root_dir_path_js_1.getRootDirectory)(), "dolph_config.yaml");
|
|
8
34
|
fs.writeFileSync(filePath, dolphConfigContent, { encoding: "utf-8" });
|
|
9
35
|
}
|
|
36
|
+
exports.writeDolphConfig = writeDolphConfig;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function writeGitignore(): void;
|
|
@@ -1,13 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.writeGitignore = void 0;
|
|
27
|
+
const fs = __importStar(require("fs"));
|
|
28
|
+
const get_root_dir_path_js_1 = require("./get_root_dir_path.js");
|
|
29
|
+
const path_1 = require("path");
|
|
30
|
+
function writeGitignore() {
|
|
5
31
|
const gitignoreContent = `node_modules
|
|
6
32
|
.env
|
|
7
33
|
logs
|
|
8
34
|
yarn-error.log
|
|
9
35
|
app
|
|
10
36
|
`;
|
|
11
|
-
const filePath = join(getRootDirectory(), ".gitignore");
|
|
37
|
+
const filePath = (0, path_1.join)((0, get_root_dir_path_js_1.getRootDirectory)(), ".gitignore");
|
|
12
38
|
fs.writeFileSync(filePath, gitignoreContent, { encoding: "utf-8" });
|
|
13
39
|
}
|
|
40
|
+
exports.writeGitignore = writeGitignore;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function writePackageJsonFile(name: string, extension: string): void;
|
|
@@ -1,7 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.writePackageJsonFile = void 0;
|
|
27
|
+
const fs = __importStar(require("fs"));
|
|
28
|
+
const path_1 = require("path");
|
|
29
|
+
const get_root_dir_path_js_1 = require("./get_root_dir_path.js");
|
|
30
|
+
function writePackageJsonFile(name, extension) {
|
|
5
31
|
const packageJsonContent = extension === "ts"
|
|
6
32
|
? `{
|
|
7
33
|
"name": "${name}",
|
|
@@ -57,6 +83,7 @@ export function writePackageJsonFile(name, extension) {
|
|
|
57
83
|
}
|
|
58
84
|
}
|
|
59
85
|
`;
|
|
60
|
-
const filePath = join(getRootDirectory(), "package.json");
|
|
86
|
+
const filePath = (0, path_1.join)((0, get_root_dir_path_js_1.getRootDirectory)(), "package.json");
|
|
61
87
|
fs.writeFileSync(filePath, packageJsonContent, { encoding: "utf-8" });
|
|
62
88
|
}
|
|
89
|
+
exports.writePackageJsonFile = writePackageJsonFile;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function writeSwcrc(isSpring: boolean): void;
|
|
@@ -1,7 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.writeSwcrc = void 0;
|
|
27
|
+
const fs = __importStar(require("fs"));
|
|
28
|
+
const get_root_dir_path_js_1 = require("./get_root_dir_path.js");
|
|
29
|
+
const path_1 = require("path");
|
|
30
|
+
function writeSwcrc(isSpring) {
|
|
5
31
|
let swcrcContent = ``;
|
|
6
32
|
if (!isSpring) {
|
|
7
33
|
swcrcContent = `{
|
|
@@ -90,6 +116,7 @@ export function writeSwcrc(isSpring) {
|
|
|
90
116
|
}
|
|
91
117
|
`;
|
|
92
118
|
}
|
|
93
|
-
const filePath = join(getRootDirectory(), ".swcrc");
|
|
119
|
+
const filePath = (0, path_1.join)((0, get_root_dir_path_js_1.getRootDirectory)(), ".swcrc");
|
|
94
120
|
fs.writeFileSync(filePath, swcrcContent, { encoding: "utf-8" });
|
|
95
121
|
}
|
|
122
|
+
exports.writeSwcrc = writeSwcrc;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function writeTsConfigFile(isSpring: boolean): void;
|
|
@@ -1,7 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.writeTsConfigFile = void 0;
|
|
27
|
+
const fs = __importStar(require("fs"));
|
|
28
|
+
const get_root_dir_path_js_1 = require("./get_root_dir_path.js");
|
|
29
|
+
const path_1 = require("path");
|
|
30
|
+
function writeTsConfigFile(isSpring) {
|
|
5
31
|
let tsConfigContent = ``;
|
|
6
32
|
if (!isSpring) {
|
|
7
33
|
tsConfigContent = `
|
|
@@ -11,6 +37,7 @@ export function writeTsConfigFile(isSpring) {
|
|
|
11
37
|
"allowJs": false,
|
|
12
38
|
"declaration": false,
|
|
13
39
|
"experimentalDecorators": true,
|
|
40
|
+
"emitDecoratorMetadata": true,
|
|
14
41
|
"sourceMap": false,
|
|
15
42
|
"useUnknownInCatchVariables": false,
|
|
16
43
|
"strictFunctionTypes": false,
|
|
@@ -53,6 +80,7 @@ export function writeTsConfigFile(isSpring) {
|
|
|
53
80
|
"allowJs": false,
|
|
54
81
|
"declaration": false,
|
|
55
82
|
"experimentalDecorators": true,
|
|
83
|
+
"emitDecoratorMetadata": true,
|
|
56
84
|
"sourceMap": false,
|
|
57
85
|
"useUnknownInCatchVariables": false,
|
|
58
86
|
"strictFunctionTypes": false,
|
|
@@ -89,6 +117,7 @@ export function writeTsConfigFile(isSpring) {
|
|
|
89
117
|
}
|
|
90
118
|
`;
|
|
91
119
|
}
|
|
92
|
-
const filePath = join(getRootDirectory(), "tsconfig.json");
|
|
120
|
+
const filePath = (0, path_1.join)((0, get_root_dir_path_js_1.getRootDirectory)(), "tsconfig.json");
|
|
93
121
|
fs.writeFileSync(filePath, tsConfigContent, { encoding: "utf-8" });
|
|
94
122
|
}
|
|
123
|
+
exports.writeTsConfigFile = writeTsConfigFile;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const writeConfig: (config: any) => void;
|
|
@@ -1,16 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.writeConfig = void 0;
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const js_yaml_1 = __importDefault(require("js-yaml"));
|
|
9
|
+
const get_user_config_path_js_1 = require("./get_user_config_path.js");
|
|
10
|
+
const fs_1 = require("fs");
|
|
11
|
+
const filePath = (0, get_user_config_path_js_1.getUserConfigFilePath)();
|
|
12
|
+
const writeConfig = (config) => {
|
|
7
13
|
try {
|
|
8
|
-
const yamlString =
|
|
9
|
-
writeFileSync(filePath, yamlString, "utf8");
|
|
10
|
-
console.log(
|
|
14
|
+
const yamlString = js_yaml_1.default.dump(config);
|
|
15
|
+
(0, fs_1.writeFileSync)(filePath, yamlString, "utf8");
|
|
16
|
+
console.log(chalk_1.default.green("Configurations saved successfully! 😎."));
|
|
11
17
|
}
|
|
12
18
|
catch (e) {
|
|
13
|
-
console.log(
|
|
19
|
+
console.log(chalk_1.default.bold(chalk_1.default.red("Error encountered reading config file, please run 'dolph cf' to initialize config file 🥹")));
|
|
14
20
|
process.exit(1);
|
|
15
21
|
}
|
|
16
22
|
};
|
|
23
|
+
exports.writeConfig = writeConfig;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dolphjs/cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "The dolphjs-cli is a tool for efficient initialization and management of a dolphjs project",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"repository": "https://github.com/dolphjs/dolph-cli.git",
|
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
"lint": "eslint .",
|
|
11
11
|
"check-lint": "eslint [0-9]*.ts",
|
|
12
12
|
"clean": "rimraf ./dist",
|
|
13
|
-
"build": "tsc ./lib/index.ts --esModuleInterop true --target ES2020 --module
|
|
13
|
+
"build": "tsc ./lib/index.ts ./lib/install.ts --esModuleInterop true --target ES2020 --module commonjs --outDir dist",
|
|
14
14
|
"start": "npm run clean && npm run build && node ./dist/index.js",
|
|
15
15
|
"dev": "ts-node ./lib/index.ts",
|
|
16
16
|
"dev:start": "node ./dist/index.js",
|
|
17
|
-
"pub": "npm run clean && npm run build"
|
|
17
|
+
"pub": "npm run clean && npm run build",
|
|
18
|
+
"postinstall": "node ./dist/install.js"
|
|
18
19
|
},
|
|
19
|
-
"type": "module",
|
|
20
20
|
"engines": {
|
|
21
21
|
"node": ">=18.0.0"
|
|
22
22
|
},
|
|
@@ -35,24 +35,25 @@
|
|
|
35
35
|
"dist/**/*"
|
|
36
36
|
],
|
|
37
37
|
"bin": {
|
|
38
|
-
"dolph": "./dist/index.js"
|
|
39
|
-
"dc": "./dist/index.js"
|
|
38
|
+
"dolph": "./dist/index.js"
|
|
40
39
|
},
|
|
41
40
|
"peerDependencies": {
|
|
42
|
-
"ts-node": "^10.9.2",
|
|
43
41
|
"@swc/cli": "^0.1.62",
|
|
44
|
-
"@swc/core": "^1.3.91"
|
|
42
|
+
"@swc/core": "^1.3.91",
|
|
43
|
+
"ts-node": "^10.9.2"
|
|
45
44
|
},
|
|
46
45
|
"dependencies": {
|
|
47
|
-
"chalk": "^
|
|
46
|
+
"chalk": "^4.1.2",
|
|
48
47
|
"chokidar": "^3.5.3",
|
|
49
48
|
"commander": "^11.1.0",
|
|
50
49
|
"cross-spawn": "^7.0.3",
|
|
51
50
|
"figlet": "^1.7.0",
|
|
52
|
-
"inquirer": "^
|
|
51
|
+
"inquirer": "^8.2.5",
|
|
53
52
|
"js-yaml": "^4.1.0",
|
|
54
53
|
"lodash": "^4.17.21",
|
|
55
|
-
"rimraf": "^5.0.5"
|
|
54
|
+
"rimraf": "^5.0.5",
|
|
55
|
+
"tar": "^7.5.22",
|
|
56
|
+
"unzipper": "^0.12.5"
|
|
56
57
|
},
|
|
57
58
|
"devDependencies": {
|
|
58
59
|
"@types/figlet": "^1.5.8",
|
|
@@ -65,5 +66,14 @@
|
|
|
65
66
|
"ts-node": "^10.9.2",
|
|
66
67
|
"tslint": "^6.1.3",
|
|
67
68
|
"typescript": "^5.2.2"
|
|
68
|
-
}
|
|
69
|
+
},
|
|
70
|
+
"os": [
|
|
71
|
+
"darwin",
|
|
72
|
+
"linux",
|
|
73
|
+
"win32"
|
|
74
|
+
],
|
|
75
|
+
"cpu": [
|
|
76
|
+
"x64",
|
|
77
|
+
"arm64"
|
|
78
|
+
]
|
|
69
79
|
}
|