File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import path from "path" ;
2+ import fs from "fs" ;
3+ import { execSync } from "child_process" ;
4+
5+ const githubRemoteURL = "https://github.com/NetLogo/ColorPicker.git" ;
6+ const deployBranch = "build" ;
7+
8+ const distDir = path . resolve ( "./dist" ) ;
9+ process . chdir ( distDir ) ;
10+
11+ if ( fs . existsSync ( ".git" ) ) {
12+ execSync ( "git remote set-url origin " + githubRemoteURL ) ;
13+ } else {
14+ execSync ( "git init" ) ;
15+ execSync ( `git checkout --orphan ${ deployBranch } ` ) ;
16+ execSync ( `git remote add origin ${ githubRemoteURL } ` ) ;
17+ execSync ( "git fetch origin " + deployBranch , { stdio : "ignore" } ) ;
18+ }
19+
20+ execSync ( "git add ." ) ;
21+ try {
22+ execSync ( `git commit -m 'Deploy to ${ deployBranch } '` ) ;
23+ } catch ( e ) {
24+ console . warn ( "Nothing to commit." ) ;
25+ }
26+ execSync ( `git push origin ${ deployBranch } --force` ) ;
Original file line number Diff line number Diff line change 77 "dev" : " vite" ,
88 "build" : " tsc && vite build && vite build --mode inlined" ,
99 "build:inlined" : " vite build --mode inlined" ,
10+ "deploy" : " npm run build && node deploy.js" ,
1011 "preview" : " vite preview"
1112 },
1213 "devDependencies" : {
You can’t perform that action at this time.
0 commit comments