Skip to content

Commit

Permalink
chore(ci): use biome in codesandbox ci
Browse files Browse the repository at this point in the history
  • Loading branch information
Sec-ant authored Feb 25, 2024
1 parent f57a9d8 commit 3637f5a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .codesandbox/ci.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"buildCommand": "build:ci",
"installCommand": "install:ci",
"node": "18"
}
8 changes: 2 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
"private": false,
"version": "0.4.14",
"type": "module",
"files": [
"./dist"
],
"files": ["./dist"],
"main": "./dist/index.js",
"module": "./dist/index.js",
"exports": {
Expand Down Expand Up @@ -58,6 +56,7 @@
"access": "public"
},
"scripts": {
"install:ci": "npm ci && ./scripts/pre-ci.sh",
"update-hooks": "simple-git-hooks",
"changeset": "changeset",
"bump": "changeset version 2>/dev/null | grep . && npm i; exit 0",
Expand All @@ -75,9 +74,6 @@
"nocheck-chevrotain-types": "tsx ./scripts/nocheck-chevrotain-types.ts",
"copy": "copy-files-from-to",
"postbuild": "tsc --project ./tsconfig.production.json && conc \"npm:add-glob-import-types\" \"npm:nocheck-chevrotain-types\" \"npm:copy\"",
"prebuild:ci": "npm run type-check",
"build:ci": "vite build",
"postbuild:ci": "npm run postbuild",
"test": "vitest",
"test:ui": "vitest --ui",
"preview": "vite preview",
Expand Down
13 changes: 13 additions & 0 deletions scripts/pre-ci.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash

curl -L https://github.com/jqlang/jq/releases/latest/download/jq-linux-amd64 -o jq
chmod a+x jq

BIOME_VERSION=$(npm -j ls | ./jq -r '.dependencies["@biomejs/biome"].version')
npm i -DE biome-cli-codesandbox@$BIOME_VERSION

npm pkg set scripts.lint="BIOME_BINARY=biome-cli-codesandbox/biome $(npm pkg get scripts.lint | ./jq -r)"
npm pkg set scripts['format:biome']="BIOME_BINARY=biome-cli-codesandbox/biome $(npm pkg get scripts['format:biome'] | ./jq -r)"
npm pkg set scripts['check:biome']="BIOME_BINARY=biome-cli-codesandbox/biome $(npm pkg get scripts['check:biome'] | ./jq -r)"

rm jq

0 comments on commit 3637f5a

Please sign in to comment.