Commit 6ed7c91d authored by timel's avatar timel

chore: build steps 50%

parent a9842169
...@@ -19,23 +19,23 @@ ...@@ -19,23 +19,23 @@
"settings": { "settings": {
"import/resolver": { "import/resolver": {
"node": true, "node": true,
"typescript": true, "typescript": true
"alias": { // "alias": {
"map": [ // "map": [
[ // [
"rust-src", // "rust-src",
"/rust-src/pkg" // "/rust-src/pkg"
] // ]
], // ],
"extensions": [ // "extensions": [
".js", // ".js",
".jsx", // ".jsx",
".ts", // ".ts",
".tsx", // ".tsx",
".json", // ".json",
".wasm" // ".wasm"
] // ]
} // }
} }
} }
} }
stages: stages:
- install - install
- check - rs_check_lint
- lint
- test
- wasm - wasm
- ts_check_lint
- test
- build - build
- deploy - deploy
...@@ -22,31 +22,15 @@ npm_ci: ...@@ -22,31 +22,15 @@ npm_ci:
dependencies: dependencies:
- npm_ci - npm_ci
ts_check:
dependencies:
- npm_ci
stage: check
tags:
- linux
script:
- npx tsc
rs_check: rs_check:
stage: check stage: rs_check_lint
image: rust:latest image: rust:latest
tags: tags:
- linux - linux
script: cd rust-src && cargo check script: cd rust-src && cargo check
ts_lint:
extends: .build_base
stage: lint
tags:
- linux
script: npm run lint
rs_lint: rs_lint:
stage: lint stage: rs_check_lint
image: rust:latest image: rust:latest
tags: tags:
- linux - linux
...@@ -70,6 +54,25 @@ wasm_build: ...@@ -70,6 +54,25 @@ wasm_build:
- rust-src/pkg - rust-src/pkg
- node_modules - node_modules
ts_check:
dependencies:
- npm_ci
- wasm_build
stage: ts_check_lint
tags:
- linux
script:
- npx tsc
ts_lint:
dependencies:
- wasm_build
extends: .build_base
stage: ts_check_lint
tags:
- linux
script: npm run lint
npm_build: npm_build:
dependencies: dependencies:
- wasm_build - wasm_build
......
...@@ -23,3 +23,10 @@ wasm-bindgen-test = "0.3.13" ...@@ -23,3 +23,10 @@ wasm-bindgen-test = "0.3.13"
[profile.release] [profile.release]
opt-level = "s" opt-level = "s"
[source.crates-io]
registry = "https://github.com/rust-lang/crates.io-index"
replace-with = 'ustc'
[source.ustc]
registry = "git://mirrors.ustc.edu.cn/crates.io-index"
...@@ -14,25 +14,25 @@ interface ImportMeta { ...@@ -14,25 +14,25 @@ interface ImportMeta {
/** /**
* 手动声明WASM模块rust-src * 手动声明WASM模块rust-src
*/ */
declare module "rust-src" { // declare module "rust-src" {
export default function rustInit(url?: URL): Promise<void>; // export default function rustInit(url?: URL): Promise<void>;
export class BufferWriter { // export class BufferWriter {
constructor(); // constructor();
public writeInt8(value: number): void; // public writeInt8(value: number): void;
public writeUint8(value: number): void; // public writeUint8(value: number): void;
public writeInt16(value: number): void; // public writeInt16(value: number): void;
public writeUint16(value: number): void; // public writeUint16(value: number): void;
public writeInt32(value: number): void; // public writeInt32(value: number): void;
public writeUint32(value: number): void; // public writeUint32(value: number): void;
public toArray(): Uint8Array; // public toArray(): Uint8Array;
} // }
export class BufferReader { // export class BufferReader {
constructor(buffer: Uint8Array); // constructor(buffer: Uint8Array);
public readInt8(): number; // public readInt8(): number;
public readUint8(): number; // public readUint8(): number;
public readInt16(): number; // public readInt16(): number;
public readUint16(): number; // public readUint16(): number;
public readInt32(): number; // public readInt32(): number;
public readUint32(): number; // public readUint32(): number;
} // }
} // }
...@@ -26,9 +26,13 @@ ...@@ -26,9 +26,13 @@
"@/*": [ "@/*": [
"./src/*" "./src/*"
], ],
"rust-src": [
"./rust-src/pkg"
]
} }
}, },
"include": [ "include": [
"src", "src",
"rust-src/pkg"
] ]
} }
...@@ -13,7 +13,7 @@ export default defineConfig({ ...@@ -13,7 +13,7 @@ export default defineConfig({
plugins: [ plugins: [
react(), react(),
svgr(), svgr(),
wasmPack("./rust-src"), // wasmPack("./rust-src"),
ydkLoader(), ydkLoader(),
tsconfigPaths(), tsconfigPaths(),
], ],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment