Skip to content

Commit

Permalink
Merge branch 'refactor/node' into refactor/watch-node-logic
Browse files Browse the repository at this point in the history
  • Loading branch information
fu050409 authored Jul 29, 2024
2 parents 3181c68 + 7f837d1 commit 3e0e49c
Show file tree
Hide file tree
Showing 133 changed files with 5,064 additions and 1,292 deletions.
5 changes: 5 additions & 0 deletions .changeset/thick-pandas-listen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@farmfe/core": patch
---

import.meta.url and require compatible esm and cjs
5 changes: 5 additions & 0 deletions .changeset/weak-tables-grin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@farmfe/core": patch
---

chore: Improve binary performance
45 changes: 45 additions & 0 deletions .github/workflows/codspeed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: codspeed-benchmarks

on:
push:
branches:
- "main"
pull_request:
# `workflow_dispatch` allows CodSpeed to trigger backtest
# performance analysis in order to generate initial data.
workflow_dispatch:

jobs:
call-rust-build:
uses: ./.github/workflows/rust-build.yaml

benchmarks:
needs: [call-rust-build]
runs-on: ${{ matrix.settings.os }}
strategy:
fail-fast: false
matrix:
settings:
- os: ubuntu-latest
abi: linux-x64-gnu
steps:
- uses: "actions/checkout@v3"
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Install Dependencies
run: npm install -g [email protected] && pnpm i --frozen-lockfile
- name: Build CLI and Core
run: pnpm --filter @farmfe/cli run build
- uses: actions/download-artifact@v3
id: download
with:
name: ${{ github.sha }}-${{ matrix.settings.abi }}
path: ./packages/core/binding
- name: Build Core CJS
run: cd packages/core && pnpm run build:cjs
- name: Run benchmarks
uses: CodSpeedHQ/action@v3
with:
run: npm exec vitest bench
token: ${{ secrets.CODSPEED_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/rust-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Run cargo test
run: cargo test --release --tests
run: cargo test --profile ci-test --tests
138 changes: 127 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 21 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
[workspace]
members = [
"crates/*",
"packages/create-farm",
"rust-plugins/*",
]
members = ["crates/*", "packages/create-farm", "rust-plugins/*"]
resolver = "2"

[workspace.package]
edition = "2021"
homepage = "https://farmfe.org"
license = "MIT"
repository = "https://github.com/farm-fe/farm"

[profile.release]
codegen-units = 1
lto = "fat"
opt-level = 3
strip = true
panic = "abort"

[profile.ci-test]
inherits = "release"
opt-level = 0
debug = 2
lto = false
codegen-units = 16
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ See [Contributing Guide](https://github.com/farm-fe/farm/blob/main/CONTRIBUTING.

- Wechat group

<br><img src="https://github.com/ErKeLost/react/assets/66500121/3bb8046c-5b79-4f36-98b7-970c118de490" width="30%" />
<br><img src="https://github.com/user-attachments/assets/7acfbc12-9666-4559-964e-8124d8eab85b" width="30%" />

- QQ group

Expand Down
2 changes: 1 addition & 1 deletion README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ Farm 远快于业界常用的 JS 构建工具,在 benchmark 测试中,Farm

- 微信交流群

<br><img src="https://github.com/ErKeLost/react/assets/66500121/3bb8046c-5b79-4f36-98b7-970c118de490" width="30%" />
<br><img src="https://github.com/user-attachments/assets/7acfbc12-9666-4559-964e-8124d8eab85b" width="30%" />

- QQ 群

Expand Down
25 changes: 25 additions & 0 deletions bench/benches/example.bench.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import path from 'node:path';
import { bench, describe } from 'vitest';
import { build } from '@farmfe/core';

async function build_react_example() {
await build({
root: path.resolve(process.cwd(), './examples/react'),
configPath: path.resolve('./examples/react'),
compilation: { input: {}, output: {} }
});
}

describe('react_example_bench', () => {
let hasRun = false;
bench(
'build_react_example',
async () => {
if (!hasRun) {
await build_react_example();
hasRun = true;
}
},
{ warmupIterations: 0 }
);
});
Loading

0 comments on commit 3e0e49c

Please sign in to comment.