create-baeta 2.0.0-next.0 → 2.0.0-next.10
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/CHANGELOG.md +83 -0
- package/README.md +43 -18
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +41 -44
- package/dist/cli.js.map +1 -1
- package/dist/handler-B14-RjjJ.js +832 -0
- package/dist/handler-B14-RjjJ.js.map +1 -0
- package/dist/index.d.ts +57 -0
- package/dist/index.js +3 -31
- package/package.json +20 -12
- package/templates/shared.ts +1 -1
- package/templates/yoga.ts +0 -1
- package/dist/chunk-MRF3CANS.js +0 -913
- package/dist/chunk-MRF3CANS.js.map +0 -1
- package/dist/index.js.map +0 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# create-baeta
|
|
2
|
+
|
|
3
|
+
## 2.0.0-next.10
|
|
4
|
+
|
|
5
|
+
## 2.0.0-next.9
|
|
6
|
+
|
|
7
|
+
## 2.0.0-next.8
|
|
8
|
+
|
|
9
|
+
## 2.0.0-next.7
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#214](https://github.com/andreisergiu98/baeta/pull/214) [`c47665a`](https://github.com/andreisergiu98/baeta/commit/c47665a76a0f88bae07f42983b380361e4f0843a) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - Fix create-baeta template using the old middleware function call
|
|
14
|
+
|
|
15
|
+
## 2.0.0-next.2
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Fix broken types
|
|
20
|
+
|
|
21
|
+
## 2.0.0-next.1
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- Fix release version
|
|
26
|
+
|
|
27
|
+
## 2.0.0-next.0
|
|
28
|
+
|
|
29
|
+
### Major Changes
|
|
30
|
+
|
|
31
|
+
- [#214](https://github.com/andreisergiu98/baeta/pull/214) [`31d1a50`](https://github.com/andreisergiu98/baeta/commit/31d1a509f96535b43ae85d19c770eb1a5f09dc94) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - Baeta v2 – major refactor
|
|
32
|
+
- **Side-effect-free type generation & resolver definitions.**
|
|
33
|
+
The types generator and resolver definitions were reworked to be side-effect free, improving type safety.
|
|
34
|
+
- **Stricter type safety.**
|
|
35
|
+
You must now **explicitly define resolvers for every field** during development—breakages that used to surface at runtime are now caught at compile time.
|
|
36
|
+
- **Removed `@baeta/compiler`.**
|
|
37
|
+
Since modern runtimes can execute TypeScript natively, the separate compiler package is no longer needed. Use your runtime’s native TS support or your existing build setup.
|
|
38
|
+
- **Subscriptions update.**
|
|
39
|
+
`@baeta/subscriptions-pubsub` now targets **`graphql-subscriptions` v3**.
|
|
40
|
+
|
|
41
|
+
## 1.0.11
|
|
42
|
+
|
|
43
|
+
### Patch Changes
|
|
44
|
+
|
|
45
|
+
- [`d3b6040`](https://github.com/andreisergiu98/baeta/commit/d3b6040c0fe3b88297791fc68fe5904431b8739c) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - Add static .gitignore template
|
|
46
|
+
|
|
47
|
+
## 1.0.9
|
|
48
|
+
|
|
49
|
+
### Patch Changes
|
|
50
|
+
|
|
51
|
+
- [`583014f`](https://github.com/andreisergiu98/baeta/commit/583014f0bac810b25d9a8226bda2df4c9039f5e3) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - Update dependencies
|
|
52
|
+
|
|
53
|
+
## 1.0.8
|
|
54
|
+
|
|
55
|
+
### Patch Changes
|
|
56
|
+
|
|
57
|
+
- [#189](https://github.com/andreisergiu98/baeta/pull/189) [`d500378`](https://github.com/andreisergiu98/baeta/commit/d500378198e0a9c48298c4242913bca8ad348228) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - add jsdocs
|
|
58
|
+
|
|
59
|
+
- [#165](https://github.com/andreisergiu98/baeta/pull/165) [`1334c2a`](https://github.com/andreisergiu98/baeta/commit/1334c2a866676c88f0f3d380b22133d81c4e98bc) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - mark as stable
|
|
60
|
+
|
|
61
|
+
## 0.0.4
|
|
62
|
+
|
|
63
|
+
### Patch Changes
|
|
64
|
+
|
|
65
|
+
- [`770fef4`](https://github.com/andreisergiu98/baeta/commit/770fef4974fd8926886162424f326c4cda2ad21b) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - fix package entrypoint
|
|
66
|
+
|
|
67
|
+
## 0.0.3
|
|
68
|
+
|
|
69
|
+
### Patch Changes
|
|
70
|
+
|
|
71
|
+
- [`bcbfb49`](https://github.com/andreisergiu98/baeta/commit/bcbfb49b16daf5d6f195ba273f52b1aa89602c1c) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - fix yoga entrypoint for bun and deno
|
|
72
|
+
|
|
73
|
+
## 0.0.2
|
|
74
|
+
|
|
75
|
+
### Patch Changes
|
|
76
|
+
|
|
77
|
+
- [#184](https://github.com/andreisergiu98/baeta/pull/184) [`bf2d1a3`](https://github.com/andreisergiu98/baeta/commit/bf2d1a326235e5f34e723a5acc81cd7b974b913b) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - add runtime selector
|
|
78
|
+
|
|
79
|
+
## 0.0.1
|
|
80
|
+
|
|
81
|
+
### Patch Changes
|
|
82
|
+
|
|
83
|
+
- [#182](https://github.com/andreisergiu98/baeta/pull/182) [`9a0f100`](https://github.com/andreisergiu98/baeta/commit/9a0f1003a9579406809c80e6fe123e54fb86e5ac) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - add create baeta package
|
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<div align="center">
|
|
6
6
|
<h1>Baeta</h1>
|
|
7
7
|
<a href="https://www.npmjs.com/package/@baeta/cli"><img src="https://img.shields.io/npm/v/@baeta/cli.svg?style=flat" /></a>
|
|
8
|
-
<a href="https://github.com/andreisergiu98/baeta/actions/workflows/
|
|
8
|
+
<a href="https://github.com/andreisergiu98/baeta/actions/workflows/checks.yml"><img src="https://img.shields.io/github/actions/workflow/status/andreisergiu98/baeta/checks.yml" /></a>
|
|
9
9
|
<a href="https://github.com/andreisergiu98/baeta/pulls"><img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" /></a>
|
|
10
10
|
<a href="https://github.com/andreisergiu98/baeta/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue" /></a>
|
|
11
11
|
<br />
|
|
@@ -77,43 +77,68 @@ type Query {
|
|
|
77
77
|
#### 2. Implement your resolvers
|
|
78
78
|
|
|
79
79
|
```typescript
|
|
80
|
-
import {
|
|
80
|
+
import { UserModule } from "./typedef.ts";
|
|
81
81
|
|
|
82
|
-
const { Query } =
|
|
82
|
+
const { Query } = UserModule;
|
|
83
83
|
|
|
84
|
-
Query.user(({ args }) => {
|
|
84
|
+
const userQuery = Query.user.resolve(({ args }) => {
|
|
85
85
|
return dataSource.user.find(args.where);
|
|
86
86
|
});
|
|
87
87
|
|
|
88
|
-
Query.users(() => {
|
|
88
|
+
const usersQuery = Query.users.resolve(() => {
|
|
89
89
|
return dataSource.user.findMany();
|
|
90
90
|
});
|
|
91
|
+
|
|
92
|
+
Query.$fields({
|
|
93
|
+
user: userQuery,
|
|
94
|
+
users: usersQuery,
|
|
95
|
+
});
|
|
91
96
|
```
|
|
92
97
|
|
|
93
98
|
#### 3. Add authorization
|
|
94
99
|
|
|
95
100
|
```typescript
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
Query
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
101
|
+
import { UserModule } from "./typedef.ts";
|
|
102
|
+
|
|
103
|
+
const { Query } = UserModule;
|
|
104
|
+
|
|
105
|
+
const userQuery = Query.user
|
|
106
|
+
.$auth({
|
|
107
|
+
$or: {
|
|
108
|
+
isPublic: true,
|
|
109
|
+
isLoggedIn: true,
|
|
110
|
+
},
|
|
111
|
+
})
|
|
112
|
+
.resolve(async ({ args }) => {
|
|
113
|
+
// ...
|
|
114
|
+
});
|
|
104
115
|
```
|
|
105
116
|
|
|
106
117
|
#### 4. Add caching
|
|
107
118
|
|
|
108
119
|
```typescript
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
const { User, Query } = getUserModule();
|
|
120
|
+
const { Query, Mutation, User } = UserModule;
|
|
112
121
|
|
|
113
122
|
export const userCache = User.$createCache();
|
|
114
123
|
|
|
115
|
-
Query.user
|
|
116
|
-
|
|
124
|
+
const userQuery = Query.user
|
|
125
|
+
.$auth({
|
|
126
|
+
// ...
|
|
127
|
+
})
|
|
128
|
+
.$useCache(userCache)
|
|
129
|
+
.resolve(async ({ args }) => {
|
|
130
|
+
// ...
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
const updateUserMutation = Mutation.updateUser
|
|
134
|
+
.$use(async (next) => {
|
|
135
|
+
const user = await next();
|
|
136
|
+
await userCache.save(user);
|
|
137
|
+
return user;
|
|
138
|
+
})
|
|
139
|
+
.resolve(async ({ args }) => {
|
|
140
|
+
// ...
|
|
141
|
+
});
|
|
117
142
|
```
|
|
118
143
|
|
|
119
144
|
## Compatibility
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/cli.js
CHANGED
|
@@ -1,58 +1,55 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
handler,
|
|
4
|
-
packageManagers
|
|
5
|
-
} from "./chunk-MRF3CANS.js";
|
|
6
|
-
|
|
7
|
-
// cli.ts
|
|
2
|
+
import { d as packageManagers, t as handler } from "./handler-B14-RjjJ.js";
|
|
8
3
|
import { logger } from "@docusaurus/logger";
|
|
9
4
|
import semver from "semver";
|
|
10
5
|
import yargs from "yargs";
|
|
11
6
|
import { hideBin } from "yargs/helpers";
|
|
12
7
|
|
|
13
|
-
|
|
14
|
-
var version = "2.0.0-next.
|
|
15
|
-
var engines = {
|
|
16
|
-
node: ">=22.20.0"
|
|
17
|
-
};
|
|
8
|
+
//#region package.json
|
|
9
|
+
var version = "2.0.0-next.10";
|
|
10
|
+
var engines = { "node": ">=22.20.0" };
|
|
18
11
|
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region cli.ts
|
|
14
|
+
const requiredVersion = engines.node;
|
|
21
15
|
if (!semver.satisfies(process.version, requiredVersion)) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
logger.error("Minimum Node.js version not met :(");
|
|
17
|
+
logger.info`You are using Node.js number=${process.version}, Requirement: Node.js number=${requiredVersion}.`;
|
|
18
|
+
process.exit(1);
|
|
25
19
|
}
|
|
26
20
|
process.on("unhandledRejection", (err) => {
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
logger.error(err);
|
|
22
|
+
process.exit(1);
|
|
29
23
|
});
|
|
30
24
|
yargs(hideBin(process.argv)).version(version).command({
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
25
|
+
command: "* [appName] [template] [rootDir]",
|
|
26
|
+
describe: "Initialize Baeta application",
|
|
27
|
+
builder: (yargs$1) => {
|
|
28
|
+
return yargs$1.option("package-manager", {
|
|
29
|
+
alias: "p",
|
|
30
|
+
describe: "The package manager used to install dependencies.",
|
|
31
|
+
type: "string",
|
|
32
|
+
choices: packageManagers
|
|
33
|
+
}).option("skip-install", {
|
|
34
|
+
alias: "s",
|
|
35
|
+
describe: "Do not run package manager immediately after scaffolding",
|
|
36
|
+
type: "boolean"
|
|
37
|
+
}).positional("appName", {
|
|
38
|
+
type: "string",
|
|
39
|
+
describe: "Name of the app"
|
|
40
|
+
}).positional("template", {
|
|
41
|
+
type: "string",
|
|
42
|
+
describe: "Template to use",
|
|
43
|
+
choices: ["yoga", "apollo"]
|
|
44
|
+
}).positional("rootDir", {
|
|
45
|
+
type: "string",
|
|
46
|
+
describe: "Root directory",
|
|
47
|
+
default: "."
|
|
48
|
+
});
|
|
49
|
+
},
|
|
50
|
+
handler: (argv) => handler(argv)
|
|
57
51
|
}).showHelpOnFail(true).strict().help().parse();
|
|
52
|
+
|
|
53
|
+
//#endregion
|
|
54
|
+
export { };
|
|
58
55
|
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"cli.js","names":["yargs"],"sources":["../package.json","../cli.ts"],"sourcesContent":["{\n \"name\": \"create-baeta\",\n \"version\": \"2.0.0-next.10\",\n \"keywords\": [\n \"baeta\",\n \"graphql\",\n \"schema\",\n \"types\",\n \"typescript\",\n \"framework\",\n \"builder\"\n ],\n \"homepage\": \"https://github.com/andreisergiu98/baeta#readme\",\n \"bugs\": {\n \"url\": \"https://github.com/andreisergiu98/baeta/issues\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/andreisergiu98/baeta.git\",\n \"directory\": \"packages/create-baeta\"\n },\n \"license\": \"MIT\",\n \"author\": {\n \"name\": \"Andrei Pampu\",\n \"url\": \"https://github.com/andreisergiu98\"\n },\n \"type\": \"module\",\n \"exports\": {\n \".\": {\n \"types\": \"./index.ts\",\n \"default\": \"./index.ts\"\n }\n },\n \"types\": \"dist/index.d.ts\",\n \"bin\": \"dist/cli.js\",\n \"files\": [\n \"dist\",\n \"templates\",\n \"package.json\"\n ],\n \"scripts\": {\n \"prebuild\": \"node --no-warnings --experimental-transform-types ./scripts/version-manifest.ts\",\n \"build\": \"yarn prebuild && builder build\",\n \"prepack\": \"builder prepare\",\n \"postpack\": \"builder prepare --clean\",\n \"test\": \"builder test\",\n \"test:circular\": \"builder test-circular\",\n \"types\": \"yarn prebuild && tsc --noEmit\"\n },\n \"ava\": {\n \"extensions\": {\n \"ts\": \"module\"\n }\n },\n \"dependencies\": {\n \"@docusaurus/logger\": \"^3.9.2\",\n \"fs-extra\": \"^11.3.2\",\n \"prompts\": \"^2.4.2\",\n \"semver\": \"^7.7.3\",\n \"shelljs\": \"^0.10.0\",\n \"supports-color\": \"^10.2.2\",\n \"yargs\": \"^18.0.0\"\n },\n \"devDependencies\": {\n \"@baeta/builder\": \"workspace:^\",\n \"@baeta/testing\": \"workspace:^\",\n \"@baeta/tsconfig\": \"workspace:^\",\n \"@types/fs-extra\": \"^11.0.4\",\n \"@types/node\": \"^22.19.1\",\n \"@types/prompts\": \"^2.4.9\",\n \"@types/semver\": \"^7.7.1\",\n \"@types/shelljs\": \"^0.8.17\",\n \"@types/yargs\": \"^17.0.35\",\n \"typescript\": \"^5.9.3\"\n },\n \"engines\": {\n \"node\": \">=22.20.0\"\n },\n \"publishConfig\": {\n \"access\": \"public\",\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"default\": \"./dist/index.js\"\n }\n }\n },\n \"typedocOptions\": {\n \"entryPoints\": [\n \"./index.ts\"\n ],\n \"readme\": \"none\",\n \"tsconfig\": \"./tsconfig.json\",\n \"sort\": [\n \"kind\",\n \"instance-first\",\n \"required-first\",\n \"alphabetical-ignoring-documents\"\n ]\n }\n}\n","#!/usr/bin/env node\n\nimport { logger } from '@docusaurus/logger';\nimport semver from 'semver';\nimport yargs from 'yargs';\nimport { hideBin } from 'yargs/helpers';\nimport { packageManagers } from './lib/constants.ts';\nimport { handler } from './lib/handler.ts';\nimport { engines, version } from './package.json';\n\nconst requiredVersion = engines.node;\n\nif (!semver.satisfies(process.version, requiredVersion)) {\n\tlogger.error('Minimum Node.js version not met :(');\n\tlogger.info`You are using Node.js number=${process.version}, Requirement: Node.js number=${requiredVersion}.`;\n\tprocess.exit(1);\n}\n\nprocess.on('unhandledRejection', (err) => {\n\tlogger.error(err);\n\tprocess.exit(1);\n});\n\nyargs(hideBin(process.argv))\n\t.version(version)\n\t.command({\n\t\tcommand: '* [appName] [template] [rootDir]',\n\t\tdescribe: 'Initialize Baeta application',\n\t\tbuilder: (yargs) => {\n\t\t\treturn yargs\n\t\t\t\t.option('package-manager', {\n\t\t\t\t\talias: 'p',\n\t\t\t\t\tdescribe: 'The package manager used to install dependencies.',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tchoices: packageManagers,\n\t\t\t\t})\n\t\t\t\t.option('skip-install', {\n\t\t\t\t\talias: 's',\n\t\t\t\t\tdescribe: 'Do not run package manager immediately after scaffolding',\n\t\t\t\t\ttype: 'boolean',\n\t\t\t\t})\n\t\t\t\t.positional('appName', {\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdescribe: 'Name of the app',\n\t\t\t\t})\n\t\t\t\t.positional('template', {\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdescribe: 'Template to use',\n\t\t\t\t\tchoices: ['yoga', 'apollo'],\n\t\t\t\t})\n\t\t\t\t.positional('rootDir', {\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdescribe: 'Root directory',\n\t\t\t\t\tdefault: '.',\n\t\t\t\t});\n\t\t},\n\t\thandler: (argv) => handler(argv),\n\t})\n\t.showHelpOnFail(true)\n\t.strict()\n\t.help()\n\t.parse();\n"],"mappings":";;;;;;;;cAEa;cAyEA,EACT,QAAQ,aACT;;;;ACnEH,MAAM,kBAAkB,QAAQ;AAEhC,IAAI,CAAC,OAAO,UAAU,QAAQ,SAAS,gBAAgB,EAAE;AACxD,QAAO,MAAM,qCAAqC;AAClD,QAAO,IAAI,gCAAgC,QAAQ,QAAQ,gCAAgC,gBAAgB;AAC3G,SAAQ,KAAK,EAAE;;AAGhB,QAAQ,GAAG,uBAAuB,QAAQ;AACzC,QAAO,MAAM,IAAI;AACjB,SAAQ,KAAK,EAAE;EACd;AAEF,MAAM,QAAQ,QAAQ,KAAK,CAAC,CAC1B,QAAQ,QAAQ,CAChB,QAAQ;CACR,SAAS;CACT,UAAU;CACV,UAAU,YAAU;AACnB,SAAOA,QACL,OAAO,mBAAmB;GAC1B,OAAO;GACP,UAAU;GACV,MAAM;GACN,SAAS;GACT,CAAC,CACD,OAAO,gBAAgB;GACvB,OAAO;GACP,UAAU;GACV,MAAM;GACN,CAAC,CACD,WAAW,WAAW;GACtB,MAAM;GACN,UAAU;GACV,CAAC,CACD,WAAW,YAAY;GACvB,MAAM;GACN,UAAU;GACV,SAAS,CAAC,QAAQ,SAAS;GAC3B,CAAC,CACD,WAAW,WAAW;GACtB,MAAM;GACN,UAAU;GACV,SAAS;GACT,CAAC;;CAEJ,UAAU,SAAS,QAAQ,KAAK;CAChC,CAAC,CACD,eAAe,KAAK,CACpB,QAAQ,CACR,MAAM,CACN,OAAO"}
|