@standardnotes/community-cdn 0.6.2 → 0.6.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/CHANGELOG.md +4 -0
- package/dist/entries/com.sncommunity.advanced-checklist.json +17 -0
- package/dist/entries/com.sncommunity.bold-editor.json +17 -0
- package/dist/entries/com.sncommunity.markdown-basic.json +17 -0
- package/dist/entries/com.sncommunity.markdown-math.json +17 -0
- package/dist/entries/com.sncommunity.minimal-markdown.json +17 -0
- package/dist/static/com.sncommunity.advanced-checklist/build/asset-manifest.json +13 -0
- package/dist/static/com.sncommunity.advanced-checklist/build/favicon.ico +0 -0
- package/dist/static/com.sncommunity.advanced-checklist/build/index.html +1 -0
- package/dist/static/com.sncommunity.advanced-checklist/build/logo192.png +0 -0
- package/dist/static/com.sncommunity.advanced-checklist/build/logo512.png +0 -0
- package/dist/static/com.sncommunity.advanced-checklist/build/manifest.json +25 -0
- package/dist/static/com.sncommunity.advanced-checklist/build/robots.txt +3 -0
- package/dist/static/com.sncommunity.advanced-checklist/build/sample.ext.json +12 -0
- package/dist/static/com.sncommunity.advanced-checklist/build/static/css/main.339b1865.css +2 -0
- package/dist/static/com.sncommunity.advanced-checklist/build/static/css/main.339b1865.css.map +1 -0
- package/dist/static/com.sncommunity.advanced-checklist/build/static/js/main.js +3 -0
- package/dist/static/com.sncommunity.advanced-checklist/build/static/js/main.js.LICENSE.txt +87 -0
- package/dist/static/com.sncommunity.advanced-checklist/build/static/js/main.js.map +1 -0
- package/dist/static/com.sncommunity.bold-editor/dist/dist.css +5 -0
- package/dist/static/com.sncommunity.bold-editor/dist/dist.min.js +2 -0
- package/dist/static/com.sncommunity.bold-editor/dist/dist.min.js.LICENSE.txt +42 -0
- package/dist/static/com.sncommunity.bold-editor/dist/filesafe-js/EncryptionWorker.js +2 -0
- package/dist/static/com.sncommunity.bold-editor/dist/filesafe-js/EncryptionWorker.js.LICENSE.txt +5 -0
- package/dist/static/com.sncommunity.bold-editor/dist/index.html +1 -0
- package/dist/static/com.sncommunity.bold-editor/dist/vendor.css +6 -0
- package/dist/static/com.sncommunity.bold-editor/dist/vendor.js +1 -0
- package/dist/static/com.sncommunity.markdown-basic/dist/dist.css +6 -0
- package/dist/static/com.sncommunity.markdown-basic/dist/dist.css.map +1 -0
- package/dist/static/com.sncommunity.markdown-basic/dist/dist.js +2 -0
- package/dist/static/com.sncommunity.markdown-basic/dist/dist.js.LICENSE.txt +32 -0
- package/dist/static/com.sncommunity.markdown-basic/dist/index.html +7 -0
- package/dist/static/com.sncommunity.markdown-math/dist/app.css +518 -0
- package/dist/static/com.sncommunity.markdown-math/dist/app.css.map +1 -0
- package/dist/static/com.sncommunity.markdown-math/dist/app.js +78 -0
- package/dist/static/com.sncommunity.markdown-math/dist/app.js.map +1 -0
- package/dist/static/com.sncommunity.markdown-math/dist/dist.css +523 -0
- package/dist/static/com.sncommunity.markdown-math/dist/dist.js +1 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_AMS-Regular.ttf +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_AMS-Regular.woff +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_AMS-Regular.woff2 +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Caligraphic-Bold.ttf +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Caligraphic-Bold.woff +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Caligraphic-Regular.ttf +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Caligraphic-Regular.woff +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Fraktur-Bold.ttf +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Fraktur-Bold.woff +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Fraktur-Regular.ttf +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Fraktur-Regular.woff +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Main-Bold.ttf +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Main-Bold.woff +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Main-Bold.woff2 +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Main-BoldItalic.ttf +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Main-BoldItalic.woff +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Main-Italic.ttf +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Main-Italic.woff +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Main-Italic.woff2 +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Main-Regular.ttf +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Main-Regular.woff +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Main-Regular.woff2 +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Math-BoldItalic.ttf +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Math-BoldItalic.woff +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Math-Italic.ttf +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Math-Italic.woff +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Math-Italic.woff2 +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_SansSerif-Bold.ttf +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_SansSerif-Bold.woff +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_SansSerif-Italic.ttf +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_SansSerif-Italic.woff +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_SansSerif-Regular.ttf +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_SansSerif-Regular.woff +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Script-Regular.ttf +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Script-Regular.woff +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Script-Regular.woff2 +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Size1-Regular.ttf +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Size1-Regular.woff +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Size1-Regular.woff2 +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Size2-Regular.ttf +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Size2-Regular.woff +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Size2-Regular.woff2 +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Size3-Regular.ttf +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Size3-Regular.woff +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Size3-Regular.woff2 +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Size4-Regular.ttf +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Size4-Regular.woff +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Size4-Regular.woff2 +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Typewriter-Regular.ttf +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Typewriter-Regular.woff +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
- package/dist/static/com.sncommunity.markdown-math/dist/lib.js +7485 -0
- package/dist/static/com.sncommunity.markdown-math/index.html +52 -0
- package/dist/static/com.sncommunity.minimal-markdown/dist/app.css +143 -0
- package/dist/static/com.sncommunity.minimal-markdown/dist/app.css.map +1 -0
- package/dist/static/com.sncommunity.minimal-markdown/dist/app.js +115 -0
- package/dist/static/com.sncommunity.minimal-markdown/dist/app.js.map +1 -0
- package/dist/static/com.sncommunity.minimal-markdown/dist/dist.css +490 -0
- package/dist/static/com.sncommunity.minimal-markdown/dist/dist.js +11211 -0
- package/dist/static/com.sncommunity.minimal-markdown/dist/lib.js +11096 -0
- package/dist/static/com.sncommunity.minimal-markdown/dist/sn-codemirror-search/dialog/dialog.css +46 -0
- package/dist/static/com.sncommunity.minimal-markdown/dist/sn-codemirror-search/dialog/dialog.js +161 -0
- package/dist/static/com.sncommunity.minimal-markdown/dist/sn-codemirror-search/search.js +258 -0
- package/dist/static/com.sncommunity.minimal-markdown/dist/sn-codemirror-search/searchcursor.js +293 -0
- package/dist/static/com.sncommunity.minimal-markdown/index.html +23 -0
- package/dist/zips/com.sncommunity.advanced-checklist/build/asset-manifest.json +13 -0
- package/dist/zips/com.sncommunity.advanced-checklist/build/favicon.ico +0 -0
- package/dist/zips/com.sncommunity.advanced-checklist/build/index.html +1 -0
- package/dist/zips/com.sncommunity.advanced-checklist/build/logo192.png +0 -0
- package/dist/zips/com.sncommunity.advanced-checklist/build/logo512.png +0 -0
- package/dist/zips/com.sncommunity.advanced-checklist/build/manifest.json +25 -0
- package/dist/zips/com.sncommunity.advanced-checklist/build/robots.txt +3 -0
- package/dist/zips/com.sncommunity.advanced-checklist/build/sample.ext.json +12 -0
- package/dist/zips/com.sncommunity.advanced-checklist/build/static/css/main.339b1865.css +2 -0
- package/dist/zips/com.sncommunity.advanced-checklist/build/static/css/main.339b1865.css.map +1 -0
- package/dist/zips/com.sncommunity.advanced-checklist/build/static/js/main.js +3 -0
- package/dist/zips/com.sncommunity.advanced-checklist/build/static/js/main.js.LICENSE.txt +87 -0
- package/dist/zips/com.sncommunity.advanced-checklist/build/static/js/main.js.map +1 -0
- package/dist/zips/com.sncommunity.advanced-checklist/package.json +133 -0
- package/dist/zips/com.sncommunity.advanced-checklist.zip +0 -0
- package/dist/zips/com.sncommunity.bold-editor/dist/dist.css +5 -0
- package/dist/zips/com.sncommunity.bold-editor/dist/dist.min.js +2 -0
- package/dist/zips/com.sncommunity.bold-editor/dist/dist.min.js.LICENSE.txt +42 -0
- package/dist/zips/com.sncommunity.bold-editor/dist/filesafe-js/EncryptionWorker.js +2 -0
- package/dist/zips/com.sncommunity.bold-editor/dist/filesafe-js/EncryptionWorker.js.LICENSE.txt +5 -0
- package/dist/zips/com.sncommunity.bold-editor/dist/index.html +1 -0
- package/dist/zips/com.sncommunity.bold-editor/dist/vendor.css +6 -0
- package/dist/zips/com.sncommunity.bold-editor/dist/vendor.js +1 -0
- package/dist/zips/com.sncommunity.bold-editor/package.json +52 -0
- package/dist/zips/com.sncommunity.bold-editor.zip +0 -0
- package/dist/zips/com.sncommunity.markdown-basic.zip +0 -0
- package/dist/zips/com.sncommunity.markdown-math.zip +0 -0
- package/dist/zips/com.sncommunity.minimal-markdown/dist/app.css +143 -0
- package/dist/zips/com.sncommunity.minimal-markdown/dist/app.css.map +1 -0
- package/dist/zips/com.sncommunity.minimal-markdown/dist/app.js +115 -0
- package/dist/zips/com.sncommunity.minimal-markdown/dist/app.js.map +1 -0
- package/dist/zips/com.sncommunity.minimal-markdown/dist/dist.css +490 -0
- package/dist/zips/com.sncommunity.minimal-markdown/dist/dist.js +11211 -0
- package/dist/zips/com.sncommunity.minimal-markdown/dist/lib.js +11096 -0
- package/dist/zips/com.sncommunity.minimal-markdown/dist/sn-codemirror-search/dialog/dialog.css +46 -0
- package/dist/zips/com.sncommunity.minimal-markdown/dist/sn-codemirror-search/dialog/dialog.js +161 -0
- package/dist/zips/com.sncommunity.minimal-markdown/dist/sn-codemirror-search/search.js +258 -0
- package/dist/zips/com.sncommunity.minimal-markdown/dist/sn-codemirror-search/searchcursor.js +293 -0
- package/dist/zips/com.sncommunity.minimal-markdown/index.html +23 -0
- package/dist/zips/com.sncommunity.minimal-markdown/package.json +39 -0
- package/dist/zips/com.sncommunity.minimal-markdown.zip +0 -0
- package/package.json +2 -2
- package/scripts/Compile.sh +12 -0
- package/scripts/Package.mjs +188 -0
- package/scripts/Readme.mjs +40 -0
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
|
2
|
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
|
3
|
+
|
|
4
|
+
(function(mod) {
|
|
5
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
|
6
|
+
mod(require("../../lib/codemirror"))
|
|
7
|
+
else if (typeof define == "function" && define.amd) // AMD
|
|
8
|
+
define(["../../lib/codemirror"], mod)
|
|
9
|
+
else // Plain browser env
|
|
10
|
+
mod(CodeMirror)
|
|
11
|
+
})(function(CodeMirror) {
|
|
12
|
+
"use strict"
|
|
13
|
+
var Pos = CodeMirror.Pos
|
|
14
|
+
|
|
15
|
+
function regexpFlags(regexp) {
|
|
16
|
+
var flags = regexp.flags
|
|
17
|
+
return flags != null ? flags : (regexp.ignoreCase ? "i" : "")
|
|
18
|
+
+ (regexp.global ? "g" : "")
|
|
19
|
+
+ (regexp.multiline ? "m" : "")
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function ensureFlags(regexp, flags) {
|
|
23
|
+
var current = regexpFlags(regexp), target = current
|
|
24
|
+
for (var i = 0; i < flags.length; i++) if (target.indexOf(flags.charAt(i)) == -1)
|
|
25
|
+
target += flags.charAt(i)
|
|
26
|
+
return current == target ? regexp : new RegExp(regexp.source, target)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function maybeMultiline(regexp) {
|
|
30
|
+
return /\\s|\\n|\n|\\W|\\D|\[\^/.test(regexp.source)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function searchRegexpForward(doc, regexp, start) {
|
|
34
|
+
regexp = ensureFlags(regexp, "g")
|
|
35
|
+
for (var line = start.line, ch = start.ch, last = doc.lastLine(); line <= last; line++, ch = 0) {
|
|
36
|
+
regexp.lastIndex = ch
|
|
37
|
+
var string = doc.getLine(line), match = regexp.exec(string)
|
|
38
|
+
if (match)
|
|
39
|
+
return {from: Pos(line, match.index),
|
|
40
|
+
to: Pos(line, match.index + match[0].length),
|
|
41
|
+
match: match}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function searchRegexpForwardMultiline(doc, regexp, start) {
|
|
46
|
+
if (!maybeMultiline(regexp)) return searchRegexpForward(doc, regexp, start)
|
|
47
|
+
|
|
48
|
+
regexp = ensureFlags(regexp, "gm")
|
|
49
|
+
var string, chunk = 1
|
|
50
|
+
for (var line = start.line, last = doc.lastLine(); line <= last;) {
|
|
51
|
+
// This grows the search buffer in exponentially-sized chunks
|
|
52
|
+
// between matches, so that nearby matches are fast and don't
|
|
53
|
+
// require concatenating the whole document (in case we're
|
|
54
|
+
// searching for something that has tons of matches), but at the
|
|
55
|
+
// same time, the amount of retries is limited.
|
|
56
|
+
for (var i = 0; i < chunk; i++) {
|
|
57
|
+
if (line > last) break
|
|
58
|
+
var curLine = doc.getLine(line++)
|
|
59
|
+
string = string == null ? curLine : string + "\n" + curLine
|
|
60
|
+
}
|
|
61
|
+
chunk = chunk * 2
|
|
62
|
+
regexp.lastIndex = start.ch
|
|
63
|
+
var match = regexp.exec(string)
|
|
64
|
+
if (match) {
|
|
65
|
+
var before = string.slice(0, match.index).split("\n"), inside = match[0].split("\n")
|
|
66
|
+
var startLine = start.line + before.length - 1, startCh = before[before.length - 1].length
|
|
67
|
+
return {from: Pos(startLine, startCh),
|
|
68
|
+
to: Pos(startLine + inside.length - 1,
|
|
69
|
+
inside.length == 1 ? startCh + inside[0].length : inside[inside.length - 1].length),
|
|
70
|
+
match: match}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function lastMatchIn(string, regexp) {
|
|
76
|
+
var cutOff = 0, match
|
|
77
|
+
for (;;) {
|
|
78
|
+
regexp.lastIndex = cutOff
|
|
79
|
+
var newMatch = regexp.exec(string)
|
|
80
|
+
if (!newMatch) return match
|
|
81
|
+
match = newMatch
|
|
82
|
+
cutOff = match.index + (match[0].length || 1)
|
|
83
|
+
if (cutOff == string.length) return match
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function searchRegexpBackward(doc, regexp, start) {
|
|
88
|
+
regexp = ensureFlags(regexp, "g")
|
|
89
|
+
for (var line = start.line, ch = start.ch, first = doc.firstLine(); line >= first; line--, ch = -1) {
|
|
90
|
+
var string = doc.getLine(line)
|
|
91
|
+
if (ch > -1) string = string.slice(0, ch)
|
|
92
|
+
var match = lastMatchIn(string, regexp)
|
|
93
|
+
if (match)
|
|
94
|
+
return {from: Pos(line, match.index),
|
|
95
|
+
to: Pos(line, match.index + match[0].length),
|
|
96
|
+
match: match}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function searchRegexpBackwardMultiline(doc, regexp, start) {
|
|
101
|
+
regexp = ensureFlags(regexp, "gm")
|
|
102
|
+
var string, chunk = 1
|
|
103
|
+
for (var line = start.line, first = doc.firstLine(); line >= first;) {
|
|
104
|
+
for (var i = 0; i < chunk; i++) {
|
|
105
|
+
var curLine = doc.getLine(line--)
|
|
106
|
+
string = string == null ? curLine.slice(0, start.ch) : curLine + "\n" + string
|
|
107
|
+
}
|
|
108
|
+
chunk *= 2
|
|
109
|
+
|
|
110
|
+
var match = lastMatchIn(string, regexp)
|
|
111
|
+
if (match) {
|
|
112
|
+
var before = string.slice(0, match.index).split("\n"), inside = match[0].split("\n")
|
|
113
|
+
var startLine = line + before.length, startCh = before[before.length - 1].length
|
|
114
|
+
return {from: Pos(startLine, startCh),
|
|
115
|
+
to: Pos(startLine + inside.length - 1,
|
|
116
|
+
inside.length == 1 ? startCh + inside[0].length : inside[inside.length - 1].length),
|
|
117
|
+
match: match}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
var doFold, noFold
|
|
123
|
+
if (String.prototype.normalize) {
|
|
124
|
+
doFold = function(str) { return str.normalize("NFD").toLowerCase() }
|
|
125
|
+
noFold = function(str) { return str.normalize("NFD") }
|
|
126
|
+
} else {
|
|
127
|
+
doFold = function(str) { return str.toLowerCase() }
|
|
128
|
+
noFold = function(str) { return str }
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Maps a position in a case-folded line back to a position in the original line
|
|
132
|
+
// (compensating for codepoints increasing in number during folding)
|
|
133
|
+
function adjustPos(orig, folded, pos, foldFunc) {
|
|
134
|
+
if (orig.length == folded.length) return pos
|
|
135
|
+
for (var min = 0, max = pos + Math.max(0, orig.length - folded.length);;) {
|
|
136
|
+
if (min == max) return min
|
|
137
|
+
var mid = (min + max) >> 1
|
|
138
|
+
var len = foldFunc(orig.slice(0, mid)).length
|
|
139
|
+
if (len == pos) return mid
|
|
140
|
+
else if (len > pos) max = mid
|
|
141
|
+
else min = mid + 1
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function searchStringForward(doc, query, start, caseFold) {
|
|
146
|
+
// Empty string would match anything and never progress, so we
|
|
147
|
+
// define it to match nothing instead.
|
|
148
|
+
if (!query.length) return null
|
|
149
|
+
var fold = caseFold ? doFold : noFold
|
|
150
|
+
var lines = fold(query).split(/\r|\n\r?/)
|
|
151
|
+
|
|
152
|
+
search: for (var line = start.line, ch = start.ch, last = doc.lastLine() + 1 - lines.length; line <= last; line++, ch = 0) {
|
|
153
|
+
var orig = doc.getLine(line).slice(ch), string = fold(orig)
|
|
154
|
+
if (lines.length == 1) {
|
|
155
|
+
var found = string.indexOf(lines[0])
|
|
156
|
+
if (found == -1) continue search
|
|
157
|
+
var start = adjustPos(orig, string, found, fold) + ch
|
|
158
|
+
return {from: Pos(line, adjustPos(orig, string, found, fold) + ch),
|
|
159
|
+
to: Pos(line, adjustPos(orig, string, found + lines[0].length, fold) + ch)}
|
|
160
|
+
} else {
|
|
161
|
+
var cutFrom = string.length - lines[0].length
|
|
162
|
+
if (string.slice(cutFrom) != lines[0]) continue search
|
|
163
|
+
for (var i = 1; i < lines.length - 1; i++)
|
|
164
|
+
if (fold(doc.getLine(line + i)) != lines[i]) continue search
|
|
165
|
+
var end = doc.getLine(line + lines.length - 1), endString = fold(end), lastLine = lines[lines.length - 1]
|
|
166
|
+
if (endString.slice(0, lastLine.length) != lastLine) continue search
|
|
167
|
+
return {from: Pos(line, adjustPos(orig, string, cutFrom, fold) + ch),
|
|
168
|
+
to: Pos(line + lines.length - 1, adjustPos(end, endString, lastLine.length, fold))}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function searchStringBackward(doc, query, start, caseFold) {
|
|
174
|
+
if (!query.length) return null
|
|
175
|
+
var fold = caseFold ? doFold : noFold
|
|
176
|
+
var lines = fold(query).split(/\r|\n\r?/)
|
|
177
|
+
|
|
178
|
+
search: for (var line = start.line, ch = start.ch, first = doc.firstLine() - 1 + lines.length; line >= first; line--, ch = -1) {
|
|
179
|
+
var orig = doc.getLine(line)
|
|
180
|
+
if (ch > -1) orig = orig.slice(0, ch)
|
|
181
|
+
var string = fold(orig)
|
|
182
|
+
if (lines.length == 1) {
|
|
183
|
+
var found = string.lastIndexOf(lines[0])
|
|
184
|
+
if (found == -1) continue search
|
|
185
|
+
return {from: Pos(line, adjustPos(orig, string, found, fold)),
|
|
186
|
+
to: Pos(line, adjustPos(orig, string, found + lines[0].length, fold))}
|
|
187
|
+
} else {
|
|
188
|
+
var lastLine = lines[lines.length - 1]
|
|
189
|
+
if (string.slice(0, lastLine.length) != lastLine) continue search
|
|
190
|
+
for (var i = 1, start = line - lines.length + 1; i < lines.length - 1; i++)
|
|
191
|
+
if (fold(doc.getLine(start + i)) != lines[i]) continue search
|
|
192
|
+
var top = doc.getLine(line + 1 - lines.length), topString = fold(top)
|
|
193
|
+
if (topString.slice(topString.length - lines[0].length) != lines[0]) continue search
|
|
194
|
+
return {from: Pos(line + 1 - lines.length, adjustPos(top, topString, top.length - lines[0].length, fold)),
|
|
195
|
+
to: Pos(line, adjustPos(orig, string, lastLine.length, fold))}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function SearchCursor(doc, query, pos, options) {
|
|
201
|
+
this.atOccurrence = false
|
|
202
|
+
this.doc = doc
|
|
203
|
+
pos = pos ? doc.clipPos(pos) : Pos(0, 0)
|
|
204
|
+
this.pos = {from: pos, to: pos}
|
|
205
|
+
|
|
206
|
+
var caseFold
|
|
207
|
+
if (typeof options == "object") {
|
|
208
|
+
caseFold = options.caseFold
|
|
209
|
+
} else { // Backwards compat for when caseFold was the 4th argument
|
|
210
|
+
caseFold = options
|
|
211
|
+
options = null
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
if (typeof query == "string") {
|
|
215
|
+
if (caseFold == null) caseFold = false
|
|
216
|
+
this.matches = function(reverse, pos) {
|
|
217
|
+
return (reverse ? searchStringBackward : searchStringForward)(doc, query, pos, caseFold)
|
|
218
|
+
}
|
|
219
|
+
} else {
|
|
220
|
+
query = ensureFlags(query, "gm")
|
|
221
|
+
if (!options || options.multiline !== false)
|
|
222
|
+
this.matches = function(reverse, pos) {
|
|
223
|
+
return (reverse ? searchRegexpBackwardMultiline : searchRegexpForwardMultiline)(doc, query, pos)
|
|
224
|
+
}
|
|
225
|
+
else
|
|
226
|
+
this.matches = function(reverse, pos) {
|
|
227
|
+
return (reverse ? searchRegexpBackward : searchRegexpForward)(doc, query, pos)
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
SearchCursor.prototype = {
|
|
233
|
+
findNext: function() {return this.find(false)},
|
|
234
|
+
findPrevious: function() {return this.find(true)},
|
|
235
|
+
|
|
236
|
+
find: function(reverse) {
|
|
237
|
+
var result = this.matches(reverse, this.doc.clipPos(reverse ? this.pos.from : this.pos.to))
|
|
238
|
+
|
|
239
|
+
// Implements weird auto-growing behavior on null-matches for
|
|
240
|
+
// backwards-compatiblity with the vim code (unfortunately)
|
|
241
|
+
while (result && CodeMirror.cmpPos(result.from, result.to) == 0) {
|
|
242
|
+
if (reverse) {
|
|
243
|
+
if (result.from.ch) result.from = Pos(result.from.line, result.from.ch - 1)
|
|
244
|
+
else if (result.from.line == this.doc.firstLine()) result = null
|
|
245
|
+
else result = this.matches(reverse, this.doc.clipPos(Pos(result.from.line - 1)))
|
|
246
|
+
} else {
|
|
247
|
+
if (result.to.ch < this.doc.getLine(result.to.line).length) result.to = Pos(result.to.line, result.to.ch + 1)
|
|
248
|
+
else if (result.to.line == this.doc.lastLine()) result = null
|
|
249
|
+
else result = this.matches(reverse, Pos(result.to.line + 1, 0))
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
if (result) {
|
|
254
|
+
this.pos = result
|
|
255
|
+
this.atOccurrence = true
|
|
256
|
+
return this.pos.match || true
|
|
257
|
+
} else {
|
|
258
|
+
var end = Pos(reverse ? this.doc.firstLine() : this.doc.lastLine() + 1, 0)
|
|
259
|
+
this.pos = {from: end, to: end}
|
|
260
|
+
return this.atOccurrence = false
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
|
|
264
|
+
from: function() {if (this.atOccurrence) return this.pos.from},
|
|
265
|
+
to: function() {if (this.atOccurrence) return this.pos.to},
|
|
266
|
+
|
|
267
|
+
replace: function(newText, origin) {
|
|
268
|
+
if (!this.atOccurrence) return
|
|
269
|
+
var lines = CodeMirror.splitLines(newText)
|
|
270
|
+
this.doc.replaceRange(lines, this.pos.from, this.pos.to, origin)
|
|
271
|
+
this.pos.to = Pos(this.pos.from.line + lines.length - 1,
|
|
272
|
+
lines[lines.length - 1].length + (lines.length == 1 ? this.pos.from.ch : 0))
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
CodeMirror.defineExtension("getSearchCursor", function(query, pos, caseFold) {
|
|
277
|
+
return new SearchCursor(this.doc, query, pos, caseFold)
|
|
278
|
+
})
|
|
279
|
+
CodeMirror.defineDocExtension("getSearchCursor", function(query, pos, caseFold) {
|
|
280
|
+
return new SearchCursor(this, query, pos, caseFold)
|
|
281
|
+
})
|
|
282
|
+
|
|
283
|
+
CodeMirror.defineExtension("selectMatches", function(query, caseFold) {
|
|
284
|
+
var ranges = []
|
|
285
|
+
var cur = this.getSearchCursor(query, this.getCursor("from"), caseFold)
|
|
286
|
+
while (cur.findNext()) {
|
|
287
|
+
if (CodeMirror.cmpPos(cur.to(), this.getCursor("to")) > 0) break
|
|
288
|
+
ranges.push({anchor: cur.from(), head: cur.to()})
|
|
289
|
+
}
|
|
290
|
+
if (ranges.length)
|
|
291
|
+
this.setSelections(ranges, 0)
|
|
292
|
+
})
|
|
293
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<base target="_blank">
|
|
5
|
+
<meta charset="UTF-8">
|
|
6
|
+
|
|
7
|
+
<script src="dist/dist.js"></script>
|
|
8
|
+
|
|
9
|
+
<script src="dist/sn-codemirror-search/search.js"></script>
|
|
10
|
+
<script src="dist/sn-codemirror-search/searchcursor.js"></script>
|
|
11
|
+
<script src="dist/sn-codemirror-search/dialog/dialog.js"></script>
|
|
12
|
+
|
|
13
|
+
<link rel="stylesheet" media="all" href="dist/dist.css">
|
|
14
|
+
<link rel="stylesheet" media="all" href="dist/sn-codemirror-search/dialog/dialog.css">
|
|
15
|
+
</head>
|
|
16
|
+
|
|
17
|
+
<body>
|
|
18
|
+
<div id="wrapper">
|
|
19
|
+
<textarea id="code" name="code"></textarea>
|
|
20
|
+
<div>
|
|
21
|
+
|
|
22
|
+
</body>
|
|
23
|
+
</html>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sncommunity/markdown-minimal",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "1.2.0",
|
|
5
|
+
"description": "A minimal Markdown editor for Standard Notes.",
|
|
6
|
+
"author": "Standard Notes Retired",
|
|
7
|
+
"main": "dist/dist.js",
|
|
8
|
+
"sn": {
|
|
9
|
+
"name": "Minimal Markdown",
|
|
10
|
+
"content_type": "SN|Component",
|
|
11
|
+
"main": "index.html",
|
|
12
|
+
"area": "editor-editor",
|
|
13
|
+
"spellcheckControl": true,
|
|
14
|
+
"note_type": "markdown",
|
|
15
|
+
"file_type": "txt"
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "grunt",
|
|
19
|
+
"test": "echo \"Error: no test specified\" && exit 0"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@babel/core": "^7.11.1",
|
|
23
|
+
"@babel/preset-env": "^7.11.0",
|
|
24
|
+
"@standardnotes/component-relay": "standardnotes/component-relay#839ff5db9bc92db9d42cad8d202ddc4df729597d",
|
|
25
|
+
"babel-cli": "^6.26.0",
|
|
26
|
+
"codemirror": "^5.56.0",
|
|
27
|
+
"grunt": "^1.2.1",
|
|
28
|
+
"grunt-babel": "^8.0.0",
|
|
29
|
+
"grunt-browserify": "^5.3.0",
|
|
30
|
+
"grunt-contrib-concat": "^1.0.1",
|
|
31
|
+
"grunt-contrib-copy": "^1.0.0",
|
|
32
|
+
"grunt-contrib-sass": "^1.0.0",
|
|
33
|
+
"grunt-contrib-watch": "^1.1.0",
|
|
34
|
+
"grunt-newer": "^1.3.0",
|
|
35
|
+
"sass": "*",
|
|
36
|
+
"sn-codemirror-search": "1.0.0",
|
|
37
|
+
"sn-stylekit": "2.1.0"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@standardnotes/community-cdn",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.3",
|
|
4
4
|
"license": "AGPL-3.0-or-later",
|
|
5
5
|
"author": "Standard Notes Community",
|
|
6
6
|
"publishConfig": {
|
|
@@ -17,5 +17,5 @@
|
|
|
17
17
|
"minimatch": "^5.1.0",
|
|
18
18
|
"typescript": "*"
|
|
19
19
|
},
|
|
20
|
-
"gitHead": "
|
|
20
|
+
"gitHead": "a989893452a5b8d13b63b0a789e9c1cba078403a"
|
|
21
21
|
}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
console.log('Entered packaging script...')
|
|
2
|
+
|
|
3
|
+
import fs from 'fs'
|
|
4
|
+
import path from 'path'
|
|
5
|
+
import crypto from 'crypto'
|
|
6
|
+
import { fileURLToPath } from 'url'
|
|
7
|
+
import { spawnSync as spawn } from 'child_process'
|
|
8
|
+
|
|
9
|
+
import zip from '@standardnotes/deterministic-zip'
|
|
10
|
+
import minimatch from 'minimatch'
|
|
11
|
+
|
|
12
|
+
import { ensureDirExists, doesDirExist, emptyExistingDir } from '../../scripts/ScriptUtils.mjs'
|
|
13
|
+
|
|
14
|
+
import { writePackageDirectoryToReadme } from './Readme.mjs'
|
|
15
|
+
|
|
16
|
+
const __filename = fileURLToPath(import.meta.url)
|
|
17
|
+
const __dirname = path.dirname(__filename)
|
|
18
|
+
|
|
19
|
+
console.log('Beginning packaging procedure...')
|
|
20
|
+
|
|
21
|
+
const Packages = JSON.parse(fs.readFileSync(path.join(__dirname, '../plugins.json')).toString())
|
|
22
|
+
const SourceFilesPath = path.join(__dirname, '../../packages')
|
|
23
|
+
|
|
24
|
+
const DistDir = path.join(__dirname, '../dist')
|
|
25
|
+
const ZipsDir = path.join(DistDir, '/zips')
|
|
26
|
+
const AssetsDir = path.join(DistDir, '/static')
|
|
27
|
+
const EntriesDir = path.join(DistDir, '/entries')
|
|
28
|
+
|
|
29
|
+
const TmpDir = path.join(DistDir, 'tmp')
|
|
30
|
+
const PackagesJsonPath = path.join(DistDir, 'packages.json')
|
|
31
|
+
|
|
32
|
+
const CdnInfoJson = JSON.parse(fs.readFileSync(path.join(__dirname, '../cdn.json')).toString())
|
|
33
|
+
const PackagesJson = JSON.parse(fs.readFileSync(PackagesJsonPath).toString())
|
|
34
|
+
console.log('Loaded existing checksums from', PackagesJsonPath)
|
|
35
|
+
|
|
36
|
+
async function zipDirectory(sourceDir, outPath) {
|
|
37
|
+
return new Promise((resolve) => {
|
|
38
|
+
zip(sourceDir, outPath, { cwd: sourceDir }, (err) => {
|
|
39
|
+
console.log(`Zipped to ${outPath}`)
|
|
40
|
+
resolve(outPath)
|
|
41
|
+
})
|
|
42
|
+
})
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const copyFileOrDir = (src, dest, exludedFilesGlob) => {
|
|
46
|
+
const isDir = fs.lstatSync(src).isDirectory()
|
|
47
|
+
if (isDir) {
|
|
48
|
+
ensureDirExists(dest)
|
|
49
|
+
const entries = fs.readdirSync(src, { withFileTypes: true })
|
|
50
|
+
|
|
51
|
+
for (const entry of entries) {
|
|
52
|
+
const srcPath = path.join(src, entry.name)
|
|
53
|
+
|
|
54
|
+
const excluded = exludedFilesGlob && minimatch(srcPath, exludedFilesGlob)
|
|
55
|
+
if (excluded) {
|
|
56
|
+
console.log('Excluding file', srcPath)
|
|
57
|
+
continue
|
|
58
|
+
}
|
|
59
|
+
const destPath = path.join(dest, entry.name)
|
|
60
|
+
|
|
61
|
+
entry.isDirectory() ? copyFileOrDir(srcPath, destPath) : fs.copyFileSync(srcPath, destPath)
|
|
62
|
+
}
|
|
63
|
+
} else {
|
|
64
|
+
const excluded = exludedFilesGlob && minimatch(src, exludedFilesGlob)
|
|
65
|
+
if (excluded) {
|
|
66
|
+
console.log('Excluding file', src)
|
|
67
|
+
return
|
|
68
|
+
}
|
|
69
|
+
fs.copyFileSync(src, dest)
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const getComponentSrcPath = (feature) => {
|
|
74
|
+
return path.join(SourceFilesPath, feature.identifier)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const copyComponentAssets = async (feature, destination, exludedFilesGlob) => {
|
|
78
|
+
const srcComponentPath = getComponentSrcPath(feature)
|
|
79
|
+
|
|
80
|
+
if (!doesDirExist(srcComponentPath)) {
|
|
81
|
+
return false
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
emptyExistingDir(destination)
|
|
85
|
+
ensureDirExists(destination)
|
|
86
|
+
|
|
87
|
+
for (const file of feature.staticFiles) {
|
|
88
|
+
const srcFilePath = path.join(srcComponentPath, file)
|
|
89
|
+
if (!fs.existsSync(srcFilePath)) {
|
|
90
|
+
continue
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const targetFilePath = path.join(destination, file)
|
|
94
|
+
copyFileOrDir(srcFilePath, targetFilePath, exludedFilesGlob)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return true
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const computePackageZipChecksum = async (zipPath) => {
|
|
101
|
+
const zipData = fs.readFileSync(zipPath, 'base64')
|
|
102
|
+
const base64Hash = crypto.createHash('sha256').update(zipData).digest('hex')
|
|
103
|
+
const checksumProcess = spawn('sha256sum', [zipPath])
|
|
104
|
+
const checksumString = checksumProcess.stdout.toString()
|
|
105
|
+
const binaryHash = checksumString.split(' ')[0]
|
|
106
|
+
|
|
107
|
+
return {
|
|
108
|
+
base64Hash: base64Hash,
|
|
109
|
+
binaryHash: binaryHash,
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const packageFeature = async ({ feature, noZip }) => {
|
|
114
|
+
console.log('Processing feature', feature.identifier, '...')
|
|
115
|
+
|
|
116
|
+
const assetsLocation = `${path.join(AssetsDir, feature.identifier)}`
|
|
117
|
+
const assetsSuccess = await copyComponentAssets(feature, assetsLocation, '**/package.json')
|
|
118
|
+
if (!assetsSuccess) {
|
|
119
|
+
console.log('Failed to copy assets for', feature.identifier)
|
|
120
|
+
return
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (noZip) {
|
|
124
|
+
console.log('Input arg noZip detected; not zipping asset.')
|
|
125
|
+
return
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const zipAssetsTmpLocation = `${path.join(TmpDir, feature.identifier)}`
|
|
129
|
+
const zipAssetsSuccess = await copyComponentAssets(feature, zipAssetsTmpLocation)
|
|
130
|
+
if (!zipAssetsSuccess) {
|
|
131
|
+
console.log('Failed to copy zip assets for', feature.identifier)
|
|
132
|
+
return
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const zipDestination = `${ZipsDir}/${feature.identifier}.zip`
|
|
136
|
+
await zipDirectory(zipAssetsTmpLocation, zipDestination)
|
|
137
|
+
|
|
138
|
+
const packageJsonFilePath = path.join(getComponentSrcPath(feature), 'package.json')
|
|
139
|
+
const packageJsonFile = JSON.parse(fs.readFileSync(packageJsonFilePath).toString())
|
|
140
|
+
|
|
141
|
+
const checksum = await computePackageZipChecksum(zipDestination, packageJsonFile.version)
|
|
142
|
+
|
|
143
|
+
const packageEntry = {
|
|
144
|
+
...packageJsonFile.sn,
|
|
145
|
+
identifier: feature.identifier,
|
|
146
|
+
version: packageJsonFile.version,
|
|
147
|
+
url: `${CdnInfoJson.host}/static/${feature.identifier}/${packageJsonFile.sn.main}`,
|
|
148
|
+
download_url: `${CdnInfoJson.host}/zips/${feature.identifier}.zip`,
|
|
149
|
+
latest_url: `${CdnInfoJson.host}/entries/${feature.identifier}.json`,
|
|
150
|
+
publisher: packageJsonFile.author,
|
|
151
|
+
...checksum,
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
PackagesJson[feature.identifier] = packageEntry
|
|
155
|
+
|
|
156
|
+
fs.writeFileSync(`${EntriesDir}/${feature.identifier}.json`, JSON.stringify(packageEntry, undefined, 2))
|
|
157
|
+
|
|
158
|
+
console.log(`Computed checksums for ${feature.identifier}:`, checksum)
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
await (async () => {
|
|
162
|
+
const args = process.argv[2] || ''
|
|
163
|
+
const noZip = args.includes('--no-zip')
|
|
164
|
+
|
|
165
|
+
let index = 0
|
|
166
|
+
for (const feature of Packages) {
|
|
167
|
+
if (index === 0) {
|
|
168
|
+
console.log('\n---\n')
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
await packageFeature({ feature, noZip })
|
|
172
|
+
|
|
173
|
+
if (index !== Packages.length - 1) {
|
|
174
|
+
console.log('\n---\n')
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
index++
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
fs.writeFileSync(PackagesJsonPath, JSON.stringify(PackagesJson, undefined, 2))
|
|
181
|
+
copyFileOrDir(PackagesJsonPath, PackagesJsonPath)
|
|
182
|
+
|
|
183
|
+
console.log('Succesfully wrote checksums to', PackagesJsonPath)
|
|
184
|
+
|
|
185
|
+
emptyExistingDir(TmpDir)
|
|
186
|
+
|
|
187
|
+
writePackageDirectoryToReadme()
|
|
188
|
+
})()
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import path from 'path'
|
|
2
|
+
import { fileURLToPath } from 'url'
|
|
3
|
+
import { readJson, readFile, writeFile } from '../../scripts/ScriptUtils.mjs'
|
|
4
|
+
|
|
5
|
+
const __filename = fileURLToPath(import.meta.url)
|
|
6
|
+
const __dirname = path.dirname(__filename)
|
|
7
|
+
const ROOT = path.join(__dirname, '../..')
|
|
8
|
+
|
|
9
|
+
export function writePackageDirectoryToReadme() {
|
|
10
|
+
const packageEntries = readJson(path.join(ROOT, 'cdn/dist/packages.json'))
|
|
11
|
+
const packages = Object.values(packageEntries)
|
|
12
|
+
|
|
13
|
+
const template = readFile(path.join(ROOT, 'readme.template.md'))
|
|
14
|
+
|
|
15
|
+
const DirectoryPlaceholder = '<!-- DIRECTORY -->'
|
|
16
|
+
|
|
17
|
+
let directoryString = ``
|
|
18
|
+
directoryString += '| Name | Publisher | Install Link |'
|
|
19
|
+
directoryString += '\n'
|
|
20
|
+
directoryString += '|------|-----------|--------------|'
|
|
21
|
+
|
|
22
|
+
for (const packageEntry of packages) {
|
|
23
|
+
let string = '|'
|
|
24
|
+
string += `${packageEntry.name}`
|
|
25
|
+
string += '|'
|
|
26
|
+
string += `${packageEntry.publisher}`
|
|
27
|
+
string += '|'
|
|
28
|
+
string += `${packageEntry.latest_url}`
|
|
29
|
+
string += '|'
|
|
30
|
+
directoryString += '\n'
|
|
31
|
+
|
|
32
|
+
directoryString += string
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const result = template.replace(DirectoryPlaceholder, directoryString)
|
|
36
|
+
|
|
37
|
+
writeFile(result, path.join(ROOT, 'README.md'))
|
|
38
|
+
|
|
39
|
+
console.log('Wrote README file', result)
|
|
40
|
+
}
|