@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.
- package/README.md +0 -3
- package/dist/index.js +16 -16
- package/package.json +12 -10
package/README.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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 } =
|
|
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
|
-
|
|
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:
|
|
146
|
-
{ title: "Hono", value:
|
|
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,
|
|
191
|
-
template.snippet("define-platform", path.join(snippetPath,
|
|
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
|
-
"
|
|
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
|
-
"
|
|
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": "^
|
|
49
|
-
"@rollup/plugin-commonjs": "^29.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.
|
|
53
|
-
"eslint": "^
|
|
54
|
-
"globals": "^
|
|
55
|
-
"rollup": "^4.
|
|
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
|
}
|