embedex 0.3.1 → 0.3.3
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 +57 -57
- package/package.json +2 -2
- package/src/bin/cli.js +1 -1
package/README.md
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
# embedex <!-- omit from toc -->
|
|
2
2
|
|
|
3
|
-
Embed shared text and code snippets from source files into destination files. For example:
|
|
3
|
+
Embed shared text and code snippets from source files into destination files that appear on hover in IDEs. For example:
|
|
4
4
|
|
|
5
5
|
- Embed TypeScript examples into TypeDoc comments and your README.
|
|
6
6
|
- Embed a Markdown snippet into multiple JSDoc comments.
|
|
7
7
|
|
|
8
|
-
`embedex` helps ensure a single source of truth while
|
|
8
|
+
`embedex` helps ensure a single source of truth while keeping sources runnable, linted, tested, and up-to-date with the code they are documenting.
|
|
9
9
|
|
|
10
10
|
## Table of contents <!-- omit from toc -->
|
|
11
11
|
|
|
12
12
|
- [Install](#install)
|
|
13
13
|
- [Usage](#usage)
|
|
14
|
-
- [
|
|
14
|
+
- [CLI reference](#cli-reference)
|
|
15
15
|
- [Local development commands](#local-development-commands)
|
|
16
16
|
|
|
17
17
|
## Install
|
|
@@ -41,76 +41,76 @@ npm install --global embedex
|
|
|
41
41
|
|
|
42
42
|
2. In the destination file, add an `<embedex source="..."></embedex>` tag that includes the source file's path.
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
- `./README.md`:
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
```
|
|
47
|
+
# greeter
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
Greets a person by name.
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
<embedex source="examples/greeter.ts">
|
|
52
|
+
</embedex>
|
|
53
|
+
```
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
- `./src/greeter.ts`:
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
57
|
+
```ts
|
|
58
|
+
/**
|
|
59
|
+
* Greets a person by name.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* <embedex source="examples/greeter.ts">
|
|
63
|
+
* </embedex>
|
|
64
|
+
*/
|
|
65
|
+
function greet(name: string) {
|
|
66
|
+
console.log(`Hello, ${name}!`);
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
69
|
|
|
70
70
|
3. Run `npx embedex`.
|
|
71
|
-
4. The source is embedded!
|
|
71
|
+
4. The source is embedded!
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
- `./README.md`:
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
````
|
|
76
|
+
# greeter
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
Greets a person by name.
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
<embedex source="examples/greeter.ts">
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
```ts
|
|
83
|
+
import { greet } from "@my-scope/greeter";
|
|
84
84
|
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
greet("world");
|
|
86
|
+
```
|
|
87
87
|
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
</embedex>
|
|
89
|
+
````
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
- `./src/greeter.ts`:
|
|
92
92
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
93
|
+
````ts
|
|
94
|
+
/**
|
|
95
|
+
* Greets a person by name.
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* <embedex source="examples/greeter.ts">
|
|
99
|
+
*
|
|
100
|
+
* ```ts
|
|
101
|
+
* import { greet } from "@my-scope/greeter";
|
|
102
|
+
*
|
|
103
|
+
* greet("world");
|
|
104
|
+
* ```
|
|
105
|
+
*
|
|
106
|
+
* </embedex>
|
|
107
|
+
*/
|
|
108
|
+
function greet(name: string) {
|
|
109
|
+
console.log(`Hello, ${name}!`);
|
|
110
|
+
}
|
|
111
|
+
````
|
|
112
112
|
|
|
113
|
-
##
|
|
113
|
+
## CLI reference
|
|
114
114
|
|
|
115
115
|
```
|
|
116
116
|
Usage: embedex [options]
|
|
@@ -119,7 +119,7 @@ Embed shared text and code snippets from source files into destination files.
|
|
|
119
119
|
|
|
120
120
|
Options:
|
|
121
121
|
-V, --version output the version number
|
|
122
|
-
-
|
|
122
|
+
-s, --sourcesGlob <pattern> sources glob pattern (default: "examples/**/*.{md,ts}")
|
|
123
123
|
-c, --check verify if sources are correctly embedded without making changes,
|
|
124
124
|
exits with non-zero code if updates are needed; useful for CI/CD
|
|
125
125
|
pipelines (default: false)
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "embedex",
|
|
3
3
|
"description": "Embed shared text and code snippets from source files into destination files.",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.3",
|
|
5
5
|
"bin": {
|
|
6
6
|
"embedex": "./src/bin/cli.js"
|
|
7
7
|
},
|
|
8
8
|
"bugs": "https://github.com/ClipboardHealth/core-utils/issues",
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@commander-js/extra-typings": "
|
|
10
|
+
"@commander-js/extra-typings": "13.0.0",
|
|
11
11
|
"glob": "11.0.0",
|
|
12
12
|
"tslib": "2.8.0",
|
|
13
13
|
"yoctocolors-cjs": "2.1.2"
|
package/src/bin/cli.js
CHANGED
|
@@ -9,7 +9,7 @@ const program = new extra_typings_1.Command()
|
|
|
9
9
|
.name(package_json_1.name)
|
|
10
10
|
.description(package_json_1.description)
|
|
11
11
|
.version(String(package_json_1.version))
|
|
12
|
-
.addOption(new extra_typings_1.Option("-
|
|
12
|
+
.addOption(new extra_typings_1.Option("-s, --sourcesGlob <pattern>", "sources glob pattern").default("examples/**/*.{md,ts}"))
|
|
13
13
|
.addOption(new extra_typings_1.Option("-c, --check", "verify if sources are correctly embedded without making changes, exits with non-zero code if updates are needed; useful for CI/CD pipelines").default(false))
|
|
14
14
|
.addOption(new extra_typings_1.Option("-v, --verbose", "show verbose output").default(false));
|
|
15
15
|
program.parse();
|