evophp 1.0.3 → 1.0.5
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/installer.js +28 -2
- package/package.json +1 -1
package/installer.js
CHANGED
|
@@ -18,7 +18,9 @@ let [, , command, type, name] = process.argv;
|
|
|
18
18
|
|
|
19
19
|
console.log(`Installing plugin/theme: ${name}...`);
|
|
20
20
|
try {
|
|
21
|
-
|
|
21
|
+
const globalPath = require.resolve("evophp");
|
|
22
|
+
const pluginPath = path.resolve(path.dirname(globalPath), "install-plugin.js");
|
|
23
|
+
execSync(`node ${pluginPath} ${type} ${name}`, {
|
|
22
24
|
stdio: "inherit",
|
|
23
25
|
});
|
|
24
26
|
} catch (error) {
|
|
@@ -43,12 +45,36 @@ let [, , command, type, name] = process.argv;
|
|
|
43
45
|
|
|
44
46
|
console.log(`Creating a new ${type}: ${name}...`);
|
|
45
47
|
try {
|
|
46
|
-
|
|
48
|
+
const globalPath = require.resolve("evophp");
|
|
49
|
+
const pluginPath = path.resolve(path.dirname(globalPath), "new-plugin.js");
|
|
50
|
+
execSync(`node ${pluginPath} ${type} ${name}`, { stdio: "inherit" });
|
|
47
51
|
} catch (error) {
|
|
48
52
|
console.error(`Error creating new ${type}: ${error.message}`);
|
|
49
53
|
process.exit(1);
|
|
50
54
|
}
|
|
55
|
+
} else if (command === "install-dependencies" || command === "d") {
|
|
56
|
+
if (!name || !type) {
|
|
57
|
+
console.error("Please specify both the type (plugin) and name.");
|
|
58
|
+
process.exit(1);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
console.log(`Running install-dependencies for ${type}: ${name}...`);
|
|
62
|
+
|
|
63
|
+
if (type === "plugin") {
|
|
64
|
+
try {
|
|
65
|
+
const globalPath = require.resolve("evophp");
|
|
66
|
+
const pluginPath = path.resolve(path.dirname(globalPath), "install-dependencies.js");
|
|
67
|
+
execSync(`node ${pluginPath} ${name} ${args.join(' ')}`, { stdio: "inherit" });
|
|
68
|
+
} catch (error) {
|
|
69
|
+
console.error(`Error installing dependencies: ${error.message}`);
|
|
70
|
+
process.exit(1);
|
|
71
|
+
}
|
|
72
|
+
} else {
|
|
73
|
+
console.error("Install-dependencies only supports plugins currently.");
|
|
74
|
+
process.exit(1);
|
|
75
|
+
}
|
|
51
76
|
} else if (command === "init") {
|
|
77
|
+
name = type;
|
|
52
78
|
if (!name) {
|
|
53
79
|
name = await readLineAsync("Enter the name of the plugin/project:");
|
|
54
80
|
if (!name.trim()) {
|