@morda-dev/create-sdk 1.3.0 → 1.3.10
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 +16 -0
- package/package.json +16 -3
- package/template/package.json +4 -1
- package/template/src/index.ts +24 -3
- package/template/src/modules/user.ts +18 -19
package/README.md
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# create-sdk
|
|
2
|
+
# create-sdk
|
|
2
3
|

|
|
3
4
|

|
|
4
5
|

|
|
@@ -8,6 +9,8 @@
|
|
|
8
9
|
> ⚠️ Early-stage project (v0.x).
|
|
9
10
|
> Public API is intentionally strict, but may evolve before v1.0.0.
|
|
10
11
|
|
|
12
|
+
> **If it’s not exported from `src/index.ts`, it’s not part of the public API.**
|
|
13
|
+
|
|
11
14
|
`create-sdk` is a CLI tool that bootstraps a modern TypeScript SDK with an
|
|
12
15
|
**ESM-first setup**, **API Extractor**, and a **CI-ready structure** —
|
|
13
16
|
so you can focus on features, not boilerplate.
|
|
@@ -38,6 +41,19 @@ npm run build
|
|
|
38
41
|
|
|
39
42
|
That’s it. You now have a solid, production-oriented SDK foundation.
|
|
40
43
|
|
|
44
|
+
## 📁 Project structure
|
|
45
|
+
|
|
46
|
+
The generated SDK includes:
|
|
47
|
+
|
|
48
|
+
- `src/index.ts` — the single public API entrypoint
|
|
49
|
+
- `src/modules/*` — internal implementation modules
|
|
50
|
+
- `src/types/*` — public & internal types
|
|
51
|
+
- `dist/` — compiled output (ESM)
|
|
52
|
+
- `api-extractor.json` — public API surface control
|
|
53
|
+
- CI workflow for build & API checks
|
|
54
|
+
|
|
55
|
+
Only symbols exported from `src/index.ts` are considered public and stable.
|
|
56
|
+
|
|
41
57
|
|
|
42
58
|
## 📘 Example SDK
|
|
43
59
|
|
package/package.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morda-dev/create-sdk",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.10",
|
|
4
4
|
"description": "CLI to scaffold a production-ready TypeScript SDK with a strict public API",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"type": "module",
|
|
7
|
+
|
|
7
8
|
"bin": {
|
|
8
9
|
"create-sdk": "bin/create-sdk.js"
|
|
9
10
|
},
|
|
11
|
+
|
|
10
12
|
"files": [
|
|
11
13
|
"bin",
|
|
12
14
|
"src",
|
|
@@ -14,17 +16,22 @@
|
|
|
14
16
|
"README.md",
|
|
15
17
|
"LICENSE"
|
|
16
18
|
],
|
|
19
|
+
|
|
17
20
|
"engines": {
|
|
18
21
|
"node": ">=18"
|
|
19
22
|
},
|
|
23
|
+
|
|
20
24
|
"repository": {
|
|
21
25
|
"type": "git",
|
|
22
26
|
"url": "git+https://github.com/mordaHQ/create-sdk.git"
|
|
23
27
|
},
|
|
28
|
+
|
|
24
29
|
"homepage": "https://github.com/mordaHQ/create-sdk",
|
|
30
|
+
|
|
25
31
|
"bugs": {
|
|
26
32
|
"url": "https://github.com/mordaHQ/create-sdk/issues"
|
|
27
33
|
},
|
|
34
|
+
|
|
28
35
|
"keywords": [
|
|
29
36
|
"create-sdk",
|
|
30
37
|
"typescript",
|
|
@@ -36,20 +43,26 @@
|
|
|
36
43
|
"esm",
|
|
37
44
|
"developer-tools"
|
|
38
45
|
],
|
|
46
|
+
|
|
39
47
|
"scripts": {
|
|
40
48
|
"test": "vitest run",
|
|
41
49
|
"test:watch": "vitest",
|
|
42
50
|
"test:smoke": "node ./bin/create-sdk.js __tmp-smoke-sdk --yes --no-install --no-git && node -e \"import('fs').then(fs => fs.rmSync('__tmp-smoke-sdk', { recursive: true, force: true }))\""
|
|
43
51
|
},
|
|
52
|
+
|
|
44
53
|
"dependencies": {
|
|
45
54
|
"prompts": "^2.4.2"
|
|
46
55
|
},
|
|
56
|
+
|
|
47
57
|
"devDependencies": {
|
|
48
58
|
"@types/node": "^18.19.0",
|
|
49
|
-
"vitest": "^1.6.0",
|
|
50
59
|
"execa": "^9.6.1",
|
|
51
60
|
"fs-extra": "^11.3.3",
|
|
52
61
|
"tmp": "^0.2.5",
|
|
53
|
-
"
|
|
62
|
+
"vitest": "^1.6.0"
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
"publishConfig": {
|
|
66
|
+
"access": "public"
|
|
54
67
|
}
|
|
55
68
|
}
|
package/template/package.json
CHANGED
package/template/src/index.ts
CHANGED
|
@@ -17,9 +17,30 @@
|
|
|
17
17
|
export type { User, ApiResult } from "./types/user.js";
|
|
18
18
|
|
|
19
19
|
/* ============================================================================
|
|
20
|
-
* Functions (Public)
|
|
20
|
+
* Values & Functions (Public)
|
|
21
21
|
* ============================================================================
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
-
/**
|
|
25
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Public user entity.
|
|
26
|
+
*
|
|
27
|
+
* Exported explicitly to allow direct consumption:
|
|
28
|
+
* `import { user } from "sdk"`
|
|
29
|
+
*
|
|
30
|
+
* @public
|
|
31
|
+
*/
|
|
32
|
+
export { user } from "./modules/user.js";
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Returns a user entity.
|
|
36
|
+
*
|
|
37
|
+
* @public
|
|
38
|
+
*/
|
|
39
|
+
export { getUser } from "./modules/user.js";
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Example aggregate function.
|
|
43
|
+
*
|
|
44
|
+
* @public
|
|
45
|
+
*/
|
|
46
|
+
export { sumAges } from "./modules/user.js";
|
|
@@ -1,31 +1,30 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { User } from "../types/user.js";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
+
* Public user constant
|
|
5
|
+
*
|
|
4
6
|
* @public
|
|
5
|
-
* Get a user by id
|
|
6
7
|
*/
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
13
|
-
}
|
|
8
|
+
export const user: User = {
|
|
9
|
+
id: 1,
|
|
10
|
+
name: "Alice",
|
|
11
|
+
age: 30,
|
|
12
|
+
};
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
};
|
|
14
|
+
/**
|
|
15
|
+
* Returns a user entity.
|
|
16
|
+
*
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
export function getUser(): User {
|
|
20
|
+
return user;
|
|
23
21
|
}
|
|
24
22
|
|
|
25
23
|
/**
|
|
24
|
+
* Example aggregate function.
|
|
25
|
+
*
|
|
26
26
|
* @public
|
|
27
|
-
* Sum ages of users
|
|
28
27
|
*/
|
|
29
28
|
export function sumAges(users: User[]): number {
|
|
30
|
-
return users.reduce((
|
|
29
|
+
return users.reduce((a, u) => a + u.age, 0);
|
|
31
30
|
}
|