mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 11:33:30 +01:00
ci: update split upload
This commit is contained in:
@@ -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,
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user