@outwalk/create-firefly 0.14.0 → 0.14.2

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.
Files changed (3) hide show
  1. package/README.md +0 -3
  2. package/dist/index.js +16 -16
  3. package/package.json +12 -10
package/README.md CHANGED
@@ -33,9 +33,6 @@ The first argument passed to the command will be used as the project name/direct
33
33
  # Specify the platform
34
34
  -p, --platform
35
35
 
36
- # Specify the database
37
- -d, --database
38
-
39
36
  # Prevent automatic dependency installation
40
37
  --skip-install
41
38
 
package/dist/index.js CHANGED
@@ -1,12 +1,10 @@
1
1
  #!/usr/bin/env node
2
- 'use strict';
3
-
4
- var yargs = require('yargs-parser');
5
- var prompts = require('prompts');
6
- var path = require('node:path');
7
- var fs = require('node:fs');
8
- var chalk = require('chalk');
9
- var node_child_process = require('node:child_process');
2
+ import yargs from 'yargs-parser';
3
+ import prompts from 'prompts';
4
+ import path from 'node:path';
5
+ import fs from 'node:fs';
6
+ import chalk from 'chalk';
7
+ import { exec, spawnSync } from 'node:child_process';
10
8
 
11
9
  const firefly = chalk.hex("#ADFF2F");
12
10
  const logger = {
@@ -91,7 +89,7 @@ function installDependencies(dependencies, directory) {
91
89
  logger.log("installing dependencies...");
92
90
  const command = /^win/.test(process.platform) ? "npm.cmd" : "npm";
93
91
  const spawnProcess = (command2, args) => {
94
- const { status, error } = node_child_process.spawnSync(command2, args, { cwd: directory, stdio: "ignore" });
92
+ const { status, error } = spawnSync(command2, args, { cwd: directory, stdio: "ignore" });
95
93
  if (status != 0) throw new Error("failed to install project dependencies.");
96
94
  if (error) throw error;
97
95
  };
@@ -107,7 +105,7 @@ function intitializeGitRepository(directory) {
107
105
  return new Promise((resolve, reject) => {
108
106
  logger.log("initializing git repository...");
109
107
  try {
110
- node_child_process.exec("git init", { cwd: directory });
108
+ exec("git init", { cwd: directory });
111
109
  resolve();
112
110
  } catch {
113
111
  reject(new Error("failed to initialize the git repository."));
@@ -121,6 +119,8 @@ prompts.override({
121
119
  language: args.l ?? args.language,
122
120
  platform: args.p ?? args.platform
123
121
  });
122
+ const express = { template: "express", dependencies: ["express"] };
123
+ const hono = { template: "hono", dependencies: ["hono", "@hono/node-server"] };
124
124
  const questions = [
125
125
  {
126
126
  type: "text",
@@ -142,8 +142,8 @@ const questions = [
142
142
  name: "platform",
143
143
  message: "Select a platform:",
144
144
  choices: [
145
- { title: "Express", value: "express" },
146
- { title: "Hono", value: "hono,@hono/node-server" }
145
+ { title: "Express", value: JSON.stringify(express) },
146
+ { title: "Hono", value: JSON.stringify(hono) }
147
147
  ]
148
148
  }
149
149
  ];
@@ -152,12 +152,12 @@ const questions = [
152
152
  const skipInstall = args["skip-install"];
153
153
  const skipGit = args["skip-git"];
154
154
  const force = args["force"];
155
+ const platform = JSON.parse(config.platform);
155
156
  const settings = { useCurrentDirectory: false };
156
- const dependencies = ["@outwalk/firefly"];
157
+ const dependencies = ["@outwalk/firefly", ...platform.dependencies];
157
158
  if (config.language != "javascript") {
158
159
  dependencies.push(config.language);
159
160
  }
160
- dependencies.push(...config.platform.split(","));
161
161
  if (config.name == ".") {
162
162
  if (!force && fs.readdirSync(config.name).length > 0) {
163
163
  const response = await prompts({
@@ -187,8 +187,8 @@ const questions = [
187
187
  try {
188
188
  const template = new TemplateBuilder(templatePath, projectPath);
189
189
  template.inject("project-name", config.name);
190
- template.snippet("import-platform", path.join(snippetPath, config.platform, "import-platform.template"));
191
- template.snippet("define-platform", path.join(snippetPath, config.platform, "define-platform.template"));
190
+ template.snippet("import-platform", path.join(snippetPath, platform.template, "import-platform.template"));
191
+ template.snippet("define-platform", path.join(snippetPath, platform.template, "define-platform.template"));
192
192
  template.build();
193
193
  } catch (error) {
194
194
  logger.error(error.message);
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@outwalk/create-firefly",
3
- "version": "0.14.0",
3
+ "type": "module",
4
+ "version": "0.14.2",
4
5
  "description": "Firefly - a modern scalable web framework.",
5
- "main": "dist/index.js",
6
6
  "publishConfig": {
7
7
  "access": "public"
8
8
  },
@@ -18,11 +18,13 @@
18
18
  "prepublishOnly": "npm run lint && npm run build"
19
19
  },
20
20
  "keywords": [
21
- "outwalk",
22
21
  "express",
23
22
  "hono",
24
23
  "decorators",
25
- "mvc"
24
+ "project",
25
+ "generator",
26
+ "framework",
27
+ "templates"
26
28
  ],
27
29
  "files": [
28
30
  "dist",
@@ -45,14 +47,14 @@
45
47
  "yargs-parser": "^22.0.0"
46
48
  },
47
49
  "devDependencies": {
48
- "@eslint/js": "^9.39.1",
49
- "@rollup/plugin-commonjs": "^29.0.0",
50
+ "@eslint/js": "^10.0.1",
51
+ "@rollup/plugin-commonjs": "^29.0.2",
50
52
  "@rollup/plugin-json": "^6.1.0",
51
53
  "@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",
54
+ "esbuild": "^0.27.4",
55
+ "eslint": "^10.1.0",
56
+ "globals": "^17.4.0",
57
+ "rollup": "^4.60.0",
56
58
  "rollup-plugin-esbuild": "^6.2.1"
57
59
  }
58
60
  }