@outwalk/create-firefly 0.1.2 → 0.3.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.
- package/README.md +2 -2
- package/dist/index.js +15 -10
- package/package.json +1 -1
- package/templates/javascript/src/index.controller.js.template +10 -0
- package/templates/typescript/src/index.controller.ts.template +10 -0
- package/templates/javascript/.env.template +0 -1
- package/templates/javascript/src/app/app.controller.js.template +0 -12
- package/templates/javascript/src/app/app.service.js.template +0 -9
- package/templates/typescript/.env.template +0 -1
- package/templates/typescript/src/app/app.controller.ts.template +0 -14
- package/templates/typescript/src/app/app.service.ts.template +0 -9
package/README.md
CHANGED
|
@@ -13,13 +13,13 @@ A scaffolding tool for creating Firefly projects.
|
|
|
13
13
|
Create a Firefly project by running the following command and then follow the prompts.
|
|
14
14
|
|
|
15
15
|
```
|
|
16
|
-
npm create @outwalk/firefly
|
|
16
|
+
npm create @outwalk/firefly@latest
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
You can also specify settings via command line options.
|
|
20
20
|
|
|
21
21
|
```
|
|
22
|
-
npm create @outwalk/firefly my-app --language typescript
|
|
22
|
+
npm create @outwalk/firefly@latest my-app --language typescript
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
### Command Line Options.
|
package/dist/index.js
CHANGED
|
@@ -3,11 +3,18 @@
|
|
|
3
3
|
|
|
4
4
|
var yargs = require('yargs-parser');
|
|
5
5
|
var prompts = require('prompts');
|
|
6
|
-
var chalk = require('chalk');
|
|
7
6
|
var path = require('path');
|
|
8
7
|
var fs = require('fs');
|
|
8
|
+
var chalk = require('chalk');
|
|
9
9
|
var child_process = require('child_process');
|
|
10
10
|
|
|
11
|
+
const firefly = chalk.hex("#ADFF2F");
|
|
12
|
+
const logger = {
|
|
13
|
+
log: (...message) => console.log(`${firefly("[firefly]")} - `, ...message),
|
|
14
|
+
warn: (...message) => console.log(`${chalk.yellow("[firefly]")} - `, ...message),
|
|
15
|
+
error: (...message) => console.log(`${chalk.red("[firefly]")} - `, ...message)
|
|
16
|
+
};
|
|
17
|
+
|
|
11
18
|
class TemplateBuilder {
|
|
12
19
|
constructor(src, dest) {
|
|
13
20
|
this.src = src;
|
|
@@ -79,10 +86,9 @@ class TemplateBuilder {
|
|
|
79
86
|
}
|
|
80
87
|
}
|
|
81
88
|
|
|
82
|
-
const firefly$1 = chalk.hex("#ADFF2F");
|
|
83
89
|
function installDependencies(dependencies, directory) {
|
|
84
90
|
return new Promise((resolve, reject) => {
|
|
85
|
-
|
|
91
|
+
logger.log("installing dependencies...");
|
|
86
92
|
const command = /^win/.test(process.platform) ? "npm.cmd" : "npm";
|
|
87
93
|
const spawnProcess = (command2, args) => {
|
|
88
94
|
const { status, error } = child_process.spawnSync(command2, args, { cwd: directory, stdio: "ignore" });
|
|
@@ -101,7 +107,7 @@ function installDependencies(dependencies, directory) {
|
|
|
101
107
|
}
|
|
102
108
|
function intitializeGitRepository(directory) {
|
|
103
109
|
return new Promise((resolve, reject) => {
|
|
104
|
-
|
|
110
|
+
logger.log("initializing git repository...");
|
|
105
111
|
try {
|
|
106
112
|
child_process.exec("git init", { cwd: directory });
|
|
107
113
|
resolve();
|
|
@@ -111,7 +117,6 @@ function intitializeGitRepository(directory) {
|
|
|
111
117
|
});
|
|
112
118
|
}
|
|
113
119
|
|
|
114
|
-
const firefly = chalk.hex("#ADFF2F");
|
|
115
120
|
const args = yargs(process.argv.slice(2));
|
|
116
121
|
prompts.override({
|
|
117
122
|
name: args._[0],
|
|
@@ -186,12 +191,12 @@ const questions = [
|
|
|
186
191
|
if (force && !settings.useCurrentDirectory) {
|
|
187
192
|
TemplateBuilder.deleteDirectory(config.name);
|
|
188
193
|
} else {
|
|
189
|
-
|
|
194
|
+
logger.error(`${config.name} already exists.`);
|
|
190
195
|
return;
|
|
191
196
|
}
|
|
192
197
|
}
|
|
193
|
-
console.log(
|
|
194
|
-
|
|
198
|
+
console.log("\n");
|
|
199
|
+
logger.log(`creating ${config.name}...`);
|
|
195
200
|
const templatePath = path.join(__dirname, "../templates/", config.language);
|
|
196
201
|
const snippetPath = path.join(__dirname, "../templates/snippets");
|
|
197
202
|
const projectPath = !settings.useCurrentDirectory ? config.name : ".";
|
|
@@ -218,7 +223,7 @@ ${firefly("[firefly]")} - creating ${config.name}...`);
|
|
|
218
223
|
}
|
|
219
224
|
template.build();
|
|
220
225
|
} catch (error) {
|
|
221
|
-
|
|
226
|
+
logger.error(error.message);
|
|
222
227
|
return;
|
|
223
228
|
}
|
|
224
229
|
try {
|
|
@@ -227,7 +232,7 @@ ${firefly("[firefly]")} - creating ${config.name}...`);
|
|
|
227
232
|
if (!skipGit)
|
|
228
233
|
await intitializeGitRepository(projectPath);
|
|
229
234
|
} catch (error) {
|
|
230
|
-
|
|
235
|
+
logger.error(error.message);
|
|
231
236
|
if (!settings.useCurrentDirectory)
|
|
232
237
|
TemplateBuilder.deleteDirectory(config.name);
|
|
233
238
|
return;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
DATABASE_URL=
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
DATABASE_URL=
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Controller, Inject, Get } from "@outwalk/firefly";
|
|
2
|
-
import { AppService } from "./app.service";
|
|
3
|
-
|
|
4
|
-
@Controller()
|
|
5
|
-
export class AppController {
|
|
6
|
-
|
|
7
|
-
@Inject()
|
|
8
|
-
appService: AppService;
|
|
9
|
-
|
|
10
|
-
@Get()
|
|
11
|
-
getHelloWorld(): string {
|
|
12
|
-
return this.appService.getHelloWorld();
|
|
13
|
-
}
|
|
14
|
-
}
|