Skip to content

Commit

Permalink
add scirpts
Browse files Browse the repository at this point in the history
  • Loading branch information
Bowen7 committed Apr 6, 2023
1 parent 212978e commit 91e2020
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 18 deletions.
5 changes: 2 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
module.exports = {
root: true,
// This tells ESLint to load the config from the package `eslint-config-custom`
extends: ["custom"],
extends: ['next/babel', 'custom'],
settings: {
next: {
rootDir: ["apps/*/"],
rootDir: ['apps/*/'],
},
},
};
2 changes: 1 addition & 1 deletion .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
with:
version: 7.29.1
run_install: true
- run: cd packages/react-rough-fiber && pnpm build
- run: cd packages/react-rough-fiber && pnpm release
- name: Publish
run: |
if git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+$";
Expand Down
23 changes: 12 additions & 11 deletions apps/docs/components/test/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,19 @@ export const Test = () => {
});
};
return (
<RoughCanvas>
<svg viewbox="0 0 64 64" width={64} height={64}>
<rect
x={10}
y={10}
width={100}
height={100}
stroke="#000"
fill="#82ca9d"
/>
<RoughSVG>
<button onClick={onClick}>change</button>
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="red"
stroke="green"
>
<rect {...rectProps} data-testid="rect"></rect>
</svg>
</RoughCanvas>
</RoughSVG>
);
// useEffect(() => {
// imageToSVG('/app.png', (str: string) => {
Expand Down
3 changes: 2 additions & 1 deletion packages/react-rough-fiber/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ src
test
jest.config.js
tsconfig.json
tsup.config.ts
tsup.config.ts
scripts
5 changes: 3 additions & 2 deletions packages/react-rough-fiber/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{
"name": "react-rough-fiber",
"version": "0.0.1-alpha.1",
"main": "./dist/index.js",
"main": "./src/index.tsx",
"types": "./dist/index.d.ts",
"module": "./dist/esm/index.js",
"license": "MIT",
"scripts": {
"lint": "eslint *.ts*",
"test": "jest --config jest.config.js --no-cache",
"build": "rm -rf dist && tsup"
"build": "rm -rf dist && tsup",
"release": "node scripts/npm.js && npm run build"
},
"devDependencies": {
"@babel/core": "^7.0.0",
Expand Down
9 changes: 9 additions & 0 deletions packages/react-rough-fiber/scripts/npm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const fs = require('fs');
const path = require('path');

const packagePath = path.join(__dirname, '../package.json');
const package = JSON.parse(fs.readFileSync(packagePath, 'utf8').toString());

package.main = './dist/index.js';

fs.writeFileSync(packagePath, JSON.stringify(package, null, 2));

0 comments on commit 91e2020

Please sign in to comment.