1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-26 22:41:17 +02:00

Plugin repo: Fixing fetch tool

This commit is contained in:
Laurent Cozic
2021-12-22 12:01:51 +01:00
parent bc9dac2feb
commit af344601ec
2 changed files with 9 additions and 2 deletions

View File

@@ -1,7 +1,11 @@
import { githubOauthToken } from '@joplin/tools/tool-utils'; import { githubOauthToken } from '@joplin/tools/tool-utils';
import { pathExists, readdir, readFile, stat, writeFile } from 'fs-extra'; import { pathExists, readdir, readFile, stat, writeFile } from 'fs-extra';
// We need to require `.default` due to this issue:
// https://github.com/node-fetch/node-fetch/issues/450#issuecomment-387045223
const fetch = require('node-fetch').default;
const ghReleaseAssets = require('gh-release-assets'); const ghReleaseAssets = require('gh-release-assets');
const fetch = require('node-fetch');
const apiBaseUrl = 'https://api.github.com/repos/joplin/plugins'; const apiBaseUrl = 'https://api.github.com/repos/joplin/plugins';
@@ -25,6 +29,7 @@ interface ReleaseAsset {
interface Release { interface Release {
upload_url: string; upload_url: string;
html_url: string;
assets: ReleaseAsset[]; assets: ReleaseAsset[];
} }
@@ -123,6 +128,8 @@ async function saveStats(statFilePath: string, stats: any) {
export default async function(args: Args) { export default async function(args: Args) {
const release = await getRelease(); const release = await getRelease();
console.info(`Got release with ${release.assets.length} assets from ${release.html_url}`);
const statFilePath = `${args.pluginRepoDir}/stats.json`; const statFilePath = `${args.pluginRepoDir}/stats.json`;
const stats = await createStats(statFilePath, release); const stats = await createStats(statFilePath, release);

View File

@@ -1,6 +1,6 @@
{ {
"name": "@joplin/plugin-repo-cli", "name": "@joplin/plugin-repo-cli",
"version": "2.6.7", "version": "2.6.8",
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"bin": "./dist/index.js", "bin": "./dist/index.js",