mirror of
https://github.com/chrononeko/chronocat.git
synced 2024-11-22 07:07:53 +00:00
ci: pack llqqnt engines
This commit is contained in:
parent
a0513be6c5
commit
6614d8270f
24
.github/workflows/build.yml
vendored
24
.github/workflows/build.yml
vendored
@ -36,17 +36,29 @@ jobs:
|
|||||||
name: chronocat-llqqnt-${{ github.sha }}
|
name: chronocat-llqqnt-${{ github.sha }}
|
||||||
path: build/dist/llqqnt
|
path: build/dist/llqqnt
|
||||||
|
|
||||||
- name: Upload engine-chronocat-api
|
- name: Upload engine-chronocat-api LiteLoaderQQNT Plugin
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: engine-chronocat-api-${{ github.sha }}
|
name: chronocat-llqqnt-engine-chronocat-api-${{ github.sha }}
|
||||||
path: build/dist/engine-chronocat-api
|
path: build/dist/llqqnt-plugin-chronocat-engine-chronocat-api
|
||||||
|
|
||||||
- name: Upload engine-chronocat-event
|
- name: Upload engine-chronocat-event LiteLoaderQQNT Plugin
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: engine-chronocat-event-${{ github.sha }}
|
name: chronocat-llqqnt-engine-chronocat-event-${{ github.sha }}
|
||||||
path: build/dist/engine-chronocat-event
|
path: build/dist/llqqnt-plugin-chronocat-engine-chronocat-event
|
||||||
|
|
||||||
|
# - name: Upload engine-chronocat-api
|
||||||
|
# uses: actions/upload-artifact@v3
|
||||||
|
# with:
|
||||||
|
# name: engine-chronocat-api-${{ github.sha }}
|
||||||
|
# path: build/dist/engine-chronocat-api
|
||||||
|
|
||||||
|
# - name: Upload engine-chronocat-event
|
||||||
|
# uses: actions/upload-artifact@v3
|
||||||
|
# with:
|
||||||
|
# name: engine-chronocat-event-${{ github.sha }}
|
||||||
|
# path: build/dist/engine-chronocat-event
|
||||||
|
|
||||||
- name: Upload IIFE
|
- name: Upload IIFE
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
|
@ -14,8 +14,9 @@
|
|||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"clean": "node -r esbuild-register scripts/clean.cts",
|
"clean": "node -r esbuild-register scripts/clean.cts",
|
||||||
"build": "concurrently -n red \"yarn workspace @chronocat/red build\" && concurrently -n shell \"yarn workspace @chronocat/shell build\" && concurrently -n api,event \"yarn workspace @chronocat/engine-chronocat-api build\" \"yarn workspace @chronocat/engine-chronocat-event build\" && concurrently -n llqqnt,iife \"yarn workspace @chronocat/plugin-llqqnt build\" \"yarn workspace @chronocat/plugin-iife build\" && concurrently -n packengine yarn:packengine",
|
"build": "concurrently -n red \"yarn workspace @chronocat/red build\" && concurrently -n shell \"yarn workspace @chronocat/shell build\" && concurrently -n api,event \"yarn workspace @chronocat/engine-chronocat-api build\" \"yarn workspace @chronocat/engine-chronocat-event build\" && concurrently -n llqqnt,iife \"yarn workspace @chronocat/plugin-llqqnt build\" \"yarn workspace @chronocat/plugin-iife build\" && concurrently -n packengine,packllqqntengine yarn:packengine yarn:packllqqntengine",
|
||||||
"packengine": "node -r esbuild-register scripts/packengine.cts",
|
"packengine": "node -r esbuild-register scripts/packengine.cts",
|
||||||
|
"packllqqntengine": "node -r esbuild-register scripts/packllqqntengine.cts",
|
||||||
"lint": "eslint --ignore-path .gitignore --ignore-pattern '**/*.d.ts' .",
|
"lint": "eslint --ignore-path .gitignore --ignore-pattern '**/*.d.ts' .",
|
||||||
"lint:fix": "yarn lint --fix",
|
"lint:fix": "yarn lint --fix",
|
||||||
"test": "jest"
|
"test": "jest"
|
||||||
|
69
scripts/packllqqntengine.cts
Normal file
69
scripts/packllqqntengine.cts
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
import { cp, mkdir, writeFile } from 'node:fs/promises'
|
||||||
|
import { join, resolve } from 'node:path'
|
||||||
|
|
||||||
|
void Promise.all(
|
||||||
|
['engine-chronocat-api', 'engine-chronocat-event'].map(async (x) => {
|
||||||
|
const upper = `${x[0]!.toUpperCase()}${x.slice(1, 7)}${x[7]!.toUpperCase()}${x.slice(8, 17)}${x[17]!.toUpperCase()}${x.slice(18)}`
|
||||||
|
const distName = `LiteLoaderQQNT-Plugin-Chronocat-${upper}`
|
||||||
|
|
||||||
|
const corePath = resolve(__dirname, `../packages/${x}/lib/index.js`)
|
||||||
|
const coreName = `${x.slice(7)}.engine.js`
|
||||||
|
|
||||||
|
const distPath = resolve(
|
||||||
|
__dirname,
|
||||||
|
`../build/dist/llqqnt-plugin-chronocat-${x}/${distName}`,
|
||||||
|
)
|
||||||
|
|
||||||
|
const srcPath = join(distPath, 'src')
|
||||||
|
|
||||||
|
await mkdir(srcPath, {
|
||||||
|
recursive: true,
|
||||||
|
})
|
||||||
|
|
||||||
|
await writeFile(
|
||||||
|
join(srcPath, 'main.js'),
|
||||||
|
`setTimeout(()=>{process.version='__chronocat__';process.version.load(require('./${coreName}'))},0)`,
|
||||||
|
)
|
||||||
|
|
||||||
|
await cp(corePath, join(srcPath, coreName))
|
||||||
|
|
||||||
|
const { version, description } =
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||||
|
require(`../packages/${x}/package.json`) as {
|
||||||
|
version: string
|
||||||
|
description: string
|
||||||
|
}
|
||||||
|
|
||||||
|
const manifest = {
|
||||||
|
manifest_version: 4,
|
||||||
|
type: 'extension',
|
||||||
|
name: `Chronocat Engine: ${x[7]!.toUpperCase()}${x.slice(8, 17)}${x[17]!.toUpperCase()}${x.slice(18)}`,
|
||||||
|
slug: `chronocat-${x}`,
|
||||||
|
description,
|
||||||
|
version,
|
||||||
|
thumbnail: './chronocat.png',
|
||||||
|
authors: [
|
||||||
|
{
|
||||||
|
name: 'Team Chrononeko',
|
||||||
|
link: 'https://github.com/chrononeko',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
repository: {
|
||||||
|
repo: `chrononeko/${distName}`,
|
||||||
|
branch: 'master',
|
||||||
|
},
|
||||||
|
platform: ['win32', 'linux', 'darwin'],
|
||||||
|
dependencies: [],
|
||||||
|
injects: {
|
||||||
|
main: './src/main.js',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
await writeFile(join(distPath, 'manifest.json'), JSON.stringify(manifest))
|
||||||
|
|
||||||
|
await cp(
|
||||||
|
resolve(__dirname, '../packages/docs/static/chronocat.png'),
|
||||||
|
join(distPath, 'chronocat.png'),
|
||||||
|
)
|
||||||
|
}),
|
||||||
|
)
|
Loading…
Reference in New Issue
Block a user