create-faas-app 8.0.0-beta.36 → 8.0.0-beta.38
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 +12 -70
- package/dist/index.d.ts +6 -0
- package/dist/index.mjs +14 -3
- package/package.json +1 -1
- package/template/admin/src/features/users/index.tsx +1 -2
package/README.md
CHANGED
|
@@ -1,81 +1,23 @@
|
|
|
1
1
|
# create-faas-app
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
FaasJS is optimized for database-driven React business applications. `create-faas-app` gives new projects a working starting point for the official path instead of asking every team to assemble React, API, database, testing, and UI conventions from scratch.
|
|
6
|
-
|
|
7
|
-
This is the key difference from a generic React starter: the default template is shaped around complete business features. A feature is expected to connect UI, typed APIs, validation, PostgreSQL migrations, table types, and tests in one reviewable application slice.
|
|
8
|
-
|
|
9
|
-
## Quick Start
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
npx create-faas-app --name my-faas-app
|
|
13
|
-
cd my-faas-app
|
|
14
|
-
npm run dev
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
The default template is `admin`, which demonstrates the curated React + Ant Design + PostgreSQL path.
|
|
18
|
-
|
|
19
|
-
## Templates
|
|
20
|
-
|
|
21
|
-
### `admin`
|
|
22
|
-
|
|
23
|
-
Use `admin` for the golden-path FaasJS starter.
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
npx create-faas-app --name my-admin --template admin
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
It includes:
|
|
30
|
-
|
|
31
|
-
- React app structure powered by Vite Plus
|
|
32
|
-
- `@faasjs/ant-design` and Ant Design for business UI
|
|
33
|
-
- `defineApi` endpoints for typed backend APIs
|
|
34
|
-
- a copyable users slice with create, list, detail, update, migration, table types, and API tests
|
|
35
|
-
- `@faasjs/pg` for PostgreSQL access and migrations
|
|
36
|
-
- `@faasjs/pg-dev` for pg-dev-powered tests
|
|
37
|
-
- `.env.example` for local database configuration
|
|
38
|
-
- type declarations for PostgreSQL table inference
|
|
3
|
+
# create-faas-app
|
|
39
4
|
|
|
40
|
-
|
|
5
|
+
[](https://github.com/faasjs/faasjs/blob/main/packages/create-faas-app/LICENSE)
|
|
6
|
+
[](https://www.npmjs.com/package/create-faas-app)
|
|
41
7
|
|
|
42
|
-
|
|
8
|
+
Curated scaffolder for FaasJS projects. The `admin` template is the default
|
|
9
|
+
React + Ant Design + PostgreSQL starter, and `minimal` provides a smaller
|
|
10
|
+
React starter. After scaffolding, the CLI runs `npm install`, `npm run types`,
|
|
11
|
+
and `npm run test` in the new project.
|
|
43
12
|
|
|
44
|
-
|
|
13
|
+
## Usage
|
|
45
14
|
|
|
46
15
|
```bash
|
|
47
|
-
npx create-faas-app --name
|
|
16
|
+
npx create-faas-app --name faasjs
|
|
17
|
+
npx create-faas-app --name faasjs-admin --template admin
|
|
18
|
+
npx create-faas-app --name faasjs-minimal --template minimal
|
|
48
19
|
```
|
|
49
20
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
## Recommended Path
|
|
53
|
-
|
|
54
|
-
Start with `admin` unless you have a specific reason not to. It shows how FaasJS expects complete application slices to fit together:
|
|
55
|
-
|
|
56
|
-
- feature UI calls typed APIs
|
|
57
|
-
- APIs validate inputs at system boundaries
|
|
58
|
-
- APIs use PostgreSQL through the shared database workflow
|
|
59
|
-
- migrations and table types keep data contracts explicit
|
|
60
|
-
- tests cover the API and database behavior
|
|
61
|
-
|
|
62
|
-
FaasJS allows teams to replace parts of the stack, but the templates, docs, and examples optimize this curated path first.
|
|
63
|
-
|
|
64
|
-
Use `minimal` only when you intentionally want to step away from that path, such as for an API-only service, a BFF that will be paired with a separate frontend, or an app that needs a custom UI/database stack from day one.
|
|
65
|
-
|
|
66
|
-
## Auth And Permissions
|
|
67
|
-
|
|
68
|
-
Authentication and permissions are intentionally not built into FaasJS core because production auth requirements vary by product.
|
|
69
|
-
|
|
70
|
-
The admin starter includes a small auth plugin demo. Treat it as a plugin pattern that shows how to inject current-user context, protect APIs, and model project-specific permissions. It is not a mandatory framework auth system.
|
|
71
|
-
|
|
72
|
-
## Next Steps
|
|
73
|
-
|
|
74
|
-
- Read the FaasJS guide at <https://faasjs.com/guide/>.
|
|
75
|
-
- Review the root README for the project direction and package overview.
|
|
76
|
-
- Explore runnable templates in <https://github.com/faasjs/faasjs/tree/main/templates>.
|
|
77
|
-
- Use the admin starter users slice as the reference for complete UI/API/database/test examples.
|
|
78
|
-
|
|
79
|
-
## API Docs
|
|
21
|
+
## Functions
|
|
80
22
|
|
|
81
23
|
- [main](functions/main.md)
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,12 @@ import { Command } from "commander";
|
|
|
4
4
|
/**
|
|
5
5
|
* Run the `create-faas-app` CLI with a provided argv array.
|
|
6
6
|
*
|
|
7
|
+
* The array should use the same shape as `process.argv`, including executable
|
|
8
|
+
* and script slots. Parsing may prompt for a project name, create files, install
|
|
9
|
+
* dependencies, generate FaasJS action types, and run template tests. Commander
|
|
10
|
+
* help exits are swallowed and return the shared program; unexpected errors are
|
|
11
|
+
* printed with `console.error` and also return the program.
|
|
12
|
+
*
|
|
7
13
|
* @param {string[]} argv - CLI arguments forwarded to Commander.
|
|
8
14
|
* @returns {Promise<Command>} Commander program instance after parsing.
|
|
9
15
|
*
|
package/dist/index.mjs
CHANGED
|
@@ -6,7 +6,7 @@ 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.
|
|
9
|
+
var version = "8.0.0-beta.37";
|
|
10
10
|
//#endregion
|
|
11
11
|
//#region src/action/index.ts
|
|
12
12
|
const prompt = enquirer.prompt;
|
|
@@ -56,7 +56,7 @@ function scaffold(rootPath, replacements, templateName) {
|
|
|
56
56
|
* @param {object} [options] - Optional CLI arguments used to choose the project name and template.
|
|
57
57
|
* @param {string} [options.name] - Target folder name for the generated app.
|
|
58
58
|
* @param {string} [options.template] - Template name such as `admin` or `minimal`.
|
|
59
|
-
* @returns {Promise<void>} Resolves after the project is scaffolded, dependencies are installed, and tests pass.
|
|
59
|
+
* @returns {Promise<void>} Resolves after the project is scaffolded, dependencies are installed, action types are generated, and tests pass.
|
|
60
60
|
* @throws {Error} When the selected template is unknown.
|
|
61
61
|
* @example
|
|
62
62
|
* ```ts
|
|
@@ -117,7 +117,10 @@ ${getTemplateNames().join(", ")}`)).option("--name <name>", "Project name").opti
|
|
|
117
117
|
* [](https://github.com/faasjs/faasjs/blob/main/packages/create-faas-app/LICENSE)
|
|
118
118
|
* [](https://www.npmjs.com/package/create-faas-app)
|
|
119
119
|
*
|
|
120
|
-
*
|
|
120
|
+
* Curated scaffolder for FaasJS projects. The `admin` template is the default
|
|
121
|
+
* React + Ant Design + PostgreSQL starter, and `minimal` provides a smaller
|
|
122
|
+
* React starter. After scaffolding, the CLI runs `npm install`, `npm run types`,
|
|
123
|
+
* and `npm run test` in the new project.
|
|
121
124
|
*
|
|
122
125
|
* ## Usage
|
|
123
126
|
*
|
|
@@ -126,6 +129,8 @@ ${getTemplateNames().join(", ")}`)).option("--name <name>", "Project name").opti
|
|
|
126
129
|
* npx create-faas-app --name faasjs-admin --template admin
|
|
127
130
|
* npx create-faas-app --name faasjs-minimal --template minimal
|
|
128
131
|
* ```
|
|
132
|
+
*
|
|
133
|
+
* @packageDocumentation
|
|
129
134
|
*/
|
|
130
135
|
const commander = new Command();
|
|
131
136
|
commander.storeOptionsAsProperties(false).allowUnknownOption(true).version(version).name("create-faas-app").exitOverride();
|
|
@@ -133,6 +138,12 @@ registerCreateFaasApp(commander);
|
|
|
133
138
|
/**
|
|
134
139
|
* Run the `create-faas-app` CLI with a provided argv array.
|
|
135
140
|
*
|
|
141
|
+
* The array should use the same shape as `process.argv`, including executable
|
|
142
|
+
* and script slots. Parsing may prompt for a project name, create files, install
|
|
143
|
+
* dependencies, generate FaasJS action types, and run template tests. Commander
|
|
144
|
+
* help exits are swallowed and return the shared program; unexpected errors are
|
|
145
|
+
* printed with `console.error` and also return the program.
|
|
146
|
+
*
|
|
136
147
|
* @param {string[]} argv - CLI arguments forwarded to Commander.
|
|
137
148
|
* @returns {Promise<Command>} Commander program instance after parsing.
|
|
138
149
|
*
|
package/package.json
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { faas, useApp } from '@faasjs/ant-design'
|
|
2
|
-
import { useFaas } from '@faasjs/react'
|
|
1
|
+
import { faas, useApp, useFaas } from '@faasjs/ant-design'
|
|
3
2
|
import { toErrorMessage } from '@faasjs/utils'
|
|
4
3
|
import { Button, Card, Input, Space, Table, Typography } from 'antd'
|
|
5
4
|
import { useState } from 'react'
|