mirror of
https://github.com/discordjs/discord.js.git
synced 2024-08-20 22:04:45 +12:00
ci: update split upload
This commit is contained in:
parent
71bba547b6
commit
59f4db3e1d
1 changed files with 5 additions and 4 deletions
|
@ -1,5 +1,6 @@
|
||||||
import { readFile } from 'node:fs/promises';
|
import { readFile } from 'node:fs/promises';
|
||||||
import { basename } from 'node:path';
|
import { basename, dirname, relative, sep } from 'node:path';
|
||||||
|
import { cwd } from 'node:process';
|
||||||
import { getInput } from '@actions/core';
|
import { getInput } from '@actions/core';
|
||||||
import { create } from '@actions/glob';
|
import { create } from '@actions/glob';
|
||||||
import { put } from '@vercel/blob';
|
import { put } from '@vercel/blob';
|
||||||
|
@ -14,14 +15,14 @@ const promises = [];
|
||||||
const globber = await create(`packages/${pkg}/docs/${pkg}/split/*.api.json`);
|
const globber = await create(`packages/${pkg}/docs/${pkg}/split/*.api.json`);
|
||||||
for await (const file of globber.globGenerator()) {
|
for await (const file of globber.globGenerator()) {
|
||||||
const data = await readFile(file, 'utf8');
|
const data = await readFile(file, 'utf8');
|
||||||
|
const pkgName = dirname(relative(cwd(), file)).split(sep)[1];
|
||||||
try {
|
try {
|
||||||
promises.push(
|
promises.push(
|
||||||
// eslint-disable-next-line @typescript-eslint/no-loop-func
|
// eslint-disable-next-line @typescript-eslint/no-loop-func
|
||||||
limit(async () => {
|
limit(async () => {
|
||||||
console.log(`Uploading ${file} with ${version}...`);
|
console.log(`Uploading ${file} with ${version} from ${pkgName}...`);
|
||||||
const name = basename(file).replace('main.', '');
|
const name = basename(file).replace('main.', '');
|
||||||
|
await put(`rewrite/${pkgName}/${version}.${name}`, data, {
|
||||||
await put(`rewrite/${pkg}/${version}.${name}`, data, {
|
|
||||||
access: 'public',
|
access: 'public',
|
||||||
addRandomSuffix: false,
|
addRandomSuffix: false,
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue