create-faas-app 8.0.0-beta.14 → 8.0.0-beta.16

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 CHANGED
@@ -1,20 +1,5 @@
1
1
  # create-faas-app
2
2
 
3
- [![License: MIT](https://img.shields.io/npm/l/create-faas-app.svg)](https://github.com/faasjs/faasjs/blob/main/packages/create-faas-app/LICENSE)
4
- [![NPM Version](https://img.shields.io/npm/v/create-faas-app.svg)](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
@@ -28,10 +28,11 @@ let node_path = require("node:path");
28
28
  let enquirer = require("enquirer");
29
29
  enquirer = __toESM(enquirer);
30
30
  //#region package.json
31
- var version = "8.0.0-beta.13";
31
+ var version = "8.0.0-beta.15";
32
32
  //#endregion
33
33
  //#region src/action.ts
34
34
  const prompt = enquirer.default.prompt;
35
+ const validateName = (input) => Validator.name(input);
35
36
  const Validator = { name(input) {
36
37
  const match = /^[a-z0-9-_]+$/i.test(input) ? true : "Must be a-z, 0-9 or -_";
37
38
  if (match !== true) return match;
@@ -49,10 +50,9 @@ function buildPackageJSON(name) {
49
50
  type: "module",
50
51
  version: "1.0.0",
51
52
  scripts: {
52
- dev: "vite",
53
+ dev: "node --import @faasjs/node-utils/register-hooks vite",
53
54
  build: "vite build",
54
55
  start: "node --import @faasjs/node-utils/register-hooks server.ts",
55
- check: "faas lint",
56
56
  test: "vitest run"
57
57
  },
58
58
  dependencies: {
@@ -209,14 +209,11 @@ export default function HomePage() {
209
209
  `);
210
210
  writeFile((0, node_path.join)(rootPath, "src", "pages", "home", "api", "hello.func.ts"), `import { defineApi, z } from '@faasjs/core'
211
211
 
212
- const schema = z
213
- .object({
214
- name: z.string().optional(),
215
- })
216
- .required()
217
-
218
212
  export const func = defineApi({
219
- schema,
213
+ schema: z
214
+ .object({
215
+ name: z.string().optional(),
216
+ }),
220
217
  async handler({ params }) {
221
218
  return {
222
219
  ok: true,
@@ -252,7 +249,7 @@ async function action(options = {}) {
252
249
  name: "value",
253
250
  message: "Project name",
254
251
  initial: "faasjs",
255
- validate: Validator.name
252
+ validate: validateName
256
253
  }).then((res) => res.value);
257
254
  if (!answers.name) return;
258
255
  const runtime = process.versions.bun ? "bun" : "npm";
@@ -283,8 +280,6 @@ function action_default(program) {
283
280
  * # use bun
284
281
  * bunx create-faas-app --name faasjs
285
282
  * ```
286
- *
287
- * @packageDocumentation
288
283
  */
289
284
  const commander$1 = new commander.Command();
290
285
  commander$1.storeOptionsAsProperties(false).allowUnknownOption(true).version(version).name("create-faas-app").exitOverride();
package/dist/index.mjs CHANGED
@@ -4,10 +4,11 @@ import { existsSync, mkdirSync, writeFileSync } from "node:fs";
4
4
  import { dirname, join } from "node:path";
5
5
  import enquirer from "enquirer";
6
6
  //#region package.json
7
- var version = "8.0.0-beta.13";
7
+ var version = "8.0.0-beta.15";
8
8
  //#endregion
9
9
  //#region src/action.ts
10
10
  const prompt = enquirer.prompt;
11
+ const validateName = (input) => Validator.name(input);
11
12
  const Validator = { name(input) {
12
13
  const match = /^[a-z0-9-_]+$/i.test(input) ? true : "Must be a-z, 0-9 or -_";
13
14
  if (match !== true) return match;
@@ -25,10 +26,9 @@ function buildPackageJSON(name) {
25
26
  type: "module",
26
27
  version: "1.0.0",
27
28
  scripts: {
28
- dev: "vite",
29
+ dev: "node --import @faasjs/node-utils/register-hooks vite",
29
30
  build: "vite build",
30
31
  start: "node --import @faasjs/node-utils/register-hooks server.ts",
31
- check: "faas lint",
32
32
  test: "vitest run"
33
33
  },
34
34
  dependencies: {
@@ -185,14 +185,11 @@ export default function HomePage() {
185
185
  `);
186
186
  writeFile(join(rootPath, "src", "pages", "home", "api", "hello.func.ts"), `import { defineApi, z } from '@faasjs/core'
187
187
 
188
- const schema = z
189
- .object({
190
- name: z.string().optional(),
191
- })
192
- .required()
193
-
194
188
  export const func = defineApi({
195
- schema,
189
+ schema: z
190
+ .object({
191
+ name: z.string().optional(),
192
+ }),
196
193
  async handler({ params }) {
197
194
  return {
198
195
  ok: true,
@@ -228,7 +225,7 @@ async function action(options = {}) {
228
225
  name: "value",
229
226
  message: "Project name",
230
227
  initial: "faasjs",
231
- validate: Validator.name
228
+ validate: validateName
232
229
  }).then((res) => res.value);
233
230
  if (!answers.name) return;
234
231
  const runtime = process.versions.bun ? "bun" : "npm";
@@ -259,8 +256,6 @@ function action_default(program) {
259
256
  * # use bun
260
257
  * bunx create-faas-app --name faasjs
261
258
  * ```
262
- *
263
- * @packageDocumentation
264
259
  */
265
260
  const commander = new Command();
266
261
  commander.storeOptionsAsProperties(false).allowUnknownOption(true).version(version).name("create-faas-app").exitOverride();
package/index.mjs CHANGED
@@ -2,4 +2,4 @@
2
2
 
3
3
  import { main } from './dist/index.mjs'
4
4
 
5
- main(process.argv)
5
+ await main(process.argv)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-faas-app",
3
- "version": "8.0.0-beta.14",
3
+ "version": "8.0.0-beta.16",
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": "*"