Skip to content

Commit 69e87af

Browse files
committed
πŸ“ Add tsdoc
1 parent 2611a0a commit 69e87af

File tree

10 files changed

+40
-8
lines changed

10 files changed

+40
-8
lines changed

β€Žpackages/application/package.jsonβ€Ž

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
],
3434
"scripts": {
3535
"build": "pnpm run \"/^build:.*/\"",
36-
"build:tsc": "tsc -b tsconfig.build.json",
36+
"build:tsc": "tsdown",
3737
"clean": "pnpm run \"/^clean:.*/\"",
3838
"clean:tsc": "rm -rf dist",
3939
"docs": "node '../../markdown.mjs'",
@@ -52,6 +52,8 @@
5252
"@w5s/global-storage": "workspace:^1.0.0-alpha.0"
5353
},
5454
"devDependencies": {
55+
"@w5s/tsdown-config": "1.0.0-alpha.4",
56+
"tsdown": "0.21.2",
5557
"typescript": "5.9.3",
5658
"vite": "latest",
5759
"vitest": "latest"

β€Žpackages/application/src/Meta.tsβ€Ž

Lines changed: 0 additions & 3 deletions
This file was deleted.

β€Žpackages/application/src/index.spec.tsβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ describe('index', () => {
66
expect(Object.keys(Module).toSorted()).toEqual(
77
[
88
// public exports
9+
'meta',
910
'useRef',
1011
'useConfiguration',
1112
'useState',

β€Žpackages/application/src/index.tsβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
export * from './meta.js';
12
export * from './ConfigurationRef.js';
2-
export * from './Meta.js';
33
export * from './State.js';
44
export * from './StateKey.js';
55
export * from './useConfiguration.js';
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export const meta = Object.freeze({
2+
// @ts-ignore - these variables are injected at build time
3+
name: (typeof __PACKAGE_NAME__ === 'undefined' ? '' : __PACKAGE_NAME__) as string,
4+
// @ts-ignore - these variables are injected at build time
5+
version: (typeof __PACKAGE_VERSION__ === 'undefined' ? '' : __PACKAGE_VERSION__) as string,
6+
});
7+
8+
export interface Meta {
9+
readonly name: string;
10+
}

β€Žpackages/application/src/useConfiguration.tsβ€Ž

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,21 @@ import { useRef } from './useRef.js';
33
import { useNamespace } from './useNamespace.js';
44
import type { Ref } from '@w5s/core';
55
import type { State } from './State.js';
6-
import type { Meta } from './Meta.js';
6+
import type { Meta } from './meta.js';
77

8+
/**
9+
*
10+
* @example
11+
* ```typescript
12+
* const app = { name: 'my-app' };
13+
* const configRef = useConfiguration(app, { mode: 'light', retries: 3 });
14+
* configRef.update({ retries: 4 });
15+
* console.log(configRef.current); // { mode: 'light', retries: 4 }
16+
* ```
17+
* @param meta
18+
* @param initial
19+
* @param store
20+
*/
821
export function useConfiguration<Configuration>(
922
meta: Meta,
1023
initial: Configuration,

β€Žpackages/application/src/useNamespace.tsβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { useRef } from './useRef.js';
22
import { useStorage } from '@w5s/global-storage';
33
import type { Ref } from '@w5s/core';
44
import type { State } from './State.js';
5-
import type { Meta } from './Meta.js';
5+
import type { Meta } from './meta.js';
66

77
/**
88
* Return a new `Ref` containing the namespace for the given `meta.name`.

β€Žpackages/application/src/useState.tsβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { useNamespace } from './useNamespace.js';
33
import { useRef } from './useRef.js';
44
import type { State } from './State.js';
55
import type { StateKey } from './StateKey.js';
6-
import type { Meta } from './Meta.js';
6+
import type { Meta } from './meta.js';
77

88
/**
99
* Return a new `Ref` containing the state for the given `meta.name` and `key`.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { defineConfig } from '@w5s/tsdown-config';
2+
3+
export default defineConfig({});

β€Žpnpm-lock.yamlβ€Ž

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
Β (0)