gitpick 3.20.0 → 3.21.0-canary.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +7 -17
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3,23 +3,13 @@ import p from"fs";import S from"os";import g from"path";function f(r){if(typeof
3
3
  (e.g. 1h, 30m, 15s) default: 1m`).action(async(r,o,t)=>{A.parse({url:r,target:o,branch:t.branch,overwrite:t.overwrite,watch:t.watch}),t.watch&&(typeof t.watch=="boolean"&&(t.watch="1m"),console.log(`\u{1F440} Watching every ${f(t.watch)/1e3+"s"}
4
4
  `));let e=await $(r,{branch:t.branch,target:o});console.log(`${h.bold(e.owner)}/${h.bold(e.repository)} ${h.green(`<${e.type}:${e.branch}>`)} ${e.type==="repository"?`> ${h.cyan(e.target)}`:`${h.yellow(e.path)} > ${h.cyan(`${e.target}${e.type==="blob"?`/${e.path.split("/").pop()}`:""}`)}`}`,`
5
5
  `);let i=W().start();try{i.stop();let n=g.resolve(e.target);if(t.watch&&(t.overwrite=!0),p.existsSync(n+(e.type==="blob"?"/"+e.path.split("/").pop():""))&&(await p.promises.readdir(n)).length&&!t.overwrite){let c=e.type==="tree"?"The target directory is not empty. Do you want to overwrite the files?":"The target file already exists. Do you want to overwrite the file?",{overwrite:s}=await I.prompt([{type:"confirm",name:"overwrite",message:c,default:!1}]);if(!s)throw new Error("Chose not to overwrite files");i.info("You can use -o | --overwrite flag to skip this prompt")}if(await k(i,e,t,n),t.watch){let c=f(t.watch);setInterval(async()=>await k(i,e,t,n),c)}}catch(n){if(console.log(`
6
- `),i.fail(" Level 1: An error occurred"),n instanceof l.ZodError){let c=U(n);console.error(`
7
- Validation Error:
8
- `+c.toString()+`
9
- `)}else n instanceof Error?console.error(`
10
- Error:
11
- `+n.message+`
12
- `):console.error(`
13
- Unexpected Error:
14
- `+JSON.stringify(n,null,2)+`
15
- `);process.exit(1)}});async function j(r,o){let t=await p.promises.readdir(r,{withFileTypes:!0});await p.promises.mkdir(o,{recursive:!0});for(let e of t){if(e.name===".git")continue;let i=g.join(r,e.name),n=g.join(o,e.name);e.isDirectory()?await j(i,n):await p.promises.copyFile(i,n)}}var k=async(r,o,t,e)=>{try{let i=H();process.platform==="win32"&&await i.raw(["config","--global","core.longpaths","true"]);let n=`https://${o.token?o.token+"@":o.token}github.com/${o.owner}/${o.repository}.git`,c=g.join(S.tmpdir(),`${o.repository}-${Math.random().toString(16).slice(2,8)}`);t.watch||r.start(`Picking ${o.type}${o.type==="repository"?"":" from repository"}`),await i.clone(n,c,["--depth","1","--single-branch","--branch",o.branch]);let s=g.join(c,o.path);(await p.promises.stat(s)).isDirectory()?(await p.promises.mkdir(e,{recursive:!0}),await j(s,e)):(await p.promises.mkdir(e,{recursive:!0}),await p.promises.copyFile(s,e+"/"+o.path.split("/").pop())),t.watch?r.succeed("Synced at "+new Date().toLocaleTimeString()):r.succeed(`Picked ${o.type}${o.type==="repository"?"!":" from repository!"}`),await p.promises.rm(c,{recursive:!0,force:!0})}catch(i){console.log(`
16
- `),r.fail(" Level 2: An error occurred!"),i instanceof Error?console.error(`
17
- Error:
18
- `+i.message+`
19
- `):console.error(`
20
- Unexpected Error:
21
- `+JSON.stringify(i,null,2)+`
22
- `),process.exit(1)}};import a from"chalk";import{Command as R}from"commander";var b={name:"gitpick",version:"3.20.0",description:"With gitpick, you can clone precisely what you need.",keywords:["clone","degit","directory","file","folder","git","github","scaffolding","template","url"],homepage:"https://github.com/nrjdalal/gitpick#readme",bugs:"https://github.com/nrjdalal/gitpick/issues",repository:"nrjdalal/gitpick",funding:"https://github.com/sponsors/nrjdalal",license:"MIT",author:{name:"Neeraj Dalal",email:"admin@nrjdalal.com",url:"https://nrjdalal.com"},type:"module",bin:{degit:"./dist/index.js",gitpick:"./dist/index.js"},files:["dist"],scripts:{build:"tsup",dev:"tsup --watch",prepare:"npx simple-git-hooks",test:"bun run build && node dist/index.js",tests:"bash tests.sh"},"simple-git-hooks":{"pre-commit":"npx lint-staged","commit-msg":"npx commitlint --edit $1"},dependencies:{chalk:"^5.4.1",commander:"^13.1.0",inquirer:"^12.5.0",ora:"^8.2.0","simple-git":"^3.27.0",zod:"^3.24.2","zod-validation-error":"^3.4.0"},devDependencies:{"@commitlint/cli":"^19.8.0","@commitlint/config-conventional":"^19.8.0","@ianvs/prettier-plugin-sort-imports":"^4.4.1","@types/node":"^22.13.13","lint-staged":"^15.5.0",prettier:"^3.5.3","simple-git-hooks":"^2.12.1","sort-package-json":"^2.15.1",tsup:"^8.4.0",typescript:"^5.8.2"}};process.on("SIGINT",()=>process.exit(0));process.on("SIGTERM",()=>process.exit(0));async function B(){let r=new R().name("gitpick").description("With gitpick, you can clone precisely what you need.").version(b.version||"1.0.0","-v, --version","display the version number"),o=process.argv.slice(2),t=["-v","--version","-h","--help","help","clone"];o.length&&!t.includes(o[0])&&process.argv.splice(2,0,"clone"),r.addCommand(x),r.configureHelp({formatHelp:()=>`${a.bold("With gitpick, you can clone precisely what you need.")}
6
+ `),i.fail("Level 1: An error occurred"),n instanceof l.ZodError){let c=U(n);console.error(`
7
+ Validation Error: `+c.toString())}else n instanceof Error?console.error(`
8
+ Error: `+n.message):console.error(`
9
+ Unexpected Error: `+JSON.stringify(n,null,2));process.exit(1)}});async function j(r,o){let t=await p.promises.readdir(r,{withFileTypes:!0});await p.promises.mkdir(o,{recursive:!0});for(let e of t){if(e.name===".git")continue;let i=g.join(r,e.name),n=g.join(o,e.name);e.isDirectory()?await j(i,n):await p.promises.copyFile(i,n)}}var k=async(r,o,t,e)=>{try{let i=H();process.platform==="win32"&&await i.raw(["config","--global","core.longpaths","true"]);let n=`https://${o.token?o.token+"@":o.token}github.com/${o.owner}/${o.repository}.git`,c=g.join(S.tmpdir(),`${o.repository}-${Math.random().toString(16).slice(2,8)}`);t.watch||r.start(`Picking ${o.type}${o.type==="repository"?"":" from repository"}`),await i.clone(n,c,["--depth","1","--single-branch","--branch",o.branch]);let s=g.join(c,o.path);(await p.promises.stat(s)).isDirectory()?(await p.promises.mkdir(e,{recursive:!0}),await j(s,e)):(await p.promises.mkdir(e,{recursive:!0}),await p.promises.copyFile(s,e+"/"+o.path.split("/").pop())),t.watch?r.succeed("Synced at "+new Date().toLocaleTimeString()):r.succeed(`Picked ${o.type}${o.type==="repository"?"!":" from repository!"}`),await p.promises.rm(c,{recursive:!0,force:!0})}catch(i){console.log(`
10
+ `),r.fail("Level 2: An error occurred!"),i instanceof Error?console.error(`
11
+ Error: `+i.message):console.error(`
12
+ Unexpected Error: `+JSON.stringify(i,null,2)),process.exit(1)}};import a from"chalk";import{Command as R}from"commander";var b={name:"gitpick",version:"3.20.0",description:"With gitpick, you can clone precisely what you need.",keywords:["clone","degit","directory","file","folder","git","github","scaffolding","template","url"],homepage:"https://github.com/nrjdalal/gitpick#readme",bugs:"https://github.com/nrjdalal/gitpick/issues",repository:"nrjdalal/gitpick",funding:"https://github.com/sponsors/nrjdalal",license:"MIT",author:{name:"Neeraj Dalal",email:"admin@nrjdalal.com",url:"https://nrjdalal.com"},type:"module",bin:{degit:"./dist/index.js",gitpick:"./dist/index.js"},files:["dist"],scripts:{build:"tsup",dev:"tsup --watch",prepare:"npx simple-git-hooks",test:"bun run build && node dist/index.js",tests:"bash tests.sh"},"simple-git-hooks":{"pre-commit":"npx lint-staged","commit-msg":"npx commitlint --edit $1"},dependencies:{chalk:"^5.4.1",commander:"^13.1.0",inquirer:"^12.5.0",ora:"^8.2.0","simple-git":"^3.27.0",zod:"^3.24.2","zod-validation-error":"^3.4.0"},devDependencies:{"@commitlint/cli":"^19.8.0","@commitlint/config-conventional":"^19.8.0","@ianvs/prettier-plugin-sort-imports":"^4.4.1","@types/node":"^22.13.13","lint-staged":"^15.5.0",prettier:"^3.5.3","simple-git-hooks":"^2.12.1","sort-package-json":"^2.15.1",tsup:"^8.4.0",typescript:"^5.8.2"}};process.on("SIGINT",()=>process.exit(0));process.on("SIGTERM",()=>process.exit(0));async function B(){let r=new R().name("gitpick").description("With gitpick, you can clone precisely what you need.").version(b.version||"1.0.0","-v, --version","display the version number"),o=process.argv.slice(2),t=["-v","--version","-h","--help","help","clone"];o.length&&!t.includes(o[0])&&process.argv.splice(2,0,"clone"),r.addCommand(x),r.configureHelp({formatHelp:()=>`${a.bold("With gitpick, you can clone precisely what you need.")}
23
13
 
24
14
  \u{1F680} More awesome tools at ${a.cyan("https://github.com/nrjdalal")}
25
15
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitpick",
3
- "version": "3.20.0",
3
+ "version": "3.21.0-canary.0",
4
4
  "description": "With gitpick, you can clone precisely what you need.",
5
5
  "keywords": [
6
6
  "clone",