feat(directory): add directory.json for index page
This commit is contained in:
@@ -24,4 +24,5 @@ operators:
|
|||||||
rosmontis_become_anew: !include config/rosmontis_become_anew.yaml
|
rosmontis_become_anew: !include config/rosmontis_become_anew.yaml
|
||||||
passager_dream_in_a_moment: !include config/passager_dream_in_a_moment.yaml
|
passager_dream_in_a_moment: !include config/passager_dream_in_a_moment.yaml
|
||||||
mizuki_summer_feast: !include config/mizuki_summer_feast.yaml
|
mizuki_summer_feast: !include config/mizuki_summer_feast.yaml
|
||||||
|
chongyue: !include config/chongyue.yaml
|
||||||
|
ling_it_does_wash_the_strings: !include config/ling_it_does_wash_the_strings.yaml
|
||||||
12
config/chongyue.yaml
Normal file
12
config/chongyue.yaml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
link: chongyue
|
||||||
|
type: operator
|
||||||
|
date: 2023/01
|
||||||
|
title: 'Arknights: Chongyue - 明日方舟:重岳'
|
||||||
|
filename: dyn_illust_char_1013_chen2
|
||||||
|
logo: logo_sui
|
||||||
|
fallback_name: char_1013_chen2_2
|
||||||
|
viewport_left: 0
|
||||||
|
viewport_right: 0
|
||||||
|
viewport_top: 0
|
||||||
|
viewport_bottom: 0
|
||||||
|
invert_filter: true
|
||||||
12
config/ling_it_does_wash_the_strings.yaml
Normal file
12
config/ling_it_does_wash_the_strings.yaml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
link: ling_it_does_wash_the_strings
|
||||||
|
type: skin
|
||||||
|
date: 2023/01
|
||||||
|
title: 'Arknights: It Does Wash the Strings / Ling - 明日方舟:濯缨 · 令'
|
||||||
|
filename: dyn_illust_char_2023_ling#4
|
||||||
|
logo: logo_sui
|
||||||
|
fallback_name: char_2023_ling_2#4
|
||||||
|
viewport_left: 0
|
||||||
|
viewport_right: 0
|
||||||
|
viewport_top: 0
|
||||||
|
viewport_bottom: 0
|
||||||
|
invert_filter: false
|
||||||
18
lib/directory.js
Normal file
18
lib/directory.js
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
import path from 'path'
|
||||||
|
import { writeSync, copy } from './file.js'
|
||||||
|
|
||||||
|
export default function (config, rootDir) {
|
||||||
|
const targetFolder = path.join(rootDir, config.folder.release, "_assets");
|
||||||
|
const sourceFolder = path.join(rootDir, config.folder.operator);
|
||||||
|
const filesToCopy = [];
|
||||||
|
const directoryJson = []
|
||||||
|
for (const [key, value] of Object.entries(config.operators)) {
|
||||||
|
filesToCopy.push(key);
|
||||||
|
directoryJson.push(value);
|
||||||
|
}
|
||||||
|
writeSync(JSON.stringify(directoryJson, null), path.join(targetFolder, "directory.json"))
|
||||||
|
filesToCopy.forEach((key) => {
|
||||||
|
const filename = `${config.operators[key].filename}.json`;
|
||||||
|
copy(path.join(sourceFolder, key, filename), path.join(targetFolder, filename))
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -6,6 +6,11 @@ export async function write(content, filePath) {
|
|||||||
return await fsP.writeFile(filePath, content, { flag: 'w' })
|
return await fsP.writeFile(filePath, content, { flag: 'w' })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function writeSync(content, filePath) {
|
||||||
|
mkdir(path.dirname(filePath))
|
||||||
|
return fs.writeFileSync(filePath, content, { flag: 'w' })
|
||||||
|
}
|
||||||
|
|
||||||
export async function read(filePath, encoding = 'utf8') {
|
export async function read(filePath, encoding = 'utf8') {
|
||||||
return await fsP.readFile(filePath, encoding, { flag: 'r' })
|
return await fsP.readFile(filePath, encoding, { flag: 'r' })
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import AssetsProcessor from './lib/assets_processor.js'
|
|||||||
import path from 'path'
|
import path from 'path'
|
||||||
import { fileURLToPath } from 'url'
|
import { fileURLToPath } from 'url'
|
||||||
import init from './lib/initializer.js'
|
import init from './lib/initializer.js'
|
||||||
|
import directory from './lib/directory.js'
|
||||||
|
|
||||||
let mode = null
|
let mode = null
|
||||||
const OPERATOR_NAME = process.env.O;
|
const OPERATOR_NAME = process.env.O;
|
||||||
@@ -35,9 +36,17 @@ const EXTRACTED_FOLDER = path.join(OPERATOR_SOURCE_FOLDER, OPERATOR_NAME, 'extra
|
|||||||
const OPERATOR_SHARE_FOLDER = path.join(OPERATOR_SOURCE_FOLDER, '_share')
|
const OPERATOR_SHARE_FOLDER = path.join(OPERATOR_SOURCE_FOLDER, '_share')
|
||||||
if (mode === 'NODE') {
|
if (mode === 'NODE') {
|
||||||
|
|
||||||
if (process.argv[2] === '-i') {
|
const op = process.argv[2]
|
||||||
init(OPERATOR_NAME, __dirname, EXTRACTED_FOLDER)
|
|
||||||
process.exit(0)
|
switch (op) {
|
||||||
|
case '-i':
|
||||||
|
init(OPERATOR_NAME, __dirname, EXTRACTED_FOLDER)
|
||||||
|
process.exit(0)
|
||||||
|
case '-d':
|
||||||
|
directory(config, __dirname)
|
||||||
|
process.exit(0)
|
||||||
|
default:
|
||||||
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
rmdir(OPERATOR_RELEASE_FOLDER)
|
rmdir(OPERATOR_RELEASE_FOLDER)
|
||||||
|
|||||||
Reference in New Issue
Block a user