@eunjae/dots 1.2.1 → 1.2.2

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.
@@ -1,7 +1,7 @@
1
- import{a as m,b as y}from"./chunk-2GAUT3J6.js";import{exec as H}from"node:child_process";import{promisify as L}from"node:util";import{lstat as h,mkdir as x,readlink as B,rm as I,symlink as v}from"node:fs/promises";import{homedir as D}from"node:os";import{dirname as M,resolve as w}from"node:path";function g(t,e){return t.startsWith("~/")?w(D(),t.slice(2)):t.startsWith("./")||!t.startsWith("/")?w(e,t):t}async function k(t){try{return await h(t),!0}catch{return!1}}async function E(t){try{return(await h(t)).isSymbolicLink()}catch{return!1}}async function F(t,e,o){let r=g(t.src,e),n=g(t.dest,e);if(!await k(r))return{action:"skipped",src:r,dest:n,error:`Source does not exist: ${r}`};if(await k(n)){if(await E(n)&&await B(n)===r)return{action:"exists",src:r,dest:n};if(!t.force)return{action:"skipped",src:r,dest:n,error:"Destination exists and is not the correct symlink. Use force: true to overwrite."};o||await I(n,{recursive:!0})}return o||(await x(M(n),{recursive:!0}),await v(r,n)),{action:"created",src:r,dest:n}}async function u(t,e,o){let r=[];for(let n of t){let s=await F(n,e,o);r.push(s)}return r}var c=L(H);function W(t){return typeof t=="string"?{name:t}:t}async function N(){try{return await c("which brew"),!0}catch{return!1}}async function T(t,e,o){if(o)return e?o.casks.has(t):o.formulae.has(t);try{let r=e?`brew list --cask ${t}`:`brew list ${t}`;return await c(r),!0}catch{return!1}}async function U(){try{let[t,e]=await Promise.all([c("brew list --formula -1"),c("brew list --cask -1")]),o=new Set(t.stdout.split(`
1
+ import{a as y,b as w}from"./chunk-2GAUT3J6.js";import{exec as H}from"node:child_process";import{promisify as L}from"node:util";import{lstat as $,mkdir as B,readlink as I,rm as v,symlink as D}from"node:fs/promises";import{homedir as M}from"node:os";import{dirname as g,resolve as k}from"node:path";function d(t,e){return t.startsWith("~/")?k(M(),t.slice(2)):t.startsWith("./")||!t.startsWith("/")?k(e,t):t}async function h(t){try{return await $(t),!0}catch{return!1}}async function E(t){try{return(await $(t)).isSymbolicLink()}catch{return!1}}async function F(t,e,o){let r=d(t.src,e),n=d(t.dest,e);if(!await h(r))return{action:"skipped",src:r,dest:n,error:`Source does not exist: ${r}`};if(await h(n)){if(await E(n)){let s=await I(n);if(d(s,g(n))===r)return{action:"exists",src:r,dest:n}}if(!t.force)return{action:"skipped",src:r,dest:n,error:"Destination exists and is not the correct symlink. Use force: true to overwrite."};o||await v(n,{recursive:!0})}return o||(await B(g(n),{recursive:!0}),await D(r,n)),{action:"created",src:r,dest:n}}async function u(t,e,o){let r=[];for(let n of t){let s=await F(n,e,o);r.push(s)}return r}var c=L(H);function W(t){return typeof t=="string"?{name:t}:t}async function N(){try{return await c("which brew"),!0}catch{return!1}}async function T(t,e,o){if(o)return e?o.casks.has(t):o.formulae.has(t);try{let r=e?`brew list --cask ${t}`:`brew list ${t}`;return await c(r),!0}catch{return!1}}async function U(){try{let[t,e]=await Promise.all([c("brew list --formula -1"),c("brew list --cask -1")]),o=new Set(t.stdout.split(`
2
2
  `).map(n=>n.trim()).filter(Boolean)),r=new Set(e.stdout.split(`
3
- `).map(n=>n.trim()).filter(Boolean));return{formulae:o,casks:r}}catch{return null}}async function z(t,e){let o=e?`brew install --cask ${t}`:`brew install ${t}`;await c(o)}async function G(t){return await N()?!0:t?(console.log("[dry-run] Would install Homebrew"),!1):(console.log("Installing Homebrew..."),await c('/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"'),!0)}async function j(t,e,o,r){let n=W(t),{name:s,cask:i=!1,symlinks:a}=n;if(await T(s,i,r)){let l={action:"exists",name:s,cask:i};return a&&a.length>0&&(l.symlinkResults=await u(a,e,o)),l}if(!o)try{await z(s,i)}catch(l){return{action:"skipped",name:s,cask:i,error:`Failed to install: ${l instanceof Error?l.message:String(l)}`}}let p={action:"installed",name:s,cask:i};return a&&a.length>0&&(p.symlinkResults=await u(a,e,o)),p}async function $(t,e,o){let r=await G(o);if(!r&&!o)throw new Error("Homebrew is not installed and could not be installed");let n=r?await U():null,s=[];for(let i of t){let a=await j(i,e,o,n);n&&a.action==="installed"&&(a.cask?n.casks.add(a.name):n.formulae.add(a.name)),s.push(a)}return s}import{exec as q}from"node:child_process";import{promisify as J}from"node:util";var f=J(q);async function K(){try{return await f("which mas"),!0}catch{return!1}}async function O(){await f("brew install mas")}async function Q(t){try{let{stdout:e}=await f("mas list");return e.includes(String(t))}catch{return!1}}async function V(t){await f(`mas install ${t}`)}async function X(t,e){let o=typeof t=="number"?t:t.id,r=typeof t=="number"?void 0:t.name;if(await Q(o))return{action:"exists",id:o,name:r};if(!e)try{await V(o)}catch(n){return{action:"skipped",id:o,name:r,error:`Failed to install: ${n instanceof Error?n.message:String(n)}`}}return{action:"installed",id:o,name:r}}async function S(t,e){await K()||e||await O();let o=[];for(let r of t){let n=await X(r,e);o.push(n)}return o}import{exec as Y}from"node:child_process";import{lstat as Z,mkdir as _}from"node:fs/promises";import{homedir as tt}from"node:os";import{resolve as d}from"node:path";import{promisify as et}from"node:util";var R=et(Y);function b(t){return t.startsWith("~/")?d(tt(),t.slice(2)):t}function rt(t){let e=t.match(/\/([^/]+?)(?:\.git)?$/);if(e?.[1])return e[1];let o=t.match(/:([^/]+?)(?:\.git)?$/);if(o?.[1])return o[1];throw new Error(`Cannot extract repository name from URL: ${t}`)}async function nt(t){try{return await Z(t),!0}catch{return!1}}async function ot(t){try{return await R(`git -C "${t}" rev-parse --git-dir`),!0}catch{return!1}}async function st(t,e,o){let{url:r}=t,n;if(t.dest)n=b(t.dest);else if(o){let s=rt(r);n=b(d(o,s))}else return{action:"skipped",url:r,dest:"",error:"No destination specified and no workspacePath configured"};if(await nt(n))return await ot(n)?{action:"exists",url:r,dest:n}:{action:"skipped",url:r,dest:n,error:`Destination exists but is not a git repository: ${n}`};if(!e){let s=d(n,"..");await _(s,{recursive:!0});try{await R(`git clone "${r}" "${n}"`)}catch(i){return{action:"skipped",url:r,dest:n,error:`Failed to clone: ${i instanceof Error?i.message:String(i)}`}}}return{action:"cloned",url:r,dest:n}}async function C(t,e,o){let r=[];for(let n of t){let s=await st(n,e,o);r.push(s)}return r}import{exec as it}from"node:child_process";import{promisify as at}from"node:util";var P=at(it);async function lt(t){try{return await P(t),!0}catch{return!1}}async function ct(t,e){let{name:o,command:r,unless:n}=t;if(n&&await lt(n))return{action:"skipped",name:o,command:r};if(!e)try{await P(r)}catch(s){return{action:"skipped",name:o,command:r,error:`Failed to execute: ${s instanceof Error?s.message:String(s)}`}}return{action:"executed",name:o,command:r}}async function A(t,e){let o=[];for(let r of t){let n=await ct(r,e);o.push(n)}return o}async function pt(t,e){if(!t.repos||t.repos.length===0)return;e.proc.stdout.write(`\u{1F4E6} Repositories:
4
- `);let o=await C(t.repos,e.dryRun,e.workspacePath);for(let r of o){let n=e.dryRun?"[dry-run] ":"";r.action==="cloned"?e.proc.stdout.write(` ${n}\u2713 Cloned ${r.url} \u2192 ${r.dest}
3
+ `).map(n=>n.trim()).filter(Boolean));return{formulae:o,casks:r}}catch{return null}}async function z(t,e){let o=e?`brew install --cask ${t}`:`brew install ${t}`;await c(o)}async function G(t){return await N()?!0:t?(console.log("[dry-run] Would install Homebrew"),!1):(console.log("Installing Homebrew..."),await c('/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"'),!0)}async function j(t,e,o,r){let n=W(t),{name:s,cask:i=!1,symlinks:a}=n;if(await T(s,i,r)){let l={action:"exists",name:s,cask:i};return a&&a.length>0&&(l.symlinkResults=await u(a,e,o)),l}if(!o)try{await z(s,i)}catch(l){return{action:"skipped",name:s,cask:i,error:`Failed to install: ${l instanceof Error?l.message:String(l)}`}}let p={action:"installed",name:s,cask:i};return a&&a.length>0&&(p.symlinkResults=await u(a,e,o)),p}async function S(t,e,o){let r=await G(o);if(!r&&!o)throw new Error("Homebrew is not installed and could not be installed");let n=r?await U():null,s=[];for(let i of t){let a=await j(i,e,o,n);n&&a.action==="installed"&&(a.cask?n.casks.add(a.name):n.formulae.add(a.name)),s.push(a)}return s}import{exec as q}from"node:child_process";import{promisify as J}from"node:util";var f=J(q);async function K(){try{return await f("which mas"),!0}catch{return!1}}async function O(){await f("brew install mas")}async function Q(t){try{let{stdout:e}=await f("mas list");return e.includes(String(t))}catch{return!1}}async function V(t){await f(`mas install ${t}`)}async function X(t,e){let o=typeof t=="number"?t:t.id,r=typeof t=="number"?void 0:t.name;if(await Q(o))return{action:"exists",id:o,name:r};if(!e)try{await V(o)}catch(n){return{action:"skipped",id:o,name:r,error:`Failed to install: ${n instanceof Error?n.message:String(n)}`}}return{action:"installed",id:o,name:r}}async function b(t,e){await K()||e||await O();let o=[];for(let r of t){let n=await X(r,e);o.push(n)}return o}import{exec as Y}from"node:child_process";import{lstat as Z,mkdir as _}from"node:fs/promises";import{homedir as tt}from"node:os";import{resolve as m}from"node:path";import{promisify as et}from"node:util";var C=et(Y);function R(t){return t.startsWith("~/")?m(tt(),t.slice(2)):t}function rt(t){let e=t.match(/\/([^/]+?)(?:\.git)?$/);if(e?.[1])return e[1];let o=t.match(/:([^/]+?)(?:\.git)?$/);if(o?.[1])return o[1];throw new Error(`Cannot extract repository name from URL: ${t}`)}async function nt(t){try{return await Z(t),!0}catch{return!1}}async function ot(t){try{return await C(`git -C "${t}" rev-parse --git-dir`),!0}catch{return!1}}async function st(t,e,o){let{url:r}=t,n;if(t.dest)n=R(t.dest);else if(o){let s=rt(r);n=R(m(o,s))}else return{action:"skipped",url:r,dest:"",error:"No destination specified and no workspacePath configured"};if(await nt(n))return await ot(n)?{action:"exists",url:r,dest:n}:{action:"skipped",url:r,dest:n,error:`Destination exists but is not a git repository: ${n}`};if(!e){let s=m(n,"..");await _(s,{recursive:!0});try{await C(`git clone "${r}" "${n}"`)}catch(i){return{action:"skipped",url:r,dest:n,error:`Failed to clone: ${i instanceof Error?i.message:String(i)}`}}}return{action:"cloned",url:r,dest:n}}async function P(t,e,o){let r=[];for(let n of t){let s=await st(n,e,o);r.push(s)}return r}import{exec as it}from"node:child_process";import{promisify as at}from"node:util";var x=at(it);async function lt(t){try{return await x(t),!0}catch{return!1}}async function ct(t,e){let{name:o,command:r,unless:n}=t;if(n&&await lt(n))return{action:"skipped",name:o,command:r};if(!e)try{await x(r)}catch(s){return{action:"skipped",name:o,command:r,error:`Failed to execute: ${s instanceof Error?s.message:String(s)}`}}return{action:"executed",name:o,command:r}}async function A(t,e){let o=[];for(let r of t){let n=await ct(r,e);o.push(n)}return o}async function pt(t,e){if(!t.repos||t.repos.length===0)return;e.proc.stdout.write(`\u{1F4E6} Repositories:
4
+ `);let o=await P(t.repos,e.dryRun,e.workspacePath);for(let r of o){let n=e.dryRun?"[dry-run] ":"";r.action==="cloned"?e.proc.stdout.write(` ${n}\u2713 Cloned ${r.url} \u2192 ${r.dest}
5
5
  `):r.action==="exists"?e.proc.stdout.write(` ${n}\u2022 Already exists: ${r.dest}
6
6
  `):r.action==="skipped"&&e.proc.stdout.write(` ${n}\u2717 Skipped: ${r.error}
7
7
  `)}e.proc.stdout.write(`
@@ -11,7 +11,7 @@ import{a as m,b as y}from"./chunk-2GAUT3J6.js";import{exec as H}from"node:child_
11
11
  `):r.action==="skipped"&&e.proc.stdout.write(` ${n}\u2717 Skipped: ${r.error}
12
12
  `)}e.proc.stdout.write(`
13
13
  `)}async function ft(t,e){let o=t.brew??[],r=(t.brewCask??[]).map(i=>({name:i,cask:!0})),n=[...o,...r];if(n.length===0)return;e.proc.stdout.write(`\u{1F37A} Homebrew packages:
14
- `);let s=await $(n,e.configDir,e.dryRun);for(let i of s){let a=e.dryRun?"[dry-run] ":"",p=i.cask?"(cask)":"";if(i.action==="installed"?e.proc.stdout.write(` ${a}\u2713 Installed ${i.name} ${p}
14
+ `);let s=await S(n,e.configDir,e.dryRun);for(let i of s){let a=e.dryRun?"[dry-run] ":"",p=i.cask?"(cask)":"";if(i.action==="installed"?e.proc.stdout.write(` ${a}\u2713 Installed ${i.name} ${p}
15
15
  `):i.action==="exists"?e.proc.stdout.write(` ${a}\u2022 Already installed: ${i.name} ${p}
16
16
  `):i.action==="skipped"&&e.proc.stdout.write(` ${a}\u2717 Skipped ${i.name}: ${i.error}
17
17
  `),i.symlinkResults)for(let l of i.symlinkResults)l.action==="created"?e.proc.stdout.write(` ${a}\u2713 Symlink: ${l.dest} \u2192 ${l.src}
@@ -19,7 +19,7 @@ import{a as m,b as y}from"./chunk-2GAUT3J6.js";import{exec as H}from"node:child_
19
19
  `):l.action==="skipped"&&e.proc.stdout.write(` ${a}\u2717 Symlink skipped: ${l.error}
20
20
  `)}e.proc.stdout.write(`
21
21
  `)}async function dt(t,e){if(!t.mas||t.mas.length===0)return;e.proc.stdout.write(`\u{1F34E} Mac App Store:
22
- `);let o=await S(t.mas,e.dryRun);for(let r of o){let n=e.dryRun?"[dry-run] ":"",s=r.name?`${r.name} (${r.id})`:`${r.id}`;r.action==="installed"?e.proc.stdout.write(` ${n}\u2713 Installed: ${s}
22
+ `);let o=await b(t.mas,e.dryRun);for(let r of o){let n=e.dryRun?"[dry-run] ":"",s=r.name?`${r.name} (${r.id})`:`${r.id}`;r.action==="installed"?e.proc.stdout.write(` ${n}\u2713 Installed: ${s}
23
23
  `):r.action==="exists"?e.proc.stdout.write(` ${n}\u2022 Already installed: ${s}
24
24
  `):r.action==="skipped"&&e.proc.stdout.write(` ${n}\u2717 Skipped ${s}: ${r.error}
25
25
  `)}e.proc.stdout.write(`
@@ -28,13 +28,13 @@ import{a as m,b as y}from"./chunk-2GAUT3J6.js";import{exec as H}from"node:child_
28
28
  `):r.action==="skipped"&&(r.error?e.proc.stdout.write(` ${n}\u2717 Failed ${r.name}: ${r.error}
29
29
  `):e.proc.stdout.write(` ${n}\u2022 Already done: ${r.name}
30
30
  `))}e.proc.stdout.write(`
31
- `)}async function yt(t,e){await pt(t,e),await ut(t,e),await ft(t,e),await dt(t,e),await mt(t,e)}async function Gt(t){let{process:e}=this,o=t.dry,r=y();o?e.stdout.write(`
31
+ `)}async function yt(t,e){await pt(t,e),await ut(t,e),await ft(t,e),await dt(t,e),await mt(t,e)}async function Gt(t){let{process:e}=this,o=t.dry,r=w();o?e.stdout.write(`
32
32
  \u{1F50D} Dry run mode - no changes will be made
33
33
 
34
34
  `):e.stdout.write(`
35
35
  \u{1F680} Applying configuration...
36
36
 
37
- `);let n=await m(r);if(!n){e.stderr.write(`Error: No config file found. Create dots.config.ts in the current directory.
37
+ `);let n=await y(r);if(!n){e.stderr.write(`Error: No config file found. Create dots.config.ts in the current directory.
38
38
  `),e.exit(1);return}let s=n.find(a=>a.workspacePath)?.workspacePath,i={proc:e,configDir:r,dryRun:o,workspacePath:s};for(let a of n)await yt(a,i);o?e.stdout.write(`\u2705 Dry run complete. Run without --dry to apply changes.
39
39
 
40
40
  `):e.stdout.write(`\u2705 Configuration applied successfully!
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import{a as o,b as s}from"../chunk-2U4DKOZ5.js";import"../chunk-7VN7XXCT.js";import{proposeCompletions as r}from"@stricli/core";var t=process.argv.slice(3);process.env.COMP_LINE?.endsWith(" ")&&t.push("");await r(o,t,s(process));try{for(let{completion:p}of await r(o,t,s(process)))process.stdout.write(`${p}
2
+ import{a as o,b as s}from"../chunk-NJ2O4YI7.js";import"../chunk-6ABAXPMT.js";import{proposeCompletions as r}from"@stricli/core";var t=process.argv.slice(3);process.env.COMP_LINE?.endsWith(" ")&&t.push("");await r(o,t,s(process));try{for(let{completion:p}of await r(o,t,s(process)))process.stdout.write(`${p}
3
3
  `)}catch{}
package/dist/bin/cli.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{a as r,b as o}from"../chunk-2U4DKOZ5.js";import"../chunk-7VN7XXCT.js";import{run as i}from"@stricli/core";await i(r,process.argv.slice(2),o(process));
2
+ import{a as r,b as o}from"../chunk-NJ2O4YI7.js";import"../chunk-6ABAXPMT.js";import{run as i}from"@stricli/core";await i(r,process.argv.slice(2),o(process));
@@ -0,0 +1 @@
1
+ var s="Declarative dotfiles and Mac setup manager";var i="1.2.2";export{s as a,i as b};
@@ -1 +1 @@
1
- import{a as o,b as t}from"./chunk-7VN7XXCT.js";import{buildApplication as i,buildCommand as e,buildRouteMap as n}from"@stricli/core";var a=e({loader:async()=>import("./init.impl-XV367SGR.js"),parameters:{positional:{kind:"tuple",parameters:[{brief:"Git URL of the config repository (omit to create new project)",parse:String,placeholder:"repo-url",optional:!0}]},flags:{path:{kind:"parsed",brief:"Path for the dotfiles directory",parse:String,default:"~/.dots"}}},docs:{brief:"Initialize dots (clone existing repo or create new project)"}}),p=e({loader:async()=>import("./apply.impl-S5OH5NTZ.js"),parameters:{flags:{dry:{kind:"boolean",brief:"Show what would be done without making changes",default:!1}}},docs:{brief:"Apply the configuration from the current directory"}}),s=n({routes:{init:a,apply:p},docs:{brief:o}}),u=i(s,{name:"dots",versionInfo:{currentVersion:t}});import c from"node:fs";import l from"node:os";import m from"node:path";function y(r){return{process:r,os:l,fs:c,path:m}}export{u as a,y as b};
1
+ import{a as o,b as t}from"./chunk-6ABAXPMT.js";import{buildApplication as i,buildCommand as e,buildRouteMap as n}from"@stricli/core";var a=e({loader:async()=>import("./init.impl-WDM22MCX.js"),parameters:{positional:{kind:"tuple",parameters:[{brief:"Git URL of the config repository (omit to create new project)",parse:String,placeholder:"repo-url",optional:!0}]},flags:{path:{kind:"parsed",brief:"Path for the dotfiles directory",parse:String,default:"~/.dots"}}},docs:{brief:"Initialize dots (clone existing repo or create new project)"}}),p=e({loader:async()=>import("./apply.impl-P5EFB4G5.js"),parameters:{flags:{dry:{kind:"boolean",brief:"Show what would be done without making changes",default:!1}}},docs:{brief:"Apply the configuration from the current directory"}}),s=n({routes:{init:a,apply:p},docs:{brief:o}}),u=i(s,{name:"dots",versionInfo:{currentVersion:t}});import c from"node:fs";import l from"node:os";import m from"node:path";function y(r){return{process:r,os:l,fs:c,path:m}}export{u as a,y as b};
@@ -1,4 +1,4 @@
1
- import{b as u}from"./chunk-7VN7XXCT.js";import{exec as m}from"node:child_process";import{lstat as f,mkdir as y,readFile as h,writeFile as a}from"node:fs/promises";import{homedir as d}from"node:os";import{resolve as s}from"node:path";import{promisify as b}from"node:util";var l=t=>`{
1
+ import{b as u}from"./chunk-6ABAXPMT.js";import{exec as m}from"node:child_process";import{lstat as f,mkdir as y,readFile as h,writeFile as a}from"node:fs/promises";import{homedir as d}from"node:os";import{resolve as s}from"node:path";import{promisify as b}from"node:util";var l=t=>`{
2
2
  "name": "dotfiles",
3
3
  "private": true,
4
4
  "type": "module",
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "description": "Declarative dotfiles and Mac setup manager",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
- "version": "1.2.1",
7
+ "version": "1.2.2",
8
8
  "files": [
9
9
  "dist"
10
10
  ],
@@ -1 +0,0 @@
1
- var s="Declarative dotfiles and Mac setup manager";var i="1.2.1";export{s as a,i as b};