@dawudesign/node-hexa-cli 0.2.6 → 0.2.7
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/index.js +5 -12
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -470,23 +470,16 @@ function assertKebabCase(value, label) {
|
|
|
470
470
|
}
|
|
471
471
|
function assertInsideProject() {
|
|
472
472
|
const pkgPath = import_node_path6.default.join(process.cwd(), "package.json");
|
|
473
|
+
const configPath = import_node_path6.default.join(process.cwd(), "node-hexa.config.json");
|
|
474
|
+
const contextsPath = import_node_path6.default.join(process.cwd(), "src", "contexts");
|
|
473
475
|
if (!import_node_fs5.default.existsSync(pkgPath)) {
|
|
474
476
|
throw new Error(
|
|
475
|
-
"No package.json found. Run this command from the root of your
|
|
477
|
+
"No package.json found. Run this command from the root of your project."
|
|
476
478
|
);
|
|
477
479
|
}
|
|
478
|
-
|
|
479
|
-
try {
|
|
480
|
-
pkg = JSON.parse(import_node_fs5.default.readFileSync(pkgPath, "utf8"));
|
|
481
|
-
} catch {
|
|
482
|
-
throw new Error(
|
|
483
|
-
"Could not parse package.json. Make sure it contains valid JSON."
|
|
484
|
-
);
|
|
485
|
-
}
|
|
486
|
-
const allDeps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
487
|
-
if (!allDeps["@nestjs/core"]) {
|
|
480
|
+
if (!import_node_fs5.default.existsSync(configPath) && !import_node_fs5.default.existsSync(contextsPath)) {
|
|
488
481
|
throw new Error(
|
|
489
|
-
"
|
|
482
|
+
"No node-hexa.config.json or src/contexts/ found.\nRun this command from the root of a node-hexa project, or run 'node-hexa init <name>' first."
|
|
490
483
|
);
|
|
491
484
|
}
|
|
492
485
|
}
|