From 3b249a41c059ade60ca44d4ec94d1e759991527e Mon Sep 17 00:00:00 2001 From: Mamadou Talla DIA Date: Sat, 19 Sep 2026 13:29:23 +0100 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20ajouter=20la=20version=201.0.1=20au?= =?UTF-8?q?=20changelog=20avec=20des=20am=C3=A9liorations=20sur=20les=20al?= =?UTF-8?q?ias=20de=20modules=20et=20les=20fichiers=20.gitignore?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- website/app/pages/changelog.vue | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/website/app/pages/changelog.vue b/website/app/pages/changelog.vue index c1da190..4b99072 100644 --- a/website/app/pages/changelog.vue +++ b/website/app/pages/changelog.vue @@ -1,12 +1,30 @@ - - - - - - diff --git a/playground/app/plugins/auth.ts b/playground/app/plugins/auth.ts deleted file mode 100644 index 46641fc..0000000 --- a/playground/app/plugins/auth.ts +++ /dev/null @@ -1,15 +0,0 @@ -export default defineVuePlugin({ - hooks: { - "app:mounted": () => { - console.log("++++++++++++++++++++++++++è_________"); - }, - }, - - setup: () => { - return { - provide: { - test: () => "hey is test", - }, - }; - }, -}); diff --git a/playground/app/tsconfig.json b/playground/app/tsconfig.json deleted file mode 100644 index 6f160fb..0000000 --- a/playground/app/tsconfig.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "files": [], - "references": [{ "path": "../.app/tsconfig.app.json" }] -} diff --git a/playground/content/docs/.navigation.yml b/playground/content/docs/.navigation.yml deleted file mode 100644 index 98463a2..0000000 --- a/playground/content/docs/.navigation.yml +++ /dev/null @@ -1 +0,0 @@ -path: documentation diff --git a/playground/content/docs/get-started/index.md b/playground/content/docs/get-started/index.md deleted file mode 100644 index b8e1be8..0000000 --- a/playground/content/docs/get-started/index.md +++ /dev/null @@ -1,59 +0,0 @@ ---- -title: 'Title of the page' -description: 'meta description of the page' ---- - -# Pluto - -**Pluto** (minor-planet designation: _134340 Pluto_) -is a -[dwarf planet](https://en.wikipedia.org/wiki/Dwarf_planet) -in the -[Kuiper belt](https://en.wikipedia.org/wiki/Kuiper_belt). - -## History - -### Sub History - -In the 1840s, -[Urbain Le Verrier](https://wikipedia.org/wiki/Urbain_Le_Verrier) -used Newtonian mechanics to predict the position of the -then-undiscovered planet -[Neptune](https://wikipedia.org/wiki/Neptune) -after analyzing perturbations in the orbit of -[Uranus](https://wikipedia.org/wiki/Uranus). - ---- - -Just a link: www.nasa.gov. - -- Lists -- [ ] todo -- [x] done - -A table: - -| a | b | -| --- | --- | - -
Show example - -```js -console.log("Hi pluto!"); -``` - -
- -::div ---- -class: "p-4" ---- - -Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. -:: - -::router-link ---- -to: "/hello" ---- -:: \ No newline at end of file diff --git a/playground/content/docs/get-started/intall.md b/playground/content/docs/get-started/intall.md deleted file mode 100644 index e69de29..0000000 diff --git a/playground/content/docs/get-started/usage.md b/playground/content/docs/get-started/usage.md deleted file mode 100644 index e69de29..0000000 diff --git a/playground/content/docs/index.md b/playground/content/docs/index.md deleted file mode 100644 index e69de29..0000000 diff --git a/playground/modules/content/syora.config.ts b/playground/modules/content/syora.config.ts deleted file mode 100644 index ee31a49..0000000 --- a/playground/modules/content/syora.config.ts +++ /dev/null @@ -1,4 +0,0 @@ -// packages/content/src/index.ts -import { defineConfig } from "runable"; - -export default defineConfig({}); diff --git a/playground/modules/test/runable.config.ts b/playground/modules/test/runable.config.ts new file mode 100644 index 0000000..e9bca81 --- /dev/null +++ b/playground/modules/test/runable.config.ts @@ -0,0 +1,5 @@ +import { defineModule } from "runable"; + +export default defineModule({ + configKey: "test01", +}); diff --git a/playground/public/favicon.svg b/playground/public/favicon.svg deleted file mode 100644 index 8431ca7..0000000 --- a/playground/public/favicon.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - diff --git a/playground/syora.config.ts b/playground/runable.config.ts similarity index 67% rename from playground/syora.config.ts rename to playground/runable.config.ts index 29bb0bf..d1eb283 100644 --- a/playground/syora.config.ts +++ b/playground/runable.config.ts @@ -1,10 +1,7 @@ import { defineConfig } from "runable"; -import { join } from "node:path"; export default defineConfig({ - // devtools: { enable: true }, - - modules: ["@runable/content"], + modules: ["./modules/test"], head: { title: "Runable/vue playground", @@ -18,5 +15,5 @@ export default defineConfig({ ssr: true, - content: {}, + test01: {}, }); diff --git a/playground/server.ts b/playground/server.ts index 8fe900e..37f122d 100644 --- a/playground/server.ts +++ b/playground/server.ts @@ -1 +1,16 @@ -import "./server/express/index.js"; +// server.ts +import Express from "express"; +import { express } from "runable/adapters/express"; + +const server = Express(); + +server.get("/api/health", (_req, res) => { + res.json({ status: "ok" }); +}); + +// The adapter initializes Runable once and serves the frontend. +server.use(express()); + +server.listen(3000, () => { + console.log("http://localhost:3000"); +}); diff --git a/playground/server/express/index.ts b/playground/server/express/index.ts deleted file mode 100644 index 89cc669..0000000 --- a/playground/server/express/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { express } from "runable/adapters/express"; -import Express from "express"; - -const app = Express(); -app.use(express()); - -app.listen(5173); diff --git a/playground/server/fastify/index.ts b/playground/server/fastify/index.ts deleted file mode 100644 index c05b945..0000000 --- a/playground/server/fastify/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -import Fastify from "fastify"; -import { fastify } from "runable/adapters/fastify"; - -const app = Fastify(); -await app.register(fastify()); - -await app.listen({ port: 5173 }); diff --git a/playground/server/hono/index.ts b/playground/server/hono/index.ts deleted file mode 100644 index 30fcc17..0000000 --- a/playground/server/hono/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { serve as server, type HttpBindings } from "@hono/node-server"; -import { Hono } from "hono"; -import { hono } from "runable/adapters/hono"; - -const app = new Hono<{ Bindings: HttpBindings }>(); - -app.use("*", hono()); - -server({ fetch: app.fetch, port: 5173 }); diff --git a/playground/server/koa/index.ts b/playground/server/koa/index.ts deleted file mode 100644 index 295a096..0000000 --- a/playground/server/koa/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { koa } from "runable/adapters/koa"; -import Koa from "koa"; - -const app = new Koa(); -app.use(koa()); - -app.listen(5173); diff --git a/playground/server/nestjs/index.ts b/playground/server/nestjs/index.ts deleted file mode 100644 index ac0c6ab..0000000 --- a/playground/server/nestjs/index.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { NestFactory } from "@nestjs/core"; -import type { NestExpressApplication } from "@nestjs/platform-express"; -import { Module } from "@nestjs/common"; -import { nestjs } from "runable/adapters/nestjs"; - -@Module({}) -class AppModule {} - -async function bootstrap() { - const app = await NestFactory.create(AppModule); - app.use(nestjs()); - - await app.listen(5173); -} - -bootstrap(); diff --git a/playground/tsconfig.json b/playground/tsconfig.json index f4c4f24..92b0eee 100644 --- a/playground/tsconfig.json +++ b/playground/tsconfig.json @@ -1,8 +1,7 @@ { - "extends": "../tsconfig.base.json", - "compilerOptions": { - "paths": {} - }, - "include": ["./**/*.ts", "runable.config.ts"], - "exclude": ["dist", "node_modules"] + "files": [], + "references": [ + { "path": ".app/tsconfig.app.json" }, + { "path": "tsconfig.node.json" } + ] } diff --git a/playground/tsconfig.node.json b/playground/tsconfig.node.json new file mode 100644 index 0000000..a1102c1 --- /dev/null +++ b/playground/tsconfig.node.json @@ -0,0 +1,13 @@ +{ + "compilerOptions": { + "target": "ES2023", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "strict": true, + "skipLibCheck": true, + "noEmit": true, + "types": ["node"] + }, + "include": ["**/*.ts", "**/*.vue"], + "exclude": ["node_modules", ".app", ".output"] +} diff --git a/tests/regressions/cli-create-module.test.ts b/tests/regressions/cli-create-module.test.ts index 61590e6..05dc4d9 100644 --- a/tests/regressions/cli-create-module.test.ts +++ b/tests/regressions/cli-create-module.test.ts @@ -1,6 +1,7 @@ -import { readFileSync } from "node:fs"; +import { existsSync, readFileSync } from "node:fs"; import path from "node:path"; import { describe, expect, it } from "vitest"; +import { cleanupFixtureDir, createFixtureDir } from "../fixtures.js"; import { REPO_ROOT } from "../helpers.js"; describe("runable create --module", () => { @@ -25,4 +26,75 @@ describe("runable create --module", () => { expect(selector).toContain('value: "starter"'); expect(selector).not.toContain('value: "module"'); }); + + it("creates a Runable playground that loads the module root", async () => { + const directory = createFixtureDir("cli-module-playground-"); + + try { + const { createModulePlayground } = await import( + "../../packages/cli/dist/commands/create/module.js" + ); + const { configurePnpmBuilds, createPackageJson } = await import( + "../../packages/cli/dist/commands/create/shared.js" + ); + await createModulePlayground(directory, { + moduleName: "test-module", + framework: "other", + createServerEntry: false, + }); + await createPackageJson(directory, "test-module"); + await configurePnpmBuilds("pnpm", directory); + + expect(existsSync(path.join(directory, "playground/app/app.vue"))).toBe( + true, + ); + expect( + existsSync(path.join(directory, "playground/app/pages/index.vue")), + ).toBe(true); + expect( + existsSync(path.join(directory, "playground/tsconfig.json")), + ).toBe(true); + expect( + existsSync(path.join(directory, "playground/tsconfig.node.json")), + ).toBe(true); + expect( + readFileSync( + path.join(directory, "playground/runable.config.ts"), + "utf8", + ), + ).toContain('modules: [".."]'); + + const packageJson = JSON.parse( + readFileSync(path.join(directory, "package.json"), "utf8"), + ); + expect(packageJson.workspaces).toEqual(["playground"]); + expect(packageJson.scripts).toMatchObject({ + "playground:prepare": "cd playground && runable prepare", + "playground:build": "cd playground && runable build", + }); + + const playgroundPackageJson = JSON.parse( + readFileSync(path.join(directory, "playground/package.json"), "utf8"), + ); + expect(playgroundPackageJson).toMatchObject({ + name: "test-module-playground", + private: true, + dependencies: { + "test-module": "*", + runable: expect.any(String), + vue: expect.any(String), + "vue-router": expect.any(String), + }, + devDependencies: { + "@runablejs/cli": expect.any(String), + typescript: expect.any(String), + }, + }); + expect( + readFileSync(path.join(directory, "pnpm-workspace.yaml"), "utf8"), + ).toContain("- playground"); + } finally { + cleanupFixtureDir(directory); + } + }); }); diff --git a/tests/regressions/cli-starters.test.ts b/tests/regressions/cli-starters.test.ts index f6c6565..55bf3bd 100644 --- a/tests/regressions/cli-starters.test.ts +++ b/tests/regressions/cli-starters.test.ts @@ -41,6 +41,19 @@ describe("CLI starter templates", () => { expect(existsSync(join(target, "runable.config.ts"))).toBe(true); expect(existsSync(join(target, "app/app.vue"))).toBe(true); expect(existsSync(join(target, "app/pages/index.vue"))).toBe(true); + expect(existsSync(join(target, "app/tsconfig.json"))).toBe(false); + + const tsconfig = JSON.parse( + readFileSync(join(target, "tsconfig.json"), "utf8"), + ); + expect(tsconfig).toEqual({ + files: [], + references: [ + { path: ".app/tsconfig.app.json" }, + { path: "tsconfig.node.json" }, + ], + }); + expect(existsSync(join(target, "tsconfig.node.json"))).toBe(true); const indexPage = readFileSync( join(target, "app/pages/index.vue"), diff --git a/tests/regressions/module-aliases.test.ts b/tests/regressions/module-aliases.test.ts index 897dccc..58aee85 100644 --- a/tests/regressions/module-aliases.test.ts +++ b/tests/regressions/module-aliases.test.ts @@ -68,6 +68,101 @@ export default defineModule({ "@module": ["../module/app"], "@shared": ["../app/shared"], }); + expect(generated.include).toContain("../module/app/**/*"); + } finally { + cleanupFixtureDir(directory); + } + }); + + it('includes a local parent module declared with modules: [".."]', async () => { + const directory = createFixtureDir("parent-module-tsconfig-"); + const application = path.join(directory, "playground"); + + try { + linkWorkspacePackage(directory, "runable", "packages/runable"); + writeFixtureFile( + directory, + "runable.config.ts", + `import { defineModule } from "runable"; + +export default defineModule({}); +`, + ); + writeFixtureFile( + directory, + "playground/runable.config.ts", + `import { defineConfig } from "runable"; + +export default defineConfig({ modules: [".."] }); +`, + ); + + process.chdir(application); + vi.resetModules(); + const { loadConfig, writeTsConfig } = await import("runable"); + await loadConfig(); + writeTsConfig(); + + const generated = JSON.parse( + readFileSync(path.join(application, ".app/tsconfig.app.json"), "utf8"), + ); + expect(generated.include).toContain("../../app/**/*"); + } finally { + cleanupFixtureDir(directory); + } + }); + + it("does not inherit aliases from installed modules", async () => { + const directory = createFixtureDir("installed-module-aliases-"); + + try { + linkWorkspacePackage(directory, "runable", "packages/runable"); + writeFixtureFile( + directory, + "runable.config.ts", + `import { defineConfig } from "runable"; + +export default defineConfig({ modules: ["installed-module"] }); +`, + ); + writeFixtureFile( + directory, + "node_modules/installed-module/package.json", + JSON.stringify({ + name: "installed-module", + type: "module", + exports: "./dist/index.js", + }), + ); + writeFixtureFile( + directory, + "node_modules/installed-module/dist/index.js", + "export {};\n", + ); + writeFixtureFile( + directory, + "node_modules/installed-module/dist/runable.config.js", + `import path from "node:path"; +import { defineModule } from "runable"; + +export default defineModule({ + alias: { "@installed": path.join(import.meta.dirname, "app") }, +}); +`, + ); + + process.chdir(directory); + vi.resetModules(); + const { loadConfig, useConfig, writeTsConfig } = await import("runable"); + await loadConfig(); + writeTsConfig(); + + expect(useConfig().alias).not.toHaveProperty("@installed"); + + const generated = JSON.parse( + readFileSync(path.join(directory, ".app/tsconfig.app.json"), "utf8"), + ); + expect(generated.compilerOptions.paths).not.toHaveProperty("@installed"); } finally { cleanupFixtureDir(directory); } diff --git a/website/content/docs/en/getting-started/configuration.md b/website/content/docs/en/getting-started/configuration.md index 0c7ac3d..1cd1929 100644 --- a/website/content/docs/en/getting-started/configuration.md +++ b/website/content/docs/en/getting-started/configuration.md @@ -117,7 +117,7 @@ export default defineConfig({ }); ``` -Aliases declared by modules are inherited by the application and included in both Vite resolution and the generated `.app/tsconfig.app.json`. When aliases conflict, the application overrides its modules, and a module overrides its own dependencies. +Aliases declared by local modules (referenced with a relative path such as `./module` or `..`) are inherited by the application and included in both Vite resolution and the generated `.app/tsconfig.app.json`. Aliases from installed modules are not inherited. When local aliases conflict, the application overrides its modules, and a module overrides its own dependencies. Runable also adds the internal `#build` alias, which points to the generated directory defined by `output`. diff --git a/website/content/docs/en/guide/cli/create.md b/website/content/docs/en/guide/cli/create.md index 8d1fe5f..96fda59 100644 --- a/website/content/docs/en/guide/cli/create.md +++ b/website/content/docs/en/guide/cli/create.md @@ -109,6 +109,13 @@ and a `runable.config.ts` defined with `defineModule()` instead of the module, `runable`, `vue`, and `vue-router` are added to `devDependencies` rather than its runtime dependencies. +It also creates a `playground/` Runable application for developing the module +locally. Its `runable.config.ts` declares `modules: [".."]`, so it always loads +the module from the project root without requiring the package to be published. +Use `playground:prepare` and `playground:build` from the module root to run the +corresponding Runable commands against that application. The playground has +its own private `package.json` and is registered as a workspace of the module. + See Modules for the module API and authoring conventions. diff --git a/website/content/docs/fr/getting-started/configuration.md b/website/content/docs/fr/getting-started/configuration.md index 542385e..0c1d68e 100644 --- a/website/content/docs/fr/getting-started/configuration.md +++ b/website/content/docs/fr/getting-started/configuration.md @@ -121,7 +121,7 @@ export default defineConfig({ }); ``` -Les alias déclarés par les modules sont hérités par l'application et ajoutés à la résolution Vite ainsi qu'au fichier `.app/tsconfig.app.json` généré. En cas de conflit, l'application est prioritaire sur ses modules, et un module est prioritaire sur ses propres dépendances. +Les alias déclarés par les modules locaux (référencés avec un chemin relatif comme `./module` ou `..`) sont hérités par l'application et ajoutés à la résolution Vite ainsi qu'au fichier `.app/tsconfig.app.json` généré. Les alias des modules installés ne sont pas hérités. En cas de conflit entre alias locaux, l'application est prioritaire sur ses modules, et un module est prioritaire sur ses propres dépendances. Runable ajoute aussi l'alias interne `#build`, qui pointe vers le dossier généré défini par `output`.