-
Notifications
You must be signed in to change notification settings - Fork 1
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
1 parent
072875e
commit ec71ef7
Showing
10 changed files
with
320 additions
and
247 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 |
---|---|---|
|
@@ -8,10 +8,11 @@ jobs: | |
runs-on: ubuntu-latest | ||
if: ${{ contains(github.event.head_commit.message, '[publish]') }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- run: yarn install --frozen-lockfile | ||
- run: yarn prettier-ci | ||
- run: yarn build | ||
- uses: actions/checkout@v3 | ||
- uses: xhyrom/[email protected] | ||
- run: bun i | ||
- run: bun ci | ||
- uses: ArnaudBarre/npm-publish@v1 | ||
with: | ||
working-directory: dist | ||
npm-token: ${{ secrets.NPM_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
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
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,2 @@ | ||
[install.lockfile] | ||
print = "yarn" |
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 |
---|---|---|
@@ -1,35 +1,26 @@ | ||
{ | ||
"name": "vite-plugin-fast-react-svg", | ||
"description": "Turn SVG into React components, without Babel", | ||
"version": "0.3.1", | ||
"version": "0.4.0", | ||
"license": "MIT", | ||
"author": "Arnaud Barré (https://github.com/ArnaudBarre)", | ||
"main": "dist/index.js", | ||
"files": [ | ||
"dist", | ||
"types.d.ts" | ||
], | ||
"repository": "github:ArnaudBarre/vite-plugin-fast-react-svg", | ||
"keywords": [ | ||
"vite", | ||
"vite-plugin", | ||
"react", | ||
"svg" | ||
], | ||
"scripts": { | ||
"build": "tsc", | ||
"build": "scripts/bundle.ts", | ||
"prettier": "yarn prettier-ci --write", | ||
"prettier-ci": "prettier --check '**/*.{ts,json,md,yml}'" | ||
"prettier-ci": "prettier --ignore-path=.gitignore --check '**/*.{ts,json,md,yml}'", | ||
"ci": "tsc && bun prettier-ci && bun run build" | ||
}, | ||
"prettier": { | ||
"trailingComma": "all" | ||
}, | ||
"peerDependencies": { | ||
"react": ">=16", | ||
"vite": "^2 || ^3" | ||
"vite": "^2 || ^3 || ^4" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^18.0.6", | ||
"@types/react": "^18.0.15", | ||
"prettier": "^2.7.1", | ||
"typescript": "^4.7.4", | ||
"vite": "^3.0.2" | ||
"@nabla/tnode": "^0.8.0", | ||
"@types/node": "^18.11.11", | ||
"@types/react": "^18.0.26", | ||
"prettier": "^2.8.1", | ||
"typescript": "^4.9.3", | ||
"vite": "^4.0.0-beta.4" | ||
} | ||
} |
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,47 @@ | ||
#!/usr/bin/env tnode | ||
import { rmSync, writeFileSync } from "fs"; | ||
import { execSync } from "child_process"; | ||
import { build } from "esbuild"; | ||
|
||
import * as packageJSON from "../package.json"; | ||
|
||
rmSync("dist", { force: true, recursive: true }); | ||
|
||
build({ | ||
bundle: true, | ||
entryPoints: ["src/index.ts"], | ||
outdir: "dist", | ||
platform: "node", | ||
target: "node14", | ||
legalComments: "inline", | ||
external: Object.keys(packageJSON.peerDependencies), | ||
}).then(() => { | ||
execSync("cp LICENSE README.md types.d.ts dist/"); | ||
|
||
writeFileSync( | ||
"dist/index.d.ts", | ||
`import { Plugin } from "vite"; | ||
export declare function svgPlugin(): Plugin; | ||
export declare const svgToJS: (svg: string, production: boolean) => string; | ||
`, | ||
); | ||
|
||
writeFileSync( | ||
"dist/package.json", | ||
JSON.stringify( | ||
{ | ||
name: packageJSON.name, | ||
description: "Turn SVG into React components, without Babel", | ||
version: packageJSON.version, | ||
author: "Arnaud Barré (https://github.com/ArnaudBarre)", | ||
license: packageJSON.license, | ||
repository: "github:ArnaudBarre/vite-plugin-fast-react-svg", | ||
main: "index.js", | ||
keywords: ["vite", "vite-plugin", "react", "svg"], | ||
peerDependencies: packageJSON.peerDependencies, | ||
}, | ||
null, | ||
2, | ||
), | ||
); | ||
}); |
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
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
Oops, something went wrong.