imdone-core 1.34.1 → 1.34.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/_navbar.md +1 -0
- package/index-markdown.js +55 -0
- package/index.html +184 -0
- package/lib/file.js +1 -1
- package/lib/mixins/repo-fs-store.js +6 -0
- package/lib/repository.js +2 -2
- package/package.json +3 -2
package/_navbar.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
**[:house: imdone-core Documentation](/README)**
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const sidebar = '_index.md';
|
|
4
|
+
|
|
5
|
+
function getMarkdownFiles(files = []) {
|
|
6
|
+
return files.filter(file => file.endsWith('.md') && file !== sidebar && file !== '_navbar.md');
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function getFileLinks(files) {
|
|
10
|
+
return files.map(file => `- [${file.replace('.md', '')}](${file})`).join('\n');
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function getSubDirLinks(files, directory) {
|
|
14
|
+
const subDirs = files.filter(file => fs.statSync(path.join(directory, file)).isDirectory());
|
|
15
|
+
const subDirsContainingMarkdown = subDirs.filter(subDir => fs.readdirSync(path.join(directory, subDir)).find(file => file.endsWith('.md'))
|
|
16
|
+
);
|
|
17
|
+
return subDirsContainingMarkdown.map(subDir => {
|
|
18
|
+
const resource = fs.readdirSync(path.join(directory, subDir)).find(file => file.toLowerCase() === 'readme.md')
|
|
19
|
+
? 'README'
|
|
20
|
+
: sidebar
|
|
21
|
+
return `- [:file_folder: **${subDir}**](${subDir}/${resource})`;
|
|
22
|
+
}).join('\n');
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function getBreadCrumb(parentDir) {
|
|
26
|
+
const homeLink = '[:house: **Home**](/README)';
|
|
27
|
+
return parentDir ? `- ${homeLink}\n- [:arrow_heading_up: **Parent Directory**](${parentDir}${sidebar})` : '';
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function createIndexes(directory, parentDir, title) {
|
|
31
|
+
const basename = path.basename(directory);
|
|
32
|
+
if (basename.startsWith('.')) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
title = title || basename;
|
|
37
|
+
|
|
38
|
+
const files = fs.readdirSync(directory);
|
|
39
|
+
const markdownFiles = getMarkdownFiles(files);
|
|
40
|
+
|
|
41
|
+
if (markdownFiles.length > 0) {
|
|
42
|
+
const subDirLinks = getSubDirLinks(files, directory);
|
|
43
|
+
const fileLinks = getFileLinks(markdownFiles);
|
|
44
|
+
const breadcrumb = getBreadCrumb(parentDir);
|
|
45
|
+
|
|
46
|
+
fs.writeFileSync(path.join(directory, sidebar), `# ${title}\n${breadcrumb}\n${subDirLinks}\n${fileLinks}\n`);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
files
|
|
50
|
+
.filter(file => fs.statSync(path.join(directory, file)).isDirectory())
|
|
51
|
+
.forEach(subDir => createIndexes(path.join(directory, subDir), parentDir ? path.join(parentDir, basename) + '/' : '/'));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
createIndexes(process.cwd(), undefined, 'imdone-core');
|
|
55
|
+
console.log('Indexes created successfully!');
|
package/index.html
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="UTF-8">
|
|
6
|
+
<title>imdone-core</title>
|
|
7
|
+
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
|
|
8
|
+
<meta http-equiv="Pragma" content="no-cache">
|
|
9
|
+
<meta http-equiv="Expires" content="0">
|
|
10
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
|
11
|
+
<meta name="description" content="imdone-core">
|
|
12
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
|
|
13
|
+
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" , rel="stylesheet">
|
|
14
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docsify@4/lib/themes/vue.css">
|
|
15
|
+
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/prism-themes@1.3.0/themes/prism-atom-dark.css'>
|
|
16
|
+
<style>
|
|
17
|
+
.sidebar-nav {
|
|
18
|
+
margin-left: .5rem;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.sidebar-nav h2 {
|
|
22
|
+
margin-left: 0.5rem;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.markdown-section pre>code {
|
|
26
|
+
-webkit-font-smoothing: antialiased;
|
|
27
|
+
background-color: inherit;
|
|
28
|
+
color: inherit;
|
|
29
|
+
padding: 1.5em .25em;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
pre[class*="language-"] {
|
|
33
|
+
padding: 0 .5em;
|
|
34
|
+
margin: 0;
|
|
35
|
+
overflow: auto;
|
|
36
|
+
border-radius: 0.3em;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.markdown-section {
|
|
40
|
+
font-size: 21px;
|
|
41
|
+
margin: 0 8%;
|
|
42
|
+
max-width: 100%;
|
|
43
|
+
padding: 30px 15px 40px;
|
|
44
|
+
position: relative;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
a.button {
|
|
48
|
+
-webkit-tap-highlight-color: transparent;
|
|
49
|
+
text-align: center;
|
|
50
|
+
box-sizing: border-box;
|
|
51
|
+
text-decoration: none;
|
|
52
|
+
line-height: 1.33333;
|
|
53
|
+
border-radius: 3px;
|
|
54
|
+
font-size: 1.5em;
|
|
55
|
+
color: #fff;
|
|
56
|
+
background-color: #286090;
|
|
57
|
+
border-color: #204d74;
|
|
58
|
+
background-image: none;
|
|
59
|
+
font-weight: bold;
|
|
60
|
+
padding: .25em .5em;
|
|
61
|
+
margin: 0;
|
|
62
|
+
height: 2em;
|
|
63
|
+
}
|
|
64
|
+
</style>
|
|
65
|
+
</head>
|
|
66
|
+
|
|
67
|
+
<body>
|
|
68
|
+
<div id="app"></div>
|
|
69
|
+
<!-- VueJs -->
|
|
70
|
+
<!-- Production -->
|
|
71
|
+
<!--<script src="https://cdn.jsdelivr.net/npm/vue@3/dist/vue.global.prod.js"></script>-->
|
|
72
|
+
<!-- Development -->
|
|
73
|
+
<script src="https://cdn.jsdelivr.net/npm/vue@3/dist/vue.global.js"></script>
|
|
74
|
+
<script src="https://cdn.jsdelivr.net/npm/js-yaml@4.1.0/dist/js-yaml.min.js"></script>
|
|
75
|
+
<script src="https://cdn.jsdelivr.net/npm/jsonpath@1.1.1/jsonpath.min.js"></script>
|
|
76
|
+
<script>
|
|
77
|
+
window.$docsify = {
|
|
78
|
+
maxAge: 3600000,
|
|
79
|
+
repo: 'https://github.com/imdone/imdone-core',
|
|
80
|
+
loadSidebar: "_index.md",
|
|
81
|
+
subMaxLevel: 5,
|
|
82
|
+
loadNavbar: true,
|
|
83
|
+
relativePath: true,
|
|
84
|
+
search: {
|
|
85
|
+
paths: 'auto',
|
|
86
|
+
namespace: 'imdone-core'
|
|
87
|
+
},
|
|
88
|
+
customPageTitle: {
|
|
89
|
+
prefix: 'imdone-core'
|
|
90
|
+
},
|
|
91
|
+
mermaidConfig: {
|
|
92
|
+
querySelector: ".mermaid"
|
|
93
|
+
},
|
|
94
|
+
vueComponents: {
|
|
95
|
+
'load-yaml': {
|
|
96
|
+
template: `
|
|
97
|
+
<div>
|
|
98
|
+
<strong><a :href="url">{{src}}</a></strong>
|
|
99
|
+
</div>
|
|
100
|
+
<pre>
|
|
101
|
+
<code class="language-yaml">
|
|
102
|
+
{{yaml}}
|
|
103
|
+
</code>
|
|
104
|
+
</pre>
|
|
105
|
+
`,
|
|
106
|
+
props: ['src', 'path'],
|
|
107
|
+
data() {
|
|
108
|
+
return {
|
|
109
|
+
yaml: '',
|
|
110
|
+
data: {},
|
|
111
|
+
url: `${$docsify.repo}/${this.src}`
|
|
112
|
+
};
|
|
113
|
+
},
|
|
114
|
+
created() {
|
|
115
|
+
fetch(this.src)
|
|
116
|
+
.then(async response => {
|
|
117
|
+
const yaml = await response.text()
|
|
118
|
+
const data = jsyaml.load(yaml)
|
|
119
|
+
this.data = this.path ? jsonpath.query(data, this.path) : data
|
|
120
|
+
this.yaml = '\n' + jsyaml.dump(this.data, { forceQuotes: true })
|
|
121
|
+
})
|
|
122
|
+
.catch(err => console.log(err));
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
'load-code': {
|
|
126
|
+
template: `
|
|
127
|
+
<div>
|
|
128
|
+
<strong><a :href="url">{{src}}</a></strong>
|
|
129
|
+
</div>
|
|
130
|
+
<pre :data-lang="innerLang" :class="language">
|
|
131
|
+
<code :class="language">{{text}}</code>
|
|
132
|
+
</pre>
|
|
133
|
+
`,
|
|
134
|
+
props: ['src', 'path', 'lang'],
|
|
135
|
+
data() {
|
|
136
|
+
return {
|
|
137
|
+
text: '',
|
|
138
|
+
data: {},
|
|
139
|
+
url: `${$docsify.repo}/${this.src}`
|
|
140
|
+
};
|
|
141
|
+
},
|
|
142
|
+
created() {
|
|
143
|
+
fetch(this.src)
|
|
144
|
+
.then(async response => {
|
|
145
|
+
this.text = '\n' + await response.text()
|
|
146
|
+
})
|
|
147
|
+
.catch(err => console.log(err));
|
|
148
|
+
},
|
|
149
|
+
computed: {
|
|
150
|
+
language() {
|
|
151
|
+
return `language-${this.innerLang}`
|
|
152
|
+
},
|
|
153
|
+
innerLang() {
|
|
154
|
+
return this.lang || 'text'
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
|
|
159
|
+
},
|
|
160
|
+
}
|
|
161
|
+
</script>
|
|
162
|
+
<script src="https://cdn.jsdelivr.net/npm/docsify@4"></script>
|
|
163
|
+
<script src="https://cdn.jsdelivr.net/gh/rizdaprasetya/docsify-fix-pageload-scroll@master/index.js"></script>
|
|
164
|
+
<script src="https://unpkg.com/docsify/lib/plugins/search.min.js"></script>
|
|
165
|
+
<script src="https://unpkg.com/docsify/lib/plugins/zoom-image.min.js"></script>
|
|
166
|
+
<script src="https://cdn.jsdelivr.net/npm/docsify-prism@latest/dist/docsify-prism.min.js"></script>
|
|
167
|
+
<script src="https://unpkg.com/prismjs/components/prism-markdown.min.js"></script>
|
|
168
|
+
<script src="https://unpkg.com/prismjs/components/prism-javascript.min.js"></script>
|
|
169
|
+
<script src="https://unpkg.com/prismjs/components/prism-java.min.js"></script>
|
|
170
|
+
<script src="https://unpkg.com/prismjs/components/prism-yaml.min.js"></script>
|
|
171
|
+
<script src="https://unpkg.com/docsify-copy-code"></script>
|
|
172
|
+
<script src="https://unpkg.com/docsify-sidebar-collapse/dist/docsify-sidebar-collapse.min.js"></script>
|
|
173
|
+
<script src="https://unpkg.com/docsify-include-template/dist/docsify-include-template.js"></script>
|
|
174
|
+
<script src="https://cdn.jsdelivr.net/npm/docsify/lib/plugins/emoji.min.js"></script>
|
|
175
|
+
<script src="https://cdn.jsdelivr.net/npm/@sujaykumarh/docsify-plugin-title@1.x/dist/plugin.min.js"></script>
|
|
176
|
+
<script type="module">
|
|
177
|
+
import mermaid from "https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs";
|
|
178
|
+
mermaid.initialize({ startOnLoad: true });
|
|
179
|
+
window.mermaid = mermaid;
|
|
180
|
+
</script>
|
|
181
|
+
<script src="https://unpkg.com/docsify-mermaid@2.0.1/dist/docsify-mermaid.js"></script>
|
|
182
|
+
</body>
|
|
183
|
+
|
|
184
|
+
</html>
|
package/lib/file.js
CHANGED
|
@@ -142,7 +142,7 @@ File.isFile = function (file) {
|
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
File.isMarkdown = function (relPath) {
|
|
145
|
-
return /\.md
|
|
145
|
+
return /\.md$/i.test(relPath) || path.extname(relPath) === ''
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
File.addCompleted = function ({ task, content, config }) {
|
|
@@ -214,13 +214,19 @@ function mixin(repo, fs = require('fs')) {
|
|
|
214
214
|
const currentConfig = repo.config
|
|
215
215
|
if (currentConfig && currentConfig.code)
|
|
216
216
|
include_lists = _union(include_lists, currentConfig.code.include_lists)
|
|
217
|
+
|
|
218
|
+
if (currentConfig && currentConfig.settings)
|
|
219
|
+
loadedConfig.settings = {...loadedConfig.settings, ...currentConfig.settings}
|
|
220
|
+
|
|
217
221
|
if (loadedConfig && loadedConfig.code)
|
|
218
222
|
include_lists = _union(include_lists, loadedConfig.code.include_lists)
|
|
223
|
+
|
|
219
224
|
if (loadedConfig && loadedConfig.sync)
|
|
220
225
|
loadedConfig.sync = {
|
|
221
226
|
...loadedConfig.sync,
|
|
222
227
|
useImdoneioForPriority: false,
|
|
223
228
|
}
|
|
229
|
+
|
|
224
230
|
const newConfig = new Config(
|
|
225
231
|
_assign({}, baseConfig, repo.config, loadedConfig, { path: repo.path })
|
|
226
232
|
)
|
package/lib/repository.js
CHANGED
|
@@ -414,10 +414,10 @@ Repository.prototype.setIgnores = function (ignores) {
|
|
|
414
414
|
Repository.prototype.shouldInclude = function (relPath) {
|
|
415
415
|
relPath = this.getRelativePath(relPath)
|
|
416
416
|
let include = true
|
|
417
|
-
if (this.config.markdownOnly) {
|
|
417
|
+
if (this.config.markdownOnly && relPath) {
|
|
418
418
|
include = File.isMarkdown(relPath)
|
|
419
419
|
}
|
|
420
|
-
if (this.ignore
|
|
420
|
+
if (this.ignore) {
|
|
421
421
|
try {
|
|
422
422
|
include = include && !this.ignore.ignores(relPath)
|
|
423
423
|
} catch (e) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "imdone-core",
|
|
3
|
-
"version": "1.34.
|
|
3
|
+
"version": "1.34.3",
|
|
4
4
|
"description": "imdone-core",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
"lint": "jshint ./lib",
|
|
13
13
|
"mocha": "mocha --exit",
|
|
14
14
|
"test": "export NODE_ENV=test && npm run coverage",
|
|
15
|
-
"test-debug": "mocha debug"
|
|
15
|
+
"test-debug": "mocha debug",
|
|
16
|
+
"serve": "npx docsify-cli serve"
|
|
16
17
|
},
|
|
17
18
|
"repository": {
|
|
18
19
|
"type": "git",
|