Skip to content

Commit

Permalink
codemod rest of utils to esm
Browse files Browse the repository at this point in the history
  • Loading branch information
howardchung committed Dec 2, 2023
1 parent 63cb2c5 commit 8932488
Show file tree
Hide file tree
Showing 42 changed files with 57 additions and 119 deletions.
2 changes: 1 addition & 1 deletion dev/findProMatches.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import async from 'async';
import queries from '../store/queries.mjs';
import db from '../store/db.mjs';
import { generateJob, getData } from '../util/utility.js';
import { generateJob, getData } from '../util/utility.mjs';

// const leagueUrl = generateJob('api_leagues', {}).url;

Expand Down
2 changes: 1 addition & 1 deletion dev/rePatch.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import async from 'async';
import constants from 'dotaconstants';
import db from '../store/db.mjs';
import queries from '../store/queries.mjs';
import utility from '../util/utility.js';
import utility from '../util/utility.mjs';

db.select(['match_id', 'start_time'])
.from('matches')
Expand Down
2 changes: 1 addition & 1 deletion dev/wordcount.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import JSONStream from 'JSONStream';
import db from '../store/db';
import utility from '../util/utility.js';
import utility from '../util/utility.mjs';
import compute from '../util/compute.mjs';

const args = process.argv.slice(2);
Expand Down
2 changes: 1 addition & 1 deletion processors/processAllPlayers.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import utility from '../util/utility.js';
import utility from '../util/utility.mjs';
/**
* Compute data requiring all players in a match for storage in match table
* */
Expand Down
4 changes: 1 addition & 3 deletions routes/requests/queryParams/scenarioParams.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
const su = require('../../../util/scenariosUtil');

module.exports = {
scenarioParam: {
name: 'scenario',
in: 'query',
description: su.teamScenariosQueryParams.toString(),
description: 'Name of the scenario (see teamScenariosQueryParams)',
required: false,
schema: {
type: 'string',
Expand Down
2 changes: 1 addition & 1 deletion routes/spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import searchES from '../store/searchES.mjs';
import buildMatch from '../store/buildMatch.mjs';
import buildStatus from '../store/buildStatus.mjs';
import playerFields from './playerFields.json' assert { type: 'json' };
import utility from '../util/utility.js';
import utility from '../util/utility.mjs';
import db from '../store/db.mjs';
import redis from '../store/redis.mjs';
import packageJson from '../package.json' assert { type: 'json' };
Expand Down
2 changes: 1 addition & 1 deletion store/buildMatch.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import constants from 'dotaconstants';
import config from '../config.js';
import queries from './queries.mjs';
import compute from '../util/compute.mjs';
import utility from '../util/utility.js';
import utility from '../util/utility.mjs';
import cassandra from './cassandra.mjs';
import redis from './redis.mjs';
import db from './db.mjs';
Expand Down
2 changes: 1 addition & 1 deletion store/buildStatus.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import async from 'async';
import utility from '../util/utility.js';
import utility from '../util/utility.mjs';
export default function buildStatus(db, redis, cb) {
function generatePercentiles(arr) {
// sort the list
Expand Down
2 changes: 1 addition & 1 deletion store/getGcData.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import moment from 'moment';
import utility from '../util/utility.js';
import utility from '../util/utility.mjs';
import config from '../config.js';
import queries from './queries.mjs';
import db from './db.mjs';
Expand Down
4 changes: 2 additions & 2 deletions store/queries.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import async from 'async';
import constants from 'dotaconstants';
import util from 'util';
import utility from '../util/utility.js';
import utility from '../util/utility.mjs';
import config from '../config.js';
import queue from './queue.mjs';
import su from '../util/scenariosUtil.js';
import su from '../util/scenariosUtil.mjs';
import filter from '../util/filter.mjs';
import compute from '../util/compute.mjs';
import db from './db.mjs';
Expand Down
2 changes: 1 addition & 1 deletion svc/apiadmin.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import moment from 'moment';
import stripeLib from 'stripe';
import redis from '../store/redis.mjs';
import db from '../store/db.mjs';
import utility from '../util/utility.js';
import utility from '../util/utility.mjs';
import queries from '../store/queries.mjs';
import config from '../config.js';
const stripe = stripeLib(config.STRIPE_SECRET);
Expand Down
2 changes: 1 addition & 1 deletion svc/backupscanner.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import async from 'async';
import utility from '../util/utility.js';
import utility from '../util/utility.mjs';
import redis from '../store/redis.mjs';
import queries from '../store/queries.mjs';
import config from '../config.js';
Expand Down
2 changes: 1 addition & 1 deletion svc/benchmarks.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import queue from '../store/queue.mjs';
import buildMatch from '../store/buildMatch.mjs';
import utility from '../util/utility.js';
import utility from '../util/utility.mjs';
import config from '../config.js';
import redis from '../store/redis.mjs';

Expand Down
2 changes: 1 addition & 1 deletion svc/buildsets.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import buildSets from '../store/buildSets.mjs';
import redis from '../store/redis.mjs';
import db from '../store/db.mjs';
import utility from '../util/utility.js';
import utility from '../util/utility.mjs';
const { invokeInterval } = utility;
function doBuildSets(cb) {
buildSets(db, redis, cb);
Expand Down
2 changes: 1 addition & 1 deletion svc/cosmetics.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import vdf from 'simple-vdf';
import async from 'async';
import db from '../store/db.mjs';
import utility from '../util/utility.js';
import utility from '../util/utility.mjs';
import queries from '../store/queries.mjs';
const { invokeInterval, cleanItemSchema } = utility;
function doCosmetics(cb) {
Expand Down
2 changes: 1 addition & 1 deletion svc/counts.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import async from 'async';
import moment from 'moment';
import redis from '../store/redis.mjs';
import db from '../store/db.mjs';
import utility from '../util/utility.js';
import utility from '../util/utility.mjs';
import queries from '../store/queries.mjs';
import queue from '../store/queue.mjs';
import config from '../config.js';
Expand Down
2 changes: 1 addition & 1 deletion svc/distributions.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import async from 'async';
import constants from 'dotaconstants';
import db from '../store/db.mjs';
import redis from '../store/redis.mjs';
import utility from '../util/utility.js';
import utility from '../util/utility.mjs';
const { invokeInterval } = utility;
const sql = {};
const sqlq = fs.readdirSync('./sql');
Expand Down
2 changes: 1 addition & 1 deletion svc/fullhistory.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import async from 'async';
import urllib from 'url';
import constants from 'dotaconstants';
import config from '../config.js';
import { redisCount, getData, generateJob } from '../util/utility.js';
import { redisCount, getData, generateJob } from '../util/utility.mjs';
import db from '../store/db.mjs';
import redis from '../store/redis.mjs';
import queue from '../store/queue.mjs';
Expand Down
2 changes: 1 addition & 1 deletion svc/gcdata.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import getGcData from '../util/getGcData.mjs';
import queue from '../store/queue.mjs';
import config from '../config.js';
import utility from '../util/utility.js';
import utility from '../util/utility.mjs';
const { getRetrieverArr } = utility;
const retrieverArr = getRetrieverArr();
async function processGcData(job, cb) {
Expand Down
2 changes: 1 addition & 1 deletion svc/heroes.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import async from 'async';
import db from '../store/db.mjs';
import utility from '../util/utility.js';
import utility from '../util/utility.mjs';
import queries from '../store/queries.mjs';
const { invokeInterval, generateJob, getData } = utility;
function doHeroes(cb) {
Expand Down
2 changes: 1 addition & 1 deletion svc/herostats.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import moment from 'moment';
import async from 'async';
import db from '../store/db.mjs';
import redis from '../store/redis.mjs';
import utility from '../util/utility.js';
import utility from '../util/utility.mjs';
const { invokeInterval } = utility;
function doHeroStats(cb) {
const minTime = moment().subtract(30, 'day').format('X');
Expand Down
2 changes: 1 addition & 1 deletion svc/items.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import async from 'async';
import db from '../store/db.mjs';
import utility from '../util/utility.js';
import utility from '../util/utility.mjs';
import queries from '../store/queries.mjs';
const { invokeInterval } = utility;
function doItems(cb) {
Expand Down
2 changes: 1 addition & 1 deletion svc/leagues.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import async from 'async';
import utility from '../util/utility.js';
import utility from '../util/utility.mjs';
import db from '../store/db.mjs';
import queries from '../store/queries.mjs';
const { invokeInterval, generateJob, getData } = utility;
Expand Down
2 changes: 1 addition & 1 deletion svc/livegames.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import JSONbig from 'json-bigint';
import request from 'request';
import redis from '../store/redis.mjs';
import db from '../store/db.mjs';
import utility from '../util/utility.js';
import utility from '../util/utility.mjs';
import config from '../config.js';
const { invokeInterval } = utility;
function doLiveGames(cb) {
Expand Down
2 changes: 1 addition & 1 deletion svc/migrater.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import async from 'async';
import fs from 'fs';
import db from '../store/db.mjs';
import utility from '../util/utility.js';
import utility from '../util/utility.mjs';
const sqlQuery = fs.readFileSync('./sql/create_tables.sql', 'utf8');
// const cassQuery = fs.readFileSync('./sql/create_tables.cql', 'utf8');
const { invokeInterval } = utility;
Expand Down
2 changes: 1 addition & 1 deletion svc/mmr.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import db from '../store/db.mjs';
import redis from '../store/redis.mjs';
import queries from '../store/queries.mjs';
import config from '../config.js';
import { getData, redisCount, getRetrieverArr } from '../util/utility.js';
import { getData, redisCount, getRetrieverArr } from '../util/utility.mjs';
const { insertPlayer, insertPlayerRating } = queries;
const retrieverArr = getRetrieverArr();
function processMmr(job, cb) {
Expand Down
2 changes: 1 addition & 1 deletion svc/monitor.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import config from '../config.js';
import redis from '../store/redis.mjs';
import db from '../store/db.mjs';
import cassandra from '../store/cassandra.mjs';
import utility from '../util/utility.js';
import utility from '../util/utility.mjs';
const apiKey = config.STEAM_API_KEY.split(',')[0];
function invokeInterval(func) {
// invokes the function immediately, waits for callback, waits the delay, and then calls it again
Expand Down
2 changes: 1 addition & 1 deletion svc/parser.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { exec } from 'child_process';
import os from 'os';
import express from 'express';
import utility from '../util/utility.js';
import utility from '../util/utility.mjs';
import getGcData from '../store/getGcData.mjs';
import config from '../config.js';
import queue from '../store/queue.mjs';
Expand Down
2 changes: 1 addition & 1 deletion svc/profiler.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import async from 'async';
import queries from '../store/queries.mjs';
import db from '../store/db.mjs';
import utility from '../util/utility.js';
import utility from '../util/utility.mjs';
const { insertPlayer, bulkIndexPlayer } = queries;
const { getData, generateJob, convert64to32 } = utility;
function getSummaries(cb) {
Expand Down
2 changes: 1 addition & 1 deletion svc/proplayers.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import async from 'async';
import db from '../store/db.mjs';
import queries from '../store/queries.mjs';
import utility from '../util/utility.js';
import utility from '../util/utility.mjs';
const { invokeInterval, generateJob, getData } = utility;
function doProPlayers(cb) {
const container = generateJob('api_notable', {});
Expand Down
2 changes: 1 addition & 1 deletion svc/repatch.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import async from 'async';
import constants from 'dotaconstants';
import db from '../store/db.mjs';
import queries from '../store/queries.mjs';
import utility from '../util/utility.js';
import utility from '../util/utility.mjs';
const { invokeInterval } = utility;
function rePatch() {
db.select(['match_id', 'start_time'])
Expand Down
2 changes: 1 addition & 1 deletion svc/scanner.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import async from 'async';
import utility from '../util/utility.js';
import utility from '../util/utility.mjs';
import config from '../config.js';
import redis from '../store/redis.mjs';
import queries from '../store/queries.mjs';
Expand Down
4 changes: 2 additions & 2 deletions svc/scenarios.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import util from 'util';
import queue from '../store/queue.mjs';
import buildMatch from '../store/buildMatch.mjs';
import db from '../store/db.mjs';
import utility from '../util/utility.js';
import su from '../util/scenariosUtil.js';
import utility from '../util/utility.mjs';
import su from '../util/scenariosUtil.mjs';
async function processScenarios(matchID, cb) {
try {
const match = await buildMatch(matchID);
Expand Down
2 changes: 1 addition & 1 deletion svc/scenariosCleanup.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import async from 'async';
import db from '../store/db.mjs';
import config from '../config.js';
import utility from '../util/utility.js';
import utility from '../util/utility.mjs';
function clearScenariosTables(cb) {
const currentWeek = utility.epochWeek();
async.parallel(
Expand Down
2 changes: 1 addition & 1 deletion svc/syncSubs.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import db from '../store/db.mjs';
import utility from '../util/utility.js';
import utility from '../util/utility.mjs';
import config from '../config.js';
import stripeLib from 'stripe';
const stripe = stripeLib(config.STRIPE_SECRET);
Expand Down
2 changes: 1 addition & 1 deletion svc/teams.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import async from 'async';
import db from '../store/db.mjs';
import utility from '../util/utility.js';
import utility from '../util/utility.mjs';
import queries from '../store/queries.mjs';
const { invokeInterval } = utility;
function doTeams(cb) {
Expand Down
2 changes: 1 addition & 1 deletion svc/web.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import api from '../routes/api.mjs';
import queries from '../store/queries.mjs';
import db from '../store/db.mjs';
import redis from '../store/redis.mjs';
import utility from '../util/utility.js';
import utility from '../util/utility.mjs';
import config from '../config.js';
const SteamStrategy = passportSteam.Strategy;
const stripe = stripeLib(config.STRIPE_SECRET);
Expand Down
2 changes: 1 addition & 1 deletion util/compute.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import constants from 'dotaconstants';
import utility from './utility.js';
import utility from './utility.mjs';
const { max, min, isRadiant } = utility;
const { ancients } = constants;
/**
Expand Down
2 changes: 1 addition & 1 deletion util/filter.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import utility from './utility.js';
import utility from './utility.mjs';
const { isRadiant } = utility;
function filter(matches, filters) {
const curtime = Math.floor(Date.now() / 1000);
Expand Down
2 changes: 1 addition & 1 deletion util/laneMappings.js → util/laneMappings.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ for (let i = 0; i < 128; i += 1) {
laneMappings[i].push(lane);
}
}
module.exports = laneMappings;
export default laneMappings;
Loading

0 comments on commit 8932488

Please sign in to comment.