tinker-node-manager 0.0.0-stage → 0.1.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.
- package/README.md +29 -2
- package/dist/preload/index.js +13 -0
- package/dist/renderer/assets/app-DOZnQQDR.js +52 -0
- package/dist/renderer/assets/app-DOhmaQUe.css +1 -0
- package/dist/renderer/index.html +12 -0
- package/icon.png +0 -0
- package/package.json +118 -4
package/README.md
CHANGED
|
@@ -1,3 +1,30 @@
|
|
|
1
|
-
#
|
|
1
|
+
# tinker-node-manager
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A Node.js version manager plugin for [TINKER](https://github.com/liriliri/tinker), powered by [fnm](https://github.com/Schniz/fnm) via `fnm-static`.
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **Browse versions** — merged list of installed and remote releases, installed first
|
|
10
|
+
- **Install / Uninstall** Node.js versions from each row
|
|
11
|
+
- **Set Default** — mark an installed version as fnm default (highlighted row)
|
|
12
|
+
- **Set up terminal** — write fnm shell init using the bundled binary (no separate fnm install)
|
|
13
|
+
- **Filter & refresh** the version list
|
|
14
|
+
- **MCP tools** `list_versions`, `list_remote_versions`, `install_version`, `uninstall_version`, and `set_default` for agent / CLI automation
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
Download and install TINKER from `https://tinker.liriliri.io/`, then run `npm i -g tinker-node-manager`.
|
|
19
|
+
|
|
20
|
+
## Requirements
|
|
21
|
+
|
|
22
|
+
Versions are managed by the bundled fnm binary. Node installs live under fnm’s data directory (typically `~/.local/share/fnm`). For terminal `node` to follow the default version, use **Set up terminal** in the toolbar (writes init into your shell rc and links fnm under `~/.tinker/tinker-node-manager/bin`), then open a new terminal.
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
1. Browse installed and remote Node.js versions in the table
|
|
27
|
+
2. Click **Install** on an available version, or **Uninstall** on an installed one
|
|
28
|
+
3. Click **Set Default** on an installed version (the current default is highlighted)
|
|
29
|
+
4. Use **Set up terminal** once so new shells pick up fnm
|
|
30
|
+
5. Filter by version, alias, or LTS name; refresh to reload remote releases
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";const Zr=require("electron"),Qr=require("node:child_process"),Yr=require("node:util"),l=require("node:fs/promises"),jr=require("node:os"),v=require("node:path");function h(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var q={exports:{}},y={exports:{}},g={exports:{}},w={exports:{}},R={exports:{}},or;function Z(){return or||(or=1,(function(e,r){var n=Object.prototype.toString;r=function(t){return n.call(t)},e.exports=r})(R,R.exports)),R.exports}var ur;function _r(){return ur||(ur=1,(function(e,r){var n=Z();r=function(t){var i=n(t);return i==="[object Function]"||i==="[object GeneratorFunction]"||i==="[object AsyncFunction]"},e.exports=r})(w,w.exports)),w.exports}var A={exports:{}},ar;function re(){return ar||(ar=1,(function(e,r){r=function(n){var t=typeof n;return!!n&&(t==="function"||t==="object")},e.exports=r})(A,A.exports)),A.exports}var b={exports:{}},fr;function rr(){return fr||(fr=1,(function(e,r){var n=Z();Array.isArray?r=Array.isArray:r=function(t){return n(t)==="[object Array]"},e.exports=r})(b,b.exports)),b.exports}var S={exports:{}},O={exports:{}},cr;function er(){return cr||(cr=1,(function(e,r){r=function(n){return n===void 0},e.exports=r})(O,O.exports)),O.exports}var pr;function Br(){return pr||(pr=1,(function(e,r){var n=er();r=function(t,i,s){if(n(i))return t;switch(s??3){case 1:return function(o){return t.call(i,o)};case 3:return function(o,a,u){return t.call(i,o,a,u)};case 4:return function(o,a,u,f){return t.call(i,o,a,u,f)}}return function(){return t.apply(i,arguments)}},e.exports=r})(S,S.exports)),S.exports}var E={exports:{}},I={exports:{}},$={exports:{}},C={exports:{}},lr;function Dr(){return lr||(lr=1,(function(e,r){var n=Object.prototype.hasOwnProperty;r=function(t,i){return n.call(t,i)},e.exports=r})(C,C.exports)),C.exports}var vr;function Q(){return vr||(vr=1,(function(e,r){var n=Dr();Object.keys?r=Object.keys:r=function(t){var i=[];for(var s in t)n(t,s)&&i.push(s);return i},e.exports=r})($,$.exports)),$.exports}var P={exports:{}},k={exports:{}},F={exports:{}},L={exports:{}},xr;function ee(){return xr||(xr=1,(function(e,r){var n=Z();r=function(t){return n(t)==="[object Number]"},e.exports=r})(L,L.exports)),L.exports}var hr;function tr(){return hr||(hr=1,(function(e,r){var n=ee(),t=_r(),i=Math.pow(2,53)-1;r=function(s){if(!s)return!1;var o=s.length;return n(o)&&o>=0&&o<=i&&!t(s)},e.exports=r})(F,F.exports)),F.exports}var dr;function nr(){return dr||(dr=1,(function(e,r){var n=tr(),t=Q(),i=Br();r=function(s,o,a){o=i(o,a);var u,f;if(n(s))for(u=0,f=s.length;u<f;u++)o(s[u],u,s);else{var c=t(s);for(u=0,f=c.length;u<f;u++)o(s[c[u]],c[u],s)}return s},e.exports=r})(k,k.exports)),k.exports}var mr;function te(){return mr||(mr=1,(function(e,r){var n=er(),t=nr();r=function(i,s){return function(o){return t(arguments,function(a,u){if(u!==0){var f=i(a);t(f,function(c){(!s||n(o[c]))&&(o[c]=a[c])})}}),o}},e.exports=r})(P,P.exports)),P.exports}var qr;function ne(){return qr||(qr=1,(function(e,r){var n=Q(),t=te();r=t(n),e.exports=r})(I,I.exports)),I.exports}var V={exports:{}},yr;function ie(){return yr||(yr=1,(function(e,r){var n=Q();r=function(t,i){var s=n(i),o=s.length;if(t==null)return!o;t=Object(t);for(var a=0;a<o;a++){var u=s[a];if(i[u]!==t[u]||!(u in t))return!1}return!0},e.exports=r})(V,V.exports)),V.exports}var gr;function se(){return gr||(gr=1,(function(e,r){var n=ne(),t=ie();r=function(i){return i=n({},i),function(s){return t(s,i)}},e.exports=r})(E,E.exports)),E.exports}var M={exports:{}},wr;function oe(){return wr||(wr=1,(function(e,r){r=function(n){return n},e.exports=r})(M,M.exports)),M.exports}var N={exports:{}},T={exports:{}},z={exports:{}},Rr;function ue(){return Rr||(Rr=1,(function(e,r){var n=Dr(),t=rr();r=function(o,a){if(t(o))return o;if(a&&n(a,o))return[o];var u=[];return o.replace(i,function(f,c,p,m){u.push(p?m.replace(s,"$1"):c||f)}),u};var i=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,s=/\\(\\)?/g;e.exports=r})(z,z.exports)),z.exports}var Ar;function ae(){return Ar||(Ar=1,(function(e,r){var n=er(),t=ue();r=function(i,s){s=t(s,i);var o;for(o=s.shift();!n(o);){if(i=i[o],i==null)return;o=s.shift()}return i},e.exports=r})(T,T.exports)),T.exports}var br;function fe(){return br||(br=1,(function(e,r){var n=rr(),t=ae();r=function(s){return n(s)?function(o){return t(o,s)}:i(s)};function i(s){return function(o){return o?.[s]}}e.exports=r})(N,N.exports)),N.exports}var Sr;function Gr(){return Sr||(Sr=1,(function(e,r){var n=_r(),t=re(),i=rr(),s=Br(),o=se(),a=oe(),u=fe();r=function(f,c,p){return f==null?a:n(f)?s(f,c,p):t(f)&&!i(f)?o(f):u(f)},e.exports=r})(g,g.exports)),g.exports}var Or;function Ur(){return Or||(Or=1,(function(e,r){var n=Gr(),t=nr();r=function(i,s,o){var a=[];return s=n(s,o),t(i,function(u,f,c){s(u,f,c)&&a.push(u)}),a},e.exports=r})(y,y.exports)),y.exports}var Er;function ce(){return Er||(Er=1,(function(e,r){var n=Ur();r=function(t){return n(t,function(i){return!!i})},e.exports=r})(q,q.exports)),q.exports}var pe=ce();const le=h(pe);var j={exports:{}},_={exports:{}},Ir;function ve(){return Ir||(Ir=1,(function(e,r){r=function(n,t,i){return Array.prototype.indexOf.call(n,t,i)},e.exports=r})(_,_.exports)),_.exports}var B={exports:{}},$r;function xe(){return $r||($r=1,(function(e,r){var n=Z();r=function(t){return n(t)==="[object String]"},e.exports=r})(B,B.exports)),B.exports}var D={exports:{}},Cr;function he(){return Cr||(Cr=1,(function(e,r){var n=nr();r=function(t){var i=[];return n(t,function(s){i.push(s)}),i},e.exports=r})(D,D.exports)),D.exports}var Pr;function de(){return Pr||(Pr=1,(function(e,r){var n=ve(),t=xe(),i=tr(),s=he();r=function(o,a){return t(o)?o.indexOf(a)>-1:(i(o)||(o=s(o)),n(o,a)>=0)},e.exports=r})(j,j.exports)),j.exports}var me=de();const K=h(me);var qe=Ur();const Wr=h(qe);var G={exports:{}},kr;function ye(){return kr||(kr=1,(function(e,r){var n=Gr(),t=Q(),i=tr();r=function(s,o,a){o=n(o,a);for(var u=!i(s)&&t(s),f=(u||s).length,c=Array(f),p=0;p<f;p++){var m=u?u[p]:p;c[p]=o(s[m],m,s)}return c},e.exports=r})(G,G.exports)),G.exports}var ge=ye();const ir=h(ge);var U={exports:{}},Fr;function we(){return Fr||(Fr=1,(function(e,r){var n=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;r=function(t){return t.replace(n,"")},e.exports=r})(U,U.exports)),U.exports}var Re=we();const sr=h(Re);var W={exports:{}},H={exports:{}},Lr;function Ae(){return Lr||(Lr=1,(function(e,r){var n=/^\s+/;r=function(t,i){if(i==null)return t.trimLeft?t.trimLeft():t.replace(n,"");for(var s=0,o=t.length,a=i.length,u=!0,f,c;u&&s<o;)for(u=!1,f=-1,c=t.charAt(s);++f<a;)if(c===i[f]){u=!0,s++;break}return s>=o?"":t.substr(s,o)},e.exports=r})(H,H.exports)),H.exports}var X={exports:{}},Vr;function Hr(){return Vr||(Vr=1,(function(e,r){r=function(n,t){if(t==null){if(n.trimRight)return n.trimRight();t=` \r
|
|
2
|
+
\f\v`}for(var i=n.length-1,s=t.length,o=!0,a,u;o&&i>=0;)for(o=!1,a=-1,u=n.charAt(i);++a<s;)if(u===t[a]){o=!0,i--;break}return i>=0?n.substring(0,i+1):""},e.exports=r})(X,X.exports)),X.exports}var Mr;function be(){return Mr||(Mr=1,(function(e,r){var n=Ae(),t=Hr();r=function(i,s){return s==null&&i.trim?i.trim():n(t(i,s),s)},e.exports=r})(W,W.exports)),W.exports}var Se=be();const x=h(Se),Oe=Yr.promisify(Qr.execFile),Nr=require("fnm-static");function Xr(){if(!Nr)throw new Error("fnm binary not found for this platform");return Nr}async function d(e,r){const n=Xr();try{const{stdout:t,stderr:i}=await Oe(n,e,{encoding:"utf8",maxBuffer:20971520,timeout:r?.timeout??0,env:process.env});return{stdout:t||"",stderr:i||""}}catch(t){const i=t,s=x(sr(i.stderr||i.stdout||i.message||""));throw new Error(s||"fnm command failed")}}function Ee(e){const r=x(sr(e).replace(/^\*\s+/,""));if(!r)return null;const n=r.match(/^(\S+)(?:\s+(.*))?$/);if(!n)return null;const t=n[1],i=n[2]?le(ir(n[2].split(","),s=>x(s))):[];return{id:t,version:t,aliases:i,isDefault:K(i,"default"),isSystem:t==="system"}}async function Ie(){const{stdout:e}=await d(["list","--log-level","quiet"]);return Wr(ir(e.split(`
|
|
3
|
+
`),r=>Ee(r)),r=>r!==null)}async function $e(e){const r=x(e);if(!r)throw new Error("Version is required");const n=["install","--progress","never","--log-level","info"];r==="lts"?n.push("--lts"):r==="latest"?n.push("--latest"):n.push(r),await d(n,{timeout:600*1e3})}async function Ce(e){const r=x(e);if(!r)throw new Error("Version is required");if(r==="system")throw new Error("Cannot uninstall system Node");await d(["uninstall",r,"--log-level","info"])}async function Pe(e){const r=x(e);if(!r)throw new Error("Version is required");if(r==="system")throw new Error("Cannot set system as default via fnm");await d(["default",r,"--log-level","info"])}function ke(e){const r=x(sr(e));if(!r)return null;const n=r.match(/^(\S+)(?:\s+\(([^)]+)\))?$/);if(!n)return null;const t=n[1];return{id:t,version:t,lts:n[2]?x(n[2]):null}}async function Fe(e){const r=["list-remote","--sort","desc","--log-level","quiet"];e?.ltsOnly&&r.splice(1,0,"--lts");const{stdout:n}=await d(r);return Wr(ir(n.split(`
|
|
4
|
+
`),t=>ke(t)),t=>t!==null)}var J={exports:{}},Tr;function Le(){return Tr||(Tr=1,(function(e,r){r=function(n,t){var i=n.length-t.length;return i>=0&&n.indexOf(t,i)===i},e.exports=r})(J,J.exports)),J.exports}var Ve=Le();const Me=h(Ve);var Ne=Hr();const Te=h(Ne),Jr="# >>> tinker-node-manager >>>",Y="# <<< tinker-node-manager <<<",zr=v.join(jr.homedir(),".tinker","tinker-node-manager","bin");function ze(e){const r=v.basename(e).toLowerCase();return K(r,"zsh")?"zsh":K(r,"bash")?"bash":K(r,"fish")?"fish":r||"sh"}function je(e,r){return e==="zsh"?v.join(r,".zshrc"):e==="fish"?v.join(r,".config","fish","config.fish"):e==="bash"?v.join(r,".bashrc"):v.join(r,".profile")}function _e(e,r){const n=JSON.stringify(r),t=e==="fish"?`${n} env --shell fish | source`:`eval "$(${n} env)"`;return`${Jr}
|
|
5
|
+
${t}
|
|
6
|
+
${Y}`}function Be(e,r){const n=e.indexOf(Jr),t=e.indexOf(Y);if(n!==-1&&t!==-1&&t>n){const s=e.slice(0,n),o=e.slice(t+Y.length).replace(/^\n/,""),a=`${s}${r}
|
|
7
|
+
${o}`;return Me(a,`
|
|
8
|
+
`)?a:`${a}
|
|
9
|
+
`}const i=Te(e);return i?`${i}
|
|
10
|
+
|
|
11
|
+
${r}
|
|
12
|
+
`:`${r}
|
|
13
|
+
`}async function De(e){await l.mkdir(zr,{recursive:!0});const r=v.join(zr,process.platform==="win32"?"fnm.exe":"fnm");try{await l.unlink(r)}catch{}try{await l.symlink(e,r)}catch{await l.copyFile(e,r),await l.chmod(r,493)}return r}function Kr(){const e=jr.homedir(),r=ze(process.env.SHELL||"/bin/zsh");return{shell:r,rcPath:je(r,e)}}async function Ge(){const e=Xr(),r=Kr(),n=await De(e),t=_e(r.shell,n);r.shell==="fish"&&await l.mkdir(v.dirname(r.rcPath),{recursive:!0});let i="";try{i=await l.readFile(r.rcPath,"utf8")}catch{i=""}return await l.writeFile(r.rcPath,Be(i,t),"utf8"),{...r,fnmPath:n}}const Ue={listVersions:()=>Ie(),listRemoteVersions:e=>Fe(e),installVersion:e=>$e(e),uninstallVersion:e=>Ce(e),setDefaultVersion:e=>Pe(e),getShellSetupPreview:()=>Kr(),setupShellEnv:()=>Ge()};Zr.contextBridge.exposeInMainWorld("nodeManager",Ue);
|