writr 1.6.9 → 1.8.0
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/bin/writr +7 -3
- package/init/article-complex.md +40 -0
- package/init/article-ejs.md +40 -0
- package/init/article-unpublished.md +11 -0
- package/init/article1-simple.md +13 -0
- package/init/article1.md +11 -0
- package/init/article2.md +14 -0
- package/init/big-content.md +11 -0
- package/init/config.json +9 -0
- package/init/images/Introducing Docula 1.png +0 -0
- package/init/images/Introducing Docula 2.jpeg +0 -0
- package/init/images/Introducing Docula 3.png +0 -0
- package/init/images/Introducing Docula 4.png +0 -0
- package/init/permalink-test.md +13 -0
- package/init/templates/index.hjs +13 -0
- package/init/templates/partials/header.hjs +2 -0
- package/init/templates/post.hjs +19 -0
- package/init/templates/post2.hjs +17 -0
- package/init/templates/post3.ejs +7 -0
- package/init/templates/tag.hjs +9 -0
- package/package.json +23 -18
- package/dist/cache.d.ts +0 -18
- package/dist/cache.js +0 -76
- package/dist/cache.js.map +0 -1
- package/dist/config.d.ts +0 -26
- package/dist/config.js +0 -105
- package/dist/config.js.map +0 -1
- package/dist/data/dataProviderInterface.d.ts +0 -12
- package/dist/data/dataProviderInterface.js +0 -3
- package/dist/data/dataProviderInterface.js.map +0 -1
- package/dist/data/dataService.d.ts +0 -19
- package/dist/data/dataService.js +0 -139
- package/dist/data/dataService.js.map +0 -1
- package/dist/data/fileDataProvider.d.ts +0 -20
- package/dist/data/fileDataProvider.js +0 -134
- package/dist/data/fileDataProvider.js.map +0 -1
- package/dist/index.d.ts +0 -11
- package/dist/index.js +0 -69
- package/dist/index.js.map +0 -1
- package/dist/post.d.ts +0 -31
- package/dist/post.js +0 -195
- package/dist/post.js.map +0 -1
- package/dist/render/atomRenderProvider.d.ts +0 -8
- package/dist/render/atomRenderProvider.js +0 -55
- package/dist/render/atomRenderProvider.js.map +0 -1
- package/dist/render/htmRenderlProvider.d.ts +0 -14
- package/dist/render/htmRenderlProvider.js +0 -119
- package/dist/render/htmRenderlProvider.js.map +0 -1
- package/dist/render/imageRenderProvider.d.ts +0 -8
- package/dist/render/imageRenderProvider.js +0 -19
- package/dist/render/imageRenderProvider.js.map +0 -1
- package/dist/render/jsonRenderProvider.d.ts +0 -8
- package/dist/render/jsonRenderProvider.js +0 -30
- package/dist/render/jsonRenderProvider.js.map +0 -1
- package/dist/render/renderProviderInterface.d.ts +0 -5
- package/dist/render/renderProviderInterface.js +0 -3
- package/dist/render/renderProviderInterface.js.map +0 -1
- package/dist/storage/fileStorageProvider.d.ts +0 -11
- package/dist/storage/fileStorageProvider.js +0 -76
- package/dist/storage/fileStorageProvider.js.map +0 -1
- package/dist/storage/storageProviderInterface.d.ts +0 -7
- package/dist/storage/storageProviderInterface.js +0 -3
- package/dist/storage/storageProviderInterface.js.map +0 -1
- package/dist/storage/storageService.d.ts +0 -13
- package/dist/storage/storageService.js +0 -30
- package/dist/storage/storageService.js.map +0 -1
- package/dist/tag.d.ts +0 -9
- package/dist/tag.js +0 -39
- package/dist/tag.js.map +0 -1
package/bin/writr
CHANGED
|
@@ -7,7 +7,11 @@ const Writr = require("../dist/index").Writr;
|
|
|
7
7
|
const writr = new Writr;
|
|
8
8
|
|
|
9
9
|
writr.parseCLI(process);
|
|
10
|
-
|
|
10
|
+
|
|
11
|
+
if(writr.command === 'build') {
|
|
12
|
+
writr.runCLI().then(() => {
|
|
11
13
|
process.exit();
|
|
12
|
-
|
|
13
|
-
})
|
|
14
|
+
console.info("Done!");
|
|
15
|
+
})
|
|
16
|
+
}
|
|
17
|
+
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 'Docula: Persistent Links and Styles!'
|
|
3
|
+
tags:
|
|
4
|
+
- Github
|
|
5
|
+
- Open Source
|
|
6
|
+
- Docula
|
|
7
|
+
date: 2017-03-07
|
|
8
|
+
layout: post2
|
|
9
|
+
featured_image: Docula_%20Persistent%20Links%20and%20Styles%201.jpeg
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+

|
|
13
|
+
|
|
14
|
+
## Docula: Persistent Links and Styles!
|
|
15
|
+
|
|
16
|
+
In our last update, we simplified the modules down to two ([docula-ui](https://www.npmjs.com/package/docula-ui), and [docula-core](https://www.npmjs.com/package/docula-core)) and also added In-Memory data stores as the default. Now with this latest update, we made it so that you can do [persistent linking](https://docu.la/docs/article/configuration/deeplinks) and [customize the interface](https://docu.la/docs/article/configuration/customization) it very easily.
|
|
17
|
+
|
|
18
|
+
### Persistent Linking
|
|
19
|
+
|
|
20
|
+
There are many times a document can move around in a GitHub repository, but you want to keep to an URL that works. [Check out how to do it here!](https://docu.la/docs/article/configuration/deeplinks)
|
|
21
|
+
|
|
22
|
+
### Styling! Let’s Get Started
|
|
23
|
+
|
|
24
|
+
The first step is to see how we did this. Since we use [GitHub](https://github.com/) for our knowledge base repository, it made sense to extend the configuration for skinning there. Here is what the [Fons repository](https://github.com/fonsio/public-kb) looks like with the `style.css` and `navigation.html` file in the root.
|
|
25
|
+
|
|
26
|
+

|
|
27
|
+
|
|
28
|
+
The configuration for your [docula-ui](https://www.npmjs.com/package/docula-ui) is easy to do the config. You will want to add in the style.css path and navigation.html path. Also, if you have a customized logo, you can do that. Here is an example that we use for Fons.
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
Docula.install(app, '/help', {git: 'https://github.com/fonsio/public-kb.git',pageTitle: 'Fons',logo: 'https://fons.io/n/img/fons-logo-300x85.png',redis: redisConfig(),elasticsearch: elasticConfig(),topNavigation: 'navigation.html',cssTheme: 'theme.scss'});
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Yep, its as simple as that and you can see the style.css and navigation.html examples here: [https://github.com/fonsio/public-kb](https://github.com/fonsio/public-kb)
|
|
35
|
+
|
|
36
|
+
<div>
|
|
37
|
+
<p>foo</p>
|
|
38
|
+
</div>
|
|
39
|
+
***Happy Styling!***
|
|
40
|
+
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 'Docula: EJS Style'
|
|
3
|
+
tags:
|
|
4
|
+
- Github
|
|
5
|
+
- Open Source
|
|
6
|
+
- Docula
|
|
7
|
+
date: 2017-03-07
|
|
8
|
+
layout: post3
|
|
9
|
+
featured_image: Docula_%20Persistent%20Links%20and%20Styles%201.jpeg
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+

|
|
13
|
+
|
|
14
|
+
## Docula: Persistent Links and Styles!
|
|
15
|
+
|
|
16
|
+
In our last update, we simplified the modules down to two ([docula-ui](https://www.npmjs.com/package/docula-ui), and [docula-core](https://www.npmjs.com/package/docula-core)) and also added In-Memory data stores as the default. Now with this latest update, we made it so that you can do [persistent linking](https://docu.la/docs/article/configuration/deeplinks) and [customize the interface](https://docu.la/docs/article/configuration/customization) it very easily.
|
|
17
|
+
|
|
18
|
+
### Persistent Linking
|
|
19
|
+
|
|
20
|
+
There are many times a document can move around in a GitHub repository, but you want to keep to an URL that works. [Check out how to do it here!](https://docu.la/docs/article/configuration/deeplinks)
|
|
21
|
+
|
|
22
|
+
### Styling! Let’s Get Started
|
|
23
|
+
|
|
24
|
+
The first step is to see how we did this. Since we use [GitHub](https://github.com/) for our knowledge base repository, it made sense to extend the configuration for skinning there. Here is what the [Fons repository](https://github.com/fonsio/public-kb) looks like with the `style.css` and `navigation.html` file in the root.
|
|
25
|
+
|
|
26
|
+

|
|
27
|
+
|
|
28
|
+
The configuration for your [docula-ui](https://www.npmjs.com/package/docula-ui) is easy to do the config. You will want to add in the style.css path and navigation.html path. Also, if you have a customized logo, you can do that. Here is an example that we use for Fons.
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
Docula.install(app, '/help', {git: 'https://github.com/fonsio/public-kb.git',pageTitle: 'Fons',logo: 'https://fons.io/n/img/fons-logo-300x85.png',redis: redisConfig(),elasticsearch: elasticConfig(),topNavigation: 'navigation.html',cssTheme: 'theme.scss'});
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Yep, its as simple as that and you can see the style.css and navigation.html examples here: [https://github.com/fonsio/public-kb](https://github.com/fonsio/public-kb)
|
|
35
|
+
|
|
36
|
+
<div>
|
|
37
|
+
<p>foo</p>
|
|
38
|
+
</div>
|
|
39
|
+
***Happy Styling!***
|
|
40
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 'Article Simple'
|
|
3
|
+
date: 2018-15-01
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+

|
|
7
|
+
|
|
8
|
+
## Docula: Persistent Links and Styles!
|
|
9
|
+
|
|
10
|
+
In our last update, we simplified the modules down to two (<u>[docula-ui](https://www.npmjs.com/package/docula-ui)</u>, and <u>[docula-core](https://www.npmjs.com/package/docula-core))</u> and also added In-Memory data stores as the default. Now with this latest update, we made it so that you can do <u>[persistent linking](https://docu.la/docs/article/configuration/deeplinks)</u> and <u>[customize the interface](https://docu.la/docs/article/configuration/customization)</u> it very easily.
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
package/init/article1.md
ADDED
package/init/article2.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Tesla Model 3
|
|
3
|
+
author: Elon Musk
|
|
4
|
+
url: all-about-the-tesla-model-3
|
|
5
|
+
date: 2016-08-12
|
|
6
|
+
publishedAt: 6/25/2017
|
|
7
|
+
keywords: tesla, model 3, elon, musk
|
|
8
|
+
categories: muskified, nice3
|
|
9
|
+
tags: tesla, model 3,Whale,cool
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
How now brown cow.
|
|
13
|
+
|
|
14
|
+
This is how we do it
|
package/init/config.json
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 'Article Perm'
|
|
3
|
+
date: 2018-12-04
|
|
4
|
+
permalink: '/foo/crazy/url/article-perm'
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
## Getting Persistent links in a blog document is critical
|
|
10
|
+
|
|
11
|
+
In our last update, we simplified the modules down to two (<u>[docula-ui](https://www.npmjs.com/package/docula-ui)</u>, and <u>[docula-core](https://www.npmjs.com/package/docula-core))</u> and also added In-Memory data stores as the default. Now with this latest update, we made it so that you can do <u>[persistent linking](https://docu.la/docs/article/configuration/deeplinks)</u> and <u>[customize the interface](https://docu.la/docs/article/configuration/customization)</u> it very easily.
|
|
12
|
+
|
|
13
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{{#each posts}}
|
|
2
|
+
<p>{{formatDate date "MM/DD/YYYY"}}</p>
|
|
3
|
+
<p><a href="{{url}}">{{title}} - {{author}}</a></p>
|
|
4
|
+
{{/each}}
|
|
5
|
+
|
|
6
|
+
<p>Tags: <br />
|
|
7
|
+
<ul>
|
|
8
|
+
{{#each tags}}
|
|
9
|
+
<li><a href="{{id}}">{{name}}</a></li>{{/each}}
|
|
10
|
+
</ul>
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
{{formatDate "" "YYYY"}}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<h1>Post</h1>
|
|
2
|
+
|
|
3
|
+
{{> header}}
|
|
4
|
+
|
|
5
|
+
<p>{{post.title}}</p>
|
|
6
|
+
<p>{{post.author}}</p>
|
|
7
|
+
<p>{{{post.body}}}</p>
|
|
8
|
+
|
|
9
|
+
<p>{{post.matter.featured_image}}</p>
|
|
10
|
+
|
|
11
|
+
<p>{{previousPost.id}}</p>
|
|
12
|
+
<p>{{nextPost.id}}</p>
|
|
13
|
+
|
|
14
|
+
<h1>Tags</h1>
|
|
15
|
+
<ul>
|
|
16
|
+
{{#each tags}}
|
|
17
|
+
<li>{{name}}</li>
|
|
18
|
+
{{/each}}
|
|
19
|
+
</ul>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<h1>Post 2</h1>
|
|
2
|
+
|
|
3
|
+
<p>{{post.title}}</p>
|
|
4
|
+
<p>{{post.author}}</p>
|
|
5
|
+
<p>{{{post.body}}}</p>
|
|
6
|
+
|
|
7
|
+
<p>{{post.matter.featured_image}}</p>
|
|
8
|
+
|
|
9
|
+
<p>{{previousPost.id}}</p>
|
|
10
|
+
<p>{{nextPost.id}}</p>
|
|
11
|
+
|
|
12
|
+
<h1>Tags</h1>
|
|
13
|
+
<ul>
|
|
14
|
+
{{#each tags}}
|
|
15
|
+
<li>{{name}}</li>
|
|
16
|
+
{{/each}}
|
|
17
|
+
</ul>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "writr",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "A Simple to Use Markdown Blog",
|
|
5
5
|
"main": "./dist/index",
|
|
6
6
|
"types": "./dist/index",
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
],
|
|
26
26
|
"scripts": {
|
|
27
27
|
"watch": "tsc -w -p .",
|
|
28
|
-
"clean-all": "npm run clean && rm -rf node_modules && rm -rf coverage && rm -rf package-lock.json",
|
|
28
|
+
"clean-all": "npm run clean && rm -rf node_modules && rm -rf coverage && rm -rf package-lock.json && rm -rf ./test/output",
|
|
29
29
|
"clean": "rm -rf ./dist && npm run clean-output",
|
|
30
30
|
"clean-output": "rm -rf ./blog_output",
|
|
31
31
|
"compile": "npm run clean && tsc -p .",
|
|
32
32
|
"build": "npm run test && npm run compile",
|
|
33
|
-
"test": "jest --coverage && npm run clean-output",
|
|
33
|
+
"test": "npm run clean-output && jest --coverage && npm run clean-output",
|
|
34
34
|
"test-output": "npm run compile && node ./bin/writr -p ./blog_example"
|
|
35
35
|
},
|
|
36
36
|
"bin": {
|
|
@@ -38,37 +38,42 @@
|
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"array-sort": "^1.0.0",
|
|
41
|
+
"axios": "^0.26.1",
|
|
41
42
|
"cheerio": "^1.0.0-rc.10",
|
|
42
|
-
"commander": "^
|
|
43
|
+
"commander": "^9.1.0",
|
|
43
44
|
"del": "^6.0.0",
|
|
44
|
-
"ecto": "^1.1
|
|
45
|
+
"ecto": "^1.2.1",
|
|
45
46
|
"feed": "^4.2.2",
|
|
46
|
-
"fs-extra": "^10.0.
|
|
47
|
+
"fs-extra": "^10.0.1",
|
|
47
48
|
"gray-matter": "^4.0.3",
|
|
48
49
|
"helper-date": "^1.0.1",
|
|
49
|
-
"
|
|
50
|
-
"
|
|
50
|
+
"inquirer": "^8.2.2",
|
|
51
|
+
"keyv": "^4.1.1",
|
|
52
|
+
"luxon": "^2.3.1",
|
|
53
|
+
"node-html-markdown": "^1.1.3",
|
|
51
54
|
"parse-json": "^6.0.2",
|
|
52
55
|
"striptags": "^3.2.0",
|
|
53
|
-
"winston": "^3.
|
|
56
|
+
"winston": "^3.6.0"
|
|
54
57
|
},
|
|
55
58
|
"devDependencies": {
|
|
56
59
|
"@types/array-sort": "^1.0.0",
|
|
57
60
|
"@types/fs-extra": "^9.0.13",
|
|
58
|
-
"@types/
|
|
59
|
-
"@types/
|
|
60
|
-
"@types/
|
|
61
|
-
"@types/
|
|
61
|
+
"@types/inquirer": "^8.2.0",
|
|
62
|
+
"@types/jest": "^27.4.1",
|
|
63
|
+
"@types/keyv": "^3.1.4",
|
|
64
|
+
"@types/luxon": "^2.3.1",
|
|
65
|
+
"@types/node": "^17.0.23",
|
|
62
66
|
"@types/parse-json": "^4.0.0",
|
|
63
|
-
"jest": "^27.
|
|
67
|
+
"jest": "^27.5.1",
|
|
64
68
|
"source-map-support": "^0.5.21",
|
|
65
|
-
"ts-jest": "^27.1.
|
|
66
|
-
"ts-node": "^10.
|
|
67
|
-
"typescript": "^4.
|
|
69
|
+
"ts-jest": "^27.1.4",
|
|
70
|
+
"ts-node": "^10.7.0",
|
|
71
|
+
"typescript": "^4.6.3"
|
|
68
72
|
},
|
|
69
73
|
"files": [
|
|
70
74
|
"dist",
|
|
71
|
-
"bin"
|
|
75
|
+
"bin",
|
|
76
|
+
"init"
|
|
72
77
|
],
|
|
73
78
|
"jest": {
|
|
74
79
|
"globals": {
|
package/dist/cache.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Config } from "./config";
|
|
2
|
-
import { Post } from "./post";
|
|
3
|
-
import { Tag } from "./tag";
|
|
4
|
-
import Keyv = require("keyv");
|
|
5
|
-
export declare class Cache {
|
|
6
|
-
cache: Keyv;
|
|
7
|
-
constructor(config: Config);
|
|
8
|
-
getPost(key: string): Promise<Post | undefined>;
|
|
9
|
-
setPost(key: string, post: Post): Promise<boolean | undefined>;
|
|
10
|
-
getPosts(key: string): Promise<Array<Post> | undefined>;
|
|
11
|
-
setPosts(key: string, posts: Array<Post>): Promise<boolean | undefined>;
|
|
12
|
-
getTag(key: string): Promise<Tag | undefined>;
|
|
13
|
-
setTag(key: string, tag: Tag): Promise<boolean | undefined>;
|
|
14
|
-
getTags(key: string): Promise<Array<Tag> | undefined>;
|
|
15
|
-
setTags(key: string, tags: Array<Tag>): Promise<boolean | undefined>;
|
|
16
|
-
clear(): Promise<void>;
|
|
17
|
-
formatName(name: string, type: string): string;
|
|
18
|
-
}
|
package/dist/cache.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Cache = void 0;
|
|
4
|
-
const config_1 = require("./config");
|
|
5
|
-
const post_1 = require("./post");
|
|
6
|
-
const tag_1 = require("./tag");
|
|
7
|
-
const Keyv = require("keyv");
|
|
8
|
-
class Cache {
|
|
9
|
-
constructor(config) {
|
|
10
|
-
config = new config_1.Config();
|
|
11
|
-
this.cache = new Keyv({ ttl: config.cache.ttl, namespace: "data-cache" });
|
|
12
|
-
}
|
|
13
|
-
//cache
|
|
14
|
-
async getPost(key) {
|
|
15
|
-
key = this.formatName(key, "post");
|
|
16
|
-
let result = await this.cache.get(key);
|
|
17
|
-
if (result) {
|
|
18
|
-
result = post_1.Post.create(result);
|
|
19
|
-
}
|
|
20
|
-
return result;
|
|
21
|
-
}
|
|
22
|
-
async setPost(key, post) {
|
|
23
|
-
return await this.cache.set(this.formatName(key, "post"), post);
|
|
24
|
-
}
|
|
25
|
-
async getPosts(key) {
|
|
26
|
-
key = this.formatName(key, "post");
|
|
27
|
-
let result = await this.cache.get(key);
|
|
28
|
-
if (result) {
|
|
29
|
-
let posts = new Array();
|
|
30
|
-
for (let i = 0; i < result.length; i++) {
|
|
31
|
-
posts.push(post_1.Post.create(result[i]));
|
|
32
|
-
}
|
|
33
|
-
result = posts;
|
|
34
|
-
}
|
|
35
|
-
return result;
|
|
36
|
-
}
|
|
37
|
-
async setPosts(key, posts) {
|
|
38
|
-
return await this.cache.set(this.formatName(key, "post"), posts);
|
|
39
|
-
}
|
|
40
|
-
async getTag(key) {
|
|
41
|
-
key = this.formatName(key, "tag");
|
|
42
|
-
let result = await this.cache.get(key);
|
|
43
|
-
if (result) {
|
|
44
|
-
result = tag_1.Tag.create(result);
|
|
45
|
-
}
|
|
46
|
-
return result;
|
|
47
|
-
}
|
|
48
|
-
async setTag(key, tag) {
|
|
49
|
-
return await this.cache.set(this.formatName(key, "tag"), tag);
|
|
50
|
-
}
|
|
51
|
-
async getTags(key) {
|
|
52
|
-
key = this.formatName(key, "tag");
|
|
53
|
-
let result = await this.cache.get(key);
|
|
54
|
-
if (result) {
|
|
55
|
-
let tags = new Array();
|
|
56
|
-
for (let i = 0; i < result.length; i++) {
|
|
57
|
-
tags.push(tag_1.Tag.create(result[i]));
|
|
58
|
-
}
|
|
59
|
-
result = tags;
|
|
60
|
-
}
|
|
61
|
-
return result;
|
|
62
|
-
}
|
|
63
|
-
async setTags(key, tags) {
|
|
64
|
-
return await this.cache.set(this.formatName(key, "tag"), tags);
|
|
65
|
-
}
|
|
66
|
-
async clear() {
|
|
67
|
-
await this.cache.clear();
|
|
68
|
-
}
|
|
69
|
-
formatName(name, type) {
|
|
70
|
-
let result = type.trim() + "-" + name.trim();
|
|
71
|
-
result = result.toLowerCase();
|
|
72
|
-
return result;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
exports.Cache = Cache;
|
|
76
|
-
//# sourceMappingURL=cache.js.map
|
package/dist/cache.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../src/cache.ts"],"names":[],"mappings":";;;AAAA,qCAAkC;AAClC,iCAA8B;AAC9B,+BAA4B;AAC5B,6BAA8B;AAE9B,MAAa,KAAK;IAGhB,YAAY,MAAc;QAExB,MAAM,GAAG,IAAI,eAAM,EAAE,CAAC;QAEtB,IAAI,CAAC,KAAK,GAAG,IAAI,IAAI,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC,CAAC;IAC5E,CAAC;IAED,OAAO;IACP,KAAK,CAAC,OAAO,CAAC,GAAW;QACvB,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QAEnC,IAAI,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAEvC,IAAI,MAAM,EAAE;YACV,MAAM,GAAG,WAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;SAC9B;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,GAAW,EAAE,IAAU;QACnC,OAAO,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,IAAI,CAAC,CAAC;IAClE,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,GAAW;QACxB,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QAEnC,IAAI,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK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AC,GAAG,CAAC,GAAG,CAAC,CAAC;QAEvC,IAAI,MAAM,EAAE;YACV,IAAI,IAAI,GAAG,IAAI,KAAK,EAAO,CAAC;YAE5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBACtC,IAAI,CAAC,IAAI,CAAC,SAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;aAClC;YAED,MAAM,GAAG,IAAI,CAAC;SACf;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,GAAW,EAAE,IAAgB;QACzC,OAAO,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC;IACjE,CAAC;IAED,KAAK,CAAC,KAAK;QACT,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;IAC3B,CAAC;IAED,UAAU,CAAC,IAAY,EAAE,IAAY;QACnC,IAAI,MAAM,GAAI,IAAI,CAAC,IAAI,EAAE,GAAG,GAAG,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAC9C,MAAM,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;QAE9B,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAjGD,sBAiGC"}
|
package/dist/config.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export declare class Config {
|
|
2
|
-
cache: ConfigCache;
|
|
3
|
-
log: import("winston").Logger;
|
|
4
|
-
program: any;
|
|
5
|
-
provider: any;
|
|
6
|
-
render: Array<string>;
|
|
7
|
-
output: string;
|
|
8
|
-
path: string;
|
|
9
|
-
title: string;
|
|
10
|
-
url: string;
|
|
11
|
-
authorName: string;
|
|
12
|
-
authorEmail: string;
|
|
13
|
-
indexCount: number;
|
|
14
|
-
permalink: string;
|
|
15
|
-
constructor(config?: any);
|
|
16
|
-
loadPath(path: string): boolean;
|
|
17
|
-
loadConfig(filePath: string): boolean;
|
|
18
|
-
loadProgram(program: any): void;
|
|
19
|
-
parse(obj: any): void;
|
|
20
|
-
}
|
|
21
|
-
export declare class ConfigCache {
|
|
22
|
-
constructor();
|
|
23
|
-
connection: string;
|
|
24
|
-
ttl: number;
|
|
25
|
-
type: string;
|
|
26
|
-
}
|
package/dist/config.js
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ConfigCache = exports.Config = void 0;
|
|
4
|
-
const fs = require("fs-extra");
|
|
5
|
-
const winston_1 = require("winston");
|
|
6
|
-
class Config {
|
|
7
|
-
constructor(config = undefined) {
|
|
8
|
-
this.cache = new ConfigCache();
|
|
9
|
-
this.log = (0, winston_1.createLogger)({ transports: [new winston_1.transports.Console()] });
|
|
10
|
-
this.program = {};
|
|
11
|
-
this.provider = {};
|
|
12
|
-
this.render = ["html", "json", "atom"];
|
|
13
|
-
this.output = "./blog_output";
|
|
14
|
-
this.path = "./blog";
|
|
15
|
-
this.title = "";
|
|
16
|
-
this.url = "";
|
|
17
|
-
this.authorName = "";
|
|
18
|
-
this.authorEmail = "";
|
|
19
|
-
this.indexCount = 20;
|
|
20
|
-
this.permalink = "simple";
|
|
21
|
-
//set default for fileProvider
|
|
22
|
-
this.provider.name = "file";
|
|
23
|
-
if (config) {
|
|
24
|
-
this.parse(config);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
loadPath(path) {
|
|
28
|
-
this.path = path;
|
|
29
|
-
return this.loadConfig(this.path + "/config.json");
|
|
30
|
-
}
|
|
31
|
-
loadConfig(filePath) {
|
|
32
|
-
let result = false;
|
|
33
|
-
if (fs.existsSync(filePath)) {
|
|
34
|
-
let buff = fs.readFileSync(filePath);
|
|
35
|
-
let obj = JSON.parse(buff.toString());
|
|
36
|
-
this.parse(obj);
|
|
37
|
-
result = true;
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
this.log.info("the config file does not exist: " + filePath);
|
|
41
|
-
}
|
|
42
|
-
return result;
|
|
43
|
-
}
|
|
44
|
-
loadProgram(program) {
|
|
45
|
-
this.program = program;
|
|
46
|
-
this.parse(this.program);
|
|
47
|
-
}
|
|
48
|
-
parse(obj) {
|
|
49
|
-
if (obj) {
|
|
50
|
-
if (obj.render) {
|
|
51
|
-
if (typeof obj.render === "string") {
|
|
52
|
-
this.render = obj.render.split(",");
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
this.render = obj.render;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
if (obj.permalink) {
|
|
59
|
-
this.permalink = obj.permalink;
|
|
60
|
-
}
|
|
61
|
-
if (obj.output) {
|
|
62
|
-
this.output = obj.output;
|
|
63
|
-
}
|
|
64
|
-
if (obj.path) {
|
|
65
|
-
this.path = obj.path;
|
|
66
|
-
}
|
|
67
|
-
if (obj.title) {
|
|
68
|
-
this.title = obj.title;
|
|
69
|
-
}
|
|
70
|
-
if (obj.url) {
|
|
71
|
-
this.url = obj.url;
|
|
72
|
-
}
|
|
73
|
-
if (obj.authorName) {
|
|
74
|
-
this.authorName = obj.authorName;
|
|
75
|
-
}
|
|
76
|
-
if (obj.authorEmail) {
|
|
77
|
-
this.authorEmail = obj.authorEmail;
|
|
78
|
-
}
|
|
79
|
-
if (obj.indexCount) {
|
|
80
|
-
this.indexCount = obj.indexCount;
|
|
81
|
-
}
|
|
82
|
-
if (obj.cache) {
|
|
83
|
-
if (obj.cache.connection) {
|
|
84
|
-
this.cache.connection = obj.cache.connection;
|
|
85
|
-
}
|
|
86
|
-
if (obj.cache.ttl) {
|
|
87
|
-
this.cache.ttl = obj.cache.ttl;
|
|
88
|
-
}
|
|
89
|
-
if (obj.cache.type) {
|
|
90
|
-
this.cache.type = obj.cache.type;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
exports.Config = Config;
|
|
97
|
-
class ConfigCache {
|
|
98
|
-
constructor() {
|
|
99
|
-
this.connection = "";
|
|
100
|
-
this.ttl = 6000;
|
|
101
|
-
this.type = "memory";
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
exports.ConfigCache = ConfigCache;
|
|
105
|
-
//# sourceMappingURL=config.js.map
|
package/dist/config.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,qCAAmD;AAEnD,MAAa,MAAM;IAejB,YAAY,SAAc,SAAS;QAdnC,UAAK,GAAgB,IAAI,WAAW,EAAE,CAAC;QACvC,QAAG,GAAG,IAAA,sBAAY,EAAC,EAAE,UAAU,EAAE,CAAC,IAAI,oBAAU,CAAC,OAAO,EAAE,CAAC,EAAC,CAAC,CAAC;QAC9D,YAAO,GAAQ,EAAE,CAAC;QAClB,aAAQ,GAAQ,EAAE,CAAC;QACnB,WAAM,GAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QACjD,WAAM,GAAW,eAAe,CAAC;QACjC,SAAI,GAAW,QAAQ,CAAC;QACxB,UAAK,GAAW,EAAE,CAAC;QACnB,QAAG,GAAW,EAAE,CAAC;QACjB,eAAU,GAAW,EAAE,CAAC;QACxB,gBAAW,GAAW,EAAE,CAAC;QACzB,eAAU,GAAW,EAAE,CAAC;QACxB,cAAS,GAAW,QAAQ,CAAC;QAI3B,8BAA8B;QAC9B,IAAI,CAAC,QAAQ,CAAC,IAAI,GAAG,MAAM,CAAC;QAE5B,IAAI,MAAM,EAAE;YACV,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;SACpB;IACH,CAAC;IAED,QAAQ,CAAC,IAAY;QACnB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,OAAO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-
import { Post } from "../post";
|
|
3
|
-
import { Tag } from "../tag";
|
|
4
|
-
export interface DataProviderInterface {
|
|
5
|
-
getPost(id: string): Promise<Post | undefined>;
|
|
6
|
-
getPosts(): Promise<Array<Post>>;
|
|
7
|
-
getPublishedPosts(): Promise<Array<Post>>;
|
|
8
|
-
getTag(name: string): Promise<Tag | undefined>;
|
|
9
|
-
getTags(): Promise<Array<Tag>>;
|
|
10
|
-
getPublishedTags(): Promise<Array<Tag>>;
|
|
11
|
-
init(config: Config): void;
|
|
12
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dataProviderInterface.js","sourceRoot":"","sources":["../../src/data/dataProviderInterface.ts"],"names":[],"mappings":""}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Config } from "../config";
|
|
2
|
-
import { Post } from "../post";
|
|
3
|
-
import { Tag } from "../tag";
|
|
4
|
-
import { DataProviderInterface } from "./dataProviderInterface";
|
|
5
|
-
import { Cache } from "../cache";
|
|
6
|
-
export declare class DataService {
|
|
7
|
-
config: Config;
|
|
8
|
-
cache: Cache;
|
|
9
|
-
constructor(config: Config);
|
|
10
|
-
getPost(id: string): Promise<Post | undefined>;
|
|
11
|
-
getPosts(): Promise<Array<Post>>;
|
|
12
|
-
getPublishedPosts(): Promise<Array<Post>>;
|
|
13
|
-
getPostsByCount(count: number): Promise<Array<Post>>;
|
|
14
|
-
getPublishedPostsByCount(count: number): Promise<Array<Post>>;
|
|
15
|
-
getTag(name: string): Promise<Tag | undefined>;
|
|
16
|
-
getTags(): Promise<Array<Tag>>;
|
|
17
|
-
getPublishedTags(): Promise<Array<Tag>>;
|
|
18
|
-
getProvider(): DataProviderInterface;
|
|
19
|
-
}
|