create-faas-app 8.0.0-beta.26 → 8.0.0-beta.28

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.mjs CHANGED
@@ -6,12 +6,13 @@ import { dirname, join } from "node:path";
6
6
  import { fileURLToPath } from "node:url";
7
7
  import enquirer from "enquirer";
8
8
  //#region package.json
9
- var version = "8.0.0-beta.25";
9
+ var version = "8.0.0-beta.27";
10
10
  //#endregion
11
- //#region src/action.ts
11
+ //#region src/action/index.ts
12
12
  const prompt = enquirer.prompt;
13
13
  const validateName = (input) => Validator.name(input);
14
- const templateRoot = join(dirname(fileURLToPath(import.meta.url)), "..", "template");
14
+ const templateRoot = join(dirname(fileURLToPath(import.meta.url)), "..", "..", "template");
15
+ const ignoredTemplateEntries = new Set(["node_modules"]);
15
16
  const Validator = { name(input) {
16
17
  const match = /^[a-z0-9-_]+$/i.test(input) ? true : "Must be a-z, 0-9 or -_";
17
18
  if (match !== true) return match;
@@ -35,6 +36,7 @@ function generateSessionSecret() {
35
36
  function copyTemplateDirectory(sourcePath, targetPath, replacements) {
36
37
  mkdirSync(targetPath, { recursive: true });
37
38
  for (const entry of readdirSync(sourcePath, { withFileTypes: true })) {
39
+ if (ignoredTemplateEntries.has(entry.name)) continue;
38
40
  const nextSourcePath = join(sourcePath, entry.name);
39
41
  const nextTargetPath = join(targetPath, entry.name === "gitignore" ? ".gitignore" : entry.name);
40
42
  if (entry.isDirectory()) {
@@ -110,6 +112,8 @@ ${getTemplateNames().join(", ")}`)).option("--name <name>", "Project name").opti
110
112
  //#endregion
111
113
  //#region src/index.ts
112
114
  /**
115
+ * # create-faas-app
116
+ *
113
117
  * [![License: MIT](https://img.shields.io/npm/l/create-faas-app.svg)](https://github.com/faasjs/faasjs/blob/main/packages/create-faas-app/LICENSE)
114
118
  * [![NPM Version](https://img.shields.io/npm/v/create-faas-app.svg)](https://www.npmjs.com/package/create-faas-app)
115
119
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-faas-app",
3
- "version": "8.0.0-beta.26",
3
+ "version": "8.0.0-beta.28",
4
4
  "homepage": "https://faasjs.com/doc/create-faas-app",
5
5
  "bugs": {
6
6
  "url": "https://github.com/faasjs/faasjs/issues"
@@ -14,21 +14,15 @@
14
14
  "db:up": "faasjs-pg up",
15
15
  "db:down": "faasjs-pg down"
16
16
  },
17
- "dependencies": {
18
- "@faasjs/ant-design": "*",
19
- "@faasjs/core": "*",
20
- "@faasjs/pg": "*",
21
- "antd": "*",
22
- "postgres": "*",
23
- "react": "*",
24
- "react-dom": "*"
25
- },
26
17
  "devDependencies": {
27
- "@electric-sql/pglite": "*",
28
- "@electric-sql/pglite-socket": "*",
29
18
  "@faasjs/dev": "*",
30
19
  "@faasjs/pg-dev": "*"
31
20
  },
21
+ "peerDependencies": {
22
+ "@faasjs/ant-design": "*",
23
+ "@faasjs/core": "*",
24
+ "@faasjs/pg": "*"
25
+ },
32
26
  "overrides": {
33
27
  "vite": "npm:@voidzero-dev/vite-plus-core",
34
28
  "vitest": "npm:@voidzero-dev/vite-plus-test"
@@ -1,5 +1,6 @@
1
- import { defineApi, z } from '@faasjs/core'
1
+ import { defineApi } from '@faasjs/core'
2
2
  import { getClient } from '@faasjs/pg'
3
+ import * as z from 'zod'
3
4
 
4
5
  export default defineApi({
5
6
  schema: z.object({
@@ -1,5 +1,6 @@
1
- import { defineApi, HttpError, z } from '@faasjs/core'
1
+ import { defineApi, HttpError } from '@faasjs/core'
2
2
  import { getClient } from '@faasjs/pg'
3
+ import * as z from 'zod'
3
4
 
4
5
  export default defineApi({
5
6
  schema: z.object({
@@ -1,5 +1,6 @@
1
- import { defineApi, z } from '@faasjs/core'
1
+ import { defineApi } from '@faasjs/core'
2
2
  import { getClient } from '@faasjs/pg'
3
+ import * as z from 'zod'
3
4
 
4
5
  export default defineApi({
5
6
  schema: z.object({
@@ -1,5 +1,6 @@
1
- import { defineApi, HttpError, z } from '@faasjs/core'
1
+ import { defineApi, HttpError } from '@faasjs/core'
2
2
  import { getClient } from '@faasjs/pg'
3
+ import * as z from 'zod'
3
4
 
4
5
  export default defineApi({
5
6
  schema: z.object({
@@ -1,3 +1,20 @@
1
+ declare module '@faasjs/types' {
2
+ interface FaasActions {
3
+ '/pages/home/api/users/list': {
4
+ Params: { limit: number }
5
+ Data: { total?: number; users?: { id: number; name: string }[] }
6
+ }
7
+ '/pages/home/api/users/create': {
8
+ Params: { name?: string | undefined }
9
+ Data: { message?: string; total?: number; user?: { id: number; name: string } }
10
+ }
11
+ '/pages/home/api/auth/me': {
12
+ Params: Record<string, never>
13
+ Data: { current_user?: { id: number; name: string; role: string } }
14
+ }
15
+ }
16
+ }
17
+
1
18
  import { faas, useApp } from '@faasjs/ant-design'
2
19
  import { Button, Card, Input, Space, Table, Typography } from 'antd'
3
20
  import { useState } from 'react'
@@ -1,8 +1,12 @@
1
1
  import { viteConfig } from '@faasjs/dev'
2
- import { TypedPgVitestPlugin } from '@faasjs/pg-dev'
2
+ import { PgVitestPlugin } from '@faasjs/pg-dev'
3
3
  import { defineConfig } from 'vite-plus'
4
4
 
5
5
  export default defineConfig({
6
6
  ...viteConfig,
7
- plugins: [...viteConfig.plugins, TypedPgVitestPlugin()],
7
+ plugins: [...viteConfig.plugins, PgVitestPlugin()],
8
+ test: {
9
+ fileParallelism: false,
10
+ testTimeout: 30_000,
11
+ },
8
12
  })
@@ -9,15 +9,12 @@
9
9
  "start": "node --import @faasjs/node-utils/register-hooks server.ts",
10
10
  "test": "vp test"
11
11
  },
12
- "dependencies": {
13
- "@faasjs/core": "*",
14
- "@faasjs/react": "*",
15
- "react": "*",
16
- "react-dom": "*"
17
- },
18
12
  "devDependencies": {
19
13
  "@faasjs/dev": "*"
20
14
  },
15
+ "peerDependencies": {
16
+ "@faasjs/core": "*"
17
+ },
21
18
  "overrides": {
22
19
  "vite": "npm:@voidzero-dev/vite-plus-core",
23
20
  "vitest": "npm:@voidzero-dev/vite-plus-test"
@@ -1,4 +1,5 @@
1
- import { defineApi, z } from '@faasjs/core'
1
+ import { defineApi } from '@faasjs/core'
2
+ import * as z from 'zod'
2
3
 
3
4
  export default defineApi({
4
5
  schema: z.object({
@@ -1,3 +1,12 @@
1
+ declare module '@faasjs/types' {
2
+ interface FaasActions {
3
+ '/pages/home/api/hello': {
4
+ Params: { name?: string | undefined }
5
+ Data: { message?: string }
6
+ }
7
+ }
8
+ }
9
+
1
10
  import { useState } from 'react'
2
11
 
3
12
  import { faas } from '../../react-client'