@avleon/cli 0.0.34 → 0.0.35
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/create.js +32 -8
- package/package.json +1 -1
package/dist/create.js
CHANGED
|
@@ -67,18 +67,40 @@ async function askForPackageManager() {
|
|
|
67
67
|
async function createApplication(fname, flags = {}) {
|
|
68
68
|
let appPaths = (0, paths_1.appPaths)(fname);
|
|
69
69
|
const pm = await askForPackageManager();
|
|
70
|
-
const dirs = Object.values(appPaths);
|
|
71
|
-
for (let i = 0; i < dirs.length; i++) {
|
|
72
|
-
|
|
73
|
-
}
|
|
70
|
+
// const dirs = Object.values(appPaths);
|
|
71
|
+
// for (let i = 0; i < dirs.length; i++) {
|
|
72
|
+
// await fs.ensureDir(dirs[i]);
|
|
73
|
+
// }
|
|
74
|
+
await fs_extra_1.default.ensureDir(appPaths.root + "/src");
|
|
75
|
+
await fs_extra_1.default.ensureDir(appPaths.root + "/test");
|
|
74
76
|
await fs_extra_1.default.ensureDir(appPaths.root + "/public");
|
|
75
77
|
// copy
|
|
76
|
-
//
|
|
78
|
+
// home controller
|
|
79
|
+
const homeContrlelr = `
|
|
80
|
+
import { ApiController, Get } from "@avleon/core";
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
@ApiController
|
|
84
|
+
export class HomeController{
|
|
85
|
+
|
|
86
|
+
@Get()
|
|
87
|
+
sayHello(){
|
|
88
|
+
return "Hello World!";
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
`;
|
|
92
|
+
const formatHomeController = await prettier.format(homeContrlelr, {
|
|
93
|
+
singleQuote: true,
|
|
94
|
+
singleAttributePerLine: true,
|
|
95
|
+
parser: "typescript",
|
|
96
|
+
});
|
|
97
|
+
await fs_extra_1.default.writeFile(win32_1.default.join(appPaths.src, "home.controller.ts"), formatHomeController);
|
|
98
|
+
// main file
|
|
77
99
|
const mainFunc = `
|
|
78
100
|
import {
|
|
79
101
|
Avleon
|
|
80
102
|
} from "@avleon/core";
|
|
81
|
-
import {HomeController} from './
|
|
103
|
+
import { HomeController } from './home.controller';
|
|
82
104
|
|
|
83
105
|
|
|
84
106
|
const app = Avleon.createApplication();
|
|
@@ -138,8 +160,8 @@ serve();
|
|
|
138
160
|
"keywords": ["avleon","nodejs","typescript"],
|
|
139
161
|
"license": "ISC",
|
|
140
162
|
"dependencies": {
|
|
141
|
-
"@avleon/core": "^0.0.
|
|
142
|
-
"@avleon/cli": "^0.0.
|
|
163
|
+
"@avleon/core": "^0.0.28",
|
|
164
|
+
"@avleon/cli": "^0.0.34",
|
|
143
165
|
"class-transformer": "^0.5.1",
|
|
144
166
|
"class-validator": "^0.14.1",
|
|
145
167
|
"reflect-metadata": "^0.2.2"
|
|
@@ -211,6 +233,8 @@ serve();
|
|
|
211
233
|
console.log(`Running ${pm} install...`);
|
|
212
234
|
await execAsync(`cd ${fname}`);
|
|
213
235
|
await execAsync(`${pm} install`, { cwd: fname, shell: getShell() });
|
|
236
|
+
console.log(`cd ${fname} && ${pm} install`);
|
|
237
|
+
console.log(pm == 'npm' ? `npm run start:dev` : `${pm} start:dev`);
|
|
214
238
|
console.log('✅ Dependencies installed successfully.');
|
|
215
239
|
}
|
|
216
240
|
catch (error) {
|