refactor(runner): rename preprocessing to runner and update directory structure

This commit is contained in:
Haoyu Xu
2023-01-17 10:08:22 -05:00
parent 09ca22d7c7
commit 4fa886be90
16 changed files with 34 additions and 30 deletions

14
.env
View File

@@ -1,11 +1,11 @@
VITE_TITLE="Arknights: Chongyue - 明日方舟:重岳"
VITE_FILENAME=dyn_illust_char_2024_chyue
VITE_LOGO_FILENAME=logo_sui
VITE_FALLBACK_FILENAME=char_2024_chyue_2
VITE_TITLE="Arknights: Ch'en/Chen the Holungday - 明日方舟:假日威龙陈"
VITE_FILENAME=dyn_illust_char_1013_chen2
VITE_LOGO_FILENAME=logo_rhodes_override
VITE_FALLBACK_FILENAME=char_1013_chen2_2
VITE_VIEWPORT_LEFT=0
VITE_VIEWPORT_RIGHT=0
VITE_VIEWPORT_TOP=0
VITE_VIEWPORT_BOTTOM=0
VITE_INVERT_FILTER=true
VITE_VIEWPORT_TOP=1
VITE_VIEWPORT_BOTTOM=1
VITE_INVERT_FILTER=false
VITE_IMAGE_WIDTH=2048
VITE_IMAGE_HEIGHT=2048

View File

@@ -11,19 +11,19 @@ A project that builds showcase webpage for Arknights Live2D-equipped operators.
### Command Line Tool
``` bash
$ O={operator_name} node preprocessing.js
$ O={operator_name} node runner.js
To generate operator assets for showcase page
```
``` bash
$ node preprocessing.js -a
$ node runner.js -a
To generate all operator assets for showcase page
```
``` bash
$ O={operator_name} node preprocessing.js -i
$ O={operator_name} node runner.js -i
To initialize folder and config file for an operator
```
``` bash
$ node preprocessing.js -d
$ node runner.js -d
To generate directory.json
```
``` bash

View File

@@ -1,8 +0,0 @@
import { execSync } from 'child_process'
export default function (config) {
for (const [key, _] of Object.entries(config.operators)) {
if (key.startsWith('_')) break;
console.log(execSync(`O=${key} node preprocessing.js && O=${key} pnpm run build`).toString());
}
}

12
libs/exec.js Normal file
View File

@@ -0,0 +1,12 @@
import { execSync } from 'child_process'
export function buildAll(config) {
for (const [key, _] of Object.entries(config.operators)) {
if (key.startsWith('_')) break;
console.log(execSync(`O=${key} node runner.js && O=${key} pnpm run build`).toString());
}
}
export function runDev(config) {
}

View File

@@ -1,22 +1,22 @@
import assert from 'assert'
import getConfig from './lib/config.js'
import ProjectJson from './lib/project_json.js'
import EnvGenerator from './lib/env_generator.js'
import { write, rmdir, copy } from './lib/file.js'
import AssetsProcessor from './lib/assets_processor.js'
import getConfig from './libs/config.js'
import ProjectJson from './libs/project_json.js'
import EnvGenerator from './libs/env_generator.js'
import { write, rmdir, copy } from './libs/file.js'
import AssetsProcessor from './libs/assets_processor.js'
import path from 'path'
import { fileURLToPath } from 'url'
import init from './lib/initializer.js'
import directory from './lib/directory.js'
import exec from './lib/exec.js'
import init from './libs/initializer.js'
import directory from './libs/directory.js'
import { buildAll } from './libs/exec.js'
let __dirname
__dirname = __dirname || path.dirname(fileURLToPath(import.meta.url))
const config = getConfig(__dirname)
let mode = null
const OPERATOR_NAME = process.env.O;
const op = process.argv[2]
const OPERATOR_NAME = process.env.O || process.argv[3];
if (process.argv[1].endsWith('vite.js')) {
mode = "VITE"
@@ -26,7 +26,7 @@ if (process.argv[1].endsWith('vite.js')) {
switch (op) {
case '-a':
exec(config)
buildAll(config)
process.exit(0)
case '-d':
directory(config, __dirname)

View File

@@ -1,6 +1,6 @@
import { defineConfig } from 'vite'
import path from 'path'
import data from './preprocessing'
import data from './runner'
// https://vitejs.dev/config/
export default defineConfig({