@ressjs/cli 0.6.0-experimental.0 → 0.6.0-rc.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/LICENSE ADDED
@@ -0,0 +1,69 @@
1
+ ress.js Proprietary License
2
+
3
+ Copyright (c) 2025-2026 gabrielspisso. All rights reserved.
4
+
5
+ This license applies to the ress.js packages (the "Software"), published on npm
6
+ under the @ressjs and @gzzy scopes, in every version released from 0.6.0-rc.0
7
+ onwards. Earlier versions were released under the MIT License and remain
8
+ available under those terms.
9
+
10
+ 1. GRANT
11
+ Subject to this license, the Licensor grants you a worldwide, non-exclusive,
12
+ non-transferable, non-sublicensable, royalty-free license to install and use
13
+ the Software, as distributed by the Licensor, to build, run and deploy your
14
+ own applications and services, including commercial ones, and to charge your
15
+ own customers for them.
16
+
17
+ 2. RESTRICTIONS
18
+ You may not:
19
+ a) fork, copy, or redistribute the Software, in whole or in part, except for
20
+ the portions that are necessarily included in the build output of your own
21
+ application in order to run it;
22
+ b) publish, distribute or make available a modified version of the Software
23
+ or any work derived from it. Modifications for your own internal use are
24
+ allowed, but they remain subject to this license;
25
+ c) use the Software, or any part of it, to build, offer or support a
26
+ framework, library, tool or service that competes with the Software;
27
+ d) sell, sublicense, rent or host the Software itself as a product or service
28
+ for third parties, as opposed to hosting your own application built with
29
+ it;
30
+ e) remove or alter copyright, license or attribution notices;
31
+ f) use the name "ress.js" or the Licensor's names or marks to endorse or
32
+ promote your products without written permission.
33
+
34
+ 3. SCAFFOLDING OUTPUT
35
+ Files that @ressjs/create-ress-app copies into your project (templates and
36
+ generated configuration) are yours: you may use, modify and distribute them
37
+ without restriction. This does not extend to the Software packages that the
38
+ generated project installs as dependencies.
39
+
40
+ 4. SUPPORT
41
+ The Software is provided without any obligation of support, maintenance or
42
+ updates. The Licensor may offer support, maintenance, training or consulting
43
+ under a separate paid agreement; that agreement does not change this license
44
+ unless it says so explicitly and is signed by the Licensor.
45
+
46
+ 5. OWNERSHIP
47
+ The Software is licensed, not sold. The Licensor retains all rights not
48
+ expressly granted here. Feedback and suggestions you send may be used by the
49
+ Licensor without obligation to you.
50
+
51
+ 6. TERMINATION
52
+ This license ends automatically if you breach it. On termination you must
53
+ stop using the Software and delete your copies. Sections 4 to 8 survive
54
+ termination.
55
+
56
+ 7. NO WARRANTY
57
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
58
+ IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
59
+ PARTICULAR PURPOSE AND NON-INFRINGEMENT.
60
+
61
+ 8. LIMITATION OF LIABILITY
62
+ TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE LICENSOR WILL NOT BE LIABLE FOR
63
+ ANY INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES, OR FOR LOSS OF
64
+ PROFITS, DATA OR BUSINESS, ARISING FROM THE USE OF OR INABILITY TO USE THE
65
+ SOFTWARE. THE LICENSOR'S TOTAL LIABILITY IS LIMITED TO THE AMOUNT YOU PAID
66
+ FOR THE SOFTWARE, WHICH MAY BE ZERO.
67
+
68
+ For other uses, including exceptions to section 2, contact the Licensor to
69
+ agree a separate license.
@@ -9,7 +9,8 @@ export { createRessApp } from './app.js';
9
9
  export { startDevServer } from './dev.js';
10
10
  export { startProdServer } from './start.js';
11
11
  export { buildApp } from './build.js';
12
- export { inspectProject, cliVersion } from './inspect.js';
12
+ export { inspectProject } from './inspect.js';
13
+ export { cliVersion } from './version.js';
13
14
  export { resolveOptions } from './options.js';
14
15
  export { silentReporter, collectingReporter } from './reporter.js';
15
16
  export { RessError } from './errors.js';
package/dist/api/index.js CHANGED
@@ -9,7 +9,8 @@ export { createRessApp } from './app.js';
9
9
  export { startDevServer } from './dev.js';
10
10
  export { startProdServer } from './start.js';
11
11
  export { buildApp } from './build.js';
12
- export { inspectProject, cliVersion } from './inspect.js';
12
+ export { inspectProject } from './inspect.js';
13
+ export { cliVersion } from './version.js';
13
14
  export { resolveOptions } from './options.js';
14
15
  export { silentReporter, collectingReporter } from './reporter.js';
15
16
  export { RessError } from './errors.js';
@@ -63,13 +63,4 @@ export interface ProjectInfo {
63
63
  };
64
64
  };
65
65
  }
66
- /**
67
- * La versión de `@ressjs/cli`, leída de su propio `package.json`.
68
- *
69
- * Exportada porque `src/cli/main.ts` también la necesita para `--version` y no
70
- * puede tocar `node:fs` directamente sin romper la regla de separación —
71
- * "la CLI no reimplementa" incluye no leer archivos por su cuenta cuando la
72
- * API ya sabe cómo.
73
- */
74
- export declare function cliVersion(): Promise<string>;
75
66
  export declare function inspectProject(opts?: InspectOptions): Promise<ProjectInfo>;
@@ -8,10 +8,10 @@
8
8
  */
9
9
  import os from 'node:os';
10
10
  import path from 'node:path';
11
- import { fileURLToPath, URL } from 'node:url';
12
11
  import { readFile } from 'node:fs/promises';
13
- import { buildVariantCatalog, getPages, loadRouteManifest, OUT_DIR, scanRoutes, } from '@ressjs/vite-router';
12
+ import { buildVariantCatalog, getPages, loadRouteManifest, OUT_DIR, scanRoutes, writeProjectTypes, } from '@ressjs/vite-router';
14
13
  import { resolveOptions } from './options.js';
14
+ import { cliVersion } from './version.js';
15
15
  import { RessError } from './errors.js';
16
16
  async function dirBytes(dir) {
17
17
  const { readdir, stat } = await import('node:fs/promises');
@@ -39,23 +39,6 @@ async function packageVersion(root, name) {
39
39
  return undefined;
40
40
  }
41
41
  }
42
- /**
43
- * La versión de `@ressjs/cli`, leída de su propio `package.json`.
44
- *
45
- * Exportada porque `src/cli/main.ts` también la necesita para `--version` y no
46
- * puede tocar `node:fs` directamente sin romper la regla de separación —
47
- * "la CLI no reimplementa" incluye no leer archivos por su cuenta cuando la
48
- * API ya sabe cómo.
49
- */
50
- export async function cliVersion() {
51
- try {
52
- const raw = await readFile(fileURLToPath(new URL('../../package.json', import.meta.url)), 'utf-8');
53
- return JSON.parse(raw).version ?? '0.0.0';
54
- }
55
- catch {
56
- return '0.0.0';
57
- }
58
- }
59
42
  export async function inspectProject(opts = {}) {
60
43
  const root = opts.root ? path.resolve(opts.root) : process.cwd();
61
44
  const mode = opts.mode ?? 'development';
@@ -74,6 +57,9 @@ export async function inspectProject(opts = {}) {
74
57
  }
75
58
  resolvedConfig = options.config;
76
59
  configFile = options.configFile.value;
60
+ // Los tipos de `config.X` salen de la configuración resuelta. Generarlos acá
61
+ // permite tipar un clon limpio sin levantar el servidor (`ress info && tsc`).
62
+ await writeProjectTypes(root, options.config.platform);
77
63
  }
78
64
  catch (cause) {
79
65
  valid = false;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * La versión de `@ressjs/cli`, leída de su propio `package.json`.
3
+ *
4
+ * Vive en un módulo propio, sin dependencias del runtime, porque
5
+ * `src/cli/main.ts` la necesita antes de fijar `NODE_ENV`. Importarla desde
6
+ * `inspect.ts` arrastraba `@ressjs/vite-router` y, con él, React: React elige
7
+ * su build de desarrollo o de producción al cargarse, así que quedaba en
8
+ * desarrollo aunque después se fijara `NODE_ENV=production`.
9
+ */
10
+ export declare function cliVersion(): Promise<string>;
@@ -0,0 +1,20 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ import { fileURLToPath, URL } from 'node:url';
3
+ /**
4
+ * La versión de `@ressjs/cli`, leída de su propio `package.json`.
5
+ *
6
+ * Vive en un módulo propio, sin dependencias del runtime, porque
7
+ * `src/cli/main.ts` la necesita antes de fijar `NODE_ENV`. Importarla desde
8
+ * `inspect.ts` arrastraba `@ressjs/vite-router` y, con él, React: React elige
9
+ * su build de desarrollo o de producción al cargarse, así que quedaba en
10
+ * desarrollo aunque después se fijara `NODE_ENV=production`.
11
+ */
12
+ export async function cliVersion() {
13
+ try {
14
+ const raw = await readFile(fileURLToPath(new URL('../../package.json', import.meta.url)), 'utf-8');
15
+ return JSON.parse(raw).version ?? '0.0.0';
16
+ }
17
+ catch {
18
+ return '0.0.0';
19
+ }
20
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * `NODE_ENV` por comando.
3
+ *
4
+ * `ress start` y `ress build` no fijaban `NODE_ENV`, así que en producción
5
+ * React (y cualquier caché que lea `process.env.NODE_ENV`) seguía corriendo
6
+ * en modo desarrollo salvo que quien desplegara lo supiera y lo pusiera a
7
+ * mano. Se fija acá, antes de importar el runtime (`../../api/index.js`,
8
+ * detrás de un `import()` dinámico en `main.ts`), y no lo pisa si ya venía
9
+ * declarado desde afuera.
10
+ */
11
+ export type EnvCommand = 'dev' | 'build' | 'start' | 'info' | 'help' | 'version';
12
+ export declare function applyNodeEnvDefault(command: EnvCommand): void;
@@ -0,0 +1,9 @@
1
+ export function applyNodeEnvDefault(command) {
2
+ if (command === 'dev') {
3
+ process.env.NODE_ENV ??= 'development';
4
+ return;
5
+ }
6
+ if (command === 'build' || command === 'start') {
7
+ process.env.NODE_ENV ??= 'production';
8
+ }
9
+ }
package/dist/cli/main.js CHANGED
@@ -6,24 +6,27 @@
6
6
  * en `commands/*`.
7
7
  */
8
8
  import { parseArgv } from './argv.js';
9
- import { devCommand } from './commands/dev.js';
10
- import { buildCommand } from './commands/build.js';
11
- import { startCommand } from './commands/start.js';
12
- import { infoCommand } from './commands/info.js';
13
9
  import { formatError } from './reporters/terminal.js';
14
10
  import { detectFormatEnv } from './reporters/format.js';
11
+ import { applyNodeEnvDefault } from './env.js';
15
12
  import { RessError } from '../api/errors.js';
16
- import { cliVersion } from '../api/inspect.js';
17
- function dispatch(parsed) {
13
+ // Sólo módulos sin el runtime: `cliVersion` vive aparte de `inspect.ts`, que
14
+ // importa `@ressjs/vite-router` y con él React, y React tiene que cargarse
15
+ // después de `applyNodeEnvDefault`.
16
+ import { cliVersion } from '../api/version.js';
17
+ // Import dinámico y no estático: así `NODE_ENV` queda fijado (`applyNodeEnvDefault`,
18
+ // llamado antes de esto) antes de que se cargue `../../api/index.js`, que es
19
+ // donde vive el runtime que lee `process.env.NODE_ENV`.
20
+ async function dispatch(parsed) {
18
21
  switch (parsed.command) {
19
22
  case 'dev':
20
- return devCommand(parsed.flags);
23
+ return (await import('./commands/dev.js')).devCommand(parsed.flags);
21
24
  case 'build':
22
- return buildCommand(parsed.flags);
25
+ return (await import('./commands/build.js')).buildCommand(parsed.flags);
23
26
  case 'start':
24
- return startCommand(parsed.flags);
27
+ return (await import('./commands/start.js')).startCommand(parsed.flags);
25
28
  case 'info':
26
- return infoCommand(parsed.flags);
29
+ return (await import('./commands/info.js')).infoCommand(parsed.flags);
27
30
  }
28
31
  }
29
32
  export async function main(argv = process.argv.slice(2)) {
@@ -41,6 +44,7 @@ export async function main(argv = process.argv.slice(2)) {
41
44
  process.exitCode = 0;
42
45
  return;
43
46
  }
47
+ applyNodeEnvDefault(parsed.command);
44
48
  process.exitCode = await dispatch(parsed);
45
49
  }
46
50
  catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ressjs/cli",
3
- "version": "0.6.0-experimental.0",
3
+ "version": "0.6.0-rc.0",
4
4
  "description": "La CLI de ress.js: dev, build, start e info sobre la misma construcción de la aplicación que expone como API.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -37,9 +37,9 @@
37
37
  "vite"
38
38
  ],
39
39
  "author": "ress.js team",
40
- "license": "MIT",
40
+ "license": "SEE LICENSE IN LICENSE",
41
41
  "dependencies": {
42
- "@ressjs/vite-router": "0.6.0-experimental.0",
42
+ "@ressjs/vite-router": "0.6.0-rc.0",
43
43
  "@vitejs/plugin-react": "^6.1.0",
44
44
  "commander": "^12.1.0",
45
45
  "express": "^5.1.0"