Skip to content

Commit

Permalink
fix: fs related functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
ankitskvmdam committed Dec 20, 2022
1 parent c260f86 commit a04870b
Show file tree
Hide file tree
Showing 97 changed files with 156 additions and 20,095 deletions.
40 changes: 27 additions & 13 deletions clean-jsdoc-theme-helper.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,38 @@
const has = require('lodash/has');
const klawSync = require('klaw-sync');
const path = require('path')
const fs = require('fs')
const fse = require('fs-extra')
const showdown = require('showdown');


const mdToHTMLConverter = new showdown.Converter();

function lsSync(dir, opts = {}) {
const depth = has(opts, 'depth') ? opts.depth : -1;

const files = klawSync(dir, {
depthLimit: depth,
filter: (f) => !path.basename(f.path).startsWith('.'),
nodir: true,
});

return files.map((f) => f.path);
};

function copyToOutputFolder(filePath, outdir) {
var filePathNormalized = path.normalize(filePath);
const resolvedPath = path.resolve(filePath);
const filename = path.basename(resolvedPath);
const out = path.join(outdir, filename);

fs.copyFileSync(filePathNormalized, outdir);
fse.copyFileSync(resolvedPath, out);
}

function copyToOutputFolderFromArray(filePathArray, outdir) {
var i = 0;
var outputList = [];
const outputList = [];

if (Array.isArray(filePathArray)) {
for (; i < filePathArray.length; i++) {
copyToOutputFolder(filePathArray[i], outdir);
outputList.push(path.basename(filePathArray[i]));
for (const filePath of filePathArray) {
copyToOutputFolder(filePath, outdir);
outputList.push(path.basename(filePath));
}
}

Expand Down Expand Up @@ -119,13 +132,13 @@ function getBaseURL(themeOpts) {
}

function copyStaticFolder(themeOpts, outdir) {
var staticDir = themeOpts.static_dir || undefined;
const staticDir = themeOpts.static_dir || undefined;

if (staticDir) {
for (var i = 0; i < staticDir.length; i++) {
var output = path.join(outdir, staticDir[i]);
for (const dir of staticDir) {
const output = path.join(outdir, dir);

fse.copySync(staticDir[i], output);
fse.copySync(dir, output);
}
}
}
Expand Down Expand Up @@ -164,4 +177,5 @@ module.exports = {
returnPathOfStyleSrc,
copyStaticFolder,
getProcessedYield,
lsSync
}
Binary file added demo/src/assets/png/screen-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demo/src/assets/png/screen-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demo/src/assets/png/screen-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demo/src/assets/png/screen-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demo/src/assets/png/screen-5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demo/src/assets/png/screen-6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions demo/src/assets/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log('This is the new very new test script. If it runs then it means it is included.')
3 changes: 3 additions & 0 deletions demo/src/assets/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.test {
test-property: 'completed'
}
7 changes: 6 additions & 1 deletion jsdoc-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"allowUnknownTags": true
},
"source": {
"include": ["./demo/src", "./README.md", "./static/scripts/core.js"]
"include": ["./demo/src", "./README.md"]
},
"plugins": ["plugins/markdown"],
"opts": {
Expand All @@ -17,6 +17,11 @@
"search": true,
"homepageTitle": "Clean JSDoc Theme",
"default_theme": "dark",
"include_css": ["./demo/src/assets/style.css"],
"include_js": ["./demo/src/assets/script.js"],
"static_dir": ["./demo/src/assets/png", "./example"],
"add_scripts": "function foo(){console.log('foo')} function bar() {console.log('bar')} bar(); foo();",
"create_style": ".test-create-style{ background: red}",
"displayModuleHeader": true,
"title": "clean-jsdoc-theme",
"footer": "<div style='margin-bottom: 0.5rem;'>clean-jsdoc-theme</div> Fork: <a href='https://github.com/ankitskvmdam/clean-jsdoc-theme'>https://github.com/ankitskvmdam/clean-jsdoc-theme</a>",
Expand Down
19 changes: 0 additions & 19 deletions output/index.html

This file was deleted.

6 changes: 3 additions & 3 deletions output/v4/Alive.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions output/v4/Alive.js.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions output/v4/Apple.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions output/v4/Apple.js.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions output/v4/Database.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions output/v4/Energy.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions output/v4/Energy.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions output/v4/Environment.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions output/v4/Environment.js.html

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions output/v4/HTMLRenderer.html

This file was deleted.

6 changes: 3 additions & 3 deletions output/v4/HideConstructor.js.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions output/v4/Modules.js.html

Large diffs are not rendered by default.

7 changes: 0 additions & 7 deletions output/v4/MultiRegex.html

This file was deleted.

3 changes: 0 additions & 3 deletions output/v4/Response.html

This file was deleted.

12 changes: 6 additions & 6 deletions output/v4/Statement.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions output/v4/StatementIterator.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions output/v4/Test.html

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions output/v4/TokenTree.html

This file was deleted.

3 changes: 0 additions & 3 deletions output/v4/TokenTreeEmitter.html

This file was deleted.

6 changes: 3 additions & 3 deletions output/v4/Tree.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions output/v4/Tree.js.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions output/v4/World.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions output/v4/World.js.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions output/v4/api.js.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion output/v4/data/search.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"list":[{"title":"SqlJs","link":"<a href=\"module-SqlJs.html\">SqlJs</a>"},{"title":"bookshelf","link":"<a href=\"module-bookshelf.html\">bookshelf</a>"},{"title":"color/mixer","link":"<a href=\"module-color_mixer.html\">color/mixer</a>"},{"title":"Alive","link":"<a href=\"Alive.html\">Alive</a>"},{"title":"Apple","link":"<a href=\"Apple.html\">Apple</a>"},{"title":"Database","link":"<a href=\"Database.html\">Database</a>"},{"title":"Energy","link":"<a href=\"Energy.html\">Energy</a>"},{"title":"Environment","link":"<a href=\"Environment.html\">Environment</a>"},{"title":"Statement","link":"<a href=\"Statement.html\">Statement</a>"},{"title":"StatementIterator","link":"<a href=\"StatementIterator.html\">StatementIterator</a>"},{"title":"Test","link":"<a href=\"Test.html\">Test</a>"},{"title":"Tree","link":"<a href=\"Tree.html\">Tree</a>"},{"title":"World","link":"<a href=\"World.html\">World</a>"},{"title":"Book","link":"<a href=\"module-bookshelf.Book.html\">Book</a>"},{"title":"beEaten","link":"<a href=\"Apple.html#event:beEaten\">beEaten</a>","description":"<p>Sed vehicula purus dui</p>"},{"title":"beforeDestroy","link":"<a href=\"Environment.html#event:beforeDestroy\">beforeDestroy</a>","description":"<p>Lorem ipsum dolor sit amet, {@link Energy} consectetur adipiscing el</p>"},{"title":"Alive","link":"<a href=\"tutorial-Alive_.html\">Alive</a>"},{"title":"Apple","link":"<a href=\"tutorial-Apple_.html\">Apple</a>"},{"title":"Environment","link":"<a href=\"tutorial-Environment_.html\">Environment</a>"},{"title":"Other","link":"<a href=\"tutorial-Other.html\">Other</a>"},{"title":"EnergyUnit","link":"<a href=\"global.html#EnergyUnit\">EnergyUnit</a>"},{"title":"EnvironmentConfiguration","link":"<a href=\"global.html#EnvironmentConfiguration\">EnvironmentConfiguration</a>"},{"title":"SqlJs","link":"<a href=\"global.html#SqlJs\">SqlJs</a>"},{"title":"SqlJsConfig","link":"<a href=\"global.html#SqlJsConfig\">SqlJsConfig</a>"},{"title":"copy","link":"<a href=\"global.html#copy\">copy</a>"},{"title":"fibonacci","link":"<a href=\"global.html#fibonacci\">fibonacci</a>","description":"<p>Generate the Fibonacci sequence of numbers.</p>"},{"title":"getAccordionIdsFromLocalStorage","link":"<a href=\"global.html#getAccordionIdsFromLocalStorage\">getAccordionIdsFromLocalStorage</a>","description":"<p>Function to get all accordion ids from localStorage.</p>"},{"title":"initSqlJs","link":"<a href=\"global.html#initSqlJs\">initSqlJs</a>","description":"<p>Asynchronously initializes sql.js</p>"},{"title":"removeAccordionIdFromLocalStorage","link":"<a href=\"global.html#removeAccordionIdFromLocalStorage\">removeAccordionIdFromLocalStorage</a>","description":"<p>Function to remove accordion id from localStorage.</p>"},{"title":"setAccordionIdToLocalStorage","link":"<a href=\"global.html#setAccordionIdToLocalStorage\">setAccordionIdToLocalStorage</a>","description":"<p>Function to set accordion id to localStorage.</p>"}]}
{"list":[{"title":"SqlJs","link":"<a href=\"module-SqlJs.html\">SqlJs</a>"},{"title":"bookshelf","link":"<a href=\"module-bookshelf.html\">bookshelf</a>"},{"title":"color/mixer","link":"<a href=\"module-color_mixer.html\">color/mixer</a>"},{"title":"Alive","link":"<a href=\"Alive.html\">Alive</a>"},{"title":"Apple","link":"<a href=\"Apple.html\">Apple</a>"},{"title":"Database","link":"<a href=\"Database.html\">Database</a>"},{"title":"Energy","link":"<a href=\"Energy.html\">Energy</a>"},{"title":"Environment","link":"<a href=\"Environment.html\">Environment</a>"},{"title":"Statement","link":"<a href=\"Statement.html\">Statement</a>"},{"title":"StatementIterator","link":"<a href=\"StatementIterator.html\">StatementIterator</a>"},{"title":"Test","link":"<a href=\"Test.html\">Test</a>"},{"title":"Tree","link":"<a href=\"Tree.html\">Tree</a>"},{"title":"World","link":"<a href=\"World.html\">World</a>"},{"title":"Book","link":"<a href=\"module-bookshelf.Book.html\">Book</a>"},{"title":"beEaten","link":"<a href=\"Apple.html#event:beEaten\">beEaten</a>","description":"<p>Sed vehicula purus dui</p>"},{"title":"beforeDestroy","link":"<a href=\"Environment.html#event:beforeDestroy\">beforeDestroy</a>","description":"<p>Lorem ipsum dolor sit amet, {@link Energy} consectetur adipiscing el</p>"},{"title":"Alive","link":"<a href=\"tutorial-Alive_.html\">Alive</a>"},{"title":"Apple","link":"<a href=\"tutorial-Apple_.html\">Apple</a>"},{"title":"Environment","link":"<a href=\"tutorial-Environment_.html\">Environment</a>"},{"title":"Other","link":"<a href=\"tutorial-Other.html\">Other</a>"},{"title":"EnergyUnit","link":"<a href=\"global.html#EnergyUnit\">EnergyUnit</a>"},{"title":"EnvironmentConfiguration","link":"<a href=\"global.html#EnvironmentConfiguration\">EnvironmentConfiguration</a>"},{"title":"SqlJs","link":"<a href=\"global.html#SqlJs\">SqlJs</a>"},{"title":"SqlJsConfig","link":"<a href=\"global.html#SqlJsConfig\">SqlJsConfig</a>"},{"title":"fibonacci","link":"<a href=\"global.html#fibonacci\">fibonacci</a>","description":"<p>Generate the Fibonacci sequence of numbers.</p>"},{"title":"initSqlJs","link":"<a href=\"global.html#initSqlJs\">initSqlJs</a>","description":"<p>Asynchronously initializes sql.js</p>"}]}
Binary file added output/v4/demo/src/assets/png/screen-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added output/v4/demo/src/assets/png/screen-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added output/v4/demo/src/assets/png/screen-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added output/v4/demo/src/assets/png/screen-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added output/v4/demo/src/assets/png/screen-5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added output/v4/demo/src/assets/png/screen-6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit a04870b

Please sign in to comment.