File tree Expand file tree Collapse file tree 6 files changed +65
-13
lines changed
Expand file tree Collapse file tree 6 files changed +65
-13
lines changed Original file line number Diff line number Diff line change 1+ name : CI & CD
2+ on :
3+ push :
4+ tags :
5+ - v*
6+ jobs :
7+ Build-and-Publish :
8+ runs-on : ubuntu-latest
9+ permissions :
10+ contents : write
11+ id-token : write
12+ steps :
13+ - uses : actions/checkout@v4
14+
15+ - uses : pnpm/action-setup@v4
16+ with :
17+ version : 10
18+ - uses : actions/setup-node@v4
19+ with :
20+ node-version : 22
21+ registry-url : https://registry.npmjs.org
22+ cache : pnpm
23+ - name : Install Dependencies
24+ run : pnpm i --frozen-lockfile
25+
26+ - name : Build & Publish
27+ run : npm publish --access public --provenance
28+ env :
29+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
30+
31+ - name : Update document
32+ uses : peaceiris/actions-gh-pages@v4
33+ with :
34+ publish_dir : ./docs
35+ personal_token : ${{ secrets.GITHUB_TOKEN }}
36+ force_orphan : true
Original file line number Diff line number Diff line change 1+ test /
Original file line number Diff line number Diff line change 1- # ShadcnX
1+ # ShadcnX CLI
22
33A command line helper for [ Shadcn UI CLI] [ 1 ] , ` git commit ` modified component codes only.
44
5+ [ ![ CI & CD] ( https://github.com/idea2app/ShadcnX/actions/workflows/main.yml/badge.svg )] [ 2 ]
6+
57## Installation
68
79``` bash
@@ -39,3 +41,4 @@ shadcn-x edit component-name
39411 . https://github.com/idea2app/Next-shadcn-ts
4042
4143[ 1 ] : https://ui.shadcn.com/docs/cli
44+ [ 2 ] : https://github.com/idea2app/ShadcnX/actions/workflows/main.yml
Original file line number Diff line number Diff line change 11{
22 "name" : " shadcn-x" ,
33 "version" : " 0.3.0" ,
4+ "license" : " LGPL-3.0-or-later" ,
5+ "author" : " shiy2008@gmail.com" ,
46 "description" : " A command line helper for Shadcn UI CLI, `git commit` modified component codes only." ,
7+ "keywords" : [
8+ " shadcn" ,
9+ " component" ,
10+ " command" ,
11+ " helper"
12+ ],
513 "type" : " module" ,
614 "bin" : " ./dist/command.js" ,
7- "scripts" : {
8- "install" : " npm i shadcn -g" ,
9- "test" : " cd test && tsx ../source/command" ,
10- "build" : " rm -rf dist/ && tsc && cp source/components.json dist/" ,
11- "prepublishOnly" : " npm t add button badge && npm run build"
12- },
13- "author" : " shiy2008@gmail.com" ,
14- "license" : " LGPL-3.0-or-later" ,
1515 "dependencies" : {
1616 "array-unique-proposal" : " ^0.3.4" ,
1717 "open" : " ^10.1.2" ,
3131 "prettier" : {
3232 "singleQuote" : true ,
3333 "arrowParens" : " avoid"
34+ },
35+ "scripts" : {
36+ "install" : " pnpm i shadcn -g || npm i shadcn -g" ,
37+ "test" : " cd test && tsx ../source/command" ,
38+ "build" : " rm -rf dist/ && tsc && cp source/components.json dist/" ,
39+ "prepublishOnly" : " npm t add button badge && npm run build"
3440 }
3541}
Original file line number Diff line number Diff line change @@ -5,16 +5,16 @@ import 'array-unique-proposal';
55import { $ , fs , path } from 'zx' ;
66import open from 'open' ;
77
8+ import { localPathOf } from './utility.js' ;
9+
810$ . verbose = true ;
911
1012const [ command , ...args ] = process . argv . slice ( 2 ) ;
1113
1214const configurationTarget = 'components.json' ;
1315
1416if ( ! fs . existsSync ( configurationTarget ) ) {
15- const configurationSource = (
16- new URL ( 'components.json' , import . meta. url ) + ''
17- ) . replace ( 'file://' , '' ) ;
17+ const configurationSource = localPathOf ( import . meta. url , configurationTarget ) ;
1818
1919 await fs . copy ( configurationSource , configurationTarget ) ;
2020}
@@ -72,7 +72,9 @@ async function editComponent(component: string) {
7272
7373 await saveIndex ( oldList ) ;
7474
75- const filePath = path . join ( componentsFilePath , `${ component } .tsx` ) ;
75+ const filePath = path
76+ . join ( componentsFilePath , `${ component } .tsx` )
77+ . replace ( / \\ / g, '/' ) ;
7678
7779 await fs . appendFile ( '.gitignore' , `!${ filePath } ` ) ;
7880
Original file line number Diff line number Diff line change 1+ export const localPathOf = ( importMetaURL : string , relativePath : string ) =>
2+ ( new URL ( relativePath , importMetaURL ) + '' )
3+ . replace ( 'file://' + ( process . platform === 'win32' ? '/' : '' ) , '' )
4+ . replace ( / \\ / g, '/' ) ;
You can’t perform that action at this time.
0 commit comments