makepack 1.2.7 → 1.2.8
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/package.json
CHANGED
|
@@ -1,24 +1,23 @@
|
|
|
1
|
-
import { execSync, logLoader,
|
|
1
|
+
import { execSync, logLoader, logger } from "../../helpers.js"
|
|
2
2
|
import makeProjectInformation from "./makeProjectInformation.js"
|
|
3
3
|
import makeFiles from "./makeFiles.js"
|
|
4
4
|
import figlet from 'figlet'
|
|
5
5
|
|
|
6
6
|
const create = async () => {
|
|
7
7
|
let info = await makeProjectInformation()
|
|
8
|
-
|
|
8
|
+
logger.info("", "Creating project...", false)
|
|
9
9
|
await makeFiles(info)
|
|
10
|
-
loader.stop("")
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
logger.info("", "Installing Dependencies", false)
|
|
13
12
|
execSync("npm install", {
|
|
14
13
|
cwd: info.cwd,
|
|
15
14
|
})
|
|
16
15
|
|
|
17
|
-
|
|
16
|
+
logger.info("Project setup complete!", "", false)
|
|
18
17
|
if (info.isCurrentDir) {
|
|
19
|
-
console.log(`Run the development server: \
|
|
18
|
+
console.log(`Run the development server: \n${logger.info("", "npm start", false)}\nEnjoy your new project! 😊`);
|
|
20
19
|
} else {
|
|
21
|
-
console.log(`To start working with your project:\
|
|
20
|
+
console.log(`To start working with your project:\nNavigate to your project directory:\n${logger.info("", "cd " + info.dirname, false)} and Run the development server:\n${logger.info("", "npm start", false)}\nEnjoy your new project! 😊`);
|
|
22
21
|
}
|
|
23
22
|
|
|
24
23
|
figlet("Make Pack CLI", function (err, data) {
|
|
@@ -48,8 +48,8 @@ export default async (args) => {
|
|
|
48
48
|
{
|
|
49
49
|
type: "confirm",
|
|
50
50
|
name: 'overwrite',
|
|
51
|
-
message:
|
|
52
|
-
default:
|
|
51
|
+
message: `The file ${file.filename} already exists, do you want to overwrite it?`,
|
|
52
|
+
default: true
|
|
53
53
|
}
|
|
54
54
|
])
|
|
55
55
|
if (!overwrite) {
|
|
@@ -4,7 +4,7 @@ import path from 'path'
|
|
|
4
4
|
import { createServer as createViteServer } from 'vite';
|
|
5
5
|
import express from 'express';
|
|
6
6
|
import { glob } from 'glob'
|
|
7
|
-
import logger from '
|
|
7
|
+
import { logger } from '../../helpers.js'
|
|
8
8
|
import chalk from 'chalk';
|
|
9
9
|
import figlet from 'figlet';
|
|
10
10
|
|
package/src/helpers.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import child_process from 'child_process'
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
export const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import figures from 'figures';
|
|
6
4
|
|
|
7
5
|
export const logLoader = (message = "") => {
|
|
8
6
|
const spinner = ['|', '/', '-', '\\'];
|
|
@@ -32,4 +30,25 @@ export const execSync = (command, option = {}) => {
|
|
|
32
30
|
} catch (error) {
|
|
33
31
|
console.error(`Command failed: ${error.message}`);
|
|
34
32
|
}
|
|
35
|
-
};
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
export const logger = {
|
|
38
|
+
info: (message, prefix = 'INFO', icon = true) => {
|
|
39
|
+
console.log(`${icon ? chalk.blue(figures.info) + " " : ""}${chalk.cyan.bold(prefix)} ${message}`);
|
|
40
|
+
},
|
|
41
|
+
success: (message, prefix = 'SUCCESS:', icon = true) => {
|
|
42
|
+
console.log(`${icon ? chalk.green(figures.tick) + " " : ""}${chalk.green.bold(prefix)} ${message}`);
|
|
43
|
+
},
|
|
44
|
+
warning: (message, prefix = 'WARNING:', icon = true) => {
|
|
45
|
+
console.log(`${icon ? chalk.yellow(figures.warning) + " " : ""}${chalk.yellow.bold(prefix)} ${message}`);
|
|
46
|
+
},
|
|
47
|
+
error: (message, prefix = 'ERROR:', icon = true) => {
|
|
48
|
+
console.log(`${icon ? chalk.red(figures.cross) + " " : ""}${chalk.red.bold(prefix)} ${message}`);
|
|
49
|
+
},
|
|
50
|
+
custom: (icon, color, label, message) => {
|
|
51
|
+
console.log(`${chalk[color](icon)} ${chalk[color].bold(`${label}:`)} ${message}`);
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
import figures from 'figures';
|
|
3
|
-
|
|
4
|
-
const logger = {
|
|
5
|
-
info: (message, prefix = 'INFO', icon = true) => {
|
|
6
|
-
console.log(`${icon ? chalk.blue(figures.info) + " " : ""}${chalk.cyan.bold(prefix)} ${message}`);
|
|
7
|
-
},
|
|
8
|
-
success: (message, prefix = 'SUCCESS:', icon = true) => {
|
|
9
|
-
console.log(`${icon ? chalk.green(figures.tick) + " " : ""}${chalk.green.bold(prefix)} ${message}`);
|
|
10
|
-
},
|
|
11
|
-
warning: (message, prefix = 'WARNING:', icon = true) => {
|
|
12
|
-
console.log(`${icon ? chalk.yellow(figures.warning) + " " : ""}${chalk.yellow.bold(prefix)} ${message}`);
|
|
13
|
-
},
|
|
14
|
-
error: (message, prefix = 'ERROR:', icon = true) => {
|
|
15
|
-
console.log(`${icon ? chalk.red(figures.cross) + " " : ""}${chalk.red.bold(prefix)} ${message}`);
|
|
16
|
-
},
|
|
17
|
-
custom: (icon, color, label, message) => {
|
|
18
|
-
console.log(`${chalk[color](icon)} ${chalk[color].bold(`${label}:`)} ${message}`);
|
|
19
|
-
},
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export default logger;
|