@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
package/src/tasks/redeploy.js
CHANGED
|
@@ -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
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
116
|
-
|
|
117
|
-
|
|
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
|
},
|