@foal/cli 2.6.0 → 2.7.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.
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createEntity = void 0;
|
|
4
4
|
// FoalTS
|
|
5
|
+
const path_1 = require("path");
|
|
5
6
|
const file_system_1 = require("../../file-system");
|
|
6
7
|
const utils_1 = require("../../utils");
|
|
7
8
|
function createEntity({ name }) {
|
|
@@ -13,10 +14,13 @@ function createEntity({ name }) {
|
|
|
13
14
|
else if (fs.exists('entities')) {
|
|
14
15
|
root = 'entities';
|
|
15
16
|
}
|
|
16
|
-
const names = utils_1.getNames(name);
|
|
17
|
+
const names = utils_1.getNames(path_1.basename(name));
|
|
18
|
+
const subdir = path_1.dirname(name);
|
|
17
19
|
const isMongoDBProject = fs.projectHasDependency('mongodb');
|
|
18
20
|
fs
|
|
19
21
|
.cd(root)
|
|
22
|
+
.ensureDir(subdir)
|
|
23
|
+
.cd(subdir)
|
|
20
24
|
.renderOnlyIf(!isMongoDBProject, 'entity/entity.ts', `${names.kebabName}.entity.ts`, names)
|
|
21
25
|
.renderOnlyIf(isMongoDBProject, 'entity/entity.mongodb.ts', `${names.kebabName}.entity.ts`, names)
|
|
22
26
|
.ensureFile('index.ts')
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createHook = void 0;
|
|
4
4
|
// FoalTS
|
|
5
|
+
const path_1 = require("path");
|
|
5
6
|
const file_system_1 = require("../../file-system");
|
|
6
7
|
const utils_1 = require("../../utils");
|
|
7
8
|
function createHook({ name }) {
|
|
@@ -13,9 +14,12 @@ function createHook({ name }) {
|
|
|
13
14
|
else if (fs.exists('hooks')) {
|
|
14
15
|
root = 'hooks';
|
|
15
16
|
}
|
|
16
|
-
const names = utils_1.getNames(name);
|
|
17
|
+
const names = utils_1.getNames(path_1.basename(name));
|
|
18
|
+
const subdir = path_1.dirname(name);
|
|
17
19
|
fs
|
|
18
20
|
.cd(root)
|
|
21
|
+
.ensureDir(subdir)
|
|
22
|
+
.cd(subdir)
|
|
19
23
|
.render('hook/hook.ts', `${names.kebabName}.hook.ts`, names)
|
|
20
24
|
.ensureFile('index.ts')
|
|
21
25
|
.addNamedExportIn('index.ts', names.upperFirstCamelName, `./${names.kebabName}.hook`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@foal/cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.0",
|
|
4
4
|
"description": "CLI tool for FoalTS",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"ts-node": "~9.0.0",
|
|
72
72
|
"typescript": "~4.0.2"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "f29806e349427d412606a2086ae474f2b65df3ac"
|
|
75
75
|
}
|