diff options
author | 2021-09-06 01:20:40 -0700 | |
---|---|---|
committer | 2021-09-06 01:21:55 -0700 | |
commit | 6dc05575a65bf6bdc6f52848d274b1f333a36076 (patch) | |
tree | 12ec4f4a8a469a7d92f2a127ed2e4d34013f6e7c /docs/src/components/Examples/Functions/get-examples-data.js | |
parent | d321d8366b597e46ff8e3fc63d17622a9297505c (diff) | |
download | astro-6dc05575a65bf6bdc6f52848d274b1f333a36076.tar.gz astro-6dc05575a65bf6bdc6f52848d274b1f333a36076.tar.zst astro-6dc05575a65bf6bdc6f52848d274b1f333a36076.zip |
scale back the examples page
Diffstat (limited to 'docs/src/components/Examples/Functions/get-examples-data.js')
-rw-r--r-- | docs/src/components/Examples/Functions/get-examples-data.js | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/docs/src/components/Examples/Functions/get-examples-data.js b/docs/src/components/Examples/Functions/get-examples-data.js deleted file mode 100644 index e206bab10..000000000 --- a/docs/src/components/Examples/Functions/get-examples-data.js +++ /dev/null @@ -1,75 +0,0 @@ -import glob from 'tiny-glob' -import fs from 'fs' - - -/** - * @returns list of templates's package.json from the examples folder - */ -async function getPkgJSON(){ - let data = [] - const paths = await glob('../examples/*/package.json',{filesOnly:true}) - paths.map((files)=>{ - let readFile = fs.readFileSync(files) - let json = JSON.parse(readFile) - return data.push({...json}) - }) - return data -} - -/** - * @returns list of templates readme from the examples folder - */ -async function getExamplesREADME(){ - let data = [] - const paths = await glob('../examples/*/README.md',{filesOnly:true}) - paths.map( (files)=>{ - const buffer = fs.readFileSync(files) - let text = buffer.toString() - let fileName = files.split('/')[2] - data.push({fileName,text}) - }) - return data -} - -/** - * @returns list of template data - */ -async function getTemplateData(){ - let data = [] - const pkgJSONS = await getPkgJSON() - pkgJSONS.map((pkg)=>{ - let {name} = pkg - name = name.replace('@example/','') - let obj = { - name, - pkgJSON: pkg, - readme:undefined, - } - data.push(obj) - }) - return data -} - - -/** - * - * @returns Array of Template objects, - */ -async function templateData() { - let readmeData = await getExamplesREADME() - let templateData = await getTemplateData() - let arr = templateData.map((obj,i)=>{ - let {name} = obj - readmeData.map((file)=>{ - let {fileName,text} = file - if(name === fileName) - obj.readme = text - }) - - return obj - }) - return arr -} - -export default templateData - |