@padosoft/config 1.2.2 → 1.3.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.
@@ -1,50 +1,29 @@
1
- ]0;C:\Users\PADO\.bun\bin\bun.exe[?25h$ tsdown
2
- ℹ tsdown v0.22.3 powered by rolldown v1.1.1
3
- ℹ config file: C:\Users\PADO\github\ts-support\packages
4
- \config\tsdown.config.ts 
5
- ℹ entry: src\compiler\tsdown.ts, src\types\css.ts, src\
6
- types\expo-router.ts, src\types\i18next.ts, src\types\n
7
- ativewind.ts, src\compiler\plugins\hono-zod.ts, src\com
8
- piler\utils\exports.ts, src\compiler\utils\index.ts 
9
- ℹ tsconfig: tsconfig.json
10
- ℹ Build start
11
- ℹ Cleaning 21 files
12
- ℹ dist\compiler\utils\exports.mjs 0.44 kB │ gzip:
13
- 0.27 kB
14
- ℹ dist\compiler\tsdown.mjs 0.35 kB │ gzip:
15
- 0.25 kB
16
- ℹ dist\compiler\plugins\hono-zod.mjs 0.24 kB │ gzip:
17
- 0.19 kB
18
- ℹ dist\compiler\utils\index.mjs 0.09 kB │ gzip:
19
- 0.08 kB
20
- ℹ dist\types\css.mjs 0.01 kB │ gzip:
21
- 0.03 kB
22
- ℹ dist\types\expo-router.mjs 0.01 kB │ gzip:
23
- 0.03 kB
24
- ℹ dist\types\i18next.mjs 0.01 kB │ gzip:
25
- 0.03 kB
26
- ℹ dist\types\nativewind.mjs 0.01 kB │ gzip:
27
- 0.03 kB
28
- ℹ dist\types\i18next.d.mts 1.29 kB │ gzip:
29
- 0.62 kB
30
- ℹ dist\types\expo-router.d.mts 0.84 kB │ gzip:
31
- 0.32 kB
32
- ℹ dist\compiler\utils\exports.d.mts 0.25 kB │ gzip:
33
- 0.19 kB
34
- ℹ dist\types\css.d.mts 0.23 kB │ gzip:
35
- 0.15 kB
36
- ℹ dist\compiler\plugins\hono-zod.d.mts 0.20 kB │ gzip:
37
- 0.15 kB
38
- ℹ dist\compiler\tsdown.d.mts 0.19 kB │ gzip:
39
- 0.15 kB
40
- ℹ dist\compiler\utils\index.d.mts 0.09 kB │ gzip:
41
- 0.07 kB
42
- ℹ dist\types\nativewind.d.mts 0.01 kB │ gzip:
43
- 0.03 kB
44
- ℹ 16 files, total: 4.24 kB
45
- ✔ Build complete in 83ms
46
- .json json
47
- .json json
48
- .json json
49
- .json json
50
- .json json
1
+ $ tsdown
2
+ ℹ tsdown v0.22.3 powered by rolldown v1.1.1
3
+ ℹ config file: /home/runner/work/ts-support/ts-support/packages/config/tsdown.config.ts
4
+ ℹ entry: src/cli/index.ts, src/compiler/tsdown.ts, src/types/css.ts, src/types/expo-router.ts, src/types/i18next.ts, src/types/nativewind.ts, src/compiler/plugins/hono-zod.ts, src/compiler/utils/exports.ts, src/compiler/utils/index.ts
5
+ ℹ tsconfig: tsconfig.json
6
+ ℹ Build start
7
+ ℹ Granting execute permission to dist/cli/index.mjs
8
+ ℹ dist/cli/index.mjs 1.81 kB │ gzip: 0.82 kB
9
+ ℹ dist/compiler/tsdown.mjs 0.33 kB │ gzip: 0.25 kB
10
+ ℹ dist/compiler/plugins/hono-zod.mjs 0.24 kB │ gzip: 0.19 kB
11
+ ℹ dist/compiler/utils/exports.mjs 0.08 kB │ gzip: 0.09 kB
12
+ ℹ dist/compiler/utils/index.mjs 0.08 kB │ gzip: 0.09 kB
13
+ ℹ dist/types/css.mjs 0.01 kB │ gzip: 0.03 kB
14
+ ℹ dist/types/expo-router.mjs 0.01 kB │ gzip: 0.03 kB
15
+ ℹ dist/types/i18next.mjs 0.01 kB │ gzip: 0.03 kB
16
+ ℹ dist/types/nativewind.mjs 0.01 kB │ gzip: 0.03 kB
17
+ ℹ dist/exports-Cp7dWSTV.mjs 0.42 kB │ gzip: 0.26 kB
18
+ ℹ dist/types/i18next.d.mts 1.29 kB │ gzip: 0.62 kB
19
+ ℹ dist/types/expo-router.d.mts 0.84 kB │ gzip: 0.32 kB
20
+ ℹ dist/types/css.d.mts 0.23 kB │ gzip: 0.15 kB
21
+ ℹ dist/compiler/plugins/hono-zod.d.mts 0.20 kB │ gzip: 0.15 kB
22
+ ℹ dist/compiler/tsdown.d.mts 0.19 kB │ gzip: 0.15 kB
23
+ ℹ dist/compiler/utils/exports.d.mts 0.10 kB │ gzip: 0.09 kB
24
+ ℹ dist/compiler/utils/index.d.mts 0.10 kB │ gzip: 0.09 kB
25
+ ℹ dist/cli/index.d.mts 0.01 kB │ gzip: 0.03 kB
26
+ ℹ dist/types/nativewind.d.mts 0.01 kB │ gzip: 0.03 kB
27
+ ℹ dist/exports-FMOinUbl.d.mts 0.25 kB │ gzip: 0.19 kB
28
+ ℹ 20 files, total: 6.24 kB
29
+ ✔ Build complete in 134ms
package/CHANGELOG.md CHANGED
@@ -1,81 +1,89 @@
1
- # @padosoft/config
2
-
3
- ## 1.2.2
4
-
5
- ### Patch Changes
6
-
7
- - [`b017a2c`](https://github.com/padosoft/ts-support/commit/b017a2cd9669260f2dd28eec06579a902175aece) Thanks [@47PADO47](https://github.com/47PADO47)! - bump deps
8
-
9
- ## 1.2.1
10
-
11
- ### Patch Changes
12
-
13
- - [`d01b29f`](https://github.com/padosoft/ts-support/commit/d01b29fb568b4b513a89c806c7f19f056fd7797f) Thanks [@47PADO47](https://github.com/47PADO47)! - update deps
14
-
15
- ## 1.2.0
16
-
17
- ### Minor Changes
18
-
19
- - [`ab3d36e`](https://github.com/padosoft/ts-support/commit/ab3d36e1cd5002925e63f59683fc66e7c8f8c1f7) Thanks [@47PADO47](https://github.com/47PADO47)! - update to typescript@6
20
-
21
- - [`ab3d36e`](https://github.com/padosoft/ts-support/commit/ab3d36e1cd5002925e63f59683fc66e7c8f8c1f7) Thanks [@47PADO47](https://github.com/47PADO47)! - update tsdown
22
-
23
- ### Patch Changes
24
-
25
- - [`ab3d36e`](https://github.com/padosoft/ts-support/commit/ab3d36e1cd5002925e63f59683fc66e7c8f8c1f7) Thanks [@47PADO47](https://github.com/47PADO47)! - update deps
26
-
27
- ## 1.1.7
28
-
29
- ### Patch Changes
30
-
31
- - [`e4f1ba8`](https://github.com/padosoft/ts-support/commit/e4f1ba8acf343670ebfd5251774af6c3c98a08ff) Thanks [@47PADO47](https://github.com/47PADO47)! - update deps
32
-
33
- ## 1.1.6
34
-
35
- ### Patch Changes
36
-
37
- - [`873297d`](https://github.com/padosoft/ts-support/commit/873297d85c8088ec344d8380e88cbc069da489d6) Thanks [@47PADO47](https://github.com/47PADO47)! - fix types exports
38
-
39
- ## 1.1.5
40
-
41
- ### Patch Changes
42
-
43
- - [`9dec4cc`](https://github.com/padosoft/ts-support/commit/9dec4cc15a9c3b5952da7ed399afea197eee51cf) Thanks [@47PADO47](https://github.com/47PADO47)! - update tsdown
44
-
45
- ## 1.1.4
46
-
47
- ### Patch Changes
48
-
49
- - [`2acb73a`](https://github.com/padosoft/ts-support/commit/2acb73a9756df5e8b1c948c90859220af0a9e263) Thanks [@47PADO47](https://github.com/47PADO47)! - update tools config
50
-
51
- ## 1.1.3
52
-
53
- ### Patch Changes
54
-
55
- - [`5a9c998`](https://github.com/padosoft/ts-support/commit/5a9c998e2bb601458bf3aed0e8e6ec5323f7dd2f) Thanks [@47PADO47](https://github.com/47PADO47)! - update exports
56
-
57
- ## 1.1.2
58
-
59
- ### Patch Changes
60
-
61
- - [`40564ee`](https://github.com/padosoft/ts-support/commit/40564ee614b8b065cb07ebb862044739b2ec9ed4) Thanks [@47PADO47](https://github.com/47PADO47)! - fix defaultCustomExports location update
62
-
63
- ## 1.1.1
64
-
65
- ### Patch Changes
66
-
67
- - [`2aedb22`](https://github.com/padosoft/ts-support/commit/2aedb22d494e362ef7aa2f973294cf6109da4684) Thanks [@47PADO47](https://github.com/47PADO47)! - add config package.json exports
68
-
69
- - [`f51d05b`](https://github.com/padosoft/ts-support/commit/f51d05b30bb2335fbbddf043815238e34ea29361) Thanks [@47PADO47](https://github.com/47PADO47)! - fix package.json exports
70
-
71
- ## 1.1.0
72
-
73
- ### Minor Changes
74
-
75
- - bdf8d88: Migrate compiler to tsdown
76
-
77
- ## 1.0.1
78
-
79
- ### Patch Changes
80
-
81
- - ef3d6dc: Compile @padosoft/config .ts files
1
+ # @padosoft/config
2
+
3
+ ## 1.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`3a27e7c`](https://github.com/padosoft/ts-support/commit/3a27e7cef1b942f5b09cf4322cf0daa38c7668df) Thanks [@47PADO47](https://github.com/47PADO47)! - Add `init editor` CLI command to scaffold `.vscode/settings.json` and `.zed/settings.json` from canonical Biome-focused editor settings.
8
+
9
+ Usage: `bunx @padosoft/config init editor [--force]`
10
+
11
+ ## 1.2.2
12
+
13
+ ### Patch Changes
14
+
15
+ - [`b017a2c`](https://github.com/padosoft/ts-support/commit/b017a2cd9669260f2dd28eec06579a902175aece) Thanks [@47PADO47](https://github.com/47PADO47)! - bump deps
16
+
17
+ ## 1.2.1
18
+
19
+ ### Patch Changes
20
+
21
+ - [`d01b29f`](https://github.com/padosoft/ts-support/commit/d01b29fb568b4b513a89c806c7f19f056fd7797f) Thanks [@47PADO47](https://github.com/47PADO47)! - update deps
22
+
23
+ ## 1.2.0
24
+
25
+ ### Minor Changes
26
+
27
+ - [`ab3d36e`](https://github.com/padosoft/ts-support/commit/ab3d36e1cd5002925e63f59683fc66e7c8f8c1f7) Thanks [@47PADO47](https://github.com/47PADO47)! - update to typescript@6
28
+
29
+ - [`ab3d36e`](https://github.com/padosoft/ts-support/commit/ab3d36e1cd5002925e63f59683fc66e7c8f8c1f7) Thanks [@47PADO47](https://github.com/47PADO47)! - update tsdown
30
+
31
+ ### Patch Changes
32
+
33
+ - [`ab3d36e`](https://github.com/padosoft/ts-support/commit/ab3d36e1cd5002925e63f59683fc66e7c8f8c1f7) Thanks [@47PADO47](https://github.com/47PADO47)! - update deps
34
+
35
+ ## 1.1.7
36
+
37
+ ### Patch Changes
38
+
39
+ - [`e4f1ba8`](https://github.com/padosoft/ts-support/commit/e4f1ba8acf343670ebfd5251774af6c3c98a08ff) Thanks [@47PADO47](https://github.com/47PADO47)! - update deps
40
+
41
+ ## 1.1.6
42
+
43
+ ### Patch Changes
44
+
45
+ - [`873297d`](https://github.com/padosoft/ts-support/commit/873297d85c8088ec344d8380e88cbc069da489d6) Thanks [@47PADO47](https://github.com/47PADO47)! - fix types exports
46
+
47
+ ## 1.1.5
48
+
49
+ ### Patch Changes
50
+
51
+ - [`9dec4cc`](https://github.com/padosoft/ts-support/commit/9dec4cc15a9c3b5952da7ed399afea197eee51cf) Thanks [@47PADO47](https://github.com/47PADO47)! - update tsdown
52
+
53
+ ## 1.1.4
54
+
55
+ ### Patch Changes
56
+
57
+ - [`2acb73a`](https://github.com/padosoft/ts-support/commit/2acb73a9756df5e8b1c948c90859220af0a9e263) Thanks [@47PADO47](https://github.com/47PADO47)! - update tools config
58
+
59
+ ## 1.1.3
60
+
61
+ ### Patch Changes
62
+
63
+ - [`5a9c998`](https://github.com/padosoft/ts-support/commit/5a9c998e2bb601458bf3aed0e8e6ec5323f7dd2f) Thanks [@47PADO47](https://github.com/47PADO47)! - update exports
64
+
65
+ ## 1.1.2
66
+
67
+ ### Patch Changes
68
+
69
+ - [`40564ee`](https://github.com/padosoft/ts-support/commit/40564ee614b8b065cb07ebb862044739b2ec9ed4) Thanks [@47PADO47](https://github.com/47PADO47)! - fix defaultCustomExports location update
70
+
71
+ ## 1.1.1
72
+
73
+ ### Patch Changes
74
+
75
+ - [`2aedb22`](https://github.com/padosoft/ts-support/commit/2aedb22d494e362ef7aa2f973294cf6109da4684) Thanks [@47PADO47](https://github.com/47PADO47)! - add config package.json exports
76
+
77
+ - [`f51d05b`](https://github.com/padosoft/ts-support/commit/f51d05b30bb2335fbbddf043815238e34ea29361) Thanks [@47PADO47](https://github.com/47PADO47)! - fix package.json exports
78
+
79
+ ## 1.1.0
80
+
81
+ ### Minor Changes
82
+
83
+ - bdf8d88: Migrate compiler to tsdown
84
+
85
+ ## 1.0.1
86
+
87
+ ### Patch Changes
88
+
89
+ - ef3d6dc: Compile @padosoft/config .ts files
package/README.md CHANGED
@@ -1,18 +1,77 @@
1
- # @gescat/config
2
- Collezione di configurazioni condivise nei vari progetti/pacchetti
3
-
4
- ```
5
- ├── config/
6
- │ ├── expo/ //configurazioni comuni ma specifiche di expo
7
- │ │ ├── plugin/ //configurazioni comuni per plugin per expo
8
- │ │ ├── app.config.ts // configurazione in formato ts di base
9
- │ │ ├── eas.json // Configurazione per compilazione in cloud di base
10
- │ │ ├── babel.config.js
11
- │ │ ├── metro.config.js
12
- │ ├── lib/ //configurazioni specifiche di librerie installate comuni
13
- │ │ ├── drizzle.config.ts //se usi la lib drizzle per ORM
14
- │ │ ├── jest.config.ts //se usi la lib jest per i testi
15
- │ │ ├── tailwind.config.ts //se usi la lib tailwind
16
- │ ├── tools/ //configurazioni specifiche di tool comuni
17
- │ │ ├── biome.json // se usi biome - config specifica e comune di tutto il progetto
18
- ```
1
+ # @padosoft/config
2
+
3
+ Shared TypeScript, Biome, and tsdown configurations for padosoft packages and apps.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install -D @padosoft/config
9
+ ```
10
+
11
+ ## Contents
12
+
13
+ ### TypeScript configs
14
+
15
+ Extend any of these base configs in your `tsconfig.json`:
16
+
17
+ ```json
18
+ { "extends": "@padosoft/config/typescript/base" }
19
+ { "extends": "@padosoft/config/typescript/compiler" }
20
+ { "extends": "@padosoft/config/typescript/expo" }
21
+ { "extends": "@padosoft/config/typescript/hono" }
22
+ ```
23
+
24
+ ### Biome config
25
+
26
+ ```json
27
+ { "extends": ["@padosoft/config/tools/biome"] }
28
+ ```
29
+
30
+ ### tsdown config factory
31
+
32
+ Use the `tsdown` helper to get a consistent bundler setup across packages:
33
+
34
+ ```ts
35
+ // tsdown.config.ts
36
+ import { tsdown } from "@padosoft/config/compiler/tsdown";
37
+
38
+ export default tsdown({
39
+ entry: ["src/index.ts"],
40
+ });
41
+ ```
42
+
43
+ The factory sets `dts: true`, `splitting: false`, `treeshake: true`, minification outside watch mode, and `outDir: "dist"` by default.
44
+
45
+ ### Compiler plugins
46
+
47
+ #### `hono-zod`
48
+
49
+ A tsdown plugin that handles the hono/zod integration for type generation:
50
+
51
+ ```ts
52
+ import { tsdown } from "@padosoft/config/compiler/tsdown";
53
+ import { honoZodPlugin } from "@padosoft/config/compiler/plugins/hono-zod";
54
+
55
+ export default tsdown({
56
+ plugins: [honoZodPlugin()],
57
+ });
58
+ ```
59
+
60
+ ### TypeScript type declarations
61
+
62
+ Import ambient declarations for CSS modules, NativeWind, Expo Router, and i18next:
63
+
64
+ ```ts
65
+ // In your tsconfig.json types array or a .d.ts file:
66
+ import "@padosoft/config/types/css";
67
+ import "@padosoft/config/types/nativewind";
68
+ import "@padosoft/config/types/expo-router";
69
+ import "@padosoft/config/types/i18next";
70
+ ```
71
+
72
+ ### Export utilities
73
+
74
+ ```ts
75
+ import { defaultCustomExports } from "@padosoft/config/compiler/utils/exports";
76
+ import { /* helpers */ } from "@padosoft/config/compiler/utils";
77
+ ```
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import{existsSync as e}from"node:fs";import{copyFile as t,mkdir as n,writeFile as r}from"node:fs/promises";import{dirname as i,join as a}from"node:path";import{fileURLToPath as o}from"node:url";import{parseArgs as s}from"node:util";const c=i(o(import.meta.url)),{values:l,positionals:u}=s({args:process.argv.slice(2),options:{force:{type:`boolean`,short:`f`,default:!1},preset:{type:`string`,default:`base`}},allowPositionals:!0}),[d,f]=u,p=l.force,m=l.preset,h=[`base`,`compiler`,`expo`,`hono`];async function g(n,r,i){if(e(r)&&!p){console.log(` skip ${i}`);return}await t(n,r),console.log(` write ${i}`)}async function _(t,n,i){if(e(n)&&!p){console.log(` skip ${i}`);return}await r(n,t,`utf8`),console.log(` write ${i}`)}function v(){console.log(`Usage:`),console.log(` bunx @padosoft/config init editor [--force]`),console.log(` bunx @padosoft/config init biome [--force]`),console.log(` bunx @padosoft/config init tsconfig [--preset base|compiler|expo|hono] [--force]`)}d!==`init`&&(v(),process.exit(1));const y=process.cwd();if(f===`editor`){let e=a(c,`../../src/editor`);await n(a(y,`.vscode`),{recursive:!0}),await g(a(e,`vscode/settings.json`),a(y,`.vscode/settings.json`),`.vscode/settings.json`),await n(a(y,`.zed`),{recursive:!0}),await g(a(e,`zed/settings.json`),a(y,`.zed/settings.json`),`.zed/settings.json`)}else f===`biome`?await _(`${JSON.stringify({$schema:`https://biomejs.dev/schemas/2.5.1/schema.json`,extends:[`@padosoft/config/tools/biome`]},null,` `)}\n`,a(y,`biome.json`),`biome.json`):f===`tsconfig`?(h.includes(m)||(console.error(`Unknown preset "${m}" — valid: ${h.join(`, `)}`),process.exit(1)),await _(`${JSON.stringify({extends:`@padosoft/config/typescript/${m}`},null,` `)}\n`,a(y,`tsconfig.json`),`tsconfig.json`)):(v(),process.exit(1));export{};
@@ -1 +1 @@
1
- import{defaultCustomExports as e}from"./utils/exports.mjs";import{defineConfig as t}from"tsdown";const n=n=>t(t=>{let r={...t,...n};return Array.isArray(r.entry)&&r.entry.push(`!dist`),r.exports&&typeof r.exports==`boolean`&&(r.exports={customExports:e}),{dts:!0,splitting:!1,treeshake:!0,minify:!r.watch,outDir:`dist`,...r}});export{n as tsdown};
1
+ import{t as e}from"../exports-Cp7dWSTV.mjs";import{defineConfig as t}from"tsdown";const n=n=>t(t=>{let r={...t,...n};return Array.isArray(r.entry)&&r.entry.push(`!dist`),r.exports&&typeof r.exports==`boolean`&&(r.exports={customExports:e}),{dts:!0,splitting:!1,treeshake:!0,minify:!r.watch,outDir:`dist`,...r}});export{n as tsdown};
@@ -1,6 +1,2 @@
1
- import { ExportsOptions } from "tsdown";
2
-
3
- //#region src/compiler/utils/exports.d.ts
4
- declare const defaultCustomExports: Extract<NonNullable<ExportsOptions["customExports"]>, (...args: never) => unknown>;
5
- //#endregion
1
+ import { t as defaultCustomExports } from "../../exports-FMOinUbl.mjs";
6
2
  export { defaultCustomExports };
@@ -1 +1 @@
1
- const e=e=>{let t={},n={".js":(e,t)=>({default:e,types:`${e.slice(0,-t.length)}.d.ts`}),".mjs":(e,t)=>({default:e,types:`${e.slice(0,-t.length)}.d.mts`})};for(let[r,i]of Object.entries(e)){let e=r.replace(/\\/g,`/`),a=typeof i==`string`?i.replace(/\\/g,`/`):i;if(typeof a!=`string`){t[e]=a;continue}let o=Object.entries(n).find(([e])=>a.endsWith(e));if(!o){t[e]=a;continue}let[s,c]=o;t[e]=c(a,s)}return t};export{e as defaultCustomExports};
1
+ import{t as e}from"../../exports-Cp7dWSTV.mjs";export{e as defaultCustomExports};
@@ -1,2 +1,2 @@
1
- import { defaultCustomExports } from "./exports.mjs";
1
+ import { t as defaultCustomExports } from "../../exports-FMOinUbl.mjs";
2
2
  export { defaultCustomExports };
@@ -1 +1 @@
1
- import{defaultCustomExports as e}from"./exports.mjs";export{e as defaultCustomExports};
1
+ import{t as e}from"../../exports-Cp7dWSTV.mjs";export{e as defaultCustomExports};
@@ -0,0 +1 @@
1
+ const e=e=>{let t={},n={".js":(e,t)=>({default:e,types:`${e.slice(0,-t.length)}.d.ts`}),".mjs":(e,t)=>({default:e,types:`${e.slice(0,-t.length)}.d.mts`})};for(let[r,i]of Object.entries(e)){let e=r.replace(/\\/g,`/`),a=typeof i==`string`?i.replace(/\\/g,`/`):i;if(typeof a!=`string`){t[e]=a;continue}let o=Object.entries(n).find(([e])=>a.endsWith(e));if(!o){t[e]=a;continue}let[s,c]=o;t[e]=c(a,s)}return t};export{e as t};
@@ -0,0 +1,6 @@
1
+ import { ExportsOptions } from "tsdown";
2
+
3
+ //#region src/compiler/utils/exports.d.ts
4
+ declare const defaultCustomExports: Extract<NonNullable<ExportsOptions["customExports"]>, (...args: never) => unknown>;
5
+ //#endregion
6
+ export { defaultCustomExports as t };
package/package.json CHANGED
@@ -1,57 +1,72 @@
1
- {
2
- "name": "@padosoft/config",
3
- "type": "module",
4
- "version": "1.2.2",
5
- "publishConfig": {
6
- "access": "public",
7
- "registry": "https://registry.npmjs.org/"
8
- },
9
- "repository": {
10
- "url": "git+https://github.com/padosoft/ts-support.git"
11
- },
12
- "scripts": {
13
- "build": "tsdown",
14
- "ts:check": "tsc --noEmit"
15
- },
16
- "exports": {
17
- "./compiler/plugins/hono-zod": {
18
- "default": "./dist/compiler/plugins/hono-zod.mjs",
19
- "types": "./dist/compiler/plugins/hono-zod.d.mts"
20
- },
21
- "./compiler/tsdown": {
22
- "default": "./dist/compiler/tsdown.mjs",
23
- "types": "./dist/compiler/tsdown.d.mts"
24
- },
25
- "./compiler/utils": {
26
- "default": "./dist/compiler/utils/index.mjs",
27
- "types": "./dist/compiler/utils/index.d.mts"
28
- },
29
- "./compiler/utils/exports": {
30
- "default": "./dist/compiler/utils/exports.mjs",
31
- "types": "./dist/compiler/utils/exports.d.mts"
32
- },
33
- "./types/css": {
34
- "default": "./dist/types/css.mjs",
35
- "types": "./dist/types/css.d.mts"
36
- },
37
- "./types/expo-router": {
38
- "default": "./dist/types/expo-router.mjs",
39
- "types": "./dist/types/expo-router.d.mts"
40
- },
41
- "./types/i18next": {
42
- "default": "./dist/types/i18next.mjs",
43
- "types": "./dist/types/i18next.d.mts"
44
- },
45
- "./types/nativewind": {
46
- "default": "./dist/types/nativewind.mjs",
47
- "types": "./dist/types/nativewind.d.mts"
48
- },
49
- "./package.json": "./package.json",
50
- "./typescript/base": "./src/typescript/base.json",
51
- "./typescript/compiler": "./src/typescript/compiler.json",
52
- "./typescript/expo": "./src/typescript/expo.json",
53
- "./typescript/hono": "./src/typescript/hono.json",
54
- "./tools/biome": "./src/tools/biome.json"
55
- },
56
- "dependencies": {}
57
- }
1
+ {
2
+ "name": "@padosoft/config",
3
+ "description": "Shared TypeScript, Biome, and tsdown configurations for padosoft packages and apps",
4
+ "keywords": [
5
+ "typescript",
6
+ "tsconfig",
7
+ "biome",
8
+ "tsdown",
9
+ "config",
10
+ "padosoft"
11
+ ],
12
+ "type": "module",
13
+ "version": "1.3.0",
14
+ "repository": {
15
+ "url": "git+https://github.com/padosoft/ts-support.git"
16
+ },
17
+ "publishConfig": {
18
+ "access": "public",
19
+ "registry": "https://registry.npmjs.org/"
20
+ },
21
+ "scripts": {
22
+ "build": "tsdown",
23
+ "ts:check": "tsc --noEmit"
24
+ },
25
+ "bin": {
26
+ "padosoft-config": "./dist/cli/index.mjs"
27
+ },
28
+ "exports": {
29
+ "./cli": {
30
+ "default": "./dist/cli/index.mjs",
31
+ "types": "./dist/cli/index.d.mts"
32
+ },
33
+ "./compiler/plugins/hono-zod": {
34
+ "default": "./dist/compiler/plugins/hono-zod.mjs",
35
+ "types": "./dist/compiler/plugins/hono-zod.d.mts"
36
+ },
37
+ "./compiler/tsdown": {
38
+ "default": "./dist/compiler/tsdown.mjs",
39
+ "types": "./dist/compiler/tsdown.d.mts"
40
+ },
41
+ "./compiler/utils": {
42
+ "default": "./dist/compiler/utils/index.mjs",
43
+ "types": "./dist/compiler/utils/index.d.mts"
44
+ },
45
+ "./compiler/utils/exports": {
46
+ "default": "./dist/compiler/utils/exports.mjs",
47
+ "types": "./dist/compiler/utils/exports.d.mts"
48
+ },
49
+ "./types/css": {
50
+ "default": "./dist/types/css.mjs",
51
+ "types": "./dist/types/css.d.mts"
52
+ },
53
+ "./types/expo-router": {
54
+ "default": "./dist/types/expo-router.mjs",
55
+ "types": "./dist/types/expo-router.d.mts"
56
+ },
57
+ "./types/i18next": {
58
+ "default": "./dist/types/i18next.mjs",
59
+ "types": "./dist/types/i18next.d.mts"
60
+ },
61
+ "./types/nativewind": {
62
+ "default": "./dist/types/nativewind.mjs",
63
+ "types": "./dist/types/nativewind.d.mts"
64
+ },
65
+ "./package.json": "./package.json",
66
+ "./typescript/base": "./src/typescript/base.json",
67
+ "./typescript/compiler": "./src/typescript/compiler.json",
68
+ "./typescript/expo": "./src/typescript/expo.json",
69
+ "./typescript/hono": "./src/typescript/hono.json",
70
+ "./tools/biome": "./src/tools/biome.json"
71
+ }
72
+ }
@@ -0,0 +1,99 @@
1
+ #!/usr/bin/env node
2
+ import { existsSync } from "node:fs";
3
+ import { copyFile, mkdir, writeFile } from "node:fs/promises";
4
+ import { dirname, join } from "node:path";
5
+ import { fileURLToPath } from "node:url";
6
+ import { parseArgs } from "node:util";
7
+
8
+ const __dirname = dirname(fileURLToPath(import.meta.url));
9
+
10
+ const { values, positionals } = parseArgs({
11
+ args: process.argv.slice(2),
12
+ options: {
13
+ force: { type: "boolean", short: "f", default: false },
14
+ preset: { type: "string", default: "base" },
15
+ },
16
+ allowPositionals: true,
17
+ });
18
+
19
+ const [command, subcommand] = positionals;
20
+ const force = values.force as boolean;
21
+ const preset = values.preset as string;
22
+
23
+ const TSCONFIG_PRESETS = ["base", "compiler", "expo", "hono"] as const;
24
+ type TsconfigPreset = (typeof TSCONFIG_PRESETS)[number];
25
+
26
+ async function copyIfNeeded(src: string, dest: string, label: string) {
27
+ if (existsSync(dest) && !force) {
28
+ console.log(` skip ${label}`);
29
+ return;
30
+ }
31
+ await copyFile(src, dest);
32
+ console.log(` write ${label}`);
33
+ }
34
+
35
+ async function writeIfNeeded(content: string, dest: string, label: string) {
36
+ if (existsSync(dest) && !force) {
37
+ console.log(` skip ${label}`);
38
+ return;
39
+ }
40
+ await writeFile(dest, content, "utf8");
41
+ console.log(` write ${label}`);
42
+ }
43
+
44
+ function usage() {
45
+ console.log("Usage:");
46
+ console.log(" bunx @padosoft/config init editor [--force]");
47
+ console.log(" bunx @padosoft/config init biome [--force]");
48
+ console.log(
49
+ " bunx @padosoft/config init tsconfig [--preset base|compiler|expo|hono] [--force]",
50
+ );
51
+ }
52
+
53
+ if (command !== "init") {
54
+ usage();
55
+ process.exit(1);
56
+ }
57
+
58
+ const cwd = process.cwd();
59
+
60
+ if (subcommand === "editor") {
61
+ const editorDir = join(__dirname, "../../src/editor");
62
+
63
+ await mkdir(join(cwd, ".vscode"), { recursive: true });
64
+ await copyIfNeeded(
65
+ join(editorDir, "vscode/settings.json"),
66
+ join(cwd, ".vscode/settings.json"),
67
+ ".vscode/settings.json",
68
+ );
69
+
70
+ await mkdir(join(cwd, ".zed"), { recursive: true });
71
+ await copyIfNeeded(
72
+ join(editorDir, "zed/settings.json"),
73
+ join(cwd, ".zed/settings.json"),
74
+ ".zed/settings.json",
75
+ );
76
+ } else if (subcommand === "biome") {
77
+ const config = {
78
+ $schema: "https://biomejs.dev/schemas/2.5.1/schema.json",
79
+ extends: ["@padosoft/config/tools/biome"],
80
+ };
81
+ await writeIfNeeded(
82
+ `${JSON.stringify(config, null, "\t")}\n`,
83
+ join(cwd, "biome.json"),
84
+ "biome.json",
85
+ );
86
+ } else if (subcommand === "tsconfig") {
87
+ if (!TSCONFIG_PRESETS.includes(preset as TsconfigPreset)) {
88
+ console.error(`Unknown preset "${preset}" — valid: ${TSCONFIG_PRESETS.join(", ")}`);
89
+ process.exit(1);
90
+ }
91
+ await writeIfNeeded(
92
+ `${JSON.stringify({ extends: `@padosoft/config/typescript/${preset}` }, null, "\t")}\n`,
93
+ join(cwd, "tsconfig.json"),
94
+ "tsconfig.json",
95
+ );
96
+ } else {
97
+ usage();
98
+ process.exit(1);
99
+ }
@@ -1,21 +1,21 @@
1
- import type { Plugin } from "rolldown";
2
-
3
- const replaceZodOpenapiImportPlugin: Plugin = {
4
- name: "replace-z-hono-openapi-import",
5
-
6
- transform(code, id) {
7
- // Only process .ts or .tsx files
8
- if (!id.endsWith(".ts") && !id.endsWith(".tsx")) return;
9
-
10
- const updatedCode = code.replace(
11
- /import\s*\{\s*z\s*\}\s*from\s*["']hono\/openapi["'];?/g,
12
- `import { z } from "zod";`,
13
- );
14
-
15
- return {
16
- code: updatedCode,
17
- };
18
- },
19
- };
20
-
21
- export default replaceZodOpenapiImportPlugin;
1
+ import type { Plugin } from "rolldown";
2
+
3
+ const replaceZodOpenapiImportPlugin: Plugin = {
4
+ name: "replace-z-hono-openapi-import",
5
+
6
+ transform(code, id) {
7
+ // Only process .ts or .tsx files
8
+ if (!id.endsWith(".ts") && !id.endsWith(".tsx")) return;
9
+
10
+ const updatedCode = code.replace(
11
+ /import\s*\{\s*z\s*\}\s*from\s*["']hono\/openapi["'];?/g,
12
+ `import { z } from "zod";`,
13
+ );
14
+
15
+ return {
16
+ code: updatedCode,
17
+ };
18
+ },
19
+ };
20
+
21
+ export default replaceZodOpenapiImportPlugin;
@@ -1,33 +1,33 @@
1
- import { defineConfig, type InlineConfig, type UserConfigFn } from "tsdown";
2
- import { defaultCustomExports } from "./utils/exports.ts";
3
-
4
- export const tsdown = (packageOptions?: InlineConfig): UserConfigFn => {
5
- return defineConfig((overrideOptions) => {
6
- const options = {
7
- ...overrideOptions,
8
- ...packageOptions,
9
- };
10
-
11
- if (Array.isArray(options.entry)) {
12
- options.entry.push("!dist");
13
- }
14
-
15
- /**
16
- * Apply default exports transformation
17
- */
18
- if (options.exports && typeof options.exports === "boolean") {
19
- options.exports = {
20
- customExports: defaultCustomExports,
21
- };
22
- }
23
-
24
- return {
25
- dts: true,
26
- splitting: false,
27
- treeshake: true,
28
- minify: !options.watch,
29
- outDir: "dist",
30
- ...options,
31
- };
32
- });
33
- };
1
+ import { defineConfig, type InlineConfig, type UserConfigFn } from "tsdown";
2
+ import { defaultCustomExports } from "./utils/exports.ts";
3
+
4
+ export const tsdown = (packageOptions?: InlineConfig): UserConfigFn => {
5
+ return defineConfig((overrideOptions) => {
6
+ const options = {
7
+ ...overrideOptions,
8
+ ...packageOptions,
9
+ };
10
+
11
+ if (Array.isArray(options.entry)) {
12
+ options.entry.push("!dist");
13
+ }
14
+
15
+ /**
16
+ * Apply default exports transformation
17
+ */
18
+ if (options.exports && typeof options.exports === "boolean") {
19
+ options.exports = {
20
+ customExports: defaultCustomExports,
21
+ };
22
+ }
23
+
24
+ return {
25
+ dts: true,
26
+ splitting: false,
27
+ treeshake: true,
28
+ minify: !options.watch,
29
+ outDir: "dist",
30
+ ...options,
31
+ };
32
+ });
33
+ };
@@ -1,47 +1,47 @@
1
- import type { ExportsOptions } from "tsdown";
2
-
3
- export const defaultCustomExports: Extract<
4
- NonNullable<ExportsOptions["customExports"]>,
5
- (...args: never) => unknown
6
- > = (exports) => {
7
- const fixed: typeof exports = {};
8
-
9
- const handlers: Record<
10
- string,
11
- (value: string, ext: string) => { default: string; types: string }
12
- > = {
13
- ".js": (v, e) => ({
14
- default: v,
15
- types: `${v.slice(0, -e.length)}.d.ts`,
16
- }),
17
- ".mjs": (v, e) => ({
18
- default: v,
19
- types: `${v.slice(0, -e.length)}.d.mts`,
20
- }),
21
- };
22
-
23
- for (const [key, value] of Object.entries(exports)) {
24
- const normalizedKey = key.replace(/\\/g, "/");
25
- const normalizedValue =
26
- typeof value === "string" ? value.replace(/\\/g, "/") : value;
27
-
28
- if (typeof normalizedValue !== "string") {
29
- fixed[normalizedKey] = normalizedValue;
30
- continue;
31
- }
32
-
33
- const handler = Object.entries(handlers).find(([ext]) =>
34
- normalizedValue.endsWith(ext),
35
- );
36
-
37
- if (!handler) {
38
- fixed[normalizedKey] = normalizedValue;
39
- continue;
40
- }
41
-
42
- const [ext, fn] = handler;
43
- fixed[normalizedKey] = fn(normalizedValue, ext);
44
- }
45
-
46
- return fixed;
47
- };
1
+ import type { ExportsOptions } from "tsdown";
2
+
3
+ export const defaultCustomExports: Extract<
4
+ NonNullable<ExportsOptions["customExports"]>,
5
+ (...args: never) => unknown
6
+ > = (exports) => {
7
+ const fixed: typeof exports = {};
8
+
9
+ const handlers: Record<
10
+ string,
11
+ (value: string, ext: string) => { default: string; types: string }
12
+ > = {
13
+ ".js": (v, e) => ({
14
+ default: v,
15
+ types: `${v.slice(0, -e.length)}.d.ts`,
16
+ }),
17
+ ".mjs": (v, e) => ({
18
+ default: v,
19
+ types: `${v.slice(0, -e.length)}.d.mts`,
20
+ }),
21
+ };
22
+
23
+ for (const [key, value] of Object.entries(exports)) {
24
+ const normalizedKey = key.replace(/\\/g, "/");
25
+ const normalizedValue =
26
+ typeof value === "string" ? value.replace(/\\/g, "/") : value;
27
+
28
+ if (typeof normalizedValue !== "string") {
29
+ fixed[normalizedKey] = normalizedValue;
30
+ continue;
31
+ }
32
+
33
+ const handler = Object.entries(handlers).find(([ext]) =>
34
+ normalizedValue.endsWith(ext),
35
+ );
36
+
37
+ if (!handler) {
38
+ fixed[normalizedKey] = normalizedValue;
39
+ continue;
40
+ }
41
+
42
+ const [ext, fn] = handler;
43
+ fixed[normalizedKey] = fn(normalizedValue, ext);
44
+ }
45
+
46
+ return fixed;
47
+ };
@@ -1 +1 @@
1
- export * from "./exports.ts";
1
+ export * from "./exports.ts";
@@ -0,0 +1,41 @@
1
+ {
2
+ "[javascript]": {
3
+ "editor.defaultFormatter": "biomejs.biome"
4
+ },
5
+ "[javascriptreact]": {
6
+ "editor.defaultFormatter": "biomejs.biome"
7
+ },
8
+ "[typescript]": {
9
+ "editor.defaultFormatter": "biomejs.biome"
10
+ },
11
+ "[typescriptreact]": {
12
+ "editor.defaultFormatter": "biomejs.biome"
13
+ },
14
+ "editor.codeActionsOnSave": {
15
+ "source.fixAll.biome": "explicit",
16
+ "source.organizeImports.biome": "explicit",
17
+ "source.sortMembers": "explicit"
18
+ },
19
+ "editor.defaultFormatter": "biomejs.biome",
20
+ "editor.formatOnSave": true,
21
+ "js/ts.preferences.autoImportSpecifierExcludeRegexes": [
22
+ "^react-native-reanimated/lib/*",
23
+ "^expo-router/build/*"
24
+ ],
25
+ "js/ts.preferences.preferTypeOnlyAutoImports": true,
26
+ "js/ts.tsdk.path": "node_modules\\typescript\\lib",
27
+ "json.schemaDownload.trustedDomains": {
28
+ "https://schemastore.azurewebsites.net/": true,
29
+ "https://raw.githubusercontent.com/microsoft/vscode/": true,
30
+ "https://raw.githubusercontent.com/devcontainers/spec/": true,
31
+ "https://www.schemastore.org/": true,
32
+ "https://json.schemastore.org/": true,
33
+ "https://json-schema.org/": true,
34
+ "https://developer.microsoft.com/json-schemas/": true,
35
+ "https://raw.githubusercontent.com/": true,
36
+ "https://biomejs.dev": true,
37
+ "https://turbo.build": true,
38
+ "https://nitro.margelo.com": true,
39
+ "https://unpkg.com": true
40
+ }
41
+ }
@@ -0,0 +1,81 @@
1
+ {
2
+ "code_actions_on_format": {
3
+ "source.fixAll.biome": true,
4
+ "source.organizeImports.biome": true
5
+ },
6
+ "formatter": {
7
+ "language_server": {
8
+ "name": "biome"
9
+ }
10
+ },
11
+ "language_servers": ["biome", "..."],
12
+ "languages": {
13
+ "CSS": {
14
+ "formatter": {
15
+ "language_server": {
16
+ "name": "biome"
17
+ }
18
+ }
19
+ },
20
+ "GraphQL": {
21
+ "formatter": {
22
+ "language_server": {
23
+ "name": "biome"
24
+ }
25
+ }
26
+ },
27
+ "JavaScript": {
28
+ "formatter": {
29
+ "language_server": {
30
+ "name": "biome"
31
+ }
32
+ }
33
+ },
34
+ "JSON": {
35
+ "formatter": {
36
+ "language_server": {
37
+ "name": "biome"
38
+ }
39
+ }
40
+ },
41
+ "JSONC": {
42
+ "formatter": {
43
+ "language_server": {
44
+ "name": "biome"
45
+ }
46
+ }
47
+ },
48
+ "JSX": {
49
+ "formatter": {
50
+ "language_server": {
51
+ "name": "biome"
52
+ }
53
+ }
54
+ },
55
+ "TSX": {
56
+ "formatter": {
57
+ "language_server": {
58
+ "name": "biome"
59
+ }
60
+ }
61
+ },
62
+ "TypeScript": {
63
+ "formatter": {
64
+ "language_server": {
65
+ "name": "biome"
66
+ }
67
+ }
68
+ }
69
+ },
70
+ "lsp": {
71
+ "biome": {
72
+ "settings": {
73
+ "require_config_file": true
74
+ }
75
+ }
76
+ },
77
+ "telemetry": {
78
+ "diagnostics": false,
79
+ "metrics": false
80
+ }
81
+ }
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://biomejs.dev/schemas/2.4.8/schema.json",
2
+ "$schema": "https://biomejs.dev/schemas/2.5.1/schema.json",
3
3
  "assist": {
4
4
  "actions": {
5
5
  "source": {
@@ -32,7 +32,7 @@
32
32
  "correctness": {
33
33
  "noUnusedImports": "warn"
34
34
  },
35
- "recommended": true,
35
+ "preset": "recommended",
36
36
  "style": {
37
37
  "noInferrableTypes": "error",
38
38
  "noParameterAssign": "error",
package/src/types/css.ts CHANGED
@@ -1,9 +1,9 @@
1
- declare module "*.module.css" {
2
- const classes: { readonly [key: string]: string };
3
- export default classes;
4
- }
5
-
6
- declare module "*.css" {
7
- const content: string;
8
- export default content;
9
- }
1
+ declare module "*.module.css" {
2
+ const classes: { readonly [key: string]: string };
3
+ export default classes;
4
+ }
5
+
6
+ declare module "*.css" {
7
+ const content: string;
8
+ export default content;
9
+ }
@@ -1,29 +1,29 @@
1
- import type {
2
- NativeStackHeaderItemButton as NativeStackHeaderItemButtonProps,
3
- NativeStackHeaderItemMenuAction as NativeStackHeaderItemMenuActionProps,
4
- NativeStackHeaderItemMenu as NativeStackHeaderItemMenuProps,
5
- NativeStackNavigationOptions as NativeStackProps,
6
- } from "expo-router/build/react-navigation/native-stack";
7
- import type { NativeTabs } from "expo-router/unstable-native-tabs";
8
-
9
- declare module "expo-router/react-navigation" {
10
- interface NativeStackNavigationOptions extends NativeStackProps {}
11
- interface NativeStackHeaderItemButton
12
- extends NativeStackHeaderItemButtonProps {}
13
- interface NativeStackHeaderItemMenu extends NativeStackHeaderItemMenuProps {}
14
- interface NativeStackHeaderItemMenuAction
15
- extends NativeStackHeaderItemMenuActionProps {}
16
- }
17
-
18
- export interface NativeTabIcon
19
- extends Extract<
20
- Extract<
21
- React.ComponentProps<typeof NativeTabs.Trigger.Icon>,
22
- {
23
- md: unknown;
24
- }
25
- >,
26
- {
27
- sf?: unknown;
28
- }
29
- > {}
1
+ import type {
2
+ NativeStackHeaderItemButton as NativeStackHeaderItemButtonProps,
3
+ NativeStackHeaderItemMenuAction as NativeStackHeaderItemMenuActionProps,
4
+ NativeStackHeaderItemMenu as NativeStackHeaderItemMenuProps,
5
+ NativeStackNavigationOptions as NativeStackProps,
6
+ } from "expo-router/build/react-navigation/native-stack";
7
+ import type { NativeTabs } from "expo-router/unstable-native-tabs";
8
+
9
+ declare module "expo-router/react-navigation" {
10
+ interface NativeStackNavigationOptions extends NativeStackProps {}
11
+ interface NativeStackHeaderItemButton
12
+ extends NativeStackHeaderItemButtonProps {}
13
+ interface NativeStackHeaderItemMenu extends NativeStackHeaderItemMenuProps {}
14
+ interface NativeStackHeaderItemMenuAction
15
+ extends NativeStackHeaderItemMenuActionProps {}
16
+ }
17
+
18
+ export interface NativeTabIcon
19
+ extends Extract<
20
+ Extract<
21
+ React.ComponentProps<typeof NativeTabs.Trigger.Icon>,
22
+ {
23
+ md: unknown;
24
+ }
25
+ >,
26
+ {
27
+ sf?: unknown;
28
+ }
29
+ > {}
@@ -1,50 +1,50 @@
1
- export interface I18nConfig {
2
- Locale: never;
3
- Translation: never;
4
- }
5
-
6
- type Locale = I18nConfig["Locale"];
7
- type Translation = I18nConfig["Translation"];
8
-
9
- /**
10
- * Custom type configuration used to enable fully type-safe i18next translations.
11
- *
12
- * Consumers should augment the configuration interface exposed by this package
13
- * to provide their application's `Locale` and `Translation` types.
14
- *
15
- * Ensure this declaration is included by the TypeScript compiler (typically via
16
- * a `.d.ts` file in your project).
17
- *
18
- * @example
19
- * ```ts
20
- * import type { resources } from "./i18n";
21
- *
22
- * declare module "@gescat/i18n/config" {
23
- * interface I18nConfig {
24
- * Locale: "it" | "en";
25
- * Translation: typeof resources;
26
- * }
27
- * }
28
- * ```
29
- *
30
- * @see https://www.i18next.com/overview/typescript
31
- */
32
- export interface CustomI18NTypeOptions {
33
- enableSelector: false;
34
- defaultNS: keyof Translation;
35
- resources: Translation;
36
- lng: Locale | undefined;
37
- fallbackLng: Locale | undefined;
38
- }
39
-
40
- /**
41
- * Sovrascrizione interfaccia del pacchetto i18next
42
- */
43
- declare module "i18next" {
44
- interface CustomTypeOptions extends CustomI18NTypeOptions {}
45
- interface i18n {
46
- language: Locale;
47
- languages: Locale[];
48
- resolvedLanguage?: Locale;
49
- }
50
- }
1
+ export interface I18nConfig {
2
+ Locale: never;
3
+ Translation: never;
4
+ }
5
+
6
+ type Locale = I18nConfig["Locale"];
7
+ type Translation = I18nConfig["Translation"];
8
+
9
+ /**
10
+ * Custom type configuration used to enable fully type-safe i18next translations.
11
+ *
12
+ * Consumers should augment the configuration interface exposed by this package
13
+ * to provide their application's `Locale` and `Translation` types.
14
+ *
15
+ * Ensure this declaration is included by the TypeScript compiler (typically via
16
+ * a `.d.ts` file in your project).
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * import type { resources } from "./i18n";
21
+ *
22
+ * declare module "@gescat/i18n/config" {
23
+ * interface I18nConfig {
24
+ * Locale: "it" | "en";
25
+ * Translation: typeof resources;
26
+ * }
27
+ * }
28
+ * ```
29
+ *
30
+ * @see https://www.i18next.com/overview/typescript
31
+ */
32
+ export interface CustomI18NTypeOptions {
33
+ enableSelector: false;
34
+ defaultNS: keyof Translation;
35
+ resources: Translation;
36
+ lng: Locale | undefined;
37
+ fallbackLng: Locale | undefined;
38
+ }
39
+
40
+ /**
41
+ * Sovrascrizione interfaccia del pacchetto i18next
42
+ */
43
+ declare module "i18next" {
44
+ interface CustomTypeOptions extends CustomI18NTypeOptions {}
45
+ interface i18n {
46
+ language: Locale;
47
+ languages: Locale[];
48
+ resolvedLanguage?: Locale;
49
+ }
50
+ }
@@ -1 +1 @@
1
- /// <reference types="nativewind/types" />
1
+ /// <reference types="nativewind/types" />
package/tsdown.config.ts CHANGED
@@ -1,47 +1,47 @@
1
- import { readdir } from "node:fs/promises";
2
- import path from "node:path";
3
- import { fileURLToPath } from "node:url";
4
- import type { UserConfigFn } from "tsdown";
5
- import { tsdown } from "./src/compiler/tsdown.ts";
6
- import { defaultCustomExports } from "./src/compiler/utils/index.ts";
7
-
8
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
9
-
10
- const assetsDirs = ["typescript", "tools"];
11
- const assetsExts = ["json"];
12
-
13
- const config: UserConfigFn = tsdown({
14
- entry: ["src/**/*.ts"],
15
- deps: {
16
- neverBundle: ["tsdown", "rolldown"],
17
- },
18
- exports: {
19
- customExports: async (exports, context) => {
20
- const assetExports: Record<string, string> = {
21
- ...exports,
22
- };
23
-
24
- for (const dir of assetsDirs) {
25
- const absDir = path.join(__dirname, "src", dir);
26
- const files = await readdir(absDir);
27
-
28
- for (const file of files) {
29
- const ext = path.extname(file).slice(1);
30
- console.log(path.extname(file), ext);
31
-
32
- if (!assetsExts.includes(ext)) continue;
33
-
34
- const base = path.basename(file, `.${ext}`);
35
- const relPath = `./${dir}/${base}`;
36
- const fullRelPath = `./src/${dir}/${file}`;
37
-
38
- assetExports[relPath] = fullRelPath;
39
- }
40
- }
41
-
42
- return await defaultCustomExports(assetExports, context);
43
- },
44
- },
45
- });
46
-
47
- export default config;
1
+ import { readdir } from "node:fs/promises";
2
+ import path from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ import type { UserConfigFn } from "tsdown";
5
+ import { tsdown } from "./src/compiler/tsdown.ts";
6
+ import { defaultCustomExports } from "./src/compiler/utils/index.ts";
7
+
8
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
9
+
10
+ const assetsDirs = ["typescript", "tools"];
11
+ const assetsExts = ["json"];
12
+
13
+ const config: UserConfigFn = tsdown({
14
+ entry: ["src/**/*.ts"],
15
+ deps: {
16
+ neverBundle: ["tsdown", "rolldown"],
17
+ },
18
+ exports: {
19
+ bin: { "padosoft-config": "./src/cli/index.ts" },
20
+ customExports: async (exports, context) => {
21
+ const assetExports: Record<string, string> = {
22
+ ...exports,
23
+ };
24
+
25
+ for (const dir of assetsDirs) {
26
+ const absDir = path.join(__dirname, "src", dir);
27
+ const files = await readdir(absDir);
28
+
29
+ for (const file of files) {
30
+ const ext = path.extname(file).slice(1);
31
+
32
+ if (!assetsExts.includes(ext)) continue;
33
+
34
+ const base = path.basename(file, `.${ext}`);
35
+ const relPath = `./${dir}/${base}`;
36
+ const fullRelPath = `./src/${dir}/${file}`;
37
+
38
+ assetExports[relPath] = fullRelPath;
39
+ }
40
+ }
41
+
42
+ return await defaultCustomExports(assetExports, context);
43
+ },
44
+ },
45
+ });
46
+
47
+ export default config;