How to use the gluegun.filesystem.path function in gluegun

To help you get started, we’ve selected a few gluegun 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 pixeloven / pixeloven / packages / pixeloven / cli / src / toolbox / resolve-plugin.ts View on Github external
function resolvePlugin(...paths: string[]) {
    const callerPath = filesystem.path(
        process.cwd(),
        nodeModulesPath,
        ...paths,
    );
    if (fsExists(callerPath)) {
        const realPath = fs.realpathSync(callerPath);
        return filesystem.path(realPath, distPath);
    }
    const scriptPath = filesystem.path(
        __dirname,
        "../../../../../", // Back out of @pixeloven/cli/dist/lib
        ...paths,
    );
    if (fsExists(scriptPath)) {
        const realPath = fs.realpathSync(scriptPath);
        return filesystem.path(realPath, distPath);
    }
    return false;
}
github pixeloven / pixeloven / packages / pixeloven / cli / src / main.ts View on Github external
* @param plugins
     */
    function addPlugins(plugins: string[]) {
        plugins.forEach(plugin => {
            if (plugin.includes("cli-addon")) {
                builder.plugin(
                    filesystem.path(fs.realpathSync(plugin), "./dist/lib"),
                );
            }
        });
    }

    /**
     * Get plugins in the callers path
     */
    const callingPath = filesystem.path(
        process.cwd(),
        "./node_modules",
        "@pixeloven",
    );
    const callingPathPlugins = filesystem.subdirectories(callingPath);
    addPlugins(callingPathPlugins);

    /**
     * Get plugins in the script path
     */
    const scriptPath = filesystem.path(
        __dirname,
        "../../../", // Back out of cli/dist/lib
    );
    const scriptPathPlugins = filesystem.subdirectories(scriptPath);
    addPlugins(scriptPathPlugins);
github pixeloven / pixeloven / packages / pixeloven / cli / src / toolbox / get-config-path.ts View on Github external
function getConfigPath(fileName: string, strict: boolean = false) {
    const configPath = filesystem.path(fileName);
    if (filesystem.exists(configPath)) {
        print.info(`Configuration file found ${configPath}`);
        return configPath;
    }
    if (strict) {
        throw new FileNotFoundException(`File not found ${configPath}`);
    } else {
        print.warning(
            `Unable to find "${fileName}" reverting to default configuration`,
        );
    }
    return false;
}