@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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Servable community
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Servable Tools
|
|
2
|
+
|
|
3
|
+
> [!WARNING]
|
|
4
|
+
> Servable is still experimental and its api may change in the future.
|
|
5
|
+
|
|
6
|
+

|
|
7
|
+
|
|
8
|
+
[](https://www.npmjs.org/package/@servable/tools)
|
|
9
|
+
[](https://npmjs.org/package/@servable/tools)
|
|
10
|
+
[](https://github.com/servable-core/tools/actions/tests.yml)
|
|
11
|
+
[](https://opensource.org/licenses/MIT)
|
|
12
|
+
[](https://standardjs.com)
|
|
13
|
+
|
|
14
|
+
Servable tools is a utility that builds a feature's manifest, documents it and build scehma.
|
|
15
|
+
|
|
16
|
+
## Documentation
|
|
17
|
+
You can find here the complete [servable documentation](https://docs.servable.app/) with guides and api reference.
|
|
18
|
+
|
|
19
|
+
## Install
|
|
20
|
+
```bash
|
|
21
|
+
yarn add @servable/tools
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## Quickstart
|
|
26
|
+
To make use of @servable/tools you need [Servable CLI](https://github.com/servable-core/cli)
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npx @servable/cli
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## License
|
|
33
|
+
GNU General Public License (GPL): © [servable-core](https://github.com/servable-core)
|
package/package.json
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@servable/tools",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"source": "src/index.js",
|
|
5
|
+
"main": "src/index.js",
|
|
6
|
+
"version": "1.0.1",
|
|
7
|
+
"description": "Servable tools is a utility that builds a feature's manifest and documents it.",
|
|
8
|
+
"author": "Servable Community",
|
|
9
|
+
"license": "ISC",
|
|
10
|
+
"bugs": {
|
|
11
|
+
"url": "https://github.com/servable-core/tools/issues"
|
|
12
|
+
},
|
|
13
|
+
"homepage": "https://github.com/servable-core/tools#readme",
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"src"
|
|
17
|
+
],
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=10"
|
|
20
|
+
},
|
|
21
|
+
"config": {
|
|
22
|
+
"commitizen": {
|
|
23
|
+
"path": "./node_modules/cz-conventional-changelog"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public"
|
|
28
|
+
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"test_": "echo \"Error: no test specified\" && exit 1",
|
|
31
|
+
"semantic-release": "semantic-release",
|
|
32
|
+
"acp": "git add . && npm run commit && git push",
|
|
33
|
+
"commit": "git-cz",
|
|
34
|
+
"size": "size-limit",
|
|
35
|
+
"analyze": "size-limit --why",
|
|
36
|
+
"start": "microbundle-crl watch --no-compress --format modern,cjs",
|
|
37
|
+
"prepare_": "run-s build",
|
|
38
|
+
"test": "run-s test:unit test:lint test:build",
|
|
39
|
+
"test:build": "run-s build",
|
|
40
|
+
"test:lint": "eslint .",
|
|
41
|
+
"test:unit_": "cross-env CI=1 react-scripts test --env=jsdom",
|
|
42
|
+
"test:unit": "yarn node --require=dotenv/config --experimental-vm-modules --experimental-specifier-resolution=node $(yarn bin jest) --config ./jest.config.json",
|
|
43
|
+
"test:watch": "react-scripts test --env=jsdom"
|
|
44
|
+
},
|
|
45
|
+
"repository": {
|
|
46
|
+
"type": "git",
|
|
47
|
+
"url": "https://github.com/servable-core/tools.git"
|
|
48
|
+
},
|
|
49
|
+
"keywords": [
|
|
50
|
+
"server",
|
|
51
|
+
"servable"
|
|
52
|
+
],
|
|
53
|
+
"prettier": {
|
|
54
|
+
"printWidth": 80,
|
|
55
|
+
"semi": true,
|
|
56
|
+
"singleQuote": true,
|
|
57
|
+
"trailingComma": "es5"
|
|
58
|
+
},
|
|
59
|
+
"size-limit": [
|
|
60
|
+
{
|
|
61
|
+
"path": "dist/index.js",
|
|
62
|
+
"limit": "600 KB"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"path": "dist/index.modern.js",
|
|
66
|
+
"limit": "600 KB"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"path": "dist/index.umd.js",
|
|
70
|
+
"limit": "600 KB"
|
|
71
|
+
}
|
|
72
|
+
],
|
|
73
|
+
"dependencies": {
|
|
74
|
+
"fast-glob": "^3.3.2",
|
|
75
|
+
"fs-extra": "^11.2.0",
|
|
76
|
+
"fse": "^4.0.1",
|
|
77
|
+
"git-url-parse": "^13.1.1",
|
|
78
|
+
"json2md": "^2.0.0",
|
|
79
|
+
"mime": "^4.0.0",
|
|
80
|
+
"parse-comments": "^1.0.0",
|
|
81
|
+
"path-sanitizer": "^2.0.0",
|
|
82
|
+
"semver": "^7.5.4",
|
|
83
|
+
"sharp": "0.30.7",
|
|
84
|
+
"underscore": "^1.13.3"
|
|
85
|
+
},
|
|
86
|
+
"devDependencies": {
|
|
87
|
+
"@size-limit/preset-small-lib": "^4.10.2",
|
|
88
|
+
"cz-conventional-changelog": "^3.3.0",
|
|
89
|
+
"eslint": "^6.8.0",
|
|
90
|
+
"eslint-config-prettier": "^6.7.0",
|
|
91
|
+
"eslint-config-standard": "^14.1.0",
|
|
92
|
+
"eslint-config-standard-react": "^9.2.0",
|
|
93
|
+
"eslint-plugin-import": "^2.18.2",
|
|
94
|
+
"eslint-plugin-node": "^11.0.0",
|
|
95
|
+
"eslint-plugin-prettier": "^3.1.1",
|
|
96
|
+
"eslint-plugin-promise": "^4.2.1",
|
|
97
|
+
"eslint-plugin-react": "^7.17.0",
|
|
98
|
+
"eslint-plugin-standard": "^4.0.1",
|
|
99
|
+
"husky": "^6.0.0",
|
|
100
|
+
"jest": "^29.7.0",
|
|
101
|
+
"npm-run-all": "^4.1.5",
|
|
102
|
+
"prettier": "^2.0.4",
|
|
103
|
+
"semantic-release": "^23.0.0",
|
|
104
|
+
"size-limit": "^4.10.2"
|
|
105
|
+
}
|
|
106
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
|
|
2
|
+
export default async (props) => {
|
|
3
|
+
const { classes: { managed }, } = props.item.schema
|
|
4
|
+
const id = props.item.id
|
|
5
|
+
|
|
6
|
+
let items = []
|
|
7
|
+
|
|
8
|
+
let files = await props.item.loader.configDataFiles()
|
|
9
|
+
if (files.entries) {
|
|
10
|
+
let path = props.item.loader.configFolder()
|
|
11
|
+
//let featureMetadata = await props.item.loader.seedMetadata()
|
|
12
|
+
const _i = {
|
|
13
|
+
feature: props.item,
|
|
14
|
+
id,
|
|
15
|
+
type: 'feature',
|
|
16
|
+
mode: 'auto',
|
|
17
|
+
path,
|
|
18
|
+
// metadata: featureMetadata,
|
|
19
|
+
files
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
items.push(_i)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
await Promise.all(managed.map(async item => {
|
|
26
|
+
const { className } = item
|
|
27
|
+
|
|
28
|
+
let path = props.item.loader.classConfigFolder({ className })
|
|
29
|
+
let files = await props.item.loader.classConfigDataFiles({ className })
|
|
30
|
+
// let metadata = await props.item.loader.classSeedMetadata({ className })
|
|
31
|
+
if (files.entries) {
|
|
32
|
+
const _i = {
|
|
33
|
+
feature: props.item,
|
|
34
|
+
id: className,
|
|
35
|
+
type: 'class',
|
|
36
|
+
// metadata,
|
|
37
|
+
mode: 'auto',
|
|
38
|
+
path,
|
|
39
|
+
files
|
|
40
|
+
}
|
|
41
|
+
items.push(_i)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
}))
|
|
46
|
+
|
|
47
|
+
return items.filter(a => a)
|
|
48
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import featureCandidates from "./featureCandidates/index.js"
|
|
2
|
+
import _ from 'underscore'
|
|
3
|
+
|
|
4
|
+
export default async (props) => {
|
|
5
|
+
const { schema } = props
|
|
6
|
+
const {
|
|
7
|
+
features
|
|
8
|
+
} = schema
|
|
9
|
+
|
|
10
|
+
const items = _.flatten(await Promise.all(features.map(async item =>
|
|
11
|
+
featureCandidates({
|
|
12
|
+
item,
|
|
13
|
+
allFeatures: features
|
|
14
|
+
})
|
|
15
|
+
))).filter(a => a)
|
|
16
|
+
|
|
17
|
+
return items
|
|
18
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { FeatureEnum } 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/feature/seed.js'
|
|
5
|
+
import buildFeatureClass from '../../../chunks/build/feature/class.js'
|
|
6
|
+
import buildConfig from '../../../chunks/build/feature/config.js'
|
|
7
|
+
import buildLiveClasses from '../../../chunks/build/feature/liveClasses.js'
|
|
8
|
+
import buildAfterInit from '../../../chunks/build/feature/afterInit.js'
|
|
9
|
+
import buildBeforeInit from '../../../chunks/build/feature/beforeInit.js'
|
|
10
|
+
import buildFunctions from '../../../chunks/build/feature/functions.js'
|
|
11
|
+
import buildSchema from '../../../chunks/build/feature/schema.js'
|
|
12
|
+
import buildSystem from '../../../chunks/build/feature/system.js'
|
|
13
|
+
import buildLib from '../../../chunks/build/feature/lib.js'
|
|
14
|
+
import buildTriggers from '../../../chunks/build/feature/triggers.js'
|
|
15
|
+
import documentClass from '../class/index.js'
|
|
16
|
+
|
|
17
|
+
export default async props => {
|
|
18
|
+
const { path, includeChunksInMain = true } = props
|
|
19
|
+
let payload = []
|
|
20
|
+
|
|
21
|
+
let extraction = null
|
|
22
|
+
let index = await access({
|
|
23
|
+
item: FeatureEnum.Index,
|
|
24
|
+
extraction,
|
|
25
|
+
path
|
|
26
|
+
})
|
|
27
|
+
if (index && index.data && index.data.module) {
|
|
28
|
+
const { name, description, id, version } = index.data.module
|
|
29
|
+
payload.push({ h1: name })
|
|
30
|
+
payload.push({ p: `@${id}, #${version}` })
|
|
31
|
+
payload.push({ p: description })
|
|
32
|
+
// payload.push({ p: '' })
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
let icon = await access({
|
|
36
|
+
item: FeatureEnum.Assets.Icon,
|
|
37
|
+
// variant: FeatureEnum.Assets.Icon.variants.x2,
|
|
38
|
+
mimeType: FeatureEnum.Assets.Icon.mimeTypes.SVG,
|
|
39
|
+
extraction,
|
|
40
|
+
path
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
// if (icon && icon.data && icon.data.module) {
|
|
44
|
+
if (false) {
|
|
45
|
+
payload.push({
|
|
46
|
+
p: icon.data.module,
|
|
47
|
+
})
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
icon = await access({
|
|
51
|
+
item: FeatureEnum.Assets.Icon,
|
|
52
|
+
variant: FeatureEnum.Assets.Icon.variants.x2,
|
|
53
|
+
mimeType: FeatureEnum.Assets.Icon.mimeTypes.PNG,
|
|
54
|
+
extraction,
|
|
55
|
+
path
|
|
56
|
+
})
|
|
57
|
+
if (icon && icon.data && icon.data.module && icon.data.module.base64) {
|
|
58
|
+
payload.push({
|
|
59
|
+
img: {
|
|
60
|
+
title: 'icon',
|
|
61
|
+
source: `${icon.data.module.base64}`,
|
|
62
|
+
alt: 'icon',
|
|
63
|
+
style: { width: "20px" }
|
|
64
|
+
}
|
|
65
|
+
})
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
payload.push({ p: '' })
|
|
69
|
+
const chunks = {}
|
|
70
|
+
|
|
71
|
+
chunks.seed = await buildSeed({ path })
|
|
72
|
+
payload.push({ h2: chunks.seed.name })
|
|
73
|
+
payload = payload.concat(chunks.seed.payload)
|
|
74
|
+
|
|
75
|
+
chunks.featureClass = await buildFeatureClass({ path })
|
|
76
|
+
payload.push({ h2: chunks.featureClass.name })
|
|
77
|
+
payload = payload.concat(chunks.featureClass.payload)
|
|
78
|
+
|
|
79
|
+
chunks.beforeInit = await buildBeforeInit({ path })
|
|
80
|
+
payload.push({ h2: chunks.beforeInit.name })
|
|
81
|
+
payload = payload.concat(chunks.beforeInit.payload)
|
|
82
|
+
|
|
83
|
+
chunks.afterInit = await buildAfterInit({ path })
|
|
84
|
+
payload.push({ h2: chunks.afterInit.name })
|
|
85
|
+
payload = payload.concat(chunks.afterInit.payload)
|
|
86
|
+
|
|
87
|
+
chunks.config = await buildConfig({ path })
|
|
88
|
+
payload.push({ h2: chunks.config.name })
|
|
89
|
+
payload = payload.concat(chunks.config.payload)
|
|
90
|
+
|
|
91
|
+
chunks.functions = await buildFunctions({ path })
|
|
92
|
+
payload.push({ h2: chunks.functions.name })
|
|
93
|
+
payload = payload.concat(chunks.functions.payload)
|
|
94
|
+
|
|
95
|
+
chunks.liveClasses = await buildLiveClasses({ path })
|
|
96
|
+
payload.push({ h2: chunks.liveClasses.name })
|
|
97
|
+
payload = payload.concat(chunks.liveClasses.payload)
|
|
98
|
+
|
|
99
|
+
chunks.schema = await buildSchema({ path })
|
|
100
|
+
payload.push({ h2: chunks.schema.name })
|
|
101
|
+
payload = payload.concat(chunks.schema.payload)
|
|
102
|
+
|
|
103
|
+
chunks.system = await buildSystem({ path })
|
|
104
|
+
payload.push({ h2: chunks.system.name })
|
|
105
|
+
payload = payload.concat(chunks.system.payload)
|
|
106
|
+
|
|
107
|
+
chunks.lib = await buildLib({ path })
|
|
108
|
+
payload.push({ h2: chunks.lib.name })
|
|
109
|
+
payload = payload.concat(chunks.lib.payload)
|
|
110
|
+
|
|
111
|
+
chunks.triggers = await buildTriggers({ path })
|
|
112
|
+
payload.push({ h2: chunks.triggers.name })
|
|
113
|
+
payload = payload.concat(chunks.triggers.payload)
|
|
114
|
+
|
|
115
|
+
payload = payload.filter(a => a)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
let classes = null
|
|
120
|
+
const _classes = await access({
|
|
121
|
+
item: FeatureEnum.Classes,
|
|
122
|
+
path
|
|
123
|
+
})
|
|
124
|
+
if (_classes && _classes.children) {
|
|
125
|
+
classes = await Promise.all(_classes.children.map(async _class => documentClass({
|
|
126
|
+
path: _class.fullPath
|
|
127
|
+
})))
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return {
|
|
131
|
+
payload,
|
|
132
|
+
chunks,
|
|
133
|
+
classes
|
|
134
|
+
}
|
|
135
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import buildFeature from './build/feature/index.js'
|
|
2
|
+
import writeFeature from './write/feature/index.js'
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export default async props => {
|
|
6
|
+
const { path, write = false, includeAuxiliary = true, print = false } = props
|
|
7
|
+
const item = await buildFeature({ path })
|
|
8
|
+
if (print) {
|
|
9
|
+
console.log(item)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
if (write) {
|
|
13
|
+
const written = await writeFeature({ item, path, includeAuxiliary })
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return item
|
|
17
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import fse from 'fs-extra'
|
|
2
|
+
import json2md from 'json2md'
|
|
3
|
+
import writeChunk from '../utils/chunk.js'
|
|
4
|
+
import checkFileExists from "../../../../../lib/checkFileExists.js"
|
|
5
|
+
|
|
6
|
+
export default async ({ item, path, includeAuxiliary }) => {
|
|
7
|
+
const {
|
|
8
|
+
payload,
|
|
9
|
+
chunks,
|
|
10
|
+
} = item
|
|
11
|
+
|
|
12
|
+
const rootPath = path
|
|
13
|
+
|
|
14
|
+
if ((await checkFileExists(rootPath))) {
|
|
15
|
+
await fse.emptyDir(rootPath)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const indexPath = `/${rootPath}/index.md`
|
|
19
|
+
const chunksRootPath = `/${rootPath}`
|
|
20
|
+
|
|
21
|
+
const text = json2md(payload)
|
|
22
|
+
await fse.outputFile(indexPath, text)
|
|
23
|
+
|
|
24
|
+
await Promise.all(Object.keys(chunks).map(async chunk => writeChunk({ chunk: chunks[chunk], path: chunksRootPath, includeAuxiliary })))
|
|
25
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import sanitizePath from 'path-sanitizer'
|
|
2
|
+
import fse from 'fs-extra'
|
|
3
|
+
import json2md from 'json2md'
|
|
4
|
+
import writeChunk from '../utils/chunk.js'
|
|
5
|
+
import checkFileExists from "../../../../../lib/checkFileExists.js"
|
|
6
|
+
import writeClass from '../class/index.js'
|
|
7
|
+
|
|
8
|
+
export default async ({ item, path, includeAuxiliary }) => {
|
|
9
|
+
const {
|
|
10
|
+
payload,
|
|
11
|
+
chunks,
|
|
12
|
+
classes,
|
|
13
|
+
} = item
|
|
14
|
+
|
|
15
|
+
const rootPath = sanitizePath(`${path}/documentation/generated`)
|
|
16
|
+
|
|
17
|
+
if ((await checkFileExists(rootPath))) {
|
|
18
|
+
await fse.emptyDir(rootPath)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const indexPath = `/${rootPath}/index.md`
|
|
22
|
+
const chunksRootPath = `/${rootPath}`
|
|
23
|
+
|
|
24
|
+
const text = json2md(payload)
|
|
25
|
+
await fse.outputFile(indexPath, text)
|
|
26
|
+
|
|
27
|
+
await Promise.all(Object.keys(chunks).map(async chunk => writeChunk({ chunk: chunks[chunk], path: chunksRootPath, includeAuxiliary })))
|
|
28
|
+
|
|
29
|
+
if (classes && classes.length) {
|
|
30
|
+
|
|
31
|
+
await Promise.all(classes.map(async _item => {
|
|
32
|
+
if (!_item.id) {
|
|
33
|
+
return
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return writeClass({
|
|
37
|
+
item: _item,
|
|
38
|
+
path: `/${rootPath}/classes/${_item.id}`,
|
|
39
|
+
includeAuxiliary
|
|
40
|
+
})
|
|
41
|
+
}))
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import sanitizePath from 'path-sanitizer'
|
|
2
|
+
import fs from 'fs'
|
|
3
|
+
|
|
4
|
+
export default async ({ payload, path }) => {
|
|
5
|
+
const { path, feature, classes } = payload
|
|
6
|
+
const rootPath = sanitizePath(`${path}/generated`)
|
|
7
|
+
|
|
8
|
+
const featurePath = sanitizePath(`${rootPath}/index.md`)
|
|
9
|
+
fs.promises.writeFile(featurePath, feature)
|
|
10
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import sanitizePath from 'path-sanitizer'
|
|
2
|
+
import fse from 'fs-extra'
|
|
3
|
+
import json2md from 'json2md'
|
|
4
|
+
|
|
5
|
+
export default async ({ chunk, path, includeAuxiliary }) => {
|
|
6
|
+
const {
|
|
7
|
+
payload,
|
|
8
|
+
name,
|
|
9
|
+
id,
|
|
10
|
+
auxiliary
|
|
11
|
+
} = chunk
|
|
12
|
+
|
|
13
|
+
const chunkPath = `/${sanitizePath(`${path}/${id}.md`)}`
|
|
14
|
+
let text = json2md([{ h1: name }, ...payload])
|
|
15
|
+
if (includeAuxiliary && auxiliary) {
|
|
16
|
+
text = `${text}\n${auxiliary}`
|
|
17
|
+
}
|
|
18
|
+
await fse.outputFile(chunkPath, text)
|
|
19
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FeatureEnum, DataTemplateType } 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
|
+
const target = await access({
|
|
8
|
+
item: FeatureEnum.Class.Index,
|
|
9
|
+
type: DataTemplateType.Class,
|
|
10
|
+
path,
|
|
11
|
+
extraction
|
|
12
|
+
})
|
|
13
|
+
if (target && target.data) {
|
|
14
|
+
const { astAdapted } = target.data
|
|
15
|
+
if (astAdapted) {
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return { payload, name: 'Class', id: 'class', auxiliary: (target && target.data) ? target.data.documentation : null }
|
|
20
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { FeatureEnum, DataTemplateType } 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
|
+
|
|
8
|
+
const target = await access({
|
|
9
|
+
item: FeatureEnum.Functions,
|
|
10
|
+
type: DataTemplateType.Class,
|
|
11
|
+
path,
|
|
12
|
+
extraction
|
|
13
|
+
})
|
|
14
|
+
if (target && target.data) {
|
|
15
|
+
const { astAdapted } = target.data
|
|
16
|
+
if (astAdapted) {
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return { payload, name: 'Functions', id: 'functions', auxiliary: (target && target.data) ? target.data.documentation : null }
|
|
21
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { FeatureEnum, DataTemplateType } 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
|
+
|
|
8
|
+
const target = await access({
|
|
9
|
+
item: FeatureEnum.Lib,
|
|
10
|
+
type: DataTemplateType.Class,
|
|
11
|
+
path,
|
|
12
|
+
extraction
|
|
13
|
+
})
|
|
14
|
+
if (target && target.data) {
|
|
15
|
+
const { astAdapted } = target.data
|
|
16
|
+
if (astAdapted) {
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return { payload, name: 'Lib', id: 'lib', auxiliary: (target && target.data) ? target.data.documentation : null }
|
|
21
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { FeatureEnum, DataTemplateType } 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, includeAuxiliary = true } = props
|
|
6
|
+
const payload = []
|
|
7
|
+
|
|
8
|
+
const target = await access({
|
|
9
|
+
item: FeatureEnum.Class.Index,
|
|
10
|
+
type: DataTemplateType.Class,
|
|
11
|
+
path,
|
|
12
|
+
extraction
|
|
13
|
+
})
|
|
14
|
+
if (target && target.data) {
|
|
15
|
+
const { astAdapted } = target.data
|
|
16
|
+
if (astAdapted) {
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return { payload, name: 'Seed', id: 'seed', auxiliary: (target && target.data) ? target.data.documentation : null }
|
|
21
|
+
}
|