tinker-node-manager 0.0.0-stage → 0.1.1
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 +31 -2
- package/dist/preload/index.js +13 -0
- package/dist/renderer/assets/app-BJVI8T5K.js +52 -0
- package/dist/renderer/assets/app-DqK5wa2h.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,32 @@
|
|
|
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 (links fnm under `~/.tinker/tinker-node-manager/bin` and writes init into your shell rc), then open a new terminal.
|
|
23
|
+
|
|
24
|
+
Shell targets: **zsh** → `~/.zshrc`, **bash** → `~/.bashrc`, **fish** → `~/.config/fish/config.fish`, **Windows** → PowerShell profile (`Documents/PowerShell/Microsoft.PowerShell_profile.ps1`, or Windows PowerShell’s profile if that is the one already present).
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
1. Browse installed and remote Node.js versions in the table
|
|
29
|
+
2. Click **Install** on an available version, or **Uninstall** on an installed one
|
|
30
|
+
3. Click **Set Default** on an installed version (the current default is highlighted)
|
|
31
|
+
4. Use **Set up terminal** once so new shells pick up fnm
|
|
32
|
+
5. Filter by version, alias, or LTS name; refresh to reload remote releases
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";const ue=require("electron"),ae=require("node:child_process"),fe=require("node:util"),pr=require("node:fs"),x=require("node:fs/promises"),Yr=require("node:os"),p=require("node:path");function v(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var y={exports:{}},g={exports:{}},R={exports:{}},S={exports:{}},O={exports:{}},lr;function w(){return lr||(lr=1,(function(e,r){var t=Object.prototype.toString;r=function(n){return t.call(n)},e.exports=r})(O,O.exports)),O.exports}var vr;function Kr(){return vr||(vr=1,(function(e,r){var t=w();r=function(n){var i=t(n);return i==="[object Function]"||i==="[object GeneratorFunction]"||i==="[object AsyncFunction]"},e.exports=r})(S,S.exports)),S.exports}var b={exports:{}},xr;function ce(){return xr||(xr=1,(function(e,r){r=function(t){var n=typeof t;return!!t&&(n==="function"||n==="object")},e.exports=r})(b,b.exports)),b.exports}var A={exports:{}},hr;function sr(){return hr||(hr=1,(function(e,r){var t=w();Array.isArray?r=Array.isArray:r=function(n){return t(n)==="[object Array]"},e.exports=r})(A,A.exports)),A.exports}var E={exports:{}},I={exports:{}},dr;function or(){return dr||(dr=1,(function(e,r){r=function(t){return t===void 0},e.exports=r})(I,I.exports)),I.exports}var wr;function Zr(){return wr||(wr=1,(function(e,r){var t=or();r=function(n,i,s){if(t(i))return n;switch(s??3){case 1:return function(o){return n.call(i,o)};case 3:return function(o,a,u){return n.call(i,o,a,u)};case 4:return function(o,a,u,f){return n.call(i,o,a,u,f)}}return function(){return n.apply(i,arguments)}},e.exports=r})(E,E.exports)),E.exports}var P={exports:{}},$={exports:{}},C={exports:{}},k={exports:{}},mr;function Qr(){return mr||(mr=1,(function(e,r){var t=Object.prototype.hasOwnProperty;r=function(n,i){return t.call(n,i)},e.exports=r})(k,k.exports)),k.exports}var qr;function tr(){return qr||(qr=1,(function(e,r){var t=Qr();Object.keys?r=Object.keys:r=function(n){var i=[];for(var s in n)t(n,s)&&i.push(s);return i},e.exports=r})(C,C.exports)),C.exports}var F={exports:{}},L={exports:{}},j={exports:{}},N={exports:{}},yr;function pe(){return yr||(yr=1,(function(e,r){var t=w();r=function(n){return t(n)==="[object Number]"},e.exports=r})(N,N.exports)),N.exports}var gr;function ur(){return gr||(gr=1,(function(e,r){var t=pe(),n=Kr(),i=Math.pow(2,53)-1;r=function(s){if(!s)return!1;var o=s.length;return t(o)&&o>=0&&o<=i&&!n(s)},e.exports=r})(j,j.exports)),j.exports}var Rr;function ar(){return Rr||(Rr=1,(function(e,r){var t=ur(),n=tr(),i=Zr();r=function(s,o,a){o=i(o,a);var u,f;if(t(s))for(u=0,f=s.length;u<f;u++)o(s[u],u,s);else{var c=n(s);for(u=0,f=c.length;u<f;u++)o(s[c[u]],c[u],s)}return s},e.exports=r})(L,L.exports)),L.exports}var Sr;function le(){return Sr||(Sr=1,(function(e,r){var t=or(),n=ar();r=function(i,s){return function(o){return n(arguments,function(a,u){if(u!==0){var f=i(a);n(f,function(c){(!s||t(o[c]))&&(o[c]=a[c])})}}),o}},e.exports=r})(F,F.exports)),F.exports}var Or;function ve(){return Or||(Or=1,(function(e,r){var t=tr(),n=le();r=n(t),e.exports=r})($,$.exports)),$.exports}var V={exports:{}},br;function xe(){return br||(br=1,(function(e,r){var t=tr();r=function(n,i){var s=t(i),o=s.length;if(n==null)return!o;n=Object(n);for(var a=0;a<o;a++){var u=s[a];if(i[u]!==n[u]||!(u in n))return!1}return!0},e.exports=r})(V,V.exports)),V.exports}var Ar;function he(){return Ar||(Ar=1,(function(e,r){var t=ve(),n=xe();r=function(i){return i=t({},i),function(s){return n(s,i)}},e.exports=r})(P,P.exports)),P.exports}var M={exports:{}},Er;function de(){return Er||(Er=1,(function(e,r){r=function(t){return t},e.exports=r})(M,M.exports)),M.exports}var T={exports:{}},W={exports:{}},z={exports:{}},Ir;function we(){return Ir||(Ir=1,(function(e,r){var t=Qr(),n=sr();r=function(o,a){if(n(o))return o;if(a&&t(a,o))return[o];var u=[];return o.replace(i,function(f,c,l,q){u.push(l?q.replace(s,"$1"):c||f)}),u};var i=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,s=/\\(\\)?/g;e.exports=r})(z,z.exports)),z.exports}var Pr;function me(){return Pr||(Pr=1,(function(e,r){var t=or(),n=we();r=function(i,s){s=n(s,i);var o;for(o=s.shift();!t(o);){if(i=i[o],i==null)return;o=s.shift()}return i},e.exports=r})(W,W.exports)),W.exports}var $r;function qe(){return $r||($r=1,(function(e,r){var t=sr(),n=me();r=function(s){return t(s)?function(o){return n(o,s)}:i(s)};function i(s){return function(o){return o?.[s]}}e.exports=r})(T,T.exports)),T.exports}var Cr;function re(){return Cr||(Cr=1,(function(e,r){var t=Kr(),n=ce(),i=sr(),s=Zr(),o=he(),a=de(),u=qe();r=function(f,c,l){return f==null?a:t(f)?s(f,c,l):n(f)&&!i(f)?o(f):u(f)},e.exports=r})(R,R.exports)),R.exports}var kr;function ee(){return kr||(kr=1,(function(e,r){var t=re(),n=ar();r=function(i,s,o){var a=[];return s=t(s,o),n(i,function(u,f,c){s(u,f,c)&&a.push(u)}),a},e.exports=r})(g,g.exports)),g.exports}var Fr;function ye(){return Fr||(Fr=1,(function(e,r){var t=ee();r=function(n){return t(n,function(i){return!!i})},e.exports=r})(y,y.exports)),y.exports}var ge=ye();const Re=v(ge);var _={exports:{}},D={exports:{}},Lr;function Se(){return Lr||(Lr=1,(function(e,r){r=function(t,n,i){return Array.prototype.indexOf.call(t,n,i)},e.exports=r})(D,D.exports)),D.exports}var B={exports:{}},jr;function Oe(){return jr||(jr=1,(function(e,r){var t=w();r=function(n){return t(n)==="[object String]"},e.exports=r})(B,B.exports)),B.exports}var G={exports:{}},Nr;function be(){return Nr||(Nr=1,(function(e,r){var t=ar();r=function(n){var i=[];return t(n,function(s){i.push(s)}),i},e.exports=r})(G,G.exports)),G.exports}var Vr;function Ae(){return Vr||(Vr=1,(function(e,r){var t=Se(),n=Oe(),i=ur(),s=be();r=function(o,a){return n(o)?o.indexOf(a)>-1:(i(o)||(o=s(o)),t(o,a)>=0)},e.exports=r})(_,_.exports)),_.exports}var Ee=Ae();const d=v(Ee);var Ie=ee();const te=v(Ie);var U={exports:{}},Mr;function Pe(){return Mr||(Mr=1,(function(e,r){var t=re(),n=tr(),i=ur();r=function(s,o,a){o=t(o,a);for(var u=!i(s)&&n(s),f=(u||s).length,c=Array(f),l=0;l<f;l++){var q=u?u[l]:l;c[l]=o(s[q],q,s)}return c},e.exports=r})(U,U.exports)),U.exports}var $e=Pe();const fr=v($e);var H={exports:{}},Tr;function Ce(){return Tr||(Tr=1,(function(e,r){var t=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;r=function(n){return n.replace(t,"")},e.exports=r})(H,H.exports)),H.exports}var ke=Ce();const cr=v(ke);var J={exports:{}},X={exports:{}},Wr;function Fe(){return Wr||(Wr=1,(function(e,r){var t=/^\s+/;r=function(n,i){if(i==null)return n.trimLeft?n.trimLeft():n.replace(t,"");for(var s=0,o=n.length,a=i.length,u=!0,f,c;u&&s<o;)for(u=!1,f=-1,c=n.charAt(s);++f<a;)if(c===i[f]){u=!0,s++;break}return s>=o?"":n.substr(s,o)},e.exports=r})(X,X.exports)),X.exports}var Y={exports:{}},zr;function ne(){return zr||(zr=1,(function(e,r){r=function(t,n){if(n==null){if(t.trimRight)return t.trimRight();n=` \r
|
|
2
|
+
\f\v`}for(var i=t.length-1,s=n.length,o=!0,a,u;o&&i>=0;)for(o=!1,a=-1,u=t.charAt(i);++a<s;)if(u===n[a]){o=!0,i--;break}return i>=0?t.substring(0,i+1):""},e.exports=r})(Y,Y.exports)),Y.exports}var _r;function Le(){return _r||(_r=1,(function(e,r){var t=Fe(),n=ne();r=function(i,s){return s==null&&i.trim?i.trim():t(n(i,s),s)},e.exports=r})(J,J.exports)),J.exports}var je=Le();const h=v(je),Ne=fe.promisify(ae.execFile),Dr=require("fnm-static");function ie(){if(!Dr)throw new Error("fnm binary not found for this platform");return Dr}async function m(e,r){const t=ie();try{const{stdout:n,stderr:i}=await Ne(t,e,{encoding:"utf8",maxBuffer:20971520,timeout:r?.timeout??0,env:process.env});return{stdout:n||"",stderr:i||""}}catch(n){const i=n,s=h(cr(i.stderr||i.stdout||i.message||""));throw new Error(s||"fnm command failed")}}function Ve(e){const r=h(cr(e).replace(/^\*\s+/,""));if(!r)return null;const t=r.match(/^(\S+)(?:\s+(.*))?$/);if(!t)return null;const n=t[1],i=t[2]?Re(fr(t[2].split(","),s=>h(s))):[];return{id:n,version:n,aliases:i,isDefault:d(i,"default"),isSystem:n==="system"}}async function Me(){const{stdout:e}=await m(["list","--log-level","quiet"]);return te(fr(e.split(`
|
|
3
|
+
`),r=>Ve(r)),r=>r!==null)}async function Te(e){const r=h(e);if(!r)throw new Error("Version is required");const t=["install","--progress","never","--log-level","info"];r==="lts"?t.push("--lts"):r==="latest"?t.push("--latest"):t.push(r),await m(t,{timeout:600*1e3})}async function We(e){const r=h(e);if(!r)throw new Error("Version is required");if(r==="system")throw new Error("Cannot uninstall system Node");await m(["uninstall",r,"--log-level","info"])}async function ze(e){const r=h(e);if(!r)throw new Error("Version is required");if(r==="system")throw new Error("Cannot set system as default via fnm");await m(["default",r,"--log-level","info"])}function _e(e){const r=h(cr(e));if(!r)return null;const t=r.match(/^(\S+)(?:\s+\(([^)]+)\))?$/);if(!t)return null;const n=t[1];return{id:n,version:n,lts:t[2]?h(t[2]):null}}async function De(e){const r=["list-remote","--sort","desc","--log-level","quiet"];e?.ltsOnly&&r.splice(1,0,"--lts");const{stdout:t}=await m(r);return te(fr(t.split(`
|
|
4
|
+
`),n=>_e(n)),n=>n!==null)}var K={exports:{}},Br;function Be(){return Br||(Br=1,(function(e,r){r=function(t,n){var i=t.length-n.length;return i>=0&&t.indexOf(n,i)===i},e.exports=r})(K,K.exports)),K.exports}var Ge=Be();const Ue=v(Ge);var Z={exports:{}},Q={exports:{}},rr={exports:{}},Gr;function He(){return Gr||(Gr=1,(function(e,r){r=typeof window=="object"&&typeof document=="object"&&document.nodeType===9,e.exports=r})(rr,rr.exports)),rr.exports}var er={exports:{}},Ur;function Je(){return Ur||(Ur=1,(function(e,r){var t=w();r=typeof process<"u"&&t(process)==="[object process]",e.exports=r})(er,er.exports)),er.exports}var Hr;function Xe(){return Hr||(Hr=1,(function(e,r){var t=He(),n=Je();r=function(i){!i&&t&&(i=navigator.userAgent);function s(f){return i.indexOf(f)>-1}if(i){if(i=i.toLowerCase(),s("windows phone"))return"windows phone";if(s("win"))return"windows";if(s("android"))return"android";if(s("ipad")||s("iphone")||s("ipod"))return"ios";if(s("mac"))return"os x";if(s("linux"))return"linux"}else if(n){var o=process,a=o.platform,u=o.env;if(a==="win32"||u.OSTYPE==="cygwin"||u.OSTYPE==="msys")return"windows";if(a==="darwin")return"os x";if(a==="linux")return"linux"}return"unknown"},e.exports=r})(Q,Q.exports)),Q.exports}var Jr;function Ye(){return Jr||(Jr=1,(function(e,r){var t=Xe();r=t()==="windows",e.exports=r})(Z,Z.exports)),Z.exports}var Ke=Ye();const nr=v(Ke);var Ze=ne();const Qe=v(Ze),se="# >>> tinker-node-manager >>>",ir="# <<< tinker-node-manager <<<",Xr=p.join(Yr.homedir(),".tinker","tinker-node-manager","bin");function rt(e){const r=p.basename(e).toLowerCase();return d(r,"zsh")?"zsh":d(r,"bash")?"bash":d(r,"fish")?"fish":d(r,"pwsh")||d(r,"powershell")?"powershell":r||"sh"}function et(){const e=process.env.SHELL||"",r=rt(e);return nr?r==="bash"||r==="zsh"||r==="fish"?r:"powershell":e?r:"zsh"}function tt(e){const r=p.join(e,"Documents"),t=p.join(r,"PowerShell","Microsoft.PowerShell_profile.ps1"),n=p.join(r,"WindowsPowerShell","Microsoft.PowerShell_profile.ps1");return pr.existsSync(n)&&!pr.existsSync(t)?n:t}function nt(e,r){return e==="powershell"?tt(r):e==="zsh"?p.join(r,".zshrc"):e==="fish"?p.join(r,".config","fish","config.fish"):e==="bash"?p.join(r,".bashrc"):p.join(r,".profile")}function it(e){return`'${e.replace(/'/g,"''")}'`}function st(e,r){let t;return e==="powershell"?t=`(& ${it(r)} env --shell powershell) | Out-String | Invoke-Expression`:e==="fish"?t=`${JSON.stringify(r)} env --shell fish | source`:t=`eval "$(${JSON.stringify(r)} env)"`,`${se}
|
|
5
|
+
${t}
|
|
6
|
+
${ir}`}function ot(e,r){const t=e.indexOf(se),n=e.indexOf(ir);let i;if(t!==-1&&n!==-1&&n>t){const s=e.slice(0,t),o=e.slice(n+ir.length).replace(/^\n/,"");i=`${s}${r}
|
|
7
|
+
${o}`}else{const s=Qe(e);i=s?`${s}
|
|
8
|
+
|
|
9
|
+
${r}
|
|
10
|
+
`:`${r}
|
|
11
|
+
`}return Ue(i,`
|
|
12
|
+
`)?i:`${i}
|
|
13
|
+
`}async function ut(e){await x.mkdir(Xr,{recursive:!0});const r=p.join(Xr,nr?"fnm.exe":"fnm");try{await x.unlink(r)}catch{}try{await x.symlink(e,r)}catch{await x.copyFile(e,r),nr||await x.chmod(r,493)}return r}function oe(){const e=Yr.homedir(),r=et();return{shell:r,rcPath:nt(r,e)}}async function at(){const e=ie(),r=oe(),t=await ut(e),n=st(r.shell,t);await x.mkdir(p.dirname(r.rcPath),{recursive:!0});let i="";try{i=await x.readFile(r.rcPath,"utf8")}catch{i=""}return await x.writeFile(r.rcPath,ot(i,n),"utf8"),{...r,fnmPath:t}}const ft={listVersions:()=>Me(),listRemoteVersions:e=>De(e),installVersion:e=>Te(e),uninstallVersion:e=>We(e),setDefaultVersion:e=>ze(e),getShellSetupPreview:()=>oe(),setupShellEnv:()=>at()};ue.contextBridge.exposeInMainWorld("nodeManager",ft);
|