How to use korefile - 2 common examples

To help you get started, we’ve selected a few korefile 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 azu / github-funding-yml-updater / src / github-funding-yml-updater.ts View on Github external
console.info(`-------------`);
            console.info(options.fundingContentRaw);
            console.info(`-------------`);
        }
    }
    for (const repository of options.repositoryList) {
        const adaptorOptions = {
            owner: repository.owner,
            repo: repository.repo,
            ref: repository.ref || "heads/master",
            token: repository.token
        };
        const repoMark = `${repository.owner}/${repository.repo}`;
        const adaptor = options.createAdaptor
            ? options.createAdaptor(adaptorOptions)
            : createGitHubAdaptor(adaptorOptions);
        const korefile = createKoreFile({
            adaptor: adaptor
        });
        try {
            if (options.mode === "add") {
                const user = options.user;
                const fundingContent = await fetchFundingFile(korefile).catch((error) => {
                    // No Contents
                    if (error.status === 404) {
                        return {};
                    }
                    // other error
                    return Promise.reject(error);
                });
                const shouldUpdate = !hasUserInFunding(fundingContent, user);
                if (!options.silent) {
github azu / github-funding-yml-updater / src / github-funding-yml-updater.ts View on Github external
console.info(options.fundingContentRaw);
            console.info(`-------------`);
        }
    }
    for (const repository of options.repositoryList) {
        const adaptorOptions = {
            owner: repository.owner,
            repo: repository.repo,
            ref: repository.ref || "heads/master",
            token: repository.token
        };
        const repoMark = `${repository.owner}/${repository.repo}`;
        const adaptor = options.createAdaptor
            ? options.createAdaptor(adaptorOptions)
            : createGitHubAdaptor(adaptorOptions);
        const korefile = createKoreFile({
            adaptor: adaptor
        });
        try {
            if (options.mode === "add") {
                const user = options.user;
                const fundingContent = await fetchFundingFile(korefile).catch((error) => {
                    // No Contents
                    if (error.status === 404) {
                        return {};
                    }
                    // other error
                    return Promise.reject(error);
                });
                const shouldUpdate = !hasUserInFunding(fundingContent, user);
                if (!options.silent) {
                    console.info(`${repoMark}: ${shouldUpdate ? "Try to Update" : "No Update"}`);

korefile

File System API for Local/GitHub.

MIT
Latest version published 1 year ago

Package Health Score

49 / 100
Full package analysis

Popular JavaScript code snippets

Find secure code to use in your application or website