chore(core): 搭建 yggdrasil-core 子工程骨架
照搬 lightbox 的 Vite IIFE 工程结构,作为核心 JS 统一归处。 此 commit 仅打通构建管线,业务逻辑后续 task 填入。 同时把 public/yggdrasil-core 加入根 .gitignore。
This commit is contained in:
parent
731547e6df
commit
afabdf4655
1
.gitignore
vendored
1
.gitignore
vendored
@ -10,6 +10,7 @@ public/style.css
|
|||||||
public/highlight.css
|
public/highlight.css
|
||||||
public/tiptap
|
public/tiptap
|
||||||
public/lightbox
|
public/lightbox
|
||||||
|
public/yggdrasil-core
|
||||||
public/doc
|
public/doc
|
||||||
/static
|
/static
|
||||||
.env
|
.env
|
||||||
|
|||||||
1
libs/yggdrasil-core/.gitignore
vendored
Normal file
1
libs/yggdrasil-core/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
node_modules
|
||||||
1422
libs/yggdrasil-core/package-lock.json
generated
Normal file
1422
libs/yggdrasil-core/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
19
libs/yggdrasil-core/package.json
Normal file
19
libs/yggdrasil-core/package.json
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"name": "@yggdrasil/core",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"private": true,
|
||||||
|
"type": "module",
|
||||||
|
"scripts": {
|
||||||
|
"build": "tsc --noEmit && vite build",
|
||||||
|
"dev": "vite",
|
||||||
|
"typecheck": "tsc --noEmit",
|
||||||
|
"test": "vitest run",
|
||||||
|
"test:watch": "vitest"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"happy-dom": "^20.10.6",
|
||||||
|
"typescript": "^6.0.3",
|
||||||
|
"vite": "^8.1.0",
|
||||||
|
"vitest": "^4.1.9"
|
||||||
|
}
|
||||||
|
}
|
||||||
11
libs/yggdrasil-core/src/index.ts
Normal file
11
libs/yggdrasil-core/src/index.ts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
declare global {
|
||||||
|
interface Window {
|
||||||
|
__initPostContent: (selector: string) => void;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
window.__initPostContent = (_selector: string): void => {
|
||||||
|
// Task 2 实现
|
||||||
|
};
|
||||||
|
|
||||||
|
export {};
|
||||||
1
libs/yggdrasil-core/src/vite-env.d.ts
vendored
Normal file
1
libs/yggdrasil-core/src/vite-env.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/// <reference types="vite/client" />
|
||||||
19
libs/yggdrasil-core/tsconfig.json
Normal file
19
libs/yggdrasil-core/tsconfig.json
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "ES2020",
|
||||||
|
"module": "ESNext",
|
||||||
|
"moduleResolution": "bundler",
|
||||||
|
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
||||||
|
"strict": true,
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"noUnusedParameters": true,
|
||||||
|
"noImplicitReturns": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"isolatedModules": true,
|
||||||
|
"verbatimModuleSyntax": true,
|
||||||
|
"noEmit": true,
|
||||||
|
"types": []
|
||||||
|
},
|
||||||
|
"include": ["src"]
|
||||||
|
}
|
||||||
23
libs/yggdrasil-core/vite.config.ts
Normal file
23
libs/yggdrasil-core/vite.config.ts
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
import { defineConfig } from 'vite';
|
||||||
|
import { resolve } from 'path';
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
build: {
|
||||||
|
outDir: resolve(__dirname, '../../public/yggdrasil-core'),
|
||||||
|
emptyOutDir: true,
|
||||||
|
lib: {
|
||||||
|
entry: resolve(__dirname, 'src/index.ts'),
|
||||||
|
name: 'YggdrasilCore',
|
||||||
|
fileName: () => 'yggdrasil-core.js',
|
||||||
|
formats: ['iife'],
|
||||||
|
},
|
||||||
|
rolldownOptions: {
|
||||||
|
output: {
|
||||||
|
assetFileNames: 'yggdrasil-core.[ext]',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
cssCodeSplit: false,
|
||||||
|
minify: true,
|
||||||
|
sourcemap: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
8
libs/yggdrasil-core/vitest.config.ts
Normal file
8
libs/yggdrasil-core/vitest.config.ts
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import { defineConfig } from 'vitest/config';
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
test: {
|
||||||
|
environment: 'happy-dom',
|
||||||
|
include: ['src/**/*.test.ts'],
|
||||||
|
},
|
||||||
|
});
|
||||||
Loading…
x
Reference in New Issue
Block a user