@notifiles/sdk 1.0.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/LICENSE +21 -0
- package/README.md +26 -0
- package/dist/index.modern.cjs +856 -0
- package/dist/index.modern.cjs.map +1 -0
- package/dist/index.modern.modern.js +690 -0
- package/dist/index.modern.modern.js.map +1 -0
- package/package.json +152 -0
- package/src/cloud/add/index.js +38 -0
- package/src/cloud/add/index.test.js +38 -0
- package/src/cloud/add/lib/validate.js +16 -0
- package/src/cloud/index.js +3 -0
- package/src/cloud/list/index.js +18 -0
- package/src/cloud/list/index.test.js +13 -0
- package/src/email/build copy/lib/perform/email.js +52 -0
- package/src/index.js +3 -0
- package/src/lib/adaptSettings.js +12 -0
- package/src/lib/cloudLibrary/bunny/index.js +2 -0
- package/src/lib/cloudLibrary/bunny/isValid.js +32 -0
- package/src/lib/cloudLibrary/bunny/upload.js +35 -0
- package/src/lib/cloudLibrary/index.js +20 -0
- package/src/lib/cloudLibrary/minio/index.js +4 -0
- package/src/lib/cloudLibrary/minio/isValid.js +33 -0
- package/src/lib/cloudLibrary/minio/remove.js +58 -0
- package/src/lib/cloudLibrary/minio/upload.js +61 -0
- package/src/lib/cloudLibrary/minio/uploadFolder.js +26 -0
- package/src/lib/entries/getAtPath.js +105 -0
- package/src/lib/entries/isPathEntry.js +29 -0
- package/src/lib/entries.js +144 -0
- package/src/lib/fs/checkFileExists.js +6 -0
- package/src/lib/fs/directoryFilesRecursive.js +83 -0
- package/src/lib/fs/ensureDirectoryExists.js +10 -0
- package/src/lib/fs/getFileCallerURL.js +12 -0
- package/src/lib/fs/importFileAsText.js +15 -0
- package/src/lib/fs/importJSONAsync.js +16 -0
- package/src/lib/fs/importYAMLAsync.js +14 -0
- package/src/lib/remark/hastToHtml.js +6 -0
- package/src/lib/remark/htmlToHast.js +6 -0
- package/src/lib/remark/htmlToMarkdown copy.js +12 -0
- package/src/lib/remark/htmlToMarkdown.js +23 -0
- package/src/lib/remark/htmlToMdast.js +13 -0
- package/src/lib/remark/htmlToMdast_.js +21 -0
- package/src/lib/remark/htmlToMdast_3.js +21 -0
- package/src/lib/remark/markdownToHTML.js +22 -0
- package/src/lib/remark/markdownToLexer.js +19 -0
- package/src/lib/remark/mdastToHTML.js +8 -0
- package/src/lib/remark/mdastToMarkdown.js +24 -0
- package/src/lib/remark/mdastToString.js +12 -0
- package/src/project/index.js +4 -0
- package/src/project/isProject/index.js +26 -0
- package/src/project/isProject/index.test.js +13 -0
- package/src/project/isProject/sync.js +18 -0
- package/src/project/lib/activity/createFileIfNeeded.js +33 -0
- package/src/project/lib/activity/defaultContent.json +5 -0
- package/src/project/lib/activity/updateToFile.js +32 -0
- package/src/project/lib/manifest/createFileIfNeeded.js +44 -0
- package/src/project/lib/manifest/read.js +21 -0
- package/src/project/lib/manifest/update.js +36 -0
- package/src/project/lib/manifest/updateToFile.js +22 -0
- package/src/project/new/index.js +2 -0
- package/src/project/new/plain.js +49 -0
- package/src/project/new/plain.test.js +38 -0
- package/src/template/build/entry.js +37 -0
- package/src/template/build/index.js +2 -0
- package/src/template/build/lib/email/index.js +100 -0
- package/src/template/build/lib/email/translate.js +16 -0
- package/src/template/build/lib/textmessage/index.js +44 -0
- package/src/template/build/lib/textmessage/translate.js +25 -0
- package/src/template/build/path.js +18 -0
- package/src/template/build/path.test.js +29 -0
- package/src/template/cloudify/entry.js +20 -0
- package/src/template/cloudify/index.js +2 -0
- package/src/template/cloudify/lib/email/attachments/addAttachment.js +24 -0
- package/src/template/cloudify/lib/email/attachments/index.js +137 -0
- package/src/template/cloudify/lib/email/attachments/treatLocalFile.js +13 -0
- package/src/template/cloudify/lib/email/attachments/treatRemoteFile.js +26 -0
- package/src/template/cloudify/lib/email/image/index.js +90 -0
- package/src/template/cloudify/lib/email/image/treatLocalFile.js +13 -0
- package/src/template/cloudify/lib/email/image/treatRemoteFile.js +26 -0
- package/src/template/cloudify/lib/email/index.js +77 -0
- package/src/template/cloudify/lib/remove.js +14 -0
- package/src/template/cloudify/lib/textMessage.js +9 -0
- package/src/template/cloudify/lib/upload.js +14 -0
- package/src/template/cloudify/path.js +20 -0
- package/src/template/cloudify/path.test.js +24 -0
- package/src/template/consolidate/entry.js +18 -0
- package/src/template/consolidate/index.js +2 -0
- package/src/template/consolidate/lib/email.js +63 -0
- package/src/template/consolidate/lib/image/index.js +35 -0
- package/src/template/consolidate/lib/image/treatLocalFile.js +14 -0
- package/src/template/consolidate/lib/image/treatRemoteFile.js +25 -0
- package/src/template/consolidate/lib/textMessage.js +5 -0
- package/src/template/consolidate/path.js +18 -0
- package/src/template/consolidate/path.test.js +14 -0
- package/src/template/format/entry.js +57 -0
- package/src/template/format/index.js +2 -0
- package/src/template/format/path.js +18 -0
- package/src/template/format/path.test.js +29 -0
- package/src/template/index.js +8 -0
- package/src/template/lib/activity/createFileIfNeeded.js +33 -0
- package/src/template/lib/activity/defaultContent.json +4 -0
- package/src/template/lib/activity/get.js +20 -0
- package/src/template/lib/activity/updateToFile.js +33 -0
- package/src/template/lib/manifest/createFileIfNeeded.js +41 -0
- package/src/template/lib/manifest/read.js +22 -0
- package/src/template/lib/manifest/update.js +18 -0
- package/src/template/lib/manifest/updateToFile.js +22 -0
- package/src/template/new/index.js +66 -0
- package/src/template/new/index.test.js +19 -0
- package/src/template/optimize/entry.js +18 -0
- package/src/template/optimize/index.js +2 -0
- package/src/template/optimize/lib/email.js +58 -0
- package/src/template/optimize/lib/image/index.js +40 -0
- package/src/template/optimize/lib/textMessage.js +8 -0
- package/src/template/optimize/path.js +18 -0
- package/src/template/optimize/path.test.js +16 -0
- package/src/template/sync/entry.js +18 -0
- package/src/template/sync/index.js +2 -0
- package/src/template/sync/lib/email.js +86 -0
- package/src/template/sync/lib/textMessage.js +80 -0
- package/src/template/sync/lib/upload.js +14 -0
- package/src/template/sync/path.js +18 -0
- package/src/template/sync/path.test.js +29 -0
- package/src/template/update/index.js +1 -0
- package/src/template/update/path.js +41 -0
- package/src/template/update/path.test.js +46 -0
- package/src/template/version/entry.js +10 -0
- package/src/template/version/index.js +2 -0
- package/src/template/version/lib/perform.js +74 -0
- package/src/template/version/lib/reset.js +16 -0
- package/src/template/version/lib/updatePost.js +16 -0
- package/src/template/version/path.js +20 -0
- package/src/template/version/path.test.js +16 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import upload from './upload.js'
|
|
2
|
+
import fs from 'fs'
|
|
3
|
+
import updateActivity from '../../lib/activity/updateToFile.js'
|
|
4
|
+
import getActivity from '../../lib/activity/get.js'
|
|
5
|
+
import importJSONAsync from '../../../lib/fs/importJSONAsync.js'
|
|
6
|
+
|
|
7
|
+
export default async (props) => {
|
|
8
|
+
|
|
9
|
+
const { entry, settings } = props
|
|
10
|
+
const { path, email, buildPaths, } = entry
|
|
11
|
+
const { body, } = email
|
|
12
|
+
|
|
13
|
+
await fs.promises.writeFile(
|
|
14
|
+
buildPaths.email.body,
|
|
15
|
+
body
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
let manifest = await importJSONAsync(
|
|
19
|
+
buildPaths.manifestFileNameBuilt,
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
let activity = await importJSONAsync(
|
|
23
|
+
buildPaths.activityPath,
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
manifest =
|
|
27
|
+
{
|
|
28
|
+
...manifest,
|
|
29
|
+
...activity[entry.code]
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
await fs.promises.writeFile(
|
|
33
|
+
buildPaths.email.manifestFileNameBuilt,
|
|
34
|
+
JSON.stringify(manifest, null, 2)
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
const { clouds } = settings
|
|
38
|
+
let uploadResult = null
|
|
39
|
+
for (var i in clouds) {
|
|
40
|
+
const cloud = clouds[i]
|
|
41
|
+
uploadResult = await upload({
|
|
42
|
+
id: cloud.id,
|
|
43
|
+
sourceUrl: buildPaths.email.body,
|
|
44
|
+
filename: buildPaths.email.bodyFileName,
|
|
45
|
+
auth: cloud.auth,
|
|
46
|
+
settings
|
|
47
|
+
})
|
|
48
|
+
uploadResult = await upload({
|
|
49
|
+
id: cloud.id,
|
|
50
|
+
sourceUrl: buildPaths.email.text,
|
|
51
|
+
filename: buildPaths.email.textFileName,
|
|
52
|
+
auth: cloud.auth,
|
|
53
|
+
settings
|
|
54
|
+
})
|
|
55
|
+
uploadResult = await upload({
|
|
56
|
+
id: cloud.id,
|
|
57
|
+
sourceUrl: buildPaths.email.subject,
|
|
58
|
+
filename: buildPaths.email.subjectFileName,
|
|
59
|
+
auth: cloud.auth,
|
|
60
|
+
settings
|
|
61
|
+
})
|
|
62
|
+
uploadResult = await upload({
|
|
63
|
+
id: cloud.id,
|
|
64
|
+
sourceUrl: buildPaths.email.manifestFileNameBuilt,
|
|
65
|
+
filename: buildPaths.email.manifestFileName,
|
|
66
|
+
auth: cloud.auth,
|
|
67
|
+
settings
|
|
68
|
+
})
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const _activity = await getActivity({ path })
|
|
72
|
+
|
|
73
|
+
_activity[entry.code] = {
|
|
74
|
+
...(_activity[entry.code] ? _activity[entry.code] : {}),
|
|
75
|
+
status: "published"
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
await updateActivity({
|
|
79
|
+
path,
|
|
80
|
+
content: _activity,
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
return {
|
|
84
|
+
entry
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import upload from './upload.js'
|
|
2
|
+
import fs from 'fs'
|
|
3
|
+
import updateActivity from '../../lib/activity/updateToFile.js'
|
|
4
|
+
import getActivity from '../../lib/activity/get.js'
|
|
5
|
+
import importJSONAsync from '../../../lib/fs/importJSONAsync.js'
|
|
6
|
+
import checkFileExists from '../../../lib/fs/checkFileExists.js'
|
|
7
|
+
|
|
8
|
+
export default async (props) => {
|
|
9
|
+
|
|
10
|
+
const { entry, settings } = props
|
|
11
|
+
const { path, textMessage, buildPaths, } = entry
|
|
12
|
+
const { text, } = textMessage
|
|
13
|
+
|
|
14
|
+
const textPath = `${path}/textmessage.txt`
|
|
15
|
+
if (!(await checkFileExists(textPath))) {
|
|
16
|
+
return {
|
|
17
|
+
entry
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
await fs.promises.writeFile(
|
|
22
|
+
buildPaths.textMessage.text,
|
|
23
|
+
text
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
let manifest = await importJSONAsync(
|
|
27
|
+
buildPaths.manifestFileNameBuilt,
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
let activity = await importJSONAsync(
|
|
31
|
+
buildPaths.activityPath,
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
manifest =
|
|
35
|
+
{
|
|
36
|
+
...manifest,
|
|
37
|
+
...activity[entry.code]
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
await fs.promises.writeFile(
|
|
41
|
+
buildPaths.textMessage.manifestFileNameBuilt,
|
|
42
|
+
JSON.stringify(manifest, null, 2)
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
const { clouds } = settings
|
|
46
|
+
let uploadResult = null
|
|
47
|
+
for (var i in clouds) {
|
|
48
|
+
const cloud = clouds[i]
|
|
49
|
+
uploadResult = await upload({
|
|
50
|
+
id: cloud.id,
|
|
51
|
+
sourceUrl: buildPaths.textMessage.text,
|
|
52
|
+
filename: buildPaths.textMessage.textFileName,
|
|
53
|
+
auth: cloud.auth,
|
|
54
|
+
settings
|
|
55
|
+
})
|
|
56
|
+
uploadResult = await upload({
|
|
57
|
+
id: cloud.id,
|
|
58
|
+
sourceUrl: buildPaths.textMessage.manifestFileNameBuilt,
|
|
59
|
+
filename: buildPaths.textMessage.manifestFileName,
|
|
60
|
+
auth: cloud.auth,
|
|
61
|
+
settings
|
|
62
|
+
})
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const _activity = await getActivity({ path })
|
|
66
|
+
|
|
67
|
+
_activity[entry.code] = {
|
|
68
|
+
...(_activity[entry.code] ? _activity[entry.code] : {}),
|
|
69
|
+
status: "published"
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
await updateActivity({
|
|
73
|
+
path,
|
|
74
|
+
content: _activity,
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
return {
|
|
78
|
+
entry
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export default async (props) => {
|
|
2
|
+
|
|
3
|
+
const { id, settings } = props
|
|
4
|
+
|
|
5
|
+
const cloudLibrary = settings.cloudLibrary({ id })
|
|
6
|
+
if (!cloudLibrary) {
|
|
7
|
+
return {
|
|
8
|
+
isValid: false,
|
|
9
|
+
error: new Error('Cloud not supported.')
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return cloudLibrary.upload(props)
|
|
14
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import perform from './lib/email.js'
|
|
2
|
+
import getEntries from '../../lib/entries/getAtPath.js'
|
|
3
|
+
|
|
4
|
+
export default async ({
|
|
5
|
+
path,
|
|
6
|
+
settings
|
|
7
|
+
}) => {
|
|
8
|
+
let entries = await getEntries({
|
|
9
|
+
path,
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
for (var i in entries) {
|
|
13
|
+
const entry = entries[i]
|
|
14
|
+
await perform({ entry, settings })
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return true
|
|
18
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
|
|
2
|
+
test.skip('build posts', async () => {
|
|
3
|
+
const fsPath = (await import('path')).default
|
|
4
|
+
let path = fsPath.resolve(process.env.TEST_MOCK_FOLDER)
|
|
5
|
+
const operation = (await import('./path.js')).default
|
|
6
|
+
|
|
7
|
+
const result = await operation({
|
|
8
|
+
settings: {
|
|
9
|
+
platforms: [{
|
|
10
|
+
id: 'medium',
|
|
11
|
+
auth: {
|
|
12
|
+
token: process.env.TEST_MEDIUM_TOKEN,
|
|
13
|
+
}
|
|
14
|
+
}],
|
|
15
|
+
storage: {
|
|
16
|
+
type: "cdn",
|
|
17
|
+
auth: {
|
|
18
|
+
key: '',
|
|
19
|
+
secret: '',
|
|
20
|
+
bucketName: ''
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
path,
|
|
25
|
+
})
|
|
26
|
+
expect(result).toBeTruthy()
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as processPath } from './path.js'
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import consolidate from '../consolidate/entry.js'
|
|
2
|
+
import getEntries from '../../lib/entries/getAtPath.js'
|
|
3
|
+
import build from '../build/entry.js'
|
|
4
|
+
import sync from '../sync/entry.js'
|
|
5
|
+
import format from '../format/entry.js'
|
|
6
|
+
import optimize from '../optimize/entry.js'
|
|
7
|
+
import version from '../version/entry.js'
|
|
8
|
+
import cloudify from '../cloudify/entry.js'
|
|
9
|
+
import adaptSettings from '../../lib/adaptSettings.js'
|
|
10
|
+
|
|
11
|
+
export default async ({
|
|
12
|
+
path,
|
|
13
|
+
settings
|
|
14
|
+
}) => {
|
|
15
|
+
adaptSettings({ settings })
|
|
16
|
+
let entries = await getEntries({
|
|
17
|
+
path,
|
|
18
|
+
settings
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
for (var i in entries) {
|
|
22
|
+
let entry = entries[i]
|
|
23
|
+
switch (entry.manifest.status) {
|
|
24
|
+
case 'pause': {
|
|
25
|
+
continue
|
|
26
|
+
}
|
|
27
|
+
default: break
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
entry = (await format({ entry, settings })).entry
|
|
31
|
+
entry = (await build({ entry, settings })).entry
|
|
32
|
+
entry = (await consolidate({ entry, settings })).entry
|
|
33
|
+
entry = (await optimize({ entry, settings })).entry
|
|
34
|
+
entry = (await cloudify({ entry, settings })).entry
|
|
35
|
+
entry = (await sync({ entry, settings })).entry
|
|
36
|
+
|
|
37
|
+
await version({})
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return true
|
|
41
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
describe('project', () => {
|
|
4
|
+
it('Updates and syncs to minio', async () => {
|
|
5
|
+
const fsPath = (await import('path')).default
|
|
6
|
+
let path = `${fsPath.resolve(process.env.TEST_MOCK_FOLDER)}`
|
|
7
|
+
const operation = (await import('./path.js')).default
|
|
8
|
+
const result = await operation({
|
|
9
|
+
settings: {
|
|
10
|
+
forceUploadAttachments: false,
|
|
11
|
+
clouds: [{
|
|
12
|
+
id: "minio",
|
|
13
|
+
auth: {
|
|
14
|
+
endPoint: process.env.TEST_MINIO_ENDPOINT,
|
|
15
|
+
accessKey: process.env.TEST_MINIO_ACCESS_KEY,
|
|
16
|
+
secretKey: process.env.TEST_MINIO_SECRET,
|
|
17
|
+
bucketName: process.env.TEST_MINIO_BUCKET_NAME
|
|
18
|
+
}
|
|
19
|
+
},],
|
|
20
|
+
},
|
|
21
|
+
path,
|
|
22
|
+
})
|
|
23
|
+
expect(result).toBeTruthy()
|
|
24
|
+
})
|
|
25
|
+
it.skip('Updates and syncs to minio force', async () => {
|
|
26
|
+
const fsPath = (await import('path')).default
|
|
27
|
+
let path = `${fsPath.resolve(process.env.TEST_MOCK_FOLDER)}`
|
|
28
|
+
const operation = (await import('./path.js')).default
|
|
29
|
+
const result = await operation({
|
|
30
|
+
settings: {
|
|
31
|
+
forceUploadAttachments: true,
|
|
32
|
+
clouds: [{
|
|
33
|
+
id: "minio",
|
|
34
|
+
auth: {
|
|
35
|
+
endPoint: process.env.TEST_MINIO_ENDPOINT,
|
|
36
|
+
accessKey: process.env.TEST_MINIO_ACCESS_KEY,
|
|
37
|
+
secretKey: process.env.TEST_MINIO_SECRET,
|
|
38
|
+
bucketName: process.env.TEST_MINIO_BUCKET_NAME
|
|
39
|
+
}
|
|
40
|
+
},],
|
|
41
|
+
},
|
|
42
|
+
path,
|
|
43
|
+
})
|
|
44
|
+
expect(result).toBeTruthy()
|
|
45
|
+
})
|
|
46
|
+
})
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import markdownToLexer from '../../../lib/remark/markdownToLexer.js'
|
|
2
|
+
import mdastToHTML from '../../../lib/remark/mdastToHTML.js'
|
|
3
|
+
import mdastToMarkdown from '../../../lib/remark/mdastToMarkdown.js'
|
|
4
|
+
import reset from './reset.js'
|
|
5
|
+
import updatePost from './updatePost.js'
|
|
6
|
+
|
|
7
|
+
export default async (props) => {
|
|
8
|
+
|
|
9
|
+
const { entry } = props
|
|
10
|
+
const { path, } = entry
|
|
11
|
+
const data = props.source ? props.source : (entry.post.consolidated
|
|
12
|
+
? entry.post.consolidated
|
|
13
|
+
: entry.post.source)
|
|
14
|
+
|
|
15
|
+
await reset({ path })
|
|
16
|
+
|
|
17
|
+
const child = markdownToLexer({
|
|
18
|
+
data
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
const mdast = await perform({
|
|
22
|
+
child,
|
|
23
|
+
path
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
let md = await mdastToMarkdown({ mdast })
|
|
27
|
+
let html = mdastToHTML({ mdast })
|
|
28
|
+
|
|
29
|
+
await updatePost({
|
|
30
|
+
path,
|
|
31
|
+
md,
|
|
32
|
+
html
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
return {
|
|
36
|
+
md,
|
|
37
|
+
html,
|
|
38
|
+
entry: mdast
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const perform = async (props) => {
|
|
43
|
+
const { child, path } = props
|
|
44
|
+
let _child = { ...child }
|
|
45
|
+
// switch (_child.type) {
|
|
46
|
+
// case 'code': {
|
|
47
|
+
// switch (_child.lang) {
|
|
48
|
+
// case 'mermaid': {
|
|
49
|
+
// _child = await buildMermaid({
|
|
50
|
+
// child: _child,
|
|
51
|
+
// path
|
|
52
|
+
// })
|
|
53
|
+
// } break
|
|
54
|
+
// default:
|
|
55
|
+
// break
|
|
56
|
+
// }
|
|
57
|
+
// } break
|
|
58
|
+
// default:
|
|
59
|
+
// break
|
|
60
|
+
// }
|
|
61
|
+
|
|
62
|
+
let _children = []
|
|
63
|
+
if (_child.children) {
|
|
64
|
+
_children = await Promise.all(_child.children.map(async child => perform({
|
|
65
|
+
...props,
|
|
66
|
+
child
|
|
67
|
+
})))
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return {
|
|
71
|
+
..._child,
|
|
72
|
+
children: _children
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import fsPath from 'path'
|
|
2
|
+
import fs from 'fs'
|
|
3
|
+
import checkFileExists from '../../../lib/fs/checkFileExists.js'
|
|
4
|
+
|
|
5
|
+
export default async ({
|
|
6
|
+
path, }) => {
|
|
7
|
+
|
|
8
|
+
const buildPath = fsPath.join(path, "build")
|
|
9
|
+
if (!(await checkFileExists(buildPath))) {
|
|
10
|
+
return
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
let success = await fs.promises.rmdir(buildPath, { recursive: true })
|
|
14
|
+
success = true
|
|
15
|
+
return success
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import fsPath from 'path'
|
|
2
|
+
import fs from 'fs'
|
|
3
|
+
|
|
4
|
+
export default async ({
|
|
5
|
+
path,
|
|
6
|
+
md,
|
|
7
|
+
html }) => {
|
|
8
|
+
|
|
9
|
+
const mdPath = fsPath.join(path, ".post.built.md")
|
|
10
|
+
const htmlPath = fsPath.join(path, ".post.built.html")
|
|
11
|
+
|
|
12
|
+
await fs.promises.writeFile(mdPath, md, 'utf8')
|
|
13
|
+
await fs.promises.writeFile(htmlPath, html, 'utf8')
|
|
14
|
+
|
|
15
|
+
return true
|
|
16
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import perform from './lib/perform.js'
|
|
2
|
+
import getEntries from '../../lib/entries/getAtPath.js'
|
|
3
|
+
import adaptSettings from '../../lib/adaptSettings.js'
|
|
4
|
+
|
|
5
|
+
export default async ({
|
|
6
|
+
path,
|
|
7
|
+
settings
|
|
8
|
+
}) => {
|
|
9
|
+
adaptSettings({ settings })
|
|
10
|
+
let entries = await getEntries({
|
|
11
|
+
path,
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
for (var i in entries) {
|
|
15
|
+
const entry = entries[i]
|
|
16
|
+
await perform({ entry, settings })
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return true
|
|
20
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
test.skip('version posts', async () => {
|
|
4
|
+
const fsPath = (await import('path')).default
|
|
5
|
+
let path = fsPath.resolve(process.env.TEST_MOCK_FOLDER)
|
|
6
|
+
const operation = (await import('./path.js')).default
|
|
7
|
+
|
|
8
|
+
const result = await operation({
|
|
9
|
+
settings: {
|
|
10
|
+
},
|
|
11
|
+
path,
|
|
12
|
+
})
|
|
13
|
+
expect(result).toBeTruthy()
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
|