Skip to content

Commit 846695a

Browse files
committed
chore: daily development
0 parents  commit 846695a

File tree

10 files changed

+391
-0
lines changed

10 files changed

+391
-0
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Npm Publish swc-plugin-istanbul
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- ci
8+
- canyonjs
9+
10+
env:
11+
RUST_LOG: debug
12+
CARGO_INCREMENTAL: 0
13+
MACOSX_DEPLOYMENT_TARGET: "10.13"
14+
15+
jobs:
16+
build:
17+
name: Build
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v2
21+
with:
22+
submodules: true
23+
24+
- name: Setup node
25+
uses: actions/setup-node@v2
26+
with:
27+
node-version: 20
28+
29+
- run: |
30+
echo "Before: corepack version => $(corepack --version || echo 'not installed')"
31+
npm install -g corepack@latest
32+
echo "After : corepack version => $(corepack --version)"
33+
corepack enable
34+
pnpm --version
35+
pnpm i
36+
37+
- name: Install Rust Nightly
38+
uses: actions-rs/toolchain@v1
39+
with:
40+
toolchain: nightly
41+
profile: minimal
42+
override: true
43+
44+
- name: Install wasm target
45+
shell: bash
46+
run: |
47+
rustup target add wasm32-wasip1
48+
49+
- name: Login to npm
50+
run: |
51+
echo "//registry.npmjs.org/:_authToken=${{ secrets.NODE_AUTH_TOKEN }}" > ~/.npmrc
52+
53+
- name: Publish to npm
54+
run: pnpm --filter=swc-plugin-istanbul publish -f --no-git-checks --access=public
55+
env:
56+
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}

.gitignore

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/target
2+
Cargo.lock
3+
swc_plugin_istanbul.wasm
4+
.canyon_output
5+
6+
7+
# Logs
8+
*.log
9+
npm-debug.log*
10+
yarn-debug.log*
11+
yarn-error.log*
12+
pnpm-debug.log*
13+
lerna-debug.log*
14+
15+
node_modules
16+
dist
17+
dist-ssr
18+
*.local
19+
20+
# Editor directories and files
21+
.vscode/*
22+
!.vscode/extensions.json
23+
.idea
24+
.DS_Store
25+
*.suo
26+
*.ntvs*
27+
*.njsproj
28+
*.sln
29+
*.sw?
30+
31+
# IDE / Editor
32+
.idea/*
33+
!.idea/rcb-settings.xml
34+
35+
# PNPM
36+
.pnpm-store
37+
38+
39+
#pnpm-lock.yaml
40+
41+
.env
42+
43+
db/sql
44+
45+
46+
coverage
47+
48+
/schema.gql
49+
50+
target/
51+
Cargo.lock
52+
53+
.turbo
54+
pnpm-lock.yaml
55+
package-lock.json

.swcrc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"$schema": "https://swc.rs/schema.json",
3+
"jsc": {
4+
"experimental":{
5+
"plugins": [
6+
["swc-plugin-coverage-instrument", {}],
7+
["./swc_plugin_istanbul.wasm",{
8+
"dsn":"http://localhost:3000",
9+
"reporter":"1",
10+
"instrumentCwd":"./src",
11+
"branch":"dev",
12+
"sha":"xxx",
13+
"projectID":"xxx",
14+
"compareTarget":"xxx",
15+
}]
16+
]
17+
}
18+
}
19+
}

Cargo.toml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
[package]
2+
3+
description = "Canyon plugin for debugging."
4+
5+
6+
authors = ["Travis Zhang <wr.zhang25@gmail.com>"]
7+
edition = "2021"
8+
homepage = "https://github.com/canyon-project/canyon"
9+
license = "MIT"
10+
name = "swc_plugin_istanbul"
11+
publish = false
12+
repository = "https://github.com/canyon-project/canyon.git"
13+
rust-version = "1.70"
14+
version = "0.18.6"
15+
16+
17+
[lib]
18+
crate-type = ["cdylib", "rlib"]
19+
20+
[dependencies]
21+
swc_core = { version = "0.96.2", features = ["ecma_plugin_transform"] }
22+
serde_json = "1.0.132"
23+
serde = { version = "1.0.210", features = ["derive"] }
24+
rand = "0.8.5"
25+
26+
# .cargo/config defines few alias to build plugin.
27+
# cargo build-wasi generates wasm-wasi32 binary
28+
# cargo build-wasm32 generates wasm32-unknown-unknown binary.

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
版本定义
2+
3+
- next.js 14.2.4
4+
- swc/core 1.4.0
5+
- swc-plugin-coverage-instrument 0.0.24
6+
- swc-plugin-istanbul 0.0.24-beta.0

features/add.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
function add (a,b) {
2+
if (a>b){
3+
return a-b
4+
}
5+
return a+b
6+
}
7+
8+
add(1, 2);

features/jian.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
function add (a,b) {
2+
if (a>b){
3+
return a-b
4+
}
5+
return a+b
6+
}
7+
8+
add(1, 2);

git.mjs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { exec } from 'child_process';
2+
exec('git add . && git commit -m "chore: daily development" && git push', (err, stdout, stderr) => {
3+
if (err) {
4+
console.error(err);
5+
return;
6+
}
7+
console.log(stdout);
8+
console.log(stderr);
9+
});

package.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "swc-plugin-istanbul",
3+
"version": "0.0.1-beta.0",
4+
"description": "A SWC plugin cooperates with istanbul to report the coverage",
5+
"main": "swc_plugin_istanbul.wasm",
6+
"scripts": {
7+
"test": "npm run prepack && swc features -d dist",
8+
"prepack": "cargo build --release -p swc_plugin_istanbul --target wasm32-wasip1 && cp ./target/wasm32-wasip1/release/swc_plugin_istanbul.wasm ."
9+
},
10+
"files": [
11+
"swc_plugin_istanbul.wasm"
12+
],
13+
"devDependencies": {
14+
"@swc/cli": "*",
15+
"@swc/core": "1.4.0",
16+
"swc-plugin-coverage-instrument": "0.0.24"
17+
}
18+
}

0 commit comments

Comments
 (0)