@outwalk/create-firefly 0.11.0 → 0.14.1

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 CHANGED
@@ -3,10 +3,10 @@
3
3
 
4
4
  var yargs = require('yargs-parser');
5
5
  var prompts = require('prompts');
6
- var path = require('path');
7
- var fs = require('fs');
6
+ var path = require('node:path');
7
+ var fs = require('node:fs');
8
8
  var chalk = require('chalk');
9
- var child_process = require('child_process');
9
+ var node_child_process = require('node:child_process');
10
10
 
11
11
  const firefly = chalk.hex("#ADFF2F");
12
12
  const logger = {
@@ -91,7 +91,7 @@ function installDependencies(dependencies, directory) {
91
91
  logger.log("installing dependencies...");
92
92
  const command = /^win/.test(process.platform) ? "npm.cmd" : "npm";
93
93
  const spawnProcess = (command2, args) => {
94
- const { status, error } = child_process.spawnSync(command2, args, { cwd: directory, stdio: "ignore" });
94
+ const { status, error } = node_child_process.spawnSync(command2, args, { cwd: directory, stdio: "ignore" });
95
95
  if (status != 0) throw new Error("failed to install project dependencies.");
96
96
  if (error) throw error;
97
97
  };
@@ -107,7 +107,7 @@ function intitializeGitRepository(directory) {
107
107
  return new Promise((resolve, reject) => {
108
108
  logger.log("initializing git repository...");
109
109
  try {
110
- child_process.exec("git init", { cwd: directory });
110
+ node_child_process.exec("git init", { cwd: directory });
111
111
  resolve();
112
112
  } catch {
113
113
  reject(new Error("failed to initialize the git repository."));
@@ -119,8 +119,7 @@ const args = yargs(process.argv.slice(2));
119
119
  prompts.override({
120
120
  name: args._[0],
121
121
  language: args.l ?? args.language,
122
- platform: args.p ?? args.platform,
123
- database: args.d ?? args.database
122
+ platform: args.p ?? args.platform
124
123
  });
125
124
  const questions = [
126
125
  {
@@ -144,17 +143,7 @@ const questions = [
144
143
  message: "Select a platform:",
145
144
  choices: [
146
145
  { title: "Express", value: "express" },
147
- { title: "Custom", value: "custom-platform" }
148
- ]
149
- },
150
- {
151
- type: "select",
152
- name: "database",
153
- message: "Select a database:",
154
- choices: [
155
- { title: "Mongoose", value: "mongoose" },
156
- { title: "Custom", value: "custom-database" },
157
- { title: "None", value: "none" }
146
+ { title: "Hono", value: "hono,@hono/node-server" }
158
147
  ]
159
148
  }
160
149
  ];
@@ -168,12 +157,7 @@ const questions = [
168
157
  if (config.language != "javascript") {
169
158
  dependencies.push(config.language);
170
159
  }
171
- if (!["none", "custom-platform"].includes(config.platform)) {
172
- dependencies.push(config.platform);
173
- }
174
- if (!["none", "custom-database"].includes(config.database)) {
175
- dependencies.push(config.database);
176
- }
160
+ dependencies.push(...config.platform.split(","));
177
161
  if (config.name == ".") {
178
162
  if (!force && fs.readdirSync(config.name).length > 0) {
179
163
  const response = await prompts({
@@ -203,24 +187,9 @@ const questions = [
203
187
  try {
204
188
  const template = new TemplateBuilder(templatePath, projectPath);
205
189
  template.inject("project-name", config.name);
206
- template.inject("options", config.database != "none" ? "{ platform, database }" : "{ platform }");
207
- if (config.platform.startsWith("custom")) {
208
- template.snippet("import-platform", path.join(snippetPath, config.platform, config.language, "import-platform.template"));
209
- template.snippet("define-platform", path.join(snippetPath, config.platform, config.language, "define-platform.template"));
210
- } else {
211
- template.snippet("import-platform", path.join(snippetPath, config.platform, "import-platform.template"));
212
- template.snippet("define-platform", path.join(snippetPath, config.platform, "define-platform.template"));
213
- }
214
- if (config.database.startsWith("custom")) {
215
- template.snippet("import-database", path.join(snippetPath, config.database, config.language, "import-database.template"));
216
- template.snippet("define-database", path.join(snippetPath, config.database, config.language, "define-database.template"));
217
- } else if (config.database != "none") {
218
- template.snippet("import-database", path.join(snippetPath, config.database, "import-database.template"));
219
- template.snippet("define-database", path.join(snippetPath, config.database, "define-database.template"));
220
- } else {
221
- template.inject("import-database", "");
222
- template.inject("define-database", "");
223
- }
190
+ const platform = config.platform.split(",")[0];
191
+ template.snippet("import-platform", path.join(snippetPath, platform, "import-platform.template"));
192
+ template.snippet("define-platform", path.join(snippetPath, platform, "define-platform.template"));
224
193
  template.build();
225
194
  } catch (error) {
226
195
  logger.error(error.message);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@outwalk/create-firefly",
3
- "version": "0.11.0",
3
+ "version": "0.14.1",
4
4
  "description": "Firefly - a modern scalable web framework.",
5
5
  "main": "dist/index.js",
6
6
  "publishConfig": {
@@ -20,6 +20,7 @@
20
20
  "keywords": [
21
21
  "outwalk",
22
22
  "express",
23
+ "hono",
23
24
  "decorators",
24
25
  "mvc"
25
26
  ],
@@ -44,14 +45,14 @@
44
45
  "yargs-parser": "^22.0.0"
45
46
  },
46
47
  "devDependencies": {
47
- "@eslint/js": "^9.28.0",
48
- "@rollup/plugin-commonjs": "^28.0.3",
48
+ "@eslint/js": "^9.39.1",
49
+ "@rollup/plugin-commonjs": "^29.0.0",
49
50
  "@rollup/plugin-json": "^6.1.0",
50
- "@rollup/plugin-node-resolve": "^16.0.1",
51
- "esbuild": "^0.25.5",
52
- "eslint": "^9.28.0",
53
- "globals": "^16.2.0",
54
- "rollup": "^4.43.0",
51
+ "@rollup/plugin-node-resolve": "^16.0.3",
52
+ "esbuild": "^0.27.0",
53
+ "eslint": "^9.39.1",
54
+ "globals": "^16.5.0",
55
+ "rollup": "^4.53.2",
55
56
  "rollup-plugin-esbuild": "^6.2.1"
56
57
  }
57
58
  }
@@ -4,8 +4,8 @@
4
4
  "type": "module",
5
5
  "private": true,
6
6
  "engines": {
7
- "node": "^18",
8
- "npm": "^9"
7
+ "node": "^22",
8
+ "npm": "^10"
9
9
  },
10
10
  "scripts": {
11
11
  "build": "firefly build",
@@ -1,10 +1,7 @@
1
1
  import { Application } from "@outwalk/firefly";
2
2
  {{import-platform}}
3
- {{import-database}}
4
3
 
5
4
  {{define-platform}}
6
5
 
7
- {{define-database}}
8
-
9
6
  /* start the application */
10
- new Application({{options}}).listen();
7
+ new Application({ platform }).listen();
@@ -0,0 +1,2 @@
1
+ /* setup the platform and global middleware */
2
+ const platform = new HonoPlatform();
@@ -0,0 +1 @@
1
+ import { HonoPlatform } from "@outwalk/firefly/hono";
@@ -4,11 +4,11 @@
4
4
  "type": "module",
5
5
  "private": true,
6
6
  "engines": {
7
- "node": "^18",
8
- "npm": "^9"
7
+ "node": "^22",
8
+ "npm": "^10"
9
9
  },
10
10
  "scripts": {
11
- "build": "tsc && firefly build",
11
+ "build": "firefly build",
12
12
  "lint": "firefly lint",
13
13
  "start": "firefly start",
14
14
  "dev": "firefly start --dev"
@@ -1,10 +1,7 @@
1
1
  import { Application } from "@outwalk/firefly";
2
2
  {{import-platform}}
3
- {{import-database}}
4
3
 
5
4
  {{define-platform}}
6
5
 
7
- {{define-database}}
8
-
9
6
  /* start the application */
10
- new Application({{options}}).listen();
7
+ new Application({ platform }).listen();
@@ -3,19 +3,22 @@
3
3
  "compilerOptions": {
4
4
  /* features */
5
5
  "experimentalDecorators": true,
6
+ "emitDecoratorMetadata": true,
6
7
  "useDefineForClassFields": true,
7
8
 
8
9
  /* syntax */
9
10
  "target": "ES2020",
10
11
  "module": "ESNext",
11
12
  "lib": ["ES2020"],
13
+ "jsx": "preserve",
12
14
  "skipLibCheck": true,
13
15
 
14
16
  /* bundler mode */
15
17
  "moduleResolution": "Bundler",
16
18
  "allowImportingTsExtensions": true,
19
+ "rewriteRelativeImportExtensions": true,
17
20
  "resolveJsonModule": true,
18
- "isolatedModules": true,
21
+ "isolatedModules": false,
19
22
  "noEmit": true,
20
23
 
21
24
  /* import path aliases */
@@ -1,13 +0,0 @@
1
- /* implement a database using the firefly database interface */
2
- class CustomDatabase extends Database {
3
-
4
- async connect() {
5
- super.displayConnectionMessage();
6
- }
7
-
8
- isConnected() {
9
- return false;
10
- }
11
- }
12
-
13
- const database = new CustomDatabase();
@@ -1 +0,0 @@
1
- import { Database } from "@outwalk/firefly";
@@ -1,14 +0,0 @@
1
- /* implement a database using the firefly database interface */
2
- class CustomDatabase extends Database {
3
-
4
- async connect(): Promise<CustomDatabase> {
5
- super.displayConnectionMessage();
6
- return this;
7
- }
8
-
9
- isConnected(): boolean {
10
- return false;
11
- }
12
- }
13
-
14
- const database = new CustomDatabase();
@@ -1 +0,0 @@
1
- import { Database } from "@outwalk/firefly";
@@ -1,11 +0,0 @@
1
- /* implement a platform using the firefly platform interface */
2
- class CustomPlatform extends Platform {
3
-
4
- loadController(route, middleware, routes) {}
5
-
6
- loadErrorHandler() {}
7
-
8
- listen(port) {}
9
- }
10
-
11
- const platform = new CustomPlatform();
@@ -1 +0,0 @@
1
- import { Platform } from "@outwalk/firefly";
@@ -1,11 +0,0 @@
1
- /* implement a platform using the firefly platform interface */
2
- class CustomPlatform extends Platform {
3
-
4
- loadController(route: string, middleware: Function[], routes: Route[]): void {}
5
-
6
- loadErrorHandler(): void {}
7
-
8
- listen(port: number): void {}
9
- }
10
-
11
- const platform = new CustomPlatform();
@@ -1 +0,0 @@
1
- import { Platform, Route } from "@outwalk/firefly";
@@ -1,2 +0,0 @@
1
- /* setup the database and global plugins */
2
- const database = new MongooseDatabase();
@@ -1 +0,0 @@
1
- import { MongooseDatabase } from "@outwalk/firefly/mongoose";