diff --git a/.changeset/hip-zoos-agree.md b/.changeset/hip-zoos-agree.md deleted file mode 100644 index 83fe6c0..0000000 --- a/.changeset/hip-zoos-agree.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'svg-to-component.parse': minor ---- - -feat: beta1 diff --git a/.changeset/slimy-cobras-smash.md b/.changeset/slimy-cobras-smash.md deleted file mode 100644 index f991268..0000000 --- a/.changeset/slimy-cobras-smash.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'svg-to-component.preview': minor ---- - -feat: beta1 diff --git a/.github/workflows/check-pull-request.yml b/.github/workflows/check-pull-request.yml index c039fa3..aef68d8 100644 --- a/.github/workflows/check-pull-request.yml +++ b/.github/workflows/check-pull-request.yml @@ -22,7 +22,7 @@ jobs: run: echo "result=$(TZ=Asia/Shanghai date)" >> "$GITHUB_OUTPUT" - name: Create or update a comment - uses: taoliujun/action-unique-comment@v1 + uses: taoliujun/action-unique-comment@master with: uniqueIdentifier: ${{ github.workflow }} body: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..dcc5d87 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,34 @@ +name: release +run-name: '${{github.workflow}}' +on: workflow_dispatch + +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: init pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + + - name: init node + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'pnpm' + cache-dependency-path: | + src/pnpm-lock.yaml + .github/actions/issue-to-hexo/pnpm-lock.yaml + + - name: install dependencies + run: pnpm install + + - name: build + run: pnpm run build + + - name: release + run: | + NPM_TOKEN=${{secrets.NPM_TOKEN}} pnpm run release:token diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md new file mode 100644 index 0000000..b4f189a --- /dev/null +++ b/packages/cli/CHANGELOG.md @@ -0,0 +1,15 @@ +# svg-to-component + +## 1.0.0 + +### Major Changes + +- 337b0c5: feat: release 1.0 + +### Patch Changes + +- Updated dependencies [337b0c5] +- Updated dependencies [688affa] +- Updated dependencies [b2f2ea5] + - svg-to-component.preview@1.0.0 + - svg-to-component.parse@1.0.0 diff --git a/packages/cli/README.md b/packages/cli/README.md deleted file mode 100644 index a61e081..0000000 --- a/packages/cli/README.md +++ /dev/null @@ -1 +0,0 @@ -# svg-to-component \ No newline at end of file diff --git a/packages/cli/package.json b/packages/cli/package.json index bfa750f..107ce18 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "svg-to-component", - "version": "0.0.0", + "version": "1.0.0", "description": "parse svg files into react components, support dynamic colors and preview.", "keywords": [ "svg", diff --git a/packages/cli/src/index.ts b/packages/cli/src/index.ts index e149cdb..c0a987d 100644 --- a/packages/cli/src/index.ts +++ b/packages/cli/src/index.ts @@ -5,7 +5,7 @@ import pkg from '../package.json'; const program = new Command(); -program.name('svg-to-component').description('svg file parse and preview.').version(pkg.version); +program.name(pkg.name).description(pkg.description).version(pkg.version); program.addCommand(commandParse); program.addCommand(commandPreview); diff --git a/packages/cli/src/log.ts b/packages/cli/src/log.ts index 4fb61b1..3a54656 100644 --- a/packages/cli/src/log.ts +++ b/packages/cli/src/log.ts @@ -1,6 +1,6 @@ import chalk from 'chalk'; -export const log = console.log; +export const { log } = console; export const outputMain = chalk.white; export const outputSecond = chalk.gray; export const outputSuccess = chalk.green; diff --git a/packages/cli/src/preview.ts b/packages/cli/src/preview.ts index 5da5bec..a07e6f4 100644 --- a/packages/cli/src/preview.ts +++ b/packages/cli/src/preview.ts @@ -1,9 +1,9 @@ import path from 'path'; import { Command } from 'commander'; import { packagePath as previewPackagePath, componentsPath } from 'svg-to-component.preview'; +import { spawn } from 'child_process'; import { log, outputMain } from './log'; import { generateComponentFiles } from './parse'; -import { spawn } from 'child_process'; const cwdPath = path.resolve(); @@ -22,7 +22,7 @@ const program = new Command('preview') log(outputMain(`> run ${previewPackagePath} server...`)); - const wp = spawn(`pnpm`, ['run', 'dev'], { + const wp = spawn(`pnpm`, ['run', 'start'], { cwd: previewPackagePath, stdio: 'inherit', }); diff --git a/packages/parse/CHANGELOG.md b/packages/parse/CHANGELOG.md new file mode 100644 index 0000000..6dda8be --- /dev/null +++ b/packages/parse/CHANGELOG.md @@ -0,0 +1,11 @@ +# svg-to-component.parse + +## 1.0.0 + +### Major Changes + +- 337b0c5: feat: release 1.0 + +### Minor Changes + +- 688affa: feat: beta1 diff --git a/packages/parse/package.json b/packages/parse/package.json index e7d23fc..aa2eb00 100644 --- a/packages/parse/package.json +++ b/packages/parse/package.json @@ -1,10 +1,11 @@ { "name": "svg-to-component.parse", - "version": "0.0.0", + "version": "1.0.0", "engines": { "node": "^20" }, "main": "./lib/index.js", + "types": "./lib/index.d.ts", "files": [ "lib", "/*.md", diff --git a/packages/preview/.eslintignore b/packages/preview/.eslintignore index d17d448..e410c7d 100644 --- a/packages/preview/.eslintignore +++ b/packages/preview/.eslintignore @@ -1 +1,2 @@ -script/ \ No newline at end of file +script/ +src/svgComponents \ No newline at end of file diff --git a/packages/preview/.gitignore b/packages/preview/.gitignore index 04e38ce..97e5ee3 100644 --- a/packages/preview/.gitignore +++ b/packages/preview/.gitignore @@ -1 +1,2 @@ -src/svgComponents/ \ No newline at end of file +src/svgComponents/ +script/lib/ \ No newline at end of file diff --git a/packages/preview/CHANGELOG.md b/packages/preview/CHANGELOG.md new file mode 100644 index 0000000..3f273c6 --- /dev/null +++ b/packages/preview/CHANGELOG.md @@ -0,0 +1,11 @@ +# svg-to-component.preview + +## 1.0.0 + +### Major Changes + +- 337b0c5: feat: release 1.0 + +### Minor Changes + +- b2f2ea5: feat: beta1 diff --git a/packages/preview/config/webpack.config.ts b/packages/preview/config/webpack.config.ts index 479cf2c..d1969c8 100644 --- a/packages/preview/config/webpack.config.ts +++ b/packages/preview/config/webpack.config.ts @@ -90,6 +90,7 @@ const webpackConfig = (): Configuration & { }, devServer: { ...devServer, + open: true, }, devtool: isWebpackDev ? 'eval-source-map' : false, module: { diff --git a/packages/preview/package.json b/packages/preview/package.json index 836d3c2..d488541 100644 --- a/packages/preview/package.json +++ b/packages/preview/package.json @@ -1,11 +1,12 @@ { "name": "svg-to-component.preview", - "version": "0.0.0", + "version": "1.0.0", "engines": { "node": "^20", "pnpm": ">=8" }, "main": "./script/lib/index.js", + "types": "./script/lib/index.d.ts", "scripts": { "lint": "eslint --cache src", "lint:ts": "tsc --noEmit", diff --git a/packages/preview/src/pages/index/components/Colors/components/ColorControl/index.tsx b/packages/preview/src/pages/index/components/Colors/components/ColorControl/index.tsx index af20e5e..92add44 100644 --- a/packages/preview/src/pages/index/components/Colors/components/ColorControl/index.tsx +++ b/packages/preview/src/pages/index/components/Colors/components/ColorControl/index.tsx @@ -136,7 +136,7 @@ const useActiveElement = () => { const styles = findElement .filter((v) => Boolean(v)) .map((v) => { - const { width, height, left, top } = v.getBoundingClientRect(); + const { width, height, left, top } = (v as HTMLElement).getBoundingClientRect(); return { width: `${width}px`, height: `${height}px`, diff --git a/packages/preview/tsconfig.json b/packages/preview/tsconfig.json index c0ed295..8518bd3 100644 --- a/packages/preview/tsconfig.json +++ b/packages/preview/tsconfig.json @@ -1,6 +1,7 @@ { "extends": "@tsconfig/create-react-app/tsconfig.json", "compilerOptions": { + "target": "ES2022", "baseUrl": ".", "paths": { "@/*": [ diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f27da26..4c0b4ea 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5191,7 +5191,7 @@ packages: dependencies: confusing-browser-globals: 1.0.11 eslint: 8.56.0 - eslint-plugin-import: 2.29.1(@typescript-eslint/parser@5.62.0)(eslint-import-resolver-typescript@2.7.1)(eslint@8.56.0) + eslint-plugin-import: 2.29.1(@typescript-eslint/parser@6.19.0)(eslint-import-resolver-typescript@3.6.1)(eslint@8.56.0) object.assign: 4.1.5 object.entries: 1.1.7 semver: 6.3.1