create-faas-app 8.0.0-beta.13 → 8.0.0-beta.15
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 -15
- package/dist/index.cjs +18 -66
- package/dist/index.mjs +11 -54
- package/index.mjs +1 -1
- package/package.json +1 -4
package/README.md
CHANGED
|
@@ -1,20 +1,5 @@
|
|
|
1
1
|
# create-faas-app
|
|
2
2
|
|
|
3
|
-
[](https://github.com/faasjs/faasjs/blob/main/packages/create-faas-app/LICENSE)
|
|
4
|
-
[](https://www.npmjs.com/package/create-faas-app)
|
|
5
|
-
|
|
6
|
-
Quick way to create a FaasJS project.
|
|
7
|
-
|
|
8
|
-
## Usage
|
|
9
|
-
|
|
10
|
-
```bash
|
|
11
|
-
# use npm
|
|
12
|
-
npx create-faas-app --name faasjs
|
|
13
|
-
|
|
14
|
-
# use bun
|
|
15
|
-
bunx create-faas-app --name faasjs
|
|
16
|
-
```
|
|
17
|
-
|
|
18
3
|
## Functions
|
|
19
4
|
|
|
20
5
|
- [main](functions/main.md)
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value:
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
//#region \0rolldown/runtime.js
|
|
3
3
|
var __create = Object.create;
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -7,16 +7,12 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
7
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
9
|
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
}
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
|
+
get: ((k) => from[k]).bind(null, key),
|
|
14
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
+
});
|
|
20
16
|
}
|
|
21
17
|
return to;
|
|
22
18
|
};
|
|
@@ -24,7 +20,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
20
|
value: mod,
|
|
25
21
|
enumerable: true
|
|
26
22
|
}) : target, mod));
|
|
27
|
-
|
|
28
23
|
//#endregion
|
|
29
24
|
let commander = require("commander");
|
|
30
25
|
let node_child_process = require("node:child_process");
|
|
@@ -32,13 +27,12 @@ let node_fs = require("node:fs");
|
|
|
32
27
|
let node_path = require("node:path");
|
|
33
28
|
let enquirer = require("enquirer");
|
|
34
29
|
enquirer = __toESM(enquirer);
|
|
35
|
-
|
|
36
30
|
//#region package.json
|
|
37
|
-
var version = "8.0.0-beta.
|
|
38
|
-
|
|
31
|
+
var version = "8.0.0-beta.15";
|
|
39
32
|
//#endregion
|
|
40
33
|
//#region src/action.ts
|
|
41
34
|
const prompt = enquirer.default.prompt;
|
|
35
|
+
const validateName = (input) => Validator.name(input);
|
|
42
36
|
const Validator = { name(input) {
|
|
43
37
|
const match = /^[a-z0-9-_]+$/i.test(input) ? true : "Must be a-z, 0-9 or -_";
|
|
44
38
|
if (match !== true) return match;
|
|
@@ -56,32 +50,24 @@ function buildPackageJSON(name) {
|
|
|
56
50
|
type: "module",
|
|
57
51
|
version: "1.0.0",
|
|
58
52
|
scripts: {
|
|
59
|
-
dev: "vite",
|
|
53
|
+
dev: "node --import @faasjs/node-utils/register-hooks vite",
|
|
60
54
|
build: "vite build",
|
|
61
55
|
start: "node --import @faasjs/node-utils/register-hooks server.ts",
|
|
62
|
-
|
|
63
|
-
test: "vitest run",
|
|
64
|
-
"migrate:latest": "faas knex latest",
|
|
65
|
-
"migrate:rollback": "faas knex rollback",
|
|
66
|
-
"migrate:status": "faas knex status",
|
|
67
|
-
"migrate:current": "faas knex current",
|
|
68
|
-
"migrate:make": "faas knex make"
|
|
56
|
+
test: "vitest run"
|
|
69
57
|
},
|
|
70
58
|
dependencies: {
|
|
71
59
|
"@faasjs/core": "*",
|
|
72
|
-
pg: "*",
|
|
73
60
|
react: "*",
|
|
74
61
|
"react-dom": "*"
|
|
75
62
|
},
|
|
76
63
|
devDependencies: {
|
|
77
|
-
"@electric-sql/pglite": "*",
|
|
78
64
|
"@faasjs/dev": "*",
|
|
79
65
|
"@types/node": "*",
|
|
80
66
|
"@types/react": "*",
|
|
81
67
|
"@types/react-dom": "*",
|
|
82
68
|
"@vitejs/plugin-react": "*",
|
|
83
69
|
jsdom: "*",
|
|
84
|
-
|
|
70
|
+
oxfmt: "*",
|
|
85
71
|
oxlint: "*",
|
|
86
72
|
typescript: "*",
|
|
87
73
|
vite: "*",
|
|
@@ -94,7 +80,6 @@ function scaffold(rootPath) {
|
|
|
94
80
|
writeFile((0, node_path.join)(rootPath, ".gitignore"), `node_modules/
|
|
95
81
|
dist/
|
|
96
82
|
coverage/
|
|
97
|
-
.pglite_dev/
|
|
98
83
|
`);
|
|
99
84
|
writeFile((0, node_path.join)(rootPath, "tsconfig.json"), `{
|
|
100
85
|
"compilerOptions": {
|
|
@@ -169,33 +154,7 @@ new Server(join(__dirname, 'src'), {
|
|
|
169
154
|
secure: false
|
|
170
155
|
session:
|
|
171
156
|
secret: secret
|
|
172
|
-
knex:
|
|
173
|
-
config:
|
|
174
|
-
client: pg
|
|
175
|
-
pool:
|
|
176
|
-
min: 0
|
|
177
|
-
max: 10
|
|
178
|
-
migrations:
|
|
179
|
-
directory: ./src/db/migrations
|
|
180
|
-
extension: ts
|
|
181
|
-
development:
|
|
182
|
-
plugins:
|
|
183
|
-
knex:
|
|
184
|
-
config:
|
|
185
|
-
client: pglite
|
|
186
|
-
connection: ./.pglite_dev
|
|
187
|
-
testing:
|
|
188
|
-
plugins:
|
|
189
|
-
knex:
|
|
190
|
-
config:
|
|
191
|
-
client: pglite
|
|
192
|
-
production:
|
|
193
|
-
plugins:
|
|
194
|
-
knex:
|
|
195
|
-
config:
|
|
196
|
-
client: pg
|
|
197
157
|
`);
|
|
198
|
-
writeFile((0, node_path.join)(rootPath, "src", "db", "migrations", ".gitkeep"), "");
|
|
199
158
|
writeFile((0, node_path.join)(rootPath, "src", "main.tsx"), `import { createRoot } from 'react-dom/client'
|
|
200
159
|
import HomePage from './pages/home'
|
|
201
160
|
|
|
@@ -250,14 +209,11 @@ export default function HomePage() {
|
|
|
250
209
|
`);
|
|
251
210
|
writeFile((0, node_path.join)(rootPath, "src", "pages", "home", "api", "hello.func.ts"), `import { defineApi, z } from '@faasjs/core'
|
|
252
211
|
|
|
253
|
-
const schema = z
|
|
254
|
-
.object({
|
|
255
|
-
name: z.string().optional(),
|
|
256
|
-
})
|
|
257
|
-
.required()
|
|
258
|
-
|
|
259
212
|
export const func = defineApi({
|
|
260
|
-
schema
|
|
213
|
+
schema: z
|
|
214
|
+
.object({
|
|
215
|
+
name: z.string().optional(),
|
|
216
|
+
}),
|
|
261
217
|
async handler({ params }) {
|
|
262
218
|
return {
|
|
263
219
|
ok: true,
|
|
@@ -293,7 +249,7 @@ async function action(options = {}) {
|
|
|
293
249
|
name: "value",
|
|
294
250
|
message: "Project name",
|
|
295
251
|
initial: "faasjs",
|
|
296
|
-
validate:
|
|
252
|
+
validate: validateName
|
|
297
253
|
}).then((res) => res.value);
|
|
298
254
|
if (!answers.name) return;
|
|
299
255
|
const runtime = process.versions.bun ? "bun" : "npm";
|
|
@@ -307,7 +263,6 @@ async function action(options = {}) {
|
|
|
307
263
|
function action_default(program) {
|
|
308
264
|
program.description("Create a new faas app").on("--help", () => console.log("Examples:\nnpx create-faas-app")).option("--name <name>", "Project name").action(action);
|
|
309
265
|
}
|
|
310
|
-
|
|
311
266
|
//#endregion
|
|
312
267
|
//#region src/index.ts
|
|
313
268
|
/**
|
|
@@ -325,8 +280,6 @@ function action_default(program) {
|
|
|
325
280
|
* # use bun
|
|
326
281
|
* bunx create-faas-app --name faasjs
|
|
327
282
|
* ```
|
|
328
|
-
*
|
|
329
|
-
* @packageDocumentation
|
|
330
283
|
*/
|
|
331
284
|
const commander$1 = new commander.Command();
|
|
332
285
|
commander$1.storeOptionsAsProperties(false).allowUnknownOption(true).version(version).name("create-faas-app").exitOverride();
|
|
@@ -340,6 +293,5 @@ async function main(argv) {
|
|
|
340
293
|
}
|
|
341
294
|
return commander$1;
|
|
342
295
|
}
|
|
343
|
-
|
|
344
296
|
//#endregion
|
|
345
|
-
exports.main = main;
|
|
297
|
+
exports.main = main;
|
package/dist/index.mjs
CHANGED
|
@@ -3,13 +3,12 @@ import { execSync } from "node:child_process";
|
|
|
3
3
|
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { dirname, join } from "node:path";
|
|
5
5
|
import enquirer from "enquirer";
|
|
6
|
-
|
|
7
6
|
//#region package.json
|
|
8
|
-
var version = "8.0.0-beta.
|
|
9
|
-
|
|
7
|
+
var version = "8.0.0-beta.15";
|
|
10
8
|
//#endregion
|
|
11
9
|
//#region src/action.ts
|
|
12
10
|
const prompt = enquirer.prompt;
|
|
11
|
+
const validateName = (input) => Validator.name(input);
|
|
13
12
|
const Validator = { name(input) {
|
|
14
13
|
const match = /^[a-z0-9-_]+$/i.test(input) ? true : "Must be a-z, 0-9 or -_";
|
|
15
14
|
if (match !== true) return match;
|
|
@@ -27,32 +26,24 @@ function buildPackageJSON(name) {
|
|
|
27
26
|
type: "module",
|
|
28
27
|
version: "1.0.0",
|
|
29
28
|
scripts: {
|
|
30
|
-
dev: "vite",
|
|
29
|
+
dev: "node --import @faasjs/node-utils/register-hooks vite",
|
|
31
30
|
build: "vite build",
|
|
32
31
|
start: "node --import @faasjs/node-utils/register-hooks server.ts",
|
|
33
|
-
|
|
34
|
-
test: "vitest run",
|
|
35
|
-
"migrate:latest": "faas knex latest",
|
|
36
|
-
"migrate:rollback": "faas knex rollback",
|
|
37
|
-
"migrate:status": "faas knex status",
|
|
38
|
-
"migrate:current": "faas knex current",
|
|
39
|
-
"migrate:make": "faas knex make"
|
|
32
|
+
test: "vitest run"
|
|
40
33
|
},
|
|
41
34
|
dependencies: {
|
|
42
35
|
"@faasjs/core": "*",
|
|
43
|
-
pg: "*",
|
|
44
36
|
react: "*",
|
|
45
37
|
"react-dom": "*"
|
|
46
38
|
},
|
|
47
39
|
devDependencies: {
|
|
48
|
-
"@electric-sql/pglite": "*",
|
|
49
40
|
"@faasjs/dev": "*",
|
|
50
41
|
"@types/node": "*",
|
|
51
42
|
"@types/react": "*",
|
|
52
43
|
"@types/react-dom": "*",
|
|
53
44
|
"@vitejs/plugin-react": "*",
|
|
54
45
|
jsdom: "*",
|
|
55
|
-
|
|
46
|
+
oxfmt: "*",
|
|
56
47
|
oxlint: "*",
|
|
57
48
|
typescript: "*",
|
|
58
49
|
vite: "*",
|
|
@@ -65,7 +56,6 @@ function scaffold(rootPath) {
|
|
|
65
56
|
writeFile(join(rootPath, ".gitignore"), `node_modules/
|
|
66
57
|
dist/
|
|
67
58
|
coverage/
|
|
68
|
-
.pglite_dev/
|
|
69
59
|
`);
|
|
70
60
|
writeFile(join(rootPath, "tsconfig.json"), `{
|
|
71
61
|
"compilerOptions": {
|
|
@@ -140,33 +130,7 @@ new Server(join(__dirname, 'src'), {
|
|
|
140
130
|
secure: false
|
|
141
131
|
session:
|
|
142
132
|
secret: secret
|
|
143
|
-
knex:
|
|
144
|
-
config:
|
|
145
|
-
client: pg
|
|
146
|
-
pool:
|
|
147
|
-
min: 0
|
|
148
|
-
max: 10
|
|
149
|
-
migrations:
|
|
150
|
-
directory: ./src/db/migrations
|
|
151
|
-
extension: ts
|
|
152
|
-
development:
|
|
153
|
-
plugins:
|
|
154
|
-
knex:
|
|
155
|
-
config:
|
|
156
|
-
client: pglite
|
|
157
|
-
connection: ./.pglite_dev
|
|
158
|
-
testing:
|
|
159
|
-
plugins:
|
|
160
|
-
knex:
|
|
161
|
-
config:
|
|
162
|
-
client: pglite
|
|
163
|
-
production:
|
|
164
|
-
plugins:
|
|
165
|
-
knex:
|
|
166
|
-
config:
|
|
167
|
-
client: pg
|
|
168
133
|
`);
|
|
169
|
-
writeFile(join(rootPath, "src", "db", "migrations", ".gitkeep"), "");
|
|
170
134
|
writeFile(join(rootPath, "src", "main.tsx"), `import { createRoot } from 'react-dom/client'
|
|
171
135
|
import HomePage from './pages/home'
|
|
172
136
|
|
|
@@ -221,14 +185,11 @@ export default function HomePage() {
|
|
|
221
185
|
`);
|
|
222
186
|
writeFile(join(rootPath, "src", "pages", "home", "api", "hello.func.ts"), `import { defineApi, z } from '@faasjs/core'
|
|
223
187
|
|
|
224
|
-
const schema = z
|
|
225
|
-
.object({
|
|
226
|
-
name: z.string().optional(),
|
|
227
|
-
})
|
|
228
|
-
.required()
|
|
229
|
-
|
|
230
188
|
export const func = defineApi({
|
|
231
|
-
schema
|
|
189
|
+
schema: z
|
|
190
|
+
.object({
|
|
191
|
+
name: z.string().optional(),
|
|
192
|
+
}),
|
|
232
193
|
async handler({ params }) {
|
|
233
194
|
return {
|
|
234
195
|
ok: true,
|
|
@@ -264,7 +225,7 @@ async function action(options = {}) {
|
|
|
264
225
|
name: "value",
|
|
265
226
|
message: "Project name",
|
|
266
227
|
initial: "faasjs",
|
|
267
|
-
validate:
|
|
228
|
+
validate: validateName
|
|
268
229
|
}).then((res) => res.value);
|
|
269
230
|
if (!answers.name) return;
|
|
270
231
|
const runtime = process.versions.bun ? "bun" : "npm";
|
|
@@ -278,7 +239,6 @@ async function action(options = {}) {
|
|
|
278
239
|
function action_default(program) {
|
|
279
240
|
program.description("Create a new faas app").on("--help", () => console.log("Examples:\nnpx create-faas-app")).option("--name <name>", "Project name").action(action);
|
|
280
241
|
}
|
|
281
|
-
|
|
282
242
|
//#endregion
|
|
283
243
|
//#region src/index.ts
|
|
284
244
|
/**
|
|
@@ -296,8 +256,6 @@ function action_default(program) {
|
|
|
296
256
|
* # use bun
|
|
297
257
|
* bunx create-faas-app --name faasjs
|
|
298
258
|
* ```
|
|
299
|
-
*
|
|
300
|
-
* @packageDocumentation
|
|
301
259
|
*/
|
|
302
260
|
const commander = new Command();
|
|
303
261
|
commander.storeOptionsAsProperties(false).allowUnknownOption(true).version(version).name("create-faas-app").exitOverride();
|
|
@@ -311,6 +269,5 @@ async function main(argv) {
|
|
|
311
269
|
}
|
|
312
270
|
return commander;
|
|
313
271
|
}
|
|
314
|
-
|
|
315
272
|
//#endregion
|
|
316
|
-
export { main };
|
|
273
|
+
export { main };
|
package/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-faas-app",
|
|
3
|
-
"version": "8.0.0-beta.
|
|
3
|
+
"version": "8.0.0-beta.15",
|
|
4
4
|
"homepage": "https://faasjs.com/doc/create-faas-app",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/faasjs/faasjs/issues"
|
|
@@ -30,9 +30,6 @@
|
|
|
30
30
|
"require": "./dist/index.cjs"
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
|
-
"scripts": {
|
|
34
|
-
"build": "tsdown src/index.ts --config ../../tsdown.config.ts"
|
|
35
|
-
},
|
|
36
33
|
"dependencies": {
|
|
37
34
|
"commander": ">=14.0.0",
|
|
38
35
|
"enquirer": "*"
|