@breadstone-tools/markdowner-app 0.0.157 → 0.0.159
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/Run.d.ts +3 -0
- package/Run.d.ts.map +1 -1
- package/Run.js +53 -14
- package/Run.js.map +1 -1
- package/package.json +3 -3
package/Run.d.ts
CHANGED
|
@@ -9,5 +9,8 @@ export interface IRunConfig {
|
|
|
9
9
|
export interface IRunResult {
|
|
10
10
|
files: Array<string>;
|
|
11
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Executes the Markdowner workflow with the given configuration.
|
|
14
|
+
*/
|
|
12
15
|
export declare function run(config: IRunConfig): Promise<IRunResult>;
|
|
13
16
|
//# sourceMappingURL=Run.d.ts.map
|
package/Run.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Run.d.ts","sourceRoot":"","sources":["../src/Run.ts"],"names":[],"mappings":"AAEA,OAAO,EAAqB,KAAK,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAKvF,MAAM,WAAW,UAAU;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACrB,UAAU,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IAC/B,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,UAAU;IACvB,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACxB;
|
|
1
|
+
{"version":3,"file":"Run.d.ts","sourceRoot":"","sources":["../src/Run.ts"],"names":[],"mappings":"AAEA,OAAO,EAAqB,KAAK,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAKvF,MAAM,WAAW,UAAU;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACrB,UAAU,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IAC/B,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,UAAU;IACvB,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACxB;AAoED;;GAEG;AACH,wBAAsB,GAAG,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAGjE"}
|
package/Run.js
CHANGED
|
@@ -1,20 +1,59 @@
|
|
|
1
1
|
// #region Imports
|
|
2
2
|
import { MarkdownProcessor } from '@breadstone-tools/markdowner-core';
|
|
3
3
|
import { File, Path } from '@breadstone-infrastructure/utilities';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Handles the Markdown transformation workflow for the Markdowner tool.
|
|
6
|
+
*/
|
|
7
|
+
class RunExecutor {
|
|
8
|
+
// #region Fields
|
|
9
|
+
_config;
|
|
10
|
+
_markdownProcessor;
|
|
11
|
+
_result;
|
|
12
|
+
// #endregion
|
|
13
|
+
// #region Properties
|
|
14
|
+
get isDryRun() {
|
|
15
|
+
return this._config.dryRun ?? false;
|
|
16
|
+
}
|
|
17
|
+
// #endregion
|
|
18
|
+
// #region Ctor
|
|
19
|
+
/**
|
|
20
|
+
* Initializes a new instance of the run executor.
|
|
21
|
+
*
|
|
22
|
+
* @param config The configuration to use for the run.
|
|
23
|
+
*/
|
|
24
|
+
constructor(config) {
|
|
25
|
+
this._config = config;
|
|
26
|
+
this._markdownProcessor = new MarkdownProcessor(config.processors);
|
|
27
|
+
this._result = {
|
|
28
|
+
files: []
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
// #endregion
|
|
32
|
+
// #region Methods
|
|
33
|
+
/**
|
|
34
|
+
* Executes the Markdown processing pipeline.
|
|
35
|
+
*/
|
|
36
|
+
async execute() {
|
|
37
|
+
const files = File.glob(this._config.files);
|
|
38
|
+
files.forEach((filePath) => this.processFile(filePath));
|
|
39
|
+
return this._result;
|
|
40
|
+
}
|
|
41
|
+
processFile(filePath) {
|
|
42
|
+
const content = File.readAllText(filePath);
|
|
43
|
+
const processedMarkdown = this._markdownProcessor.process(content);
|
|
44
|
+
if (this.isDryRun) {
|
|
45
|
+
return;
|
|
16
46
|
}
|
|
17
|
-
|
|
18
|
-
|
|
47
|
+
const newPath = Path.changeExtension(filePath, '.md.html');
|
|
48
|
+
File.writeAllText(newPath, processedMarkdown);
|
|
49
|
+
this._result.files.push(newPath);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Executes the Markdowner workflow with the given configuration.
|
|
54
|
+
*/
|
|
55
|
+
export async function run(config) {
|
|
56
|
+
const executor = new RunExecutor(config);
|
|
57
|
+
return executor.execute();
|
|
19
58
|
}
|
|
20
59
|
//# sourceMappingURL=Run.js.map
|
package/Run.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Run.js","sourceRoot":"","sources":["../src/Run.ts"],"names":[],"mappings":"AAAA,kBAAkB;AAElB,OAAO,EAAE,iBAAiB,EAAmB,MAAM,mCAAmC,CAAC;AACvF,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,sCAAsC,CAAC;AAgBlE,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"Run.js","sourceRoot":"","sources":["../src/Run.ts"],"names":[],"mappings":"AAAA,kBAAkB;AAElB,OAAO,EAAE,iBAAiB,EAAmB,MAAM,mCAAmC,CAAC;AACvF,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,sCAAsC,CAAC;AAgBlE;;GAEG;AACH,MAAM,WAAW;IAEb,iBAAiB;IAEA,OAAO,CAAa;IACpB,kBAAkB,CAAoB;IACtC,OAAO,CAAa;IAErC,aAAa;IAEb,qB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IAAI,WAAW,CAAC,MAAM,CAAC,CAAC;IACzC,OAAO,QAAQ,CAAC,OAAO,EAAE,CAAC;AAC9B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@breadstone-tools/markdowner-app",
|
|
3
3
|
"description": "Markdowner cli",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.159",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "andre.wehlert <awehlert@breadstone.de> (https://www.breadstone.de)",
|
|
7
7
|
"repository": {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"module": "./Index.js",
|
|
14
14
|
"types": "./Index.d.ts",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@breadstone-infrastructure/utilities": "^0.0.
|
|
17
|
-
"@breadstone-tools/markdowner-core": "^0.0.
|
|
16
|
+
"@breadstone-infrastructure/utilities": "^0.0.159",
|
|
17
|
+
"@breadstone-tools/markdowner-core": "^0.0.159"
|
|
18
18
|
}
|
|
19
19
|
}
|