@eunjae/dots 1.0.2 → 1.0.3
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.
- package/dist/bin/bash-complete.js +1 -1
- package/dist/bin/cli.js +1 -1
- package/dist/{chunk-QIS5QHQM.js → chunk-X22WBCAA.js} +1 -1
- package/dist/chunk-XHYWYFTY.js +1 -0
- package/dist/init.impl-TXHQE6X3.js +133 -0
- package/package.json +1 -1
- package/dist/chunk-DNQSYMNA.js +0 -1
- package/dist/init.impl-ITIVD5YC.js +0 -127
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as o,b as s}from"../chunk-
|
|
2
|
+
import{a as o,b as s}from"../chunk-X22WBCAA.js";import"../chunk-XHYWYFTY.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-
|
|
2
|
+
import{a as r,b as o}from"../chunk-X22WBCAA.js";import"../chunk-XHYWYFTY.js";import{run as i}from"@stricli/core";await i(r,process.argv.slice(2),o(process));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as o,b as t}from"./chunk-
|
|
1
|
+
import{a as o,b as t}from"./chunk-XHYWYFTY.js";import{buildApplication as i,buildCommand as e,buildRouteMap as n}from"@stricli/core";var a=e({loader:async()=>import("./init.impl-TXHQE6X3.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-27DRVKZK.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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var s="Declarative dotfiles and Mac setup manager";var i="1.0.3";export{s as a,i as b};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import{b as u}from"./chunk-XHYWYFTY.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
|
+
"name": "dotfiles",
|
|
3
|
+
"private": true,
|
|
4
|
+
"type": "module",
|
|
5
|
+
"devDependencies": {
|
|
6
|
+
"@eunjae/dots": "^${t}"
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
`,w=`node_modules
|
|
10
|
+
`,c=`import { defineConfig } from "@eunjae/dots";
|
|
11
|
+
|
|
12
|
+
export default defineConfig({
|
|
13
|
+
// Clone additional repositories
|
|
14
|
+
// repos: [
|
|
15
|
+
// { url: "git@github.com:user/project.git", dest: "~/workspace/project" },
|
|
16
|
+
// ],
|
|
17
|
+
|
|
18
|
+
// Create symlinks
|
|
19
|
+
symlinks: [
|
|
20
|
+
// { src: "./zshrc", dest: "~/.zshrc" },
|
|
21
|
+
// { src: "./gitconfig", dest: "~/.gitconfig" },
|
|
22
|
+
],
|
|
23
|
+
|
|
24
|
+
// Install Homebrew packages
|
|
25
|
+
brew: [
|
|
26
|
+
// "ripgrep",
|
|
27
|
+
// {
|
|
28
|
+
// name: "neovim",
|
|
29
|
+
// symlinks: [{ src: "./nvim", dest: "~/.config/nvim" }],
|
|
30
|
+
// },
|
|
31
|
+
],
|
|
32
|
+
});
|
|
33
|
+
`,g=`# Dotfiles
|
|
34
|
+
|
|
35
|
+
Managed with [@eunjae/dots](https://github.com/eunjae-lee/dots).
|
|
36
|
+
|
|
37
|
+
## Setup on a new machine
|
|
38
|
+
|
|
39
|
+
\`\`\`bash
|
|
40
|
+
npx @eunjae/dots init git@github.com:YOUR_USERNAME/dotfiles.git
|
|
41
|
+
\`\`\`
|
|
42
|
+
|
|
43
|
+
## Apply changes
|
|
44
|
+
|
|
45
|
+
\`\`\`bash
|
|
46
|
+
cd ~/.dots
|
|
47
|
+
npx @eunjae/dots apply
|
|
48
|
+
\`\`\`
|
|
49
|
+
|
|
50
|
+
## Preview changes (dry run)
|
|
51
|
+
|
|
52
|
+
\`\`\`bash
|
|
53
|
+
npx @eunjae/dots apply --dry
|
|
54
|
+
\`\`\`
|
|
55
|
+
`;var o=b(m);async function r(t){try{return await f(t),!0}catch{return!1}}async function p(){try{return await o("which brew"),!0}catch{return!1}}async function k(){console.log("Installing Homebrew..."),await o('/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"',{stdio:"inherit"})}async function S(t){try{return await o(`brew list ${t}`),!0}catch{return!1}}async function C(t){console.log(`Installing ${t}...`),await o(`brew install ${t}`)}async function x(){let t=s(d(),".ssh"),i=["id_ed25519","id_rsa","id_ecdsa"];for(let e of i)if(await r(s(t,e)))return!0;return!1}function H(t){t.stdout.write(`
|
|
56
|
+
To generate an SSH key, run:
|
|
57
|
+
`),t.stdout.write(` ssh-keygen -t ed25519 -C "your_email@example.com"
|
|
58
|
+
|
|
59
|
+
`),t.stdout.write(` Then add it to GitHub:
|
|
60
|
+
`),t.stdout.write(` 1. Copy your public key: cat ~/.ssh/id_ed25519.pub
|
|
61
|
+
`),t.stdout.write(` 2. Go to https://github.com/settings/keys
|
|
62
|
+
`),t.stdout.write(` 3. Click 'New SSH key' and paste the key
|
|
63
|
+
`),t.stdout.write(` 4. Re-run this command after adding the key
|
|
64
|
+
|
|
65
|
+
`)}async function $(){let t=s(d(),".ssh"),i=["id_ed25519.pub","id_rsa.pub","id_ecdsa.pub"];for(let e of i){let n=s(t,e);if(await r(n))return(await h(n,"utf-8")).trim()}throw new Error("No SSH public key found")}async function j(){try{await o("ssh -T git@github.com 2>&1 || true");let{stderr:t}=await o("ssh -T git@github.com 2>&1 || true");return t.includes("successfully authenticated")||t.includes("You've successfully authenticated")}catch{return!1}}async function v(t,i){if(i.stdout.write(`
|
|
66
|
+
\u{1F4C1} Creating new dotfiles project at ${t}
|
|
67
|
+
|
|
68
|
+
`),await r(t)){i.stderr.write(`Error: Directory already exists: ${t}
|
|
69
|
+
`),i.exit(1);return}await y(t,{recursive:!0}),await a(s(t,"package.json"),l(u)),await a(s(t,".gitignore"),w),await a(s(t,"dots.config.ts"),c),await a(s(t,"README.md"),g),i.stdout.write(` \u2713 Created package.json
|
|
70
|
+
`),i.stdout.write(` \u2713 Created .gitignore
|
|
71
|
+
`),i.stdout.write(` \u2713 Created dots.config.ts
|
|
72
|
+
`),i.stdout.write(` \u2713 Created README.md
|
|
73
|
+
`),await o(`git -C "${t}" init`),i.stdout.write(` \u2713 Initialized git repository
|
|
74
|
+
`),i.stdout.write(`
|
|
75
|
+
\u{1F4E6} Installing dependencies...
|
|
76
|
+
`);try{await o(`cd "${t}" && npm install`),i.stdout.write(` \u2713 Dependencies installed
|
|
77
|
+
`)}catch{i.stdout.write(` \u26A0 Could not install dependencies (package may not be published yet)
|
|
78
|
+
`),i.stdout.write(` Run 'npm install' manually after publishing @eunjae/dots
|
|
79
|
+
`)}i.stdout.write(`
|
|
80
|
+
\u2705 Project created!
|
|
81
|
+
|
|
82
|
+
`),i.stdout.write(`Next steps:
|
|
83
|
+
`),i.stdout.write(` cd ${t}
|
|
84
|
+
`),i.stdout.write(` # Edit dots.config.ts
|
|
85
|
+
`),i.stdout.write(` # Add your dotfiles (zshrc, gitconfig, etc.)
|
|
86
|
+
`),i.stdout.write(` git remote add origin git@github.com:YOUR_USERNAME/dotfiles.git
|
|
87
|
+
`),i.stdout.write(` npx @eunjae/dots apply --dry
|
|
88
|
+
|
|
89
|
+
`)}async function E(t,i,e){e.stdout.write(`
|
|
90
|
+
\u{1F680} Initializing dots with config repo: ${t}
|
|
91
|
+
|
|
92
|
+
`),e.stdout.write(`Step 1: Checking Homebrew...
|
|
93
|
+
`),await p()?e.stdout.write(` \u2713 Homebrew is installed
|
|
94
|
+
`):(await k(),e.stdout.write(` \u2713 Homebrew installed
|
|
95
|
+
`)),e.stdout.write(`
|
|
96
|
+
Step 2: Installing git and gh...
|
|
97
|
+
`);for(let n of["git","gh"])await S(n)?e.stdout.write(` \u2713 ${n} is installed
|
|
98
|
+
`):(await C(n),e.stdout.write(` \u2713 ${n} installed
|
|
99
|
+
`));if(e.stdout.write(`
|
|
100
|
+
Step 3: Checking SSH key and GitHub access...
|
|
101
|
+
`),!await x()){e.stdout.write(` \u26A0\uFE0F No SSH key found.
|
|
102
|
+
`),H(e);return}if(e.stdout.write(` \u2713 SSH key exists
|
|
103
|
+
`),!await j()){let n=await $();e.stdout.write(`
|
|
104
|
+
\u26A0\uFE0F SSH key not added to GitHub yet.
|
|
105
|
+
`),e.stdout.write(`
|
|
106
|
+
Your public key:
|
|
107
|
+
`),e.stdout.write(` ${n}
|
|
108
|
+
|
|
109
|
+
`),e.stdout.write(` Please add this key to GitHub:
|
|
110
|
+
`),e.stdout.write(` 1. Go to https://github.com/settings/keys
|
|
111
|
+
`),e.stdout.write(` 2. Click 'New SSH key' and paste the key
|
|
112
|
+
`),e.stdout.write(` 3. Re-run this command after adding the key
|
|
113
|
+
|
|
114
|
+
`),e.stdout.write(` Or run: gh auth login
|
|
115
|
+
|
|
116
|
+
`);return}e.stdout.write(` \u2713 GitHub SSH access confirmed
|
|
117
|
+
`),e.stdout.write(`
|
|
118
|
+
Step 4: Cloning config repo to ${i}...
|
|
119
|
+
`),await r(i)?e.stdout.write(` \u2713 Config repo already exists at ${i}
|
|
120
|
+
`):(await o(`git clone "${t}" "${i}"`),e.stdout.write(` \u2713 Config repo cloned
|
|
121
|
+
`)),e.stdout.write(`
|
|
122
|
+
Step 5: Installing dependencies...
|
|
123
|
+
`);try{await o(`cd "${i}" && npm install`),e.stdout.write(` \u2713 Dependencies installed
|
|
124
|
+
`)}catch{e.stdout.write(` \u26A0 Could not install dependencies
|
|
125
|
+
`),e.stdout.write(` Run 'npm install' manually in the config directory
|
|
126
|
+
`)}e.stdout.write(`
|
|
127
|
+
\u2705 Bootstrap complete!
|
|
128
|
+
|
|
129
|
+
`),e.stdout.write(`Next steps:
|
|
130
|
+
`),e.stdout.write(` cd ${i}
|
|
131
|
+
`),e.stdout.write(` npx @eunjae/dots apply
|
|
132
|
+
|
|
133
|
+
`)}async function P(t,i){let{process:e}=this,n=t.path.startsWith("~/")?s(d(),t.path.slice(2)):s(t.path);i?await E(i,n,e):await v(n,e)}export{P as default};
|
package/package.json
CHANGED
package/dist/chunk-DNQSYMNA.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var s="Declarative dotfiles and Mac setup manager";var i="1.0.2";export{s as a,i as b};
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import{b as l}from"./chunk-DNQSYMNA.js";import{exec as y}from"node:child_process";import{lstat as h,mkdir as p,readFile as f,writeFile as r}from"node:fs/promises";import{homedir as d}from"node:os";import{resolve as n}from"node:path";import{promisify as b}from"node:util";var c=e=>`{
|
|
2
|
-
"name": "dotfiles",
|
|
3
|
-
"private": true,
|
|
4
|
-
"type": "module",
|
|
5
|
-
"devDependencies": {
|
|
6
|
-
"@eunjae/dots": "^${e}"
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
`,w=`node_modules
|
|
10
|
-
`,g=`import { defineConfig } from "@eunjae/dots";
|
|
11
|
-
|
|
12
|
-
export default defineConfig({
|
|
13
|
-
// Clone additional repositories
|
|
14
|
-
// repos: [
|
|
15
|
-
// { url: "git@github.com:user/project.git", dest: "~/workspace/project" },
|
|
16
|
-
// ],
|
|
17
|
-
|
|
18
|
-
// Create symlinks
|
|
19
|
-
symlinks: [
|
|
20
|
-
// { src: "./zshrc", dest: "~/.zshrc" },
|
|
21
|
-
// { src: "./gitconfig", dest: "~/.gitconfig" },
|
|
22
|
-
],
|
|
23
|
-
|
|
24
|
-
// Install Homebrew packages
|
|
25
|
-
brew: [
|
|
26
|
-
// "git",
|
|
27
|
-
// "ripgrep",
|
|
28
|
-
// {
|
|
29
|
-
// name: "neovim",
|
|
30
|
-
// symlinks: [{ src: "./nvim", dest: "~/.config/nvim" }],
|
|
31
|
-
// },
|
|
32
|
-
],
|
|
33
|
-
});
|
|
34
|
-
`,m=`# Dotfiles
|
|
35
|
-
|
|
36
|
-
Managed with [@eunjae/dots](https://github.com/eunjae-lee/dots).
|
|
37
|
-
|
|
38
|
-
## Setup on a new machine
|
|
39
|
-
|
|
40
|
-
\`\`\`bash
|
|
41
|
-
npx @eunjae/dots init git@github.com:YOUR_USERNAME/dotfiles.git
|
|
42
|
-
\`\`\`
|
|
43
|
-
|
|
44
|
-
## Apply changes
|
|
45
|
-
|
|
46
|
-
\`\`\`bash
|
|
47
|
-
cd ~/.dots
|
|
48
|
-
npx @eunjae/dots apply
|
|
49
|
-
\`\`\`
|
|
50
|
-
|
|
51
|
-
## Preview changes (dry run)
|
|
52
|
-
|
|
53
|
-
\`\`\`bash
|
|
54
|
-
npx @eunjae/dots apply --dry
|
|
55
|
-
\`\`\`
|
|
56
|
-
`;var s=b(y);async function u(e){try{return await h(e),!0}catch{return!1}}async function S(){try{return await s("which brew"),!0}catch{return!1}}async function k(){console.log("Installing Homebrew..."),await s('/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"',{stdio:"inherit"})}async function x(e){try{return await s(`brew list ${e}`),!0}catch{return!1}}async function C(e){console.log(`Installing ${e}...`),await s(`brew install ${e}`)}async function H(){let e=n(d(),".ssh"),i=["id_ed25519","id_rsa","id_ecdsa"];for(let t of i)if(await u(n(e,t)))return!0;return!1}async function $(){let e=n(d(),".ssh","id_ed25519");return console.log("Generating SSH key..."),await s(`ssh-keygen -t ed25519 -f "${e}" -N ""`),(await f(`${e}.pub`,"utf-8")).trim()}async function j(){let e=n(d(),".ssh"),i=["id_ed25519.pub","id_rsa.pub","id_ecdsa.pub"];for(let t of i){let o=n(e,t);if(await u(o))return(await f(o,"utf-8")).trim()}throw new Error("No SSH public key found")}async function v(){try{await s("ssh -T git@github.com 2>&1 || true");let{stderr:e}=await s("ssh -T git@github.com 2>&1 || true");return e.includes("successfully authenticated")||e.includes("You've successfully authenticated")}catch{return!1}}async function E(e,i){if(i.stdout.write(`
|
|
57
|
-
\u{1F4C1} Creating new dotfiles project at ${e}
|
|
58
|
-
|
|
59
|
-
`),await u(e)){i.stderr.write(`Error: Directory already exists: ${e}
|
|
60
|
-
`),i.exit(1);return}await p(e,{recursive:!0}),await r(n(e,"package.json"),c(l)),await r(n(e,".gitignore"),w),await r(n(e,"dots.config.ts"),g),await r(n(e,"README.md"),m),i.stdout.write(` \u2713 Created package.json
|
|
61
|
-
`),i.stdout.write(` \u2713 Created .gitignore
|
|
62
|
-
`),i.stdout.write(` \u2713 Created dots.config.ts
|
|
63
|
-
`),i.stdout.write(` \u2713 Created README.md
|
|
64
|
-
`),await s(`git -C "${e}" init`),i.stdout.write(` \u2713 Initialized git repository
|
|
65
|
-
`),i.stdout.write(`
|
|
66
|
-
\u{1F4E6} Installing dependencies...
|
|
67
|
-
`);try{await s(`cd "${e}" && npm install`),i.stdout.write(` \u2713 Dependencies installed
|
|
68
|
-
`)}catch{i.stdout.write(` \u26A0 Could not install dependencies (package may not be published yet)
|
|
69
|
-
`),i.stdout.write(` Run 'npm install' manually after publishing @eunjae/dots
|
|
70
|
-
`)}i.stdout.write(`
|
|
71
|
-
\u2705 Project created!
|
|
72
|
-
|
|
73
|
-
`),i.stdout.write(`Next steps:
|
|
74
|
-
`),i.stdout.write(` cd ${e}
|
|
75
|
-
`),i.stdout.write(` # Edit dots.config.ts
|
|
76
|
-
`),i.stdout.write(` # Add your dotfiles (zshrc, gitconfig, etc.)
|
|
77
|
-
`),i.stdout.write(` git remote add origin git@github.com:YOUR_USERNAME/dotfiles.git
|
|
78
|
-
`),i.stdout.write(` npx @eunjae/dots apply --dry
|
|
79
|
-
|
|
80
|
-
`)}async function I(e,i,t){t.stdout.write(`
|
|
81
|
-
\u{1F680} Initializing dots with config repo: ${e}
|
|
82
|
-
|
|
83
|
-
`),t.stdout.write(`Step 1: Checking Homebrew...
|
|
84
|
-
`),await S()?t.stdout.write(` \u2713 Homebrew is installed
|
|
85
|
-
`):(await k(),t.stdout.write(` \u2713 Homebrew installed
|
|
86
|
-
`)),t.stdout.write(`
|
|
87
|
-
Step 2: Installing git and gh...
|
|
88
|
-
`);for(let a of["git","gh"])await x(a)?t.stdout.write(` \u2713 ${a} is installed
|
|
89
|
-
`):(await C(a),t.stdout.write(` \u2713 ${a} installed
|
|
90
|
-
`));t.stdout.write(`
|
|
91
|
-
Step 3: Setting up SSH key...
|
|
92
|
-
`);let o;if(await H()?(o=await j(),t.stdout.write(` \u2713 SSH key exists
|
|
93
|
-
`)):(o=await $(),t.stdout.write(` \u2713 SSH key generated
|
|
94
|
-
`)),t.stdout.write(`
|
|
95
|
-
Step 4: Checking GitHub SSH access...
|
|
96
|
-
`),await v())t.stdout.write(` \u2713 GitHub SSH access confirmed
|
|
97
|
-
`);else{t.stdout.write(`
|
|
98
|
-
\u26A0\uFE0F SSH key not added to GitHub yet.
|
|
99
|
-
`),t.stdout.write(`
|
|
100
|
-
Your public key:
|
|
101
|
-
`),t.stdout.write(` ${o}
|
|
102
|
-
|
|
103
|
-
`),t.stdout.write(` Please add this key to GitHub:
|
|
104
|
-
`),t.stdout.write(` 1. Go to https://github.com/settings/keys
|
|
105
|
-
`),t.stdout.write(` 2. Click 'New SSH key'
|
|
106
|
-
`),t.stdout.write(` 3. Paste the key above
|
|
107
|
-
`),t.stdout.write(` 4. Re-run this command after adding the key
|
|
108
|
-
|
|
109
|
-
`),t.stdout.write(` Or run: gh auth login
|
|
110
|
-
|
|
111
|
-
`);return}t.stdout.write(`
|
|
112
|
-
Step 5: Cloning config repo to ${i}...
|
|
113
|
-
`),await u(i)?t.stdout.write(` \u2713 Config repo already exists at ${i}
|
|
114
|
-
`):(await s(`git clone "${e}" "${i}"`),t.stdout.write(` \u2713 Config repo cloned
|
|
115
|
-
`)),t.stdout.write(`
|
|
116
|
-
Step 6: Installing dependencies...
|
|
117
|
-
`);try{await s(`cd "${i}" && npm install`),t.stdout.write(` \u2713 Dependencies installed
|
|
118
|
-
`)}catch{t.stdout.write(` \u26A0 Could not install dependencies
|
|
119
|
-
`),t.stdout.write(` Run 'npm install' manually in the config directory
|
|
120
|
-
`)}t.stdout.write(`
|
|
121
|
-
\u2705 Bootstrap complete!
|
|
122
|
-
|
|
123
|
-
`),t.stdout.write(`Next steps:
|
|
124
|
-
`),t.stdout.write(` cd ${i}
|
|
125
|
-
`),t.stdout.write(` npx @eunjae/dots apply
|
|
126
|
-
|
|
127
|
-
`)}async function K(e,i){let{process:t}=this,o=e.path.startsWith("~/")?n(d(),e.path.slice(2)):n(e.path);i?await I(i,o,t):await E(o,t)}export{K as default};
|