mirror of
https://github.com/tiennm99/github-readme-stats.git
synced 2026-09-03 04:18:06 +00:00
Feature/grs 1955 change commonjs imports (#1995)
* GRS-1955: Using ES6 import/export in src files * GRS-1955: Using ES6 import/export in test files * GRS-1955: Using ES6 import/export in themes index.js * GRS-1955: Readding blank line at end of top-languages-card.js * feat: fix test es6 import errors This commit makes sure jest is set-up to support es6. It also fixes several test errors and sorts the imports. * test: update test node version This commit makes sure node 16 is used in the github actions. * refactor: run prettier Co-authored-by: rickstaa <rick.staa@outlook.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
// @ts-check
|
||||
const retryer = require("../common/retryer");
|
||||
const { request, MissingParamError } = require("../common/utils");
|
||||
import { retryer } from "../common/retryer";
|
||||
import { MissingParamError, request } from "../common/utils";
|
||||
|
||||
/**
|
||||
* @param {import('Axios').AxiosRequestHeaders} variables
|
||||
@@ -97,4 +97,5 @@ async function fetchRepo(username, reponame) {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = fetchRepo;
|
||||
export { fetchRepo };
|
||||
export default fetchRepo;
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
// @ts-check
|
||||
const axios = require("axios").default;
|
||||
const githubUsernameRegex = require("github-username-regex");
|
||||
|
||||
const retryer = require("../common/retryer");
|
||||
const calculateRank = require("../calculateRank");
|
||||
const {
|
||||
request,
|
||||
logger,
|
||||
import axios from "axios";
|
||||
import * as dotenv from "dotenv";
|
||||
import githubUsernameRegex from "github-username-regex";
|
||||
import { calculateRank } from "../calculateRank";
|
||||
import { retryer } from "../common/retryer";
|
||||
import {
|
||||
CustomError,
|
||||
logger,
|
||||
MissingParamError,
|
||||
} = require("../common/utils");
|
||||
request,
|
||||
} from "../common/utils";
|
||||
|
||||
require("dotenv").config();
|
||||
dotenv.config();
|
||||
|
||||
/**
|
||||
* @param {import('axios').AxiosRequestHeaders} variables
|
||||
@@ -187,4 +187,5 @@ async function fetchStats(
|
||||
return stats;
|
||||
}
|
||||
|
||||
module.exports = fetchStats;
|
||||
export { fetchStats };
|
||||
export default fetchStats;
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
// @ts-check
|
||||
const { request, logger, MissingParamError } = require("../common/utils");
|
||||
const retryer = require("../common/retryer");
|
||||
require("dotenv").config();
|
||||
import * as dotenv from "dotenv";
|
||||
import { retryer } from "../common/retryer";
|
||||
import { logger, MissingParamError, request } from "../common/utils";
|
||||
|
||||
dotenv.config();
|
||||
|
||||
/**
|
||||
* @param {import('Axios').AxiosRequestHeaders} variables
|
||||
@@ -104,4 +106,5 @@ async function fetchTopLanguages(username, exclude_repo = []) {
|
||||
return topLangs;
|
||||
}
|
||||
|
||||
module.exports = fetchTopLanguages;
|
||||
export { fetchTopLanguages };
|
||||
export default fetchTopLanguages;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const axios = require("axios");
|
||||
const { MissingParamError } = require("../common/utils");
|
||||
import axios from "axios";
|
||||
import { MissingParamError } from "../common/utils";
|
||||
|
||||
/**
|
||||
* @param {{username: string, api_domain: string, range: string}} props
|
||||
@@ -26,6 +26,5 @@ const fetchWakatimeStats = async ({ username, api_domain, range }) => {
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
fetchWakatimeStats,
|
||||
};
|
||||
export { fetchWakatimeStats };
|
||||
export default fetchWakatimeStats;
|
||||
|
||||
Reference in New Issue
Block a user