fix(aklive2d): updated cf upload
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
akassets_url: https://akassets.halyul.dev
|
akassets:
|
||||||
|
project_name: akassets
|
||||||
|
url: https://akassets.halyul.dev
|
||||||
folder:
|
folder:
|
||||||
auto_update_data: ./data/auto_update
|
auto_update_data: ./data/auto_update
|
||||||
operator_data: ./data/operator/
|
operator_data: ./data/operator/
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ export default class CFPages {
|
|||||||
async upload() {
|
async upload() {
|
||||||
const tree = await this.#generateDirTree(this.#uploadPath);
|
const tree = await this.#generateDirTree(this.#uploadPath);
|
||||||
writeSync(JSON.stringify(tree, null), path.join(this.#uploadPath, 'index.json'));
|
writeSync(JSON.stringify(tree, null), path.join(this.#uploadPath, 'index.json'));
|
||||||
const wrangler = spawnSync('pnpm', ['wrangler', 'pages', 'deploy', this.#uploadPath]);
|
const wrangler = spawnSync('pnpm', ['wrangler', 'pages', 'deploy', this.#uploadPath, "--project-name", __config.akassets.project_name]);
|
||||||
|
|
||||||
console.log('error', wrangler.error);
|
console.log('error', wrangler.error);
|
||||||
console.log('stdout ', wrangler.stdout.toString());
|
console.log('stdout ', wrangler.stdout.toString());
|
||||||
@@ -22,7 +22,7 @@ export default class CFPages {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async download() {
|
async download() {
|
||||||
const indexFile = `${__config.akassets_url}/index.json`
|
const indexFile = `${__config.akassets.url}/index.json`
|
||||||
const resp = await fetch(indexFile);
|
const resp = await fetch(indexFile);
|
||||||
const data = await resp.json();
|
const data = await resp.json();
|
||||||
if (!exists(this.#downloadPath)) mkdir(this.#downloadPath);
|
if (!exists(this.#downloadPath)) mkdir(this.#downloadPath);
|
||||||
@@ -86,7 +86,7 @@ export default class CFPages {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return [{
|
return [{
|
||||||
url: `${__config.akassets_url}/${baseUrl + data.name.replace('#', '%23')}`,
|
url: `${__config.akassets.url}/${baseUrl + data.name.replace('#', '%23')}`,
|
||||||
target: path.join(baseDir, data.name),
|
target: path.join(baseDir, data.name),
|
||||||
hash: data.hash
|
hash: data.hash
|
||||||
}]
|
}]
|
||||||
@@ -108,7 +108,8 @@ export default class CFPages {
|
|||||||
const filePath = path.join(dir, file);
|
const filePath = path.join(dir, file);
|
||||||
const dirType = fileTypeSync(filePath);
|
const dirType = fileTypeSync(filePath);
|
||||||
if (dirType === 'dir') {
|
if (dirType === 'dir') {
|
||||||
tree.children.push(await this.#generateDirTree(filePath))
|
const children = await this.#generateDirTree(filePath);
|
||||||
|
if (children) tree.children.push(children);
|
||||||
} else {
|
} else {
|
||||||
tree.children.push({
|
tree.children.push({
|
||||||
name: file,
|
name: file,
|
||||||
|
|||||||
Reference in New Issue
Block a user