arri 0.76.3 → 0.77.0

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
@@ -4,39 +4,87 @@ Command line interface for ARRI-RPC
4
4
 
5
5
  ## Table of Contents
6
6
 
7
- - [Commands](#commands)
8
- - [Running code generators](#running-code-generators)
9
- - [Usage with @arrirpc/server](#usage-with-arrirpcserver)
7
+ - [Commands](#commands)
8
+ - [Usage with an Arri Server](#usage-with-an-arri-server)
9
+ - [Usage with an App Definition](#usage-with-an-app-definition)
10
10
 
11
11
  ## Commands
12
12
 
13
13
  Run `arri --help` to get a full list of commands
14
14
 
15
- | Cmd | Description |
16
- | -------------------- | ------------------------------------------------------------------------------------------------------------------- |
17
- | codegen [input-file] | Run generate clients specified in the `arri.config.ts`. See [here](#running-arri-codegen) for details. |
18
- | init [dir] | Scaffold an arri app/library |
19
- | list | List available arri versions |
20
- | use [version] | Update arri dependencies to a specific version (checks recursively for package.json, pubspec.yaml, cargo.toml, etc) |
21
- | version | Print current CLI version |
15
+ | Cmd | Description |
16
+ | -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
17
+ | build | Use the currently registered server plugin to build your arri server and run the code generators |
18
+ | dev | Run the currently registered server plugin in dev mode (basically watches for changes and rebuilds the server and reruns code generators as needed) |
19
+ | codegen [input-file] | Run generate clients specified in the `arri.config.ts`. See [here](#running-arri-codegen) for details. |
20
+ | init [dir] | Scaffold an arri app/library |
21
+ | list | List available arri versions |
22
+ | use [version] | Update arri dependencies to a specific version (checks recursively for package.json, pubspec.yaml, cargo.toml, etc) |
23
+ | version | Print current CLI version |
22
24
 
23
- ## Running code generators
25
+ ## Usage with an Arri server
26
+
27
+ The Arri CLI will automatically rerun code generators on hot-reload during development, and when building for production.
28
+
29
+ #### Register your server plugin
30
+
31
+ ```ts
32
+ // arri.config.ts
33
+ import { defineConfig, servers } from 'arri';
34
+
35
+ // registering the typescript server plugin
36
+ export default defineConfig({
37
+ server: servers.tsServer({
38
+ srcDir: 'src',
39
+ entry: 'app.ts',
40
+ port: 3000,
41
+ }),
42
+ generators: [
43
+ // client generators go here
44
+ ],
45
+ });
46
+
47
+ // registering the go server plugin
48
+ export default defineConfig({
49
+ server: servers.goServer({}),
50
+ generators: [
51
+ // client generators go here
52
+ ],
53
+ });
54
+ ```
55
+
56
+ #### Start developing your server
57
+
58
+ ```bash
59
+ arri dev
60
+ arri build
61
+ ```
62
+
63
+ You can also skip codegen during build
64
+
65
+ ```bash
66
+ arri build --skip-codegen
67
+ ```
68
+
69
+ ## Usage with an App Definition
70
+
71
+ `arri codegen` gives you the ability to run code generators against an already generated [Arri App Definition](/specifications/arri_app_definition.md). This is useful in cases where you don't have access to the backend but do have access to an App Definition file. So basically if you have multiple separate frontend teams, this allows you to distribute your `__definition.json` file to them and they will be able to generate type-safe client(s). (You could also make it available as an HTTP endpoint on the server if you are okay exposing that data publicly)
24
72
 
25
73
  Before running codegen you need to setup a valid Arri Config
26
74
 
27
75
  ```ts
28
76
  // arri.config.ts
29
- import { defineConfig, generators } from "arri";
77
+ import { defineConfig, generators } from 'arri';
30
78
 
31
79
  export default defineConfig({
32
80
  generators: [
33
81
  generators.dartClient({
34
- clientName: "Client",
35
- outputPath: "<some-output-file>",
82
+ clientName: 'Client',
83
+ outputPath: '<some-output-file>',
36
84
  }),
37
85
  generators.typescriptClient({
38
- clientName: "Client",
39
- outputPath: "<some-output-file>",
86
+ clientName: 'Client',
87
+ outputPath: '<some-output-file>',
40
88
  }),
41
89
  // etc...
42
90
  ],
@@ -61,33 +109,3 @@ arri codegen https://example.com/__definition
61
109
  | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------- |
62
110
  | --config | -c | Path to an arri config. Default is `arri.config.ts` |
63
111
  | --watch | -w | Watch an app definition file for changes. Only works on files. It will throw an error if invoked against an HTTP endpoint |
64
-
65
- ## Usage with @arrirpc/server
66
-
67
- @arrirpc/server will automatically rerun code generators on hot-reload during development, and when building for production.
68
-
69
- For full details visit the [server docs](https://github.com/modiimedia/arri/blob/master/packages/arri/README.md)
70
-
71
- #### 1) Create an `arri.config.ts`
72
-
73
- ```ts
74
- import { defineConfig } from "arri";
75
-
76
- export default defineConfig({
77
- server: servers.tsServer({
78
- srcDir: "src",
79
- entry: "app.ts",
80
- port: 3000,
81
- }),
82
- generators: [
83
- // client generators go here (can be imported from arri)
84
- ],
85
- });
86
- ```
87
-
88
- #### 2) Develop your server
89
-
90
- ```bash
91
- arri dev
92
- arri build
93
- ```
package/dist/index.d.cts CHANGED
@@ -88,4 +88,5 @@ declare const codegen: {
88
88
  ts: typeof typescriptCodegen;
89
89
  };
90
90
 
91
- export { type ArriConfig, DEV_DEFINITION_ENDPOINT, type ServerConfig, type TsServerConfig, codegen, defineConfig, defineServerConfig, generators, isArriConfig, isServerConfig, servers };
91
+ export { DEV_DEFINITION_ENDPOINT, codegen, defineConfig, defineServerConfig, generators, isArriConfig, isServerConfig, servers };
92
+ export type { ArriConfig, ServerConfig, TsServerConfig };
package/dist/index.d.mts CHANGED
@@ -88,4 +88,5 @@ declare const codegen: {
88
88
  ts: typeof typescriptCodegen;
89
89
  };
90
90
 
91
- export { type ArriConfig, DEV_DEFINITION_ENDPOINT, type ServerConfig, type TsServerConfig, codegen, defineConfig, defineServerConfig, generators, isArriConfig, isServerConfig, servers };
91
+ export { DEV_DEFINITION_ENDPOINT, codegen, defineConfig, defineServerConfig, generators, isArriConfig, isServerConfig, servers };
92
+ export type { ArriConfig, ServerConfig, TsServerConfig };
package/dist/index.d.ts CHANGED
@@ -88,4 +88,5 @@ declare const codegen: {
88
88
  ts: typeof typescriptCodegen;
89
89
  };
90
90
 
91
- export { type ArriConfig, DEV_DEFINITION_ENDPOINT, type ServerConfig, type TsServerConfig, codegen, defineConfig, defineServerConfig, generators, isArriConfig, isServerConfig, servers };
91
+ export { DEV_DEFINITION_ENDPOINT, codegen, defineConfig, defineServerConfig, generators, isArriConfig, isServerConfig, servers };
92
+ export type { ArriConfig, ServerConfig, TsServerConfig };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arri",
3
- "version": "0.76.3",
3
+ "version": "0.77.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -26,26 +26,26 @@
26
26
  ],
27
27
  "dependencies": {
28
28
  "@joshmossas/listhen": "^1.11.1",
29
- "c12": "^2.0.2",
29
+ "c12": "^3.0.2",
30
30
  "chokidar": "^4.0.3",
31
31
  "citty": "^0.1.6",
32
- "consola": "^3.4.0",
32
+ "consola": "^3.4.2",
33
33
  "degit": "^2.8.4",
34
34
  "enquirer": "^2.4.1",
35
- "esbuild": "^0.25.0",
35
+ "esbuild": "^0.25.1",
36
36
  "esbuild-plugin-replace": "^1.4.0",
37
37
  "globby": "^14.1.0",
38
- "h3": "^1.15.0",
38
+ "h3": "^1.15.1",
39
39
  "ofetch": "^1.4.1",
40
40
  "pathe": "^2.0.3",
41
- "prettier": "^3.5.1",
42
- "@arrirpc/codegen-kotlin": "0.76.3",
43
- "@arrirpc/codegen-rust": "0.76.3",
44
- "@arrirpc/codegen-swift": "0.76.3",
45
- "@arrirpc/codegen-utils": "0.76.3",
46
- "@arrirpc/schema": "0.76.3",
47
- "@arrirpc/codegen-dart": "0.76.3",
48
- "@arrirpc/codegen-ts": "0.76.3"
41
+ "prettier": "^3.5.3",
42
+ "@arrirpc/codegen-dart": "0.77.0",
43
+ "@arrirpc/codegen-swift": "0.77.0",
44
+ "@arrirpc/codegen-ts": "0.77.0",
45
+ "@arrirpc/codegen-utils": "0.77.0",
46
+ "@arrirpc/schema": "0.77.0",
47
+ "@arrirpc/codegen-kotlin": "0.77.0",
48
+ "@arrirpc/codegen-rust": "0.77.0"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@types/degit": "^2.8.6"