-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Allen Zhang (张涛)
committed
Nov 1, 2024
1 parent
9666041
commit 886ad9f
Showing
9 changed files
with
237 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
[alias] | ||
xtask = "run --package xtask --" | ||
|
||
|
||
[build] | ||
|
||
rustdocflags = [] | ||
|
||
[target.x86_64-unknown-linux-gnu] | ||
rustflags = ["-C", "target-feature=+sse2"] | ||
|
||
[target.x86_64-unknown-linux-musl] | ||
rustflags = ["-C", "target-feature=+sse2"] | ||
|
||
[target.x86_64-apple-darwin] | ||
rustflags = ["-C", "target-feature=+sse2"] | ||
|
||
[target.x86_64-pc-windows-msvc] | ||
rustflags = ["-C", "target-feature=+sse2"] | ||
|
||
[target.aarch64-unknown-linux-gnu] | ||
linker = "aarch64-linux-gnu-gcc" | ||
|
||
[target.aarch64-unknown-linux-musl] | ||
linker = "aarch64-linux-gnu-gcc" | ||
rustflags = ["-C", "target-feature=-crt-static", "-C", "link-arg=-lgcc"] | ||
|
||
[target.armv7-unknown-linux-gnueabihf] | ||
linker = "arm-linux-gnueabihf-gcc" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json", | ||
"changelog": "@changesets/cli/changelog", | ||
"commit": true, | ||
"fixed": [], | ||
"linked": [], | ||
"access": "restricted", | ||
"baseBranch": "main", | ||
"updateInternalDependencies": "patch", | ||
"ignore": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Publish babel-plugin-canyon | ||
|
||
on: | ||
push: | ||
branches: [ "analytics" ] | ||
|
||
jobs: | ||
publish-npm: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: pnpm/action-setup@v4 | ||
with: | ||
version: 9 | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: 20 | ||
registry-url: https://registry.npmjs.org/ | ||
- run: pnpm install | ||
- run: pnpm --filter=babel-plugin-canyon publish -f --no-git-checks --access=public --filter | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}} | ||
- run: | | ||
pnpm dist-tag add [email protected] latest | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Publish canyon-core | ||
|
||
on: | ||
push: | ||
branches: [ "analytics" ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
override: true | ||
|
||
- name: Install wasm-pack | ||
run: | | ||
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh | ||
- name: Build Wasm package | ||
working-directory: packages/canyon-core | ||
run: | | ||
wasm-pack build --target bundler | ||
- name: Publish to npm | ||
working-directory: packages/canyon-core/pkg | ||
env: | ||
NPM_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} | ||
NODE_AUTH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}} | ||
run: | | ||
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc | ||
npm publish |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
[workspace] | ||
members = [ | ||
"packages/canyon-core" | ||
] | ||
|
||
|
||
resolver = "2" | ||
|
||
|
||
[workspace.package] | ||
authors = ["Allen Zhang <[email protected]>"] | ||
edition = "2021" | ||
homepage = "https://github.com/canyon-project/canyon" | ||
license = "MIT" | ||
repository = "https://github.com/canyon-project/canyon.git" | ||
rust-version = "1.70" | ||
|
||
[workspace.dependencies] | ||
Inflector = "0.11.4" | ||
anyhow = "1.0.83" | ||
base64 = "0.22" | ||
byteorder = "1" | ||
cargo_metadata = "0.18.1" | ||
cipher = "0.4.4" | ||
clap = "4.5.4" | ||
convert_case = "0.6.0" | ||
default-from-serde = "0.1" | ||
fxhash = "0.2.1" | ||
handlebars = "5.1.2" | ||
hex = "0.4.3" | ||
lightningcss = "1.0.0-alpha.59" | ||
magic-crypt = "3.1.13" | ||
once_cell = "1.19.0" | ||
parcel_selectors = "0.27.0" | ||
phf = "0.11.2" | ||
preset_env_base = "1.0.0" | ||
radix_fmt = "1" | ||
regex = { version = "1.10.4", default-features = false } | ||
serde = "1.0.203" | ||
serde_json = "1.0.117" | ||
sourcemap = "9.0.0" | ||
swc_atoms = "2.0.0" | ||
swc_cached = "1.0.0" | ||
swc_common = "1.0.0" | ||
swc_core = "0.102.0" | ||
swc_css_ast = "1.0.0" | ||
swc_css_codegen = "1.0.0" | ||
swc_css_compat = "1.0.0" | ||
swc_css_minifier = "1.0.0" | ||
swc_css_parser = "1.0.0" | ||
swc_css_prefixer = "1.0.0" | ||
swc_css_visit = "1.0.0" | ||
swc_ecma_ast = "1.0.0" | ||
swc_ecma_codegen = "1.0.0" | ||
swc_ecma_minifier = "1.0.0" | ||
swc_ecma_parser = "1.0.0" | ||
swc_ecma_transforms = "1.0.0" | ||
swc_ecma_transforms_base = "1.0.0" | ||
swc_ecma_transforms_react = "1.0.0" | ||
swc_ecma_transforms_testing = "1.0.0" | ||
swc_ecma_utils = "1.0.0" | ||
swc_ecma_visit = "1.0.0" | ||
swc_plugin_macro = "1.0.0" | ||
swc_plugin_proxy = "1.0.0" | ||
swc_trace_macro = "2.0.0" | ||
testing = "1.0.0" | ||
tracing = "0.1.40" | ||
|
||
|
||
[profile.release] | ||
codegen-units = 1 | ||
# debug = true | ||
lto = true | ||
|
||
# Optimize for size | ||
opt-level = "s" | ||
|
||
# Strip debug symbols | ||
strip = "symbols" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[package] | ||
name = "canyon-core" | ||
version = "0.1.1-beta.2" | ||
authors.workspace = true | ||
edition.workspace = true | ||
homepage.workspace = true | ||
license.workspace = true | ||
repository.workspace = true | ||
rust-version.workspace = true | ||
|
||
[lib] | ||
crate-type = ["cdylib", "rlib"] | ||
|
||
|
||
[dependencies] | ||
wasm-bindgen='0.2.95' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
use wasm_bindgen::prelude::*; | ||
|
||
#[wasm_bindgen] | ||
pub fn percent(covered: f64, total: f64) -> f64 { | ||
if total > 0.0 { | ||
let tmp = (1000.0 * 100.0 * covered) / total; | ||
(tmp / 10.0).floor() / 100.0 | ||
} else { | ||
100.0 | ||
} | ||
} | ||
|
||
// 测试 | ||
#[cfg(test)] | ||
mod tests { | ||
use super::*; | ||
|
||
#[test] | ||
fn test_percent() { | ||
assert_eq!(percent(0.0, 0.0), 100.0); | ||
assert_eq!(percent(0.0, 1.0), 0.0); | ||
assert_eq!(percent(1.0, 1.0), 100.0); | ||
assert_eq!(percent(1.0, 2.0), 50.0); | ||
assert_eq!(percent(2.0, 1.0), 200.0); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// 用node执行 git add . && git commit -m "update" && git push | ||
|
||
// const { exec } = require('child_process'); | ||
import { exec } from 'child_process'; | ||
exec('git add . && git commit -m "chore: repo overall update" && git push', (err, stdout, stderr) => { | ||
if (err) { | ||
console.error(err); | ||
return; | ||
} | ||
console.log(stdout); | ||
console.log(stderr); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
nightly-2024-04-16 |