How to use the @jsdoc/core.lsSync function in @jsdoc/core

To help you get started, we’ve selected a few @jsdoc/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hegemonic / jsdoc-baseline / lib / template.js View on Github external
_l10nInit() {
        const l10nData = [];
        let l10nFiles;

        try {
            l10nFiles = lsSync(this.config.l10n, 0);
        } catch (e) {
            logger.fatal(`Unable to find the localization data file ${this.config.l10nFile}`);

            return this;
        }

        l10nFiles.forEach(filepath => {
            l10nData.push(loadYaml(filepath));
        });

        // Merge the objects in reverse order so that the first one loaded wins.
        this._l10nData = deepExtend.apply(deepExtend, l10nData.reverse());
        this._l10nFormatter = new MessageFormat(this.locale).compile(this._l10nData);

        return this;
    }
github jsdoc / jsdoc / packages / jsdoc / templates / default / publish.js View on Github external
if (!sourceFilePaths.includes(sourcePath)) {
                sourceFilePaths.push(sourcePath);
            }
        }
    });

    // update outdir if necessary, then create outdir
    packageInfo = ( find({kind: 'package'}) || [] )[0];
    if (packageInfo && packageInfo.name) {
        outdir = path.join( outdir, packageInfo.name, (packageInfo.version || '') );
    }
    mkdirpSync(outdir);

    // copy the template's static files to outdir
    fromDir = path.join(templatePath, 'static');
    staticFiles = lsSync(fromDir);

    staticFiles.forEach(fileName => {
        const toPath = sourceToDestination(fromDir, fileName, outdir);

        mkdirpSync(path.dirname(toPath));
        fs.copyFileSync(fileName, toPath);
    });

    // copy the fonts used by the template to outdir
    staticFiles = lsSync(path.join(require.resolve('open-sans-fonts'), '..', 'open-sans'));

    staticFiles.forEach(fileName => {
        const toPath = path.join(outdir, 'fonts', path.basename(fileName));

        if (FONT_NAMES.includes(path.parse(fileName).name)) {
            mkdirpSync(path.dirname(toPath));
github jsdoc / jsdoc / packages / jsdoc / lib / jsdoc / tutorial / resolver.js View on Github external
exports.load = filepath => {
    let content;
    let current;
    const files = lsSync(filepath, {
        depth: env.opts.recurse ? env.conf.recurseDepth : 0
    });
    let name;
    let match;
    let type;

    // tutorials handling
    files.forEach(file => {
        match = file.match(finder);

        // any filetype that can apply to tutorials
        if (match) {
            name = path.basename(match[1]);
            content = fs.readFileSync(file, env.opts.encoding);

            switch (match[2].toLowerCase()) {
github jsdoc / jsdoc / packages / jsdoc / templates / default / publish.js View on Github external
}
    mkdirpSync(outdir);

    // copy the template's static files to outdir
    fromDir = path.join(templatePath, 'static');
    staticFiles = lsSync(fromDir);

    staticFiles.forEach(fileName => {
        const toPath = sourceToDestination(fromDir, fileName, outdir);

        mkdirpSync(path.dirname(toPath));
        fs.copyFileSync(fileName, toPath);
    });

    // copy the fonts used by the template to outdir
    staticFiles = lsSync(path.join(require.resolve('open-sans-fonts'), '..', 'open-sans'));

    staticFiles.forEach(fileName => {
        const toPath = path.join(outdir, 'fonts', path.basename(fileName));

        if (FONT_NAMES.includes(path.parse(fileName).name)) {
            mkdirpSync(path.dirname(toPath));
            fs.copyFileSync(fileName, toPath);
        }
    });

    // copy the prettify script to outdir
    PRETTIFIER_SCRIPT_FILES.forEach(fileName => {
        const toPath = path.join(outdir, 'scripts', path.basename(fileName));

        fs.copyFileSync(
            path.join(require.resolve('code-prettify'), '..', fileName),
github jsdoc / jsdoc / packages / jsdoc / lib / jsdoc / src / scanner.js View on Github external
const filepath = path.resolve(process.cwd(), decodeURIComponent($));

            try {
                currentFile = statSync(filepath);
            }
            catch (e) {
                logger.error('Unable to find the source file or directory %s', filepath);

                return;
            }

            if ( currentFile.isFile() ) {
                filePaths.push(filepath);
            }
            else {
                filePaths = filePaths.concat(lsSync(filepath, depth));
            }
        });
github hegemonic / jsdoc-baseline / lib / template.js View on Github external
this.config.views.partials.forEach(filepath => {
            partials = partials.concat(lsSync(path.resolve(this.path, filepath), 0));
        });
        this._addPartials(partials.concat(layouts));

@jsdoc/core

Core functionality for JSDoc.

Apache-2.0
Latest version published 7 months ago

Package Health Score

70 / 100
Full package analysis