@servable/tools 1.0.1
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 +33 -0
- package/package.json +106 -0
- package/src/config/candidates/featureCandidates/index.js +48 -0
- package/src/config/candidates/index.js +18 -0
- package/src/config/index.js +2 -0
- package/src/config/validate/feature/index.js +7 -0
- package/src/config/validate/index.js +5 -0
- package/src/document/1.0.0/all/build/class/index.js +67 -0
- package/src/document/1.0.0/all/build/feature/index.js +135 -0
- package/src/document/1.0.0/all/index.js +17 -0
- package/src/document/1.0.0/all/write/class/index.js +25 -0
- package/src/document/1.0.0/all/write/feature/index.js +43 -0
- package/src/document/1.0.0/all/write/index.js +10 -0
- package/src/document/1.0.0/all/write/utils/chunk.js +19 -0
- package/src/document/1.0.0/chunks/build/class/class.js +20 -0
- package/src/document/1.0.0/chunks/build/class/functions.js +21 -0
- package/src/document/1.0.0/chunks/build/class/lib.js +21 -0
- package/src/document/1.0.0/chunks/build/class/seed.js +21 -0
- package/src/document/1.0.0/chunks/build/class/triggers.js +26 -0
- package/src/document/1.0.0/chunks/build/feature/afterInit.js +20 -0
- package/src/document/1.0.0/chunks/build/feature/beforeInit.js +20 -0
- package/src/document/1.0.0/chunks/build/feature/class.js +42 -0
- package/src/document/1.0.0/chunks/build/feature/config.js +20 -0
- package/src/document/1.0.0/chunks/build/feature/functions.js +20 -0
- package/src/document/1.0.0/chunks/build/feature/lib.js +21 -0
- package/src/document/1.0.0/chunks/build/feature/liveClasses.js +20 -0
- package/src/document/1.0.0/chunks/build/feature/schema.js +206 -0
- package/src/document/1.0.0/chunks/build/feature/seed.js +20 -0
- package/src/document/1.0.0/chunks/build/feature/system.js +20 -0
- package/src/document/1.0.0/chunks/build/feature/triggers.js +20 -0
- package/src/document/1.0.0/generateGithubReadme/build/chunks/_generateBadge.js +4 -0
- package/src/document/1.0.0/generateGithubReadme/build/chunks/_githubPackage.js +4 -0
- package/src/document/1.0.0/generateGithubReadme/build/chunks/adapters.js +40 -0
- package/src/document/1.0.0/generateGithubReadme/build/chunks/apis.js +39 -0
- package/src/document/1.0.0/generateGithubReadme/build/chunks/categories.js +32 -0
- package/src/document/1.0.0/generateGithubReadme/build/chunks/dependencies/build.js +29 -0
- package/src/document/1.0.0/generateGithubReadme/build/chunks/dependencies/index.js +40 -0
- package/src/document/1.0.0/generateGithubReadme/build/chunks/footer.js +33 -0
- package/src/document/1.0.0/generateGithubReadme/build/chunks/githubTags.js +42 -0
- package/src/document/1.0.0/generateGithubReadme/build/chunks/install.js +29 -0
- package/src/document/1.0.0/generateGithubReadme/build/chunks/packages.js +26 -0
- package/src/document/1.0.0/generateGithubReadme/build/chunks/registry.js +42 -0
- package/src/document/1.0.0/generateGithubReadme/build/chunks/usage.js +68 -0
- package/src/document/1.0.0/generateGithubReadme/build/index.js +224 -0
- package/src/document/1.0.0/generateGithubReadme/index.js +28 -0
- package/src/document/1.1.0/all/build/class/index.js +67 -0
- package/src/document/1.1.0/all/build/feature/index.js +135 -0
- package/src/document/1.1.0/all/index.js +17 -0
- package/src/document/1.1.0/all/write/class/index.js +25 -0
- package/src/document/1.1.0/all/write/feature/index.js +43 -0
- package/src/document/1.1.0/all/write/index.js +10 -0
- package/src/document/1.1.0/all/write/utils/chunk.js +19 -0
- package/src/document/1.1.0/chunks/build/class/class.js +20 -0
- package/src/document/1.1.0/chunks/build/class/functions.js +21 -0
- package/src/document/1.1.0/chunks/build/class/lib.js +21 -0
- package/src/document/1.1.0/chunks/build/class/seed.js +21 -0
- package/src/document/1.1.0/chunks/build/class/triggers.js +26 -0
- package/src/document/1.1.0/chunks/build/feature/afterInit.js +20 -0
- package/src/document/1.1.0/chunks/build/feature/beforeInit.js +20 -0
- package/src/document/1.1.0/chunks/build/feature/class.js +42 -0
- package/src/document/1.1.0/chunks/build/feature/config.js +20 -0
- package/src/document/1.1.0/chunks/build/feature/functions.js +20 -0
- package/src/document/1.1.0/chunks/build/feature/lib.js +21 -0
- package/src/document/1.1.0/chunks/build/feature/liveClasses.js +20 -0
- package/src/document/1.1.0/chunks/build/feature/schema.js +206 -0
- package/src/document/1.1.0/chunks/build/feature/seed.js +20 -0
- package/src/document/1.1.0/chunks/build/feature/system.js +20 -0
- package/src/document/1.1.0/chunks/build/feature/triggers.js +20 -0
- package/src/document/1.1.0/generateGithubReadme/build/chunks/_generateBadge.js +4 -0
- package/src/document/1.1.0/generateGithubReadme/build/chunks/_githubPackage.js +4 -0
- package/src/document/1.1.0/generateGithubReadme/build/chunks/adapters.js +40 -0
- package/src/document/1.1.0/generateGithubReadme/build/chunks/apis.js +39 -0
- package/src/document/1.1.0/generateGithubReadme/build/chunks/categories.js +32 -0
- package/src/document/1.1.0/generateGithubReadme/build/chunks/dependencies/build.js +29 -0
- package/src/document/1.1.0/generateGithubReadme/build/chunks/dependencies/index.js +40 -0
- package/src/document/1.1.0/generateGithubReadme/build/chunks/footer.js +33 -0
- package/src/document/1.1.0/generateGithubReadme/build/chunks/githubTags.js +42 -0
- package/src/document/1.1.0/generateGithubReadme/build/chunks/install.js +29 -0
- package/src/document/1.1.0/generateGithubReadme/build/chunks/packages.js +26 -0
- package/src/document/1.1.0/generateGithubReadme/build/chunks/registry.js +42 -0
- package/src/document/1.1.0/generateGithubReadme/build/chunks/usage.js +68 -0
- package/src/document/1.1.0/generateGithubReadme/build/index.js +224 -0
- package/src/document/1.1.0/generateGithubReadme/index.js +28 -0
- package/src/document/gateway/all/index.js +23 -0
- package/src/document/gateway/generateGithubReadme/index.js +24 -0
- package/src/domain/feature/factory/absoluteModuleSrcPath.js +10 -0
- package/src/domain/feature/factory/featurePath.js +41 -0
- package/src/domain/feature/factory/index.js +71 -0
- package/src/domain/feature/index.js +117 -0
- package/src/domain/feature/lib/instancesPathIdUniqueId.js +17 -0
- package/src/domain/featureInstance/factory/getLoaderWithPayload.js +7 -0
- package/src/domain/featureInstance/factory/index.js +65 -0
- package/src/domain/featureInstance/factory/instancesWithPath.js +12 -0
- package/src/domain/featureInstance/index.js +199 -0
- package/src/domain/featureLoader/base.js +100 -0
- package/src/domain/featureLoader/factory/getModule.js +40 -0
- package/src/domain/featureLoader/factory/index.js +9 -0
- package/src/domain/featureLoader/lib/importJSDefault.js +12 -0
- package/src/domain/featureLoader/lib/importJSONDefault.js +14 -0
- package/src/domain/featureLoader/lib/mergeClassFeatures.js +17 -0
- package/src/domain/featureLoader/lib/triggerItems.js +8 -0
- package/src/domain/featureLoader/v1.0.0.js +861 -0
- package/src/domain/featureLoader/v1.1.0.js +871 -0
- package/src/domain/lib/checkFileExists.js +6 -0
- package/src/domain/servable/index.js +19 -0
- package/src/domain/servable/parse/index.js +5 -0
- package/src/domain/servable/parse/utils/index.js +216 -0
- package/src/index.js +29 -0
- package/src/lib/adaptConfig/basic.js +85 -0
- package/src/lib/adaptFeaturePayload.js +18 -0
- package/src/lib/checkFileExists.js +6 -0
- package/src/lib/cleanFeatures.js +25 -0
- package/src/lib/directories.js +49 -0
- package/src/lib/directoryFilesRecursive.js +83 -0
- package/src/lib/directoryGlob.js +14 -0
- package/src/lib/ensureDirectoryExists.js +14 -0
- package/src/lib/featureApiVersion.js +30 -0
- package/src/lib/foldersInFolder.js +46 -0
- package/src/lib/getModuleDir.js +19 -0
- package/src/lib/importFileAsText.js +15 -0
- package/src/lib/importJSONAsync.js +16 -0
- package/src/lib/sanitizePath.js +4 -0
- package/src/manifest/access/accessChildInTreeWithRoute.js +49 -0
- package/src/manifest/access/index.js +58 -0
- package/src/manifest/data/1.0.0/class.json +233 -0
- package/src/manifest/data/1.0.0/enums.js +255 -0
- package/src/manifest/data/1.0.0/feature.json +503 -0
- package/src/manifest/data/1.0.0/schema.json +145 -0
- package/src/manifest/data/1.1.0/class.json +233 -0
- package/src/manifest/data/1.1.0/enums.js +267 -0
- package/src/manifest/data/1.1.0/feature.json +542 -0
- package/src/manifest/data/1.1.0/schema.json +145 -0
- package/src/manifest/extract/extractAst.js +36 -0
- package/src/manifest/extract/extractItem.js +70 -0
- package/src/manifest/extract/formatFile.js +22 -0
- package/src/manifest/extract/index.js +23 -0
- package/src/manifest/extract/route/extractFileWithVariants.js +38 -0
- package/src/manifest/extract/route/extractFiles.js +87 -0
- package/src/manifest/extract/route/imageToBase64.js +42 -0
- package/src/manifest/extract/route/index.js +102 -0
- package/src/manifest/extract/templateDataForId.js +44 -0
- package/src/schema/build/buildFeature/classStruct/extractFeaturesFeatures.js +29 -0
- package/src/schema/build/buildFeature/classStruct/featureInClassClassSchema.js +36 -0
- package/src/schema/build/buildFeature/classStruct/index.js +62 -0
- package/src/schema/build/buildFeature/classStruct/preserveMostRestricted.js +68 -0
- package/src/schema/build/buildFeature/extractClassesFeature.js +49 -0
- package/src/schema/build/buildFeature/index.js +119 -0
- package/src/schema/build/index.js +54 -0
- package/src/schema/build/lib/getFeaturesLiveClasses.js +14 -0
- package/src/schema/build/lib/updateFeaturesExcerpt.js +24 -0
- package/src/schema/index.js +57 -0
- package/src/schema/validate/handleFeature/computeVersions.js +48 -0
- package/src/schema/validate/handleFeature/index.js +5 -0
- package/src/schema/validate/index.js +52 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
|
|
2
|
+
export default async props => {
|
|
3
|
+
|
|
4
|
+
const payload = []
|
|
5
|
+
|
|
6
|
+
payload.push({
|
|
7
|
+
h2: 'Resources'
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
payload.push({
|
|
11
|
+
h3: 'Servable Documentation'
|
|
12
|
+
})
|
|
13
|
+
payload.push({
|
|
14
|
+
p: 'You can find here the complete [servable documentation](https://docs.servable.app/) with guides and api reference.'
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
payload.push({
|
|
18
|
+
h3: 'Servable Registry'
|
|
19
|
+
})
|
|
20
|
+
payload.push({
|
|
21
|
+
p: 'You can find other Servable features at the [Servable registry](https://servable.app/)'
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
payload.push({
|
|
26
|
+
h3: 'License'
|
|
27
|
+
})
|
|
28
|
+
payload.push({
|
|
29
|
+
p: 'MIT © [servable-core](https://github.com/servable-core)'
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
return { payload, name: 'Footer', id: 'footer', }
|
|
33
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { FeatureEnum } from "../../../../../manifest/data/1.0.0/enums.js"
|
|
2
|
+
import access from '../../../../../manifest/access/index.js'
|
|
3
|
+
|
|
4
|
+
export default async props => {
|
|
5
|
+
const { path, extraction } = props
|
|
6
|
+
const payload = []
|
|
7
|
+
let githubPackageName = null
|
|
8
|
+
let npmPackageName = null
|
|
9
|
+
|
|
10
|
+
let index = await access({
|
|
11
|
+
item: FeatureEnum.Index,
|
|
12
|
+
extraction,
|
|
13
|
+
path
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
if (index && index.data && index.data.module) {
|
|
17
|
+
githubPackageName = 'servable-core/publishable'
|
|
18
|
+
npmPackageName = `@${githubPackageName}`
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const target = await access({
|
|
22
|
+
item: FeatureEnum.AfterInit,
|
|
23
|
+
path,
|
|
24
|
+
extraction
|
|
25
|
+
})
|
|
26
|
+
if (target && target.data) {
|
|
27
|
+
const { astAdapted } = target.data
|
|
28
|
+
if (astAdapted) {
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// payload.push({
|
|
33
|
+
// p: `> [!WARNING] \> Servable is still experimental and its api may change in the future.
|
|
34
|
+
// ` })
|
|
35
|
+
|
|
36
|
+
payload.push({
|
|
37
|
+
p: `[](https://www.npmjs.org/package/${npmPackageName}) [](https://npmjs.org/package/${npmPackageName}) [](https://github.com/${githubPackageName}/actions/tests.yml) [](https://opensource.org/licenses/MIT) [](https://standardjs.com)
|
|
38
|
+
`
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
return { payload, name: 'After init', id: 'afterInit', auxiliary: (target && target.data) ? target.data.documentation : null }
|
|
42
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
|
|
2
|
+
export default async props => {
|
|
3
|
+
const { path, extraction, githubPackageName, npmPackageName } = props
|
|
4
|
+
const payload = []
|
|
5
|
+
|
|
6
|
+
payload.push({
|
|
7
|
+
h2: 'Install'
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
payload.push({
|
|
11
|
+
code: {
|
|
12
|
+
"language": "bash",
|
|
13
|
+
"content": `yarn add ${npmPackageName}`
|
|
14
|
+
}
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
payload.push({
|
|
18
|
+
p: 'or'
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
payload.push({
|
|
22
|
+
code: {
|
|
23
|
+
"language": "bash",
|
|
24
|
+
"content": `npm install ${npmPackageName}`
|
|
25
|
+
}
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
return { payload, name: 'After init', id: 'afterInit', }
|
|
29
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import _githubPackage from "./_githubPackage.js"
|
|
2
|
+
|
|
3
|
+
export default async props => {
|
|
4
|
+
const { packages, } = props
|
|
5
|
+
const payload = []
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
if (!packages || !packages.length) {
|
|
10
|
+
return { payload, name: 'Packages', id: 'packages', }
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
payload.push({
|
|
14
|
+
h3: 'Companion packages'
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
packages.forEach(p => {
|
|
18
|
+
if (!p.repository) {
|
|
19
|
+
return
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
payload.push(_githubPackage({ username: p.username, name: p.name }))
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
return { payload, name: 'Packages', id: 'packages', }
|
|
26
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
|
|
2
|
+
export default async props => {
|
|
3
|
+
const { path, extraction, mainPackage, index } = props
|
|
4
|
+
const payload = []
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
if (!index.data || !index.data.module || !index.data.module.registry) {
|
|
8
|
+
return { payload, name: 'Registry', id: 'registry', }
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const { name, description, id, version, } = mainPackage
|
|
12
|
+
payload.push({
|
|
13
|
+
h3: 'Available in Servable registry'
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
// payload.push({
|
|
17
|
+
// img: {
|
|
18
|
+
// source: 'https://api.cdn.servable.app/assets/logo.png'
|
|
19
|
+
// }
|
|
20
|
+
// })
|
|
21
|
+
|
|
22
|
+
payload.push({
|
|
23
|
+
p: '<img src="https://cdn.servable.app/assets/logo.png" alt="drawing" style="width:50px;" />'
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
payload.push({
|
|
27
|
+
p: `${id} is available at [servable registry](https://servable.app/feature/${index.data.module.registry.id}).`
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
payload.push({
|
|
31
|
+
p: '**Use in your servable project:**'
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
payload.push({
|
|
35
|
+
code: {
|
|
36
|
+
"language": "bash",
|
|
37
|
+
"content": `yo servable -t usefeature --featureid ${index.data.module.registry.id}`
|
|
38
|
+
}
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
return { payload, name: 'Registry', id: 'registry', }
|
|
42
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
|
|
2
|
+
export default async props => {
|
|
3
|
+
const { path, extraction, mainPackage, index } = props
|
|
4
|
+
const payload = []
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
if (!mainPackage || !mainPackage.usage) {
|
|
8
|
+
return { payload, name: 'Usage', id: 'usage', }
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const { howTo, template, parameters } = mainPackage.usage
|
|
12
|
+
payload.push({
|
|
13
|
+
h2: 'Usage'
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
payload.push({
|
|
17
|
+
h3: 'Template'
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
payload.push({
|
|
21
|
+
p: "Add this template to your class' features.json file. Fill the values to fit your needs with the right parameters."
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
payload.push({
|
|
25
|
+
code: {
|
|
26
|
+
"language": "json",
|
|
27
|
+
"content": JSON.stringify(template, null, 2)
|
|
28
|
+
}
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
payload.push({
|
|
32
|
+
h3: 'Parameters'
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
// payload.push({
|
|
36
|
+
// code: {
|
|
37
|
+
// "language": "json",
|
|
38
|
+
// "content": JSON.stringify(parameters)
|
|
39
|
+
// }
|
|
40
|
+
// })
|
|
41
|
+
|
|
42
|
+
if (parameters && parameters.length) {
|
|
43
|
+
const rows = []
|
|
44
|
+
parameters.forEach(param => {
|
|
45
|
+
const { type = "", name: id = "", message = "", defaultValue = "", validators } = param
|
|
46
|
+
rows.push([
|
|
47
|
+
type,
|
|
48
|
+
id,
|
|
49
|
+
message,
|
|
50
|
+
defaultValue,
|
|
51
|
+
])
|
|
52
|
+
})
|
|
53
|
+
if (rows && rows.length) {
|
|
54
|
+
payload.push({
|
|
55
|
+
table: {
|
|
56
|
+
headers: ["type", "id", "Message", "Default value"],
|
|
57
|
+
rows
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
}
|
|
61
|
+
} else {
|
|
62
|
+
payload.push({
|
|
63
|
+
p: 'No parameters'
|
|
64
|
+
})
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return { payload, name: 'Usage', id: 'usage', }
|
|
68
|
+
}
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import gitUrlParse from "git-url-parse"
|
|
2
|
+
import { FeatureEnum } from "../../../../manifest/data/1.0.0/enums.js"
|
|
3
|
+
// import append from "../utils/builder/append.js"
|
|
4
|
+
import access from '../../../../manifest/access/index.js'
|
|
5
|
+
import buildSeed from '../../chunks/build/feature/seed.js'
|
|
6
|
+
import buildFeatureClass from '../../chunks/build/feature/class.js'
|
|
7
|
+
import buildConfig from '../../chunks/build/feature/config.js'
|
|
8
|
+
import buildLiveClasses from '../../chunks/build/feature/liveClasses.js'
|
|
9
|
+
import buildAfterInit from '../../chunks/build/feature/afterInit.js'
|
|
10
|
+
import buildBeforeInit from '../../chunks/build/feature/beforeInit.js'
|
|
11
|
+
import buildFunctions from '../../chunks/build/feature/functions.js'
|
|
12
|
+
import buildSchema from '../../chunks/build/feature/schema.js'
|
|
13
|
+
import buildSystem from '../../chunks/build/feature/system.js'
|
|
14
|
+
import buildLib from '../../chunks/build/feature/lib.js'
|
|
15
|
+
import buildGithubTags from './chunks/githubTags.js'
|
|
16
|
+
import buildRegistry from './chunks/registry.js'
|
|
17
|
+
import buildInstall from './chunks/install.js'
|
|
18
|
+
import buildUsage from './chunks/usage.js'
|
|
19
|
+
import buildFooter from './chunks/footer.js'
|
|
20
|
+
import buildPackages from './chunks/packages.js'
|
|
21
|
+
import buildDependencies from './chunks/dependencies/index.js'
|
|
22
|
+
import buildTriggers from '../../chunks/build/feature/triggers.js'
|
|
23
|
+
import buildAdapters from './chunks/adapters.js'
|
|
24
|
+
import buildApis from './chunks/apis.js'
|
|
25
|
+
import buildCategories from './chunks/categories.js'
|
|
26
|
+
|
|
27
|
+
export default async props => {
|
|
28
|
+
const { path, includeChunksInMain = true } = props
|
|
29
|
+
let payload = []
|
|
30
|
+
const chunks = {}
|
|
31
|
+
let extraction = null
|
|
32
|
+
let githubPackageName = null
|
|
33
|
+
let npmPackageName = null
|
|
34
|
+
let mainPackage = null
|
|
35
|
+
let packages
|
|
36
|
+
let version = null
|
|
37
|
+
let index = await access({
|
|
38
|
+
item: FeatureEnum.Index,
|
|
39
|
+
extraction,
|
|
40
|
+
path
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
if (index && index.data && index.data.module) {
|
|
44
|
+
packages = index.data.module.packages
|
|
45
|
+
mainPackage = index.data.module
|
|
46
|
+
const { name, description, id, } = mainPackage
|
|
47
|
+
version = mainPackage.version
|
|
48
|
+
payload.push({ h1: `${name} *feature for Servable*` })
|
|
49
|
+
payload.push({ p: `**${id}**` })
|
|
50
|
+
|
|
51
|
+
npmPackageName = id
|
|
52
|
+
if (mainPackage.repository) {
|
|
53
|
+
const { owner, name: _packageName } = gitUrlParse(mainPackage.repository.url)
|
|
54
|
+
githubPackageName = `${owner}/${_packageName}`
|
|
55
|
+
} else if (npmPackageName) {
|
|
56
|
+
githubPackageName = npmPackageName.replace('@')
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
chunks.githubTags = await buildGithubTags({ path, npmPackageName, githubPackageName })
|
|
62
|
+
// payload.push({ h2: chunks.githubTags.name })
|
|
63
|
+
payload = payload.concat(chunks.githubTags.payload)
|
|
64
|
+
|
|
65
|
+
let icon = await access({
|
|
66
|
+
item: FeatureEnum.Assets.Icon,
|
|
67
|
+
// variant: FeatureEnum.Assets.Icon.variants.x2,
|
|
68
|
+
mimeType: FeatureEnum.Assets.Icon.mimeTypes.SVG,
|
|
69
|
+
extraction,
|
|
70
|
+
path
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
// if (icon && icon.data && icon.data.module) {
|
|
75
|
+
// Github does not displaya svg
|
|
76
|
+
if (false) {
|
|
77
|
+
const data = icon.data.module.replace('<svg ', '<svg width="100px" height="100px" ')
|
|
78
|
+
payload.push({
|
|
79
|
+
// p: icon.data.module,
|
|
80
|
+
p: data
|
|
81
|
+
})
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
icon = await access({
|
|
85
|
+
item: FeatureEnum.Assets.Icon,
|
|
86
|
+
variant: FeatureEnum.Assets.Icon.variants.x2,
|
|
87
|
+
mimeType: FeatureEnum.Assets.Icon.mimeTypes.PNG,
|
|
88
|
+
extraction,
|
|
89
|
+
path
|
|
90
|
+
})
|
|
91
|
+
if (icon && icon.data && icon.data.module && icon.data.module.base64) {
|
|
92
|
+
// Github does not displaya svg
|
|
93
|
+
// payload.push({
|
|
94
|
+
// img: {
|
|
95
|
+
// title: 'icon',
|
|
96
|
+
// source: `${icon.data.module.base64}`,
|
|
97
|
+
// alt: 'icon',
|
|
98
|
+
// style: { width: "20px" }
|
|
99
|
+
// }
|
|
100
|
+
// })
|
|
101
|
+
// Can't resize
|
|
102
|
+
// payload.push({
|
|
103
|
+
// img: {
|
|
104
|
+
// title: 'icon',
|
|
105
|
+
// source: `src/assets/icon.png`,
|
|
106
|
+
// alt: 'icon',
|
|
107
|
+
// style: { width: "20px" }
|
|
108
|
+
// }
|
|
109
|
+
// })
|
|
110
|
+
payload.push({
|
|
111
|
+
p: '<img src="src/assets/icon.png" alt="drawing" style="width:80px;" />'
|
|
112
|
+
})
|
|
113
|
+
payload.push({
|
|
114
|
+
p: '\n'
|
|
115
|
+
})
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
if (index && index.data && index.data.documentation) {
|
|
123
|
+
payload.push({ p: index.data.documentation })
|
|
124
|
+
// payload.push({ p: '' })
|
|
125
|
+
} else if (index && index.data && index.data.module) {
|
|
126
|
+
payload.push({ p: description })
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
chunks.registry = await buildRegistry({ path, mainPackage, index })
|
|
130
|
+
// payload.push({ h2: chunks.githubTags.name })
|
|
131
|
+
payload = payload.concat(chunks.registry.payload)
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
chunks.install = await buildInstall({ path, npmPackageName, githubPackageName })
|
|
135
|
+
// payload.push({ h2: chunks.githubTags.name })
|
|
136
|
+
payload = payload.concat(chunks.install.payload)
|
|
137
|
+
|
|
138
|
+
chunks.adapters = await buildAdapters({ mainPackage })
|
|
139
|
+
// payload.push({ h2: chunks.githubTags.name })
|
|
140
|
+
payload = payload.concat(chunks.adapters.payload)
|
|
141
|
+
|
|
142
|
+
chunks.apis = await buildApis({ mainPackage })
|
|
143
|
+
// payload.push({ h2: chunks.githubTags.name })
|
|
144
|
+
payload = payload.concat(chunks.apis.payload)
|
|
145
|
+
|
|
146
|
+
chunks.categories = await buildCategories({ mainPackage })
|
|
147
|
+
// payload.push({ h2: chunks.githubTags.name })
|
|
148
|
+
payload = payload.concat(chunks.categories.payload)
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
chunks.packages = await buildPackages({ packages })
|
|
152
|
+
// payload.push({ h2: chunks.githubTags.name })
|
|
153
|
+
payload = payload.concat(chunks.packages.payload)
|
|
154
|
+
|
|
155
|
+
chunks.dependencies = await buildDependencies({ dependencies: mainPackage.dependencies })
|
|
156
|
+
// payload.push({ h2: chunks.githubTags.name })
|
|
157
|
+
payload = payload.concat(chunks.dependencies.payload)
|
|
158
|
+
|
|
159
|
+
chunks.usage = await buildUsage({ path, mainPackage, index })
|
|
160
|
+
// payload.push({ h2: chunks.githubTags.name })
|
|
161
|
+
payload = payload.concat(chunks.usage.payload)
|
|
162
|
+
|
|
163
|
+
// payload.push({ hr: `` })
|
|
164
|
+
// payload.push({ p: `*Generated documentation below*` })
|
|
165
|
+
|
|
166
|
+
chunks.seed = await buildSeed({ path })
|
|
167
|
+
payload.push({ h2: chunks.seed.name })
|
|
168
|
+
payload = payload.concat(chunks.seed.payload)
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
chunks.featureClass = await buildFeatureClass({ path })
|
|
173
|
+
payload.push({ h2: chunks.featureClass.name })
|
|
174
|
+
payload = payload.concat(chunks.featureClass.payload)
|
|
175
|
+
|
|
176
|
+
chunks.beforeInit = await buildBeforeInit({ path })
|
|
177
|
+
payload.push({ h2: chunks.beforeInit.name })
|
|
178
|
+
payload = payload.concat(chunks.beforeInit.payload)
|
|
179
|
+
|
|
180
|
+
chunks.afterInit = await buildAfterInit({ path })
|
|
181
|
+
payload.push({ h2: chunks.afterInit.name })
|
|
182
|
+
payload = payload.concat(chunks.afterInit.payload)
|
|
183
|
+
|
|
184
|
+
chunks.config = await buildConfig({ path })
|
|
185
|
+
payload.push({ h2: chunks.config.name })
|
|
186
|
+
payload = payload.concat(chunks.config.payload)
|
|
187
|
+
|
|
188
|
+
chunks.functions = await buildFunctions({ path })
|
|
189
|
+
payload.push({ h2: chunks.functions.name })
|
|
190
|
+
payload = payload.concat(chunks.functions.payload)
|
|
191
|
+
|
|
192
|
+
chunks.liveClasses = await buildLiveClasses({ path })
|
|
193
|
+
payload.push({ h2: chunks.liveClasses.name })
|
|
194
|
+
payload = payload.concat(chunks.liveClasses.payload)
|
|
195
|
+
|
|
196
|
+
chunks.schema = await buildSchema({ path, version })
|
|
197
|
+
payload.push({ h2: chunks.schema.name })
|
|
198
|
+
payload = payload.concat(chunks.schema.payload)
|
|
199
|
+
|
|
200
|
+
chunks.system = await buildSystem({ path })
|
|
201
|
+
payload.push({ h2: chunks.system.name })
|
|
202
|
+
payload = payload.concat(chunks.system.payload)
|
|
203
|
+
|
|
204
|
+
chunks.lib = await buildLib({ path })
|
|
205
|
+
payload.push({ h2: chunks.lib.name })
|
|
206
|
+
payload = payload.concat(chunks.lib.payload)
|
|
207
|
+
|
|
208
|
+
chunks.triggers = await buildTriggers({ path })
|
|
209
|
+
payload.push({ h2: chunks.triggers.name })
|
|
210
|
+
payload = payload.concat(chunks.triggers.payload)
|
|
211
|
+
|
|
212
|
+
chunks.footer = await buildFooter({ path })
|
|
213
|
+
payload = payload.concat(chunks.footer.payload)
|
|
214
|
+
|
|
215
|
+
payload = payload.filter(a => a)
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
return {
|
|
221
|
+
payload,
|
|
222
|
+
chunks,
|
|
223
|
+
}
|
|
224
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import build from './build/index.js'
|
|
2
|
+
import json2md from 'json2md'
|
|
3
|
+
import fse from 'fs-extra'
|
|
4
|
+
|
|
5
|
+
export default async props => {
|
|
6
|
+
const {
|
|
7
|
+
path,
|
|
8
|
+
targetPath,
|
|
9
|
+
write = true,
|
|
10
|
+
includeAuxiliary = true,
|
|
11
|
+
print = false } = props
|
|
12
|
+
|
|
13
|
+
const item = await build({ path })
|
|
14
|
+
if (print) {
|
|
15
|
+
console.log(item)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const {
|
|
19
|
+
payload,
|
|
20
|
+
} = item
|
|
21
|
+
|
|
22
|
+
if (write && targetPath) {
|
|
23
|
+
const text = json2md(payload)
|
|
24
|
+
await fse.outputFile(targetPath, text)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return item
|
|
28
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { ClassEnum, DataTemplateType } from "../../../../../manifest/data/1.0.0/enums.js"
|
|
2
|
+
// import append from "../utils/builder/append.js"
|
|
3
|
+
import access from '../../../../../manifest/access/index.js'
|
|
4
|
+
import buildSeed from '../../../chunks/build/class/seed.js'
|
|
5
|
+
import buildClass from '../../../chunks/build/class/class.js'
|
|
6
|
+
import buildFunctions from '../../../chunks/build/class/functions.js'
|
|
7
|
+
import buildLib from '../../../chunks/build/class/lib.js'
|
|
8
|
+
import buildTriggers from '../../../chunks/build/class/triggers.js'
|
|
9
|
+
|
|
10
|
+
export default async props => {
|
|
11
|
+
const { path, includeChunksInMain = true } = props
|
|
12
|
+
let payload = []
|
|
13
|
+
|
|
14
|
+
let name, id = null
|
|
15
|
+
let extraction = null
|
|
16
|
+
|
|
17
|
+
let index = await access({
|
|
18
|
+
item: ClassEnum.Index,
|
|
19
|
+
type: DataTemplateType.Class,
|
|
20
|
+
path,
|
|
21
|
+
extraction
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
if (index && index.data && index.data.module) {
|
|
25
|
+
const { description = '' } = index.data.module
|
|
26
|
+
name = index.data.module.id
|
|
27
|
+
id = index.data.module.id
|
|
28
|
+
payload.push({ h1: name })
|
|
29
|
+
payload.push({ h2: `#${id}` })
|
|
30
|
+
payload.push({ p: description })
|
|
31
|
+
payload.push({ hr: "" })
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
payload.push({ h1: 'No name' })
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const chunks = {}
|
|
38
|
+
|
|
39
|
+
chunks.class = await buildClass({ path })
|
|
40
|
+
payload.push({ h2: chunks.class.name })
|
|
41
|
+
payload = payload.concat(chunks.class.payload)
|
|
42
|
+
|
|
43
|
+
chunks.seed = await buildSeed({ path })
|
|
44
|
+
payload.push({ h2: chunks.seed.name })
|
|
45
|
+
payload = payload.concat(chunks.seed.payload)
|
|
46
|
+
|
|
47
|
+
chunks.functions = await buildFunctions({ path })
|
|
48
|
+
payload.push({ h2: chunks.functions.name })
|
|
49
|
+
payload = payload.concat(chunks.functions.payload)
|
|
50
|
+
|
|
51
|
+
chunks.lib = await buildLib({ path })
|
|
52
|
+
payload.push({ h2: chunks.lib.name })
|
|
53
|
+
payload = payload.concat(chunks.lib.payload)
|
|
54
|
+
|
|
55
|
+
chunks.triggers = await buildTriggers({ path })
|
|
56
|
+
payload.push({ h2: chunks.triggers.name })
|
|
57
|
+
payload = payload.concat(chunks.triggers.payload)
|
|
58
|
+
|
|
59
|
+
payload = payload.filter(a => a)
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
payload,
|
|
63
|
+
chunks,
|
|
64
|
+
name,
|
|
65
|
+
id
|
|
66
|
+
}
|
|
67
|
+
}
|