@podosoft/podokit-template-engine 0.1.0 → 0.1.1
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 +46 -0
- package/package.json +4 -2
package/README.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# @podosoft/podokit-template-engine
|
|
2
|
+
|
|
3
|
+
Template utilities used by the [PodoKit](https://github.com/podosoft-dev/podokit) CLI: token rendering, recursive template copying, and `package.json` merging.
|
|
4
|
+
|
|
5
|
+
> This package is primarily an internal building block for `@podosoft/podokit`. It is published so the CLI is installable from the registry, but the API is small and reusable on its own.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @podosoft/podokit-template-engine
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## API
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import {
|
|
17
|
+
renderTokens,
|
|
18
|
+
copyTemplate,
|
|
19
|
+
mergePackageJson,
|
|
20
|
+
resolveOutputName,
|
|
21
|
+
} from "@podosoft/podokit-template-engine";
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### `renderTokens(content, vars)`
|
|
25
|
+
|
|
26
|
+
Replace `{{key}}` tokens with values from `vars`. Unknown tokens are left untouched.
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
renderTokens("# {{name}}", { name: "my-app" }); // "# my-app"
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### `copyTemplate(srcDir, destDir, vars)`
|
|
33
|
+
|
|
34
|
+
Recursively copy a template directory, rendering tokens in text files. Files named `dot-<x>` are written as `.<x>` (so `dot-gitignore` → `.gitignore`), which lets templates ship files that npm would otherwise strip.
|
|
35
|
+
|
|
36
|
+
### `mergePackageJson(base, overlay)`
|
|
37
|
+
|
|
38
|
+
Deep-merge two `package.json`-shaped objects: objects merge recursively, arrays concatenate and de-duplicate, and scalar overlay values win. Neither input is mutated.
|
|
39
|
+
|
|
40
|
+
### `resolveOutputName(name)`
|
|
41
|
+
|
|
42
|
+
Map a template file name to its output name (applies the `dot-` convention).
|
|
43
|
+
|
|
44
|
+
## License
|
|
45
|
+
|
|
46
|
+
[Apache-2.0](https://github.com/podosoft-dev/podokit/blob/main/LICENSE)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@podosoft/podokit-template-engine",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Template rendering, copying, and package.json merge utilities for PodoKit.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -10,7 +10,9 @@
|
|
|
10
10
|
},
|
|
11
11
|
"main": "dist/index.js",
|
|
12
12
|
"types": "dist/index.d.ts",
|
|
13
|
-
"files": [
|
|
13
|
+
"files": [
|
|
14
|
+
"dist"
|
|
15
|
+
],
|
|
14
16
|
"engines": {
|
|
15
17
|
"node": ">=20"
|
|
16
18
|
},
|