mirror of
https://github.com/samuelthomas2774/nxapi.git
synced 2026-03-21 18:04:10 -05:00
Remove mkdirp
This commit is contained in:
parent
d147c2a5e8
commit
0a9e5d859d
5
package-lock.json
generated
5
package-lock.json
generated
|
|
@ -18,7 +18,6 @@
|
|||
"env-paths": "^3.0.0",
|
||||
"eventsource": "^2.0.2",
|
||||
"express": "^4.18.2",
|
||||
"mkdirp": "^1.0.4",
|
||||
"node-notifier": "^10.0.1",
|
||||
"node-persist": "^3.1.0",
|
||||
"read": "^1.0.7",
|
||||
|
|
@ -3139,6 +3138,7 @@
|
|||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
|
||||
"integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"mkdirp": "bin/cmd.js"
|
||||
},
|
||||
|
|
@ -7005,7 +7005,8 @@
|
|||
"mkdirp": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
|
||||
"integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw=="
|
||||
"integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==",
|
||||
"dev": true
|
||||
},
|
||||
"ms": {
|
||||
"version": "2.1.2",
|
||||
|
|
|
|||
|
|
@ -45,7 +45,6 @@
|
|||
"env-paths": "^3.0.0",
|
||||
"eventsource": "^2.0.2",
|
||||
"express": "^4.18.2",
|
||||
"mkdirp": "^1.0.4",
|
||||
"node-notifier": "^10.0.1",
|
||||
"node-persist": "^3.1.0",
|
||||
"read": "^1.0.7",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import * as fs from 'node:fs/promises';
|
||||
import * as path from 'node:path';
|
||||
import mkdirp from 'mkdirp';
|
||||
import type { Arguments as ParentArguments } from '../nooklink.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
|
|
@ -40,7 +39,7 @@ export async function handler(argv: ArgumentsCamelCase<Arguments>) {
|
|||
|
||||
const directory = argv.directory ?? path.join(argv.dataPath, 'nooklink');
|
||||
|
||||
await mkdirp(directory);
|
||||
await fs.mkdir(directory, {recursive: true});
|
||||
|
||||
const latest = await nooklinkuser.getLatestNewspaper();
|
||||
const newspapers = await nooklinkuser.getNewspapers();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import * as path from 'node:path';
|
||||
import * as fs from 'node:fs/promises';
|
||||
import mkdirp from 'mkdirp';
|
||||
import type { Arguments as ParentArguments } from '../pctl.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
|
|
@ -42,7 +41,7 @@ export async function handler(argv: ArgumentsCamelCase<Arguments>) {
|
|||
|
||||
const directory = argv.directory ?? path.join(argv.dataPath, 'summaries');
|
||||
|
||||
await mkdirp(directory);
|
||||
await fs.mkdir(directory, {recursive: true});
|
||||
|
||||
const devices = await moon.getDevices();
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import * as path from 'node:path';
|
|||
import express, { Request, Response } from 'express';
|
||||
import { fetch } from 'undici';
|
||||
import * as persist from 'node-persist';
|
||||
import mkdirp from 'mkdirp';
|
||||
import { BankaraMatchSetting_schedule, CoopRule, CoopSetting_schedule, DetailFestRecordDetailResult, DetailVotingStatusResult, FestMatchSetting_schedule, FestRecordResult, FestState, FestTeam_schedule, FestTeam_votingStatus, FestVoteState, Fest_schedule, FriendListResult, FriendOnlineState, Friend_friendList, GraphQLSuccessResponse, KnownRequestId, LeagueMatchSetting_schedule, RegularMatchSetting_schedule, StageScheduleResult, XMatchSetting_schedule } from 'splatnet3-types/splatnet3';
|
||||
import type { Arguments as ParentArguments } from '../cli.js';
|
||||
import { product, version } from '../util/product.js';
|
||||
|
|
@ -425,7 +424,7 @@ class SplatNet3ApiUser extends SplatNet3User {
|
|||
fest: await this.getCurrentFest(),
|
||||
};
|
||||
|
||||
await mkdirp(path.join(this.record_fest_votes!.path, 'splatnet3-fest-votes-' + id));
|
||||
await fs.mkdir(path.join(this.record_fest_votes!.path, 'splatnet3-fest-votes-' + id), {recursive: true});
|
||||
await fs.writeFile(path.join(this.record_fest_votes!.path, 'splatnet3-fest-votes-' + id, Date.now() + '.json'), JSON.stringify(record, null, 4) + '\n');
|
||||
}
|
||||
|
||||
|
|
@ -1217,7 +1216,7 @@ class Server extends HttpServer {
|
|||
|
||||
if (!response.ok) throw new ErrorResponse('Unable to download resource ' + name, response, data.toString());
|
||||
|
||||
await mkdirp(path.dirname(path.join(dir, name)));
|
||||
await fs.mkdir(path.dirname(path.join(dir, name)), {recursive: true});
|
||||
await fs.writeFile(path.join(dir, name), data);
|
||||
|
||||
debug('Downloaded image %s', name);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import * as path from 'node:path';
|
||||
import * as fs from 'node:fs/promises';
|
||||
import mkdirp from 'mkdirp';
|
||||
import type { Arguments as ParentArguments } from '../splatnet2.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
|
|
@ -68,7 +67,7 @@ export async function handler(argv: ArgumentsCamelCase<Arguments>) {
|
|||
|
||||
const directory = argv.directory ?? path.join(argv.dataPath, 'splatnet2');
|
||||
|
||||
await mkdirp(directory);
|
||||
await fs.mkdir(directory, {recursive: true});
|
||||
|
||||
const [records, stages, activefestivals, timeline] = await Promise.all([
|
||||
splatnet.getRecords(),
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import * as path from 'node:path';
|
||||
import mkdirp from 'mkdirp';
|
||||
import * as fs from 'node:fs/promises';
|
||||
import type { Arguments as ParentArguments } from '../splatnet2.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
|
|
@ -57,7 +57,7 @@ export async function handler(argv: ArgumentsCamelCase<Arguments>) {
|
|||
|
||||
const directory = argv.directory ?? path.join(argv.dataPath, 'splatnet2');
|
||||
|
||||
await mkdirp(directory);
|
||||
await fs.mkdir(directory, {recursive: true});
|
||||
|
||||
const updated = argv.checkUpdated ? new Date((await splatnet.getRecords()).records.update_time * 1000) : undefined;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import * as path from 'node:path';
|
||||
import * as fs from 'node:fs/promises';
|
||||
import mkdirp from 'mkdirp';
|
||||
import { fetch } from 'undici';
|
||||
import { PhotoAlbumResult } from 'splatnet3-types/splatnet3';
|
||||
import type { Arguments as ParentArguments } from '../splatnet3.js';
|
||||
|
|
@ -42,7 +41,7 @@ export async function handler(argv: ArgumentsCamelCase<Arguments>) {
|
|||
|
||||
const directory = argv.directory ?? path.join(argv.dataPath, 'splatnet3');
|
||||
|
||||
await mkdirp(directory);
|
||||
await fs.mkdir(directory, {recursive: true});
|
||||
|
||||
await dumpAlbumPhotos(splatnet, directory);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import * as path from 'node:path';
|
||||
import * as fs from 'node:fs/promises';
|
||||
import mkdirp from 'mkdirp';
|
||||
import { FestState, Fest_detail, RequestId } from 'splatnet3-types/splatnet3';
|
||||
import type { Arguments as ParentArguments } from '../splatnet3.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
|
|
@ -44,7 +43,7 @@ export async function handler(argv: ArgumentsCamelCase<Arguments>) {
|
|||
|
||||
const directory = argv.directory ?? path.join(argv.dataPath, 'splatnet3');
|
||||
|
||||
await mkdirp(directory);
|
||||
await fs.mkdir(directory, {recursive: true});
|
||||
|
||||
await dumpFestRecords(splatnet, directory, argv.includeRankings);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import * as path from 'node:path';
|
||||
import * as fs from 'node:fs/promises';
|
||||
import mkdirp from 'mkdirp';
|
||||
import type { Arguments as ParentArguments } from '../splatnet3.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
|
|
@ -61,7 +60,7 @@ export async function handler(argv: ArgumentsCamelCase<Arguments>) {
|
|||
|
||||
const directory = argv.directory ?? path.join(argv.dataPath, 'splatnet3');
|
||||
|
||||
await mkdirp(directory);
|
||||
await fs.mkdir(directory, {recursive: true});
|
||||
|
||||
if (argv.history ?? _default) {
|
||||
await dumpHistoryRecords(splatnet, directory);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import * as path from 'node:path';
|
||||
import * as fs from 'node:fs/promises';
|
||||
import mkdirp from 'mkdirp';
|
||||
import { BankaraBattleHistoriesRefetchResult, CoopHistoryResult, LatestBattleHistoriesRefetchResult, LatestBattleHistoriesResult, PrivateBattleHistoriesRefetchResult, RefetchableCoopHistory_CoopResultResult, RegularBattleHistoriesRefetchResult, RequestId, XBattleHistoriesRefetchResult } from 'splatnet3-types/splatnet3';
|
||||
import type { Arguments as ParentArguments } from '../splatnet3.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
|
|
@ -62,7 +61,7 @@ export async function handler(argv: ArgumentsCamelCase<Arguments>) {
|
|||
|
||||
const directory = argv.directory ?? path.join(argv.dataPath, 'splatnet3');
|
||||
|
||||
await mkdirp(directory);
|
||||
await fs.mkdir(directory, {recursive: true});
|
||||
|
||||
if (argv.battles ?? _default) {
|
||||
await dumpResults(splatnet, directory);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import * as path from 'node:path';
|
||||
import mkdirp from 'mkdirp';
|
||||
import * as fs from 'node:fs/promises';
|
||||
import type { Arguments as ParentArguments } from '../splatnet3.js';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../../util/yargs.js';
|
||||
|
|
@ -77,7 +77,7 @@ export async function handler(argv: ArgumentsCamelCase<Arguments>) {
|
|||
|
||||
const directory = argv.directory ?? path.join(argv.dataPath, 'splatnet3');
|
||||
|
||||
await mkdirp(directory);
|
||||
await fs.mkdir(directory, {recursive: true});
|
||||
|
||||
let vs: (ReturnType<typeof dumpResults> extends Promise<infer T> ? T : never) | null = null;
|
||||
let coop: (ReturnType<typeof dumpCoopResults> extends Promise<infer T> ? T : never) | null = null;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import * as path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import * as fs from 'node:fs/promises';
|
||||
import mkdirp from 'mkdirp';
|
||||
import createDebug from '../../util/debug.js';
|
||||
import { StorageProvider } from './index.js';
|
||||
|
||||
|
|
@ -11,7 +10,7 @@ export class LocalStorageProvider implements StorageProvider {
|
|||
protected constructor(readonly path: string) {}
|
||||
|
||||
async getSessionToken(na_id: string, client_id: string) {
|
||||
await mkdirp(path.join(this.path, 'users', na_id));
|
||||
await fs.mkdir(path.join(this.path, 'users', na_id), {recursive: true});
|
||||
|
||||
try {
|
||||
debug('read', path.join('users', na_id, 'session-' + client_id));
|
||||
|
|
@ -25,14 +24,14 @@ export class LocalStorageProvider implements StorageProvider {
|
|||
}
|
||||
|
||||
async setSessionToken(na_id: string, client_id: string, token: string) {
|
||||
await mkdirp(path.join(this.path, 'users', na_id));
|
||||
await fs.mkdir(path.join(this.path, 'users', na_id), {recursive: true});
|
||||
|
||||
debug('write', path.join('users', na_id, 'session-' + client_id));
|
||||
await fs.writeFile(path.join(this.path, 'users', na_id, 'session-' + client_id), token, 'utf-8');
|
||||
}
|
||||
|
||||
async getSessionItem(na_id: string, session_id: string, key: string) {
|
||||
await mkdirp(path.join(this.path, 'sessions', na_id, session_id));
|
||||
await fs.mkdir(path.join(this.path, 'sessions', na_id, session_id), {recursive: true});
|
||||
|
||||
try {
|
||||
debug('read', path.join('sessions', na_id, session_id, key));
|
||||
|
|
@ -44,7 +43,7 @@ export class LocalStorageProvider implements StorageProvider {
|
|||
}
|
||||
|
||||
async setSessionItem(na_id: string, session_id: string, key: string, value: string) {
|
||||
await mkdirp(path.join(this.path, 'sessions', na_id, session_id));
|
||||
await fs.mkdir(path.join(this.path, 'sessions', na_id, session_id), {recursive: true});
|
||||
|
||||
debug('write', path.join('sessions', na_id, session_id, key));
|
||||
await fs.writeFile(path.join(this.path, 'sessions', na_id, session_id, key), value, 'utf-8');
|
||||
|
|
@ -53,7 +52,7 @@ export class LocalStorageProvider implements StorageProvider {
|
|||
static async create(path: string | URL) {
|
||||
if (path instanceof URL) path = fileURLToPath(path);
|
||||
|
||||
await mkdirp(path);
|
||||
await fs.mkdir(path, {recursive: true});
|
||||
|
||||
return new LocalStorageProvider(path);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import * as path from 'node:path';
|
|||
import * as fs from 'node:fs/promises';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { fetch } from 'undici';
|
||||
import mkdirp from 'mkdirp';
|
||||
import { ErrorResponse, ResponseSymbol } from '../api/util.js';
|
||||
import createDebug from '../util/debug.js';
|
||||
import { timeoutSignal } from '../util/misc.js';
|
||||
|
|
@ -29,7 +28,7 @@ const default_config: NxapiRemoteConfig = {
|
|||
};
|
||||
|
||||
async function loadRemoteConfig() {
|
||||
await mkdirp(paths.cache);
|
||||
await fs.mkdir(paths.cache, {recursive: true});
|
||||
const config_cache_path = path.resolve(paths.cache, 'config.json');
|
||||
|
||||
const url = process.env.NXAPI_CONFIG_URL ?? CONFIG_URL;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import * as path from 'node:path';
|
||||
import * as fs from 'node:fs/promises';
|
||||
import persist from 'node-persist';
|
||||
import mkdirp from 'mkdirp';
|
||||
import SplatNet2Api, { SplatNet2ErrorResponse } from '../../api/splatnet2.js';
|
||||
import { renewIksmToken } from '../auth/splatnet2.js';
|
||||
import { Records, Stages } from '../../api/splatnet2-types.js';
|
||||
|
|
@ -41,7 +40,7 @@ export class SplatNet2RecordsMonitor extends Loop {
|
|||
}
|
||||
|
||||
async init() {
|
||||
await mkdirp(this.directory);
|
||||
await fs.mkdir(this.directory, {recursive: true});
|
||||
}
|
||||
|
||||
async hasChanged(records: Records) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import * as path from 'node:path';
|
||||
import * as fs from 'node:fs/promises';
|
||||
import { fetch } from 'undici';
|
||||
import mkdirp from 'mkdirp';
|
||||
import createDebug from '../util/debug.js';
|
||||
import { dir, docker, version } from '../util/product.js';
|
||||
import { paths } from '../util/storage.js';
|
||||
|
|
@ -26,7 +25,7 @@ export async function checkUpdates() {
|
|||
}
|
||||
} catch (err) {}
|
||||
|
||||
await mkdirp(paths.cache);
|
||||
await fs.mkdir(paths.cache, {recursive: true});
|
||||
const update_cache_path = path.resolve(paths.cache, 'update.json');
|
||||
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
import { WriteStream } from 'node:fs';
|
||||
import { FileHandle, open, opendir, stat, unlink } from 'node:fs/promises';
|
||||
import { FileHandle, mkdir, open, opendir, stat, unlink } from 'node:fs/promises';
|
||||
import * as util from 'node:util';
|
||||
import { join } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import createDebug from 'debug';
|
||||
import mkdirp from 'mkdirp';
|
||||
import { dev, dir, docker, git, product, release, version } from './product.js';
|
||||
|
||||
const MAX_FILE_SIZE = 1000 * 1000 * 2; // 2 MB
|
||||
|
|
@ -136,7 +135,7 @@ async function openLogFile(path: string, start: Date, i = 0) {
|
|||
'-' + process.pid + '-' + i + '.log';
|
||||
const file = join(path, filename);
|
||||
|
||||
await mkdirp(path, {mode: 0o700});
|
||||
await mkdir(path, {mode: 0o700, recursive: true});
|
||||
|
||||
const file_handle = await open(file, 'a', 0o600);
|
||||
const stream = file_handle.createWriteStream();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user