Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/cli #11

Merged
merged 5 commits into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .changeset/hip-zoos-agree.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/slimy-cobras-smash.md

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/check-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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
15 changes: 15 additions & 0 deletions packages/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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]
- [email protected]
- [email protected]
1 change: 0 additions & 1 deletion packages/cli/README.md

This file was deleted.

2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/log.ts
Original file line number Diff line number Diff line change
@@ -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;
4 changes: 2 additions & 2 deletions packages/cli/src/preview.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import path from 'path';
import { Command } from 'commander';
import { packagePath as previewPackagePath, componentsPath } from 'svg-to-component.preview';

Check failure on line 3 in packages/cli/src/preview.ts

View workflow job for this annotation

GitHub Actions / eslint

Unable to resolve path to module '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();

Expand All @@ -22,7 +22,7 @@

log(outputMain(`> run ${previewPackagePath} server...`));

const wp = spawn(`pnpm`, ['run', 'dev'], {
const wp = spawn(`pnpm`, ['run', 'start'], {
cwd: previewPackagePath,
stdio: 'inherit',
});
Expand Down
11 changes: 11 additions & 0 deletions packages/parse/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# svg-to-component.parse

## 1.0.0

### Major Changes

- 337b0c5: feat: release 1.0

### Minor Changes

- 688affa: feat: beta1
3 changes: 2 additions & 1 deletion packages/parse/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
3 changes: 2 additions & 1 deletion packages/preview/.eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
script/
script/
src/svgComponents
3 changes: 2 additions & 1 deletion packages/preview/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
src/svgComponents/
src/svgComponents/
script/lib/
11 changes: 11 additions & 0 deletions packages/preview/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# svg-to-component.preview

## 1.0.0

### Major Changes

- 337b0c5: feat: release 1.0

### Minor Changes

- b2f2ea5: feat: beta1
1 change: 1 addition & 0 deletions packages/preview/config/webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ const webpackConfig = (): Configuration & {
},
devServer: {
...devServer,
open: true,
},
devtool: isWebpackDev ? 'eval-source-map' : false,
module: {
Expand Down
3 changes: 2 additions & 1 deletion packages/preview/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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`,
Expand Down
1 change: 1 addition & 0 deletions packages/preview/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": "@tsconfig/create-react-app/tsconfig.json",
"compilerOptions": {
"target": "ES2022",
"baseUrl": ".",
"paths": {
"@/*": [
Expand Down
2 changes: 1 addition & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading