@lamalibre/create-portlama 1.0.45 → 1.0.46

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lamalibre/create-portlama",
3
- "version": "1.0.45",
3
+ "version": "1.0.46",
4
4
  "description": "One-command setup for secure reverse tunnels with a management dashboard",
5
5
  "type": "module",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -84,43 +84,54 @@ export function redeployTasks(ctx, task) {
84
84
  title: 'Updating panel-server',
85
85
  task: async (_ctx, subtask) => {
86
86
  const serverDest = join(installDir, 'panel-server');
87
+ const tmpDir = join('/tmp', `portlama-panel-update-${Date.now()}`);
87
88
 
88
- subtask.output = 'Installing @lamalibre/portlama-panel-server from npm...';
89
89
  try {
90
- await execa('npm', [
91
- 'install',
92
- '--production',
93
- '--ignore-scripts',
90
+ // Download the package tarball to a temp directory via npm pack,
91
+ // then extract. We cannot `npm install` inside serverDest because
92
+ // its package.json has the same name — npm refuses to install a
93
+ // package as a dependency of itself.
94
+ await execa('mkdir', ['-p', tmpDir]);
95
+
96
+ subtask.output = 'Downloading @lamalibre/portlama-panel-server from npm...';
97
+ const { stdout: tarball } = await execa('npm', [
98
+ 'pack',
94
99
  '@lamalibre/portlama-panel-server@latest',
95
- ], {
100
+ '--pack-destination',
101
+ tmpDir,
102
+ ]);
103
+ const tarballPath = join(tmpDir, tarball.trim());
104
+
105
+ subtask.output = 'Extracting package...';
106
+ await execa('tar', ['xzf', tarballPath, '-C', tmpDir]);
107
+
108
+ // npm pack extracts to a `package/` directory
109
+ const extracted = join(tmpDir, 'package');
110
+
111
+ subtask.output = 'Copying panel-server files...';
112
+ await rm(join(serverDest, 'src'), { recursive: true, force: true });
113
+ await cp(join(extracted, 'src'), join(serverDest, 'src'), { recursive: true });
114
+ await cp(join(extracted, 'package.json'), join(serverDest, 'package.json'));
115
+
116
+ subtask.output = 'Installing production dependencies...';
117
+ await execa('npm', ['install', '--production', '--ignore-scripts'], {
96
118
  cwd: serverDest,
97
119
  });
98
- } catch (err) {
99
- throw new Error(
100
- `Failed to install panel-server.\n${err.stderr || err.message}`,
101
- );
102
- }
103
120
 
104
- // The npm package installs to node_modules — copy src and package.json
105
- // to the expected locations so the systemd service can find them.
106
- const npmPkg = join(serverDest, 'node_modules', '@lamalibre', 'portlama-panel-server');
107
- if (existsSync(join(npmPkg, 'src'))) {
108
- await rm(join(serverDest, 'src'), { recursive: true, force: true });
109
- await cp(join(npmPkg, 'src'), join(serverDest, 'src'), { recursive: true });
110
- await cp(join(npmPkg, 'package.json'), join(serverDest, 'package.json'));
111
- }
121
+ await execa('chown', ['-R', 'portlama:portlama', serverDest]);
112
122
 
113
- await execa('chown', ['-R', 'portlama:portlama', serverDest]);
123
+ // Ensure CLI symlink for portlama-reset-admin
124
+ const resetAdminSrc = join(serverDest, 'src', 'cli', 'reset-admin.js');
125
+ const resetAdminDest = '/usr/local/bin/portlama-reset-admin';
126
+ if (existsSync(resetAdminSrc)) {
127
+ await execa('chmod', ['+x', resetAdminSrc]);
128
+ await execa('ln', ['-sf', resetAdminSrc, resetAdminDest]);
129
+ }
114
130
 
115
- // Ensure CLI symlink for portlama-reset-admin
116
- const resetAdminSrc = join(serverDest, 'src', 'cli', 'reset-admin.js');
117
- const resetAdminDest = '/usr/local/bin/portlama-reset-admin';
118
- if (existsSync(resetAdminSrc)) {
119
- await execa('chmod', ['+x', resetAdminSrc]);
120
- await execa('ln', ['-sf', resetAdminSrc, resetAdminDest]);
131
+ subtask.output = `Panel server updated to ${ctx.latestVersion || 'latest'}`;
132
+ } finally {
133
+ await rm(tmpDir, { recursive: true, force: true }).catch(() => {});
121
134
  }
122
-
123
- subtask.output = `Panel server updated to ${ctx.latestVersion || 'latest'}`;
124
135
  },
125
136
  rendererOptions: { persistentOutput: true },
126
137
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lamalibre/portlama-panel-server",
3
- "version": "0.1.15",
3
+ "version": "0.1.17",
4
4
  "description": "Portlama management panel backend",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "publishConfig": {