@dolphjs/cli 1.1.14 → 1.1.15
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.
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { dolphMsg } from "../helpers/messages.js";
|
|
4
|
-
const findComponentsDirectory = () => {
|
|
4
|
+
const findComponentsDirectory = (componentName) => {
|
|
5
5
|
const rootDir = process.cwd();
|
|
6
|
-
const possibleDirs = [`src/components`];
|
|
6
|
+
const possibleDirs = [`src/components/${componentName}`];
|
|
7
7
|
const srcDir = possibleDirs.find((dir) => existsSync(path.join(rootDir, dir)));
|
|
8
8
|
return srcDir ? path.join(rootDir, srcDir) : null;
|
|
9
9
|
};
|
|
@@ -11,7 +11,7 @@ export const addControllerInComponentFIle = (componentName) => {
|
|
|
11
11
|
if (!componentName) {
|
|
12
12
|
dolphMsg.errorRed("component extension or name is required! 🤨");
|
|
13
13
|
}
|
|
14
|
-
const componentDir = findComponentsDirectory();
|
|
14
|
+
const componentDir = findComponentsDirectory(componentName);
|
|
15
15
|
if (!componentDir) {
|
|
16
16
|
dolphMsg.errorRed("something went wrong, please make sure to use the `new` command when creating a dolph project.");
|
|
17
17
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dolphjs/cli",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.15",
|
|
4
4
|
"description": "The dolphjs-cli is a tool for efficient intialization and management of a dolphjs project",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"repository": "https://github.com/dolphjs/dolph-cli.git",
|