d3ployer 0.0.4 → 0.0.5
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/config.js +5 -1
- package/dist/def.d.ts +7 -2
- package/dist/defaultTasks.js +21 -14
- package/package.json +1 -1
package/dist/config.js
CHANGED
|
@@ -39,9 +39,13 @@ export function defineConfig(input) {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
return {
|
|
42
|
-
packageManager: 'npm',
|
|
43
42
|
rootDir: '',
|
|
44
43
|
...input,
|
|
44
|
+
packageManager: {
|
|
45
|
+
manager: 'npm',
|
|
46
|
+
productionOnly: true,
|
|
47
|
+
...input.packageManager,
|
|
48
|
+
},
|
|
45
49
|
servers,
|
|
46
50
|
tasks,
|
|
47
51
|
scenarios,
|
package/dist/def.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import type SSH2Promise from 'ssh2-promise';
|
|
2
2
|
export type AuthMethod = 'key' | 'password' | 'agent';
|
|
3
|
+
export type PackageManager = 'npm' | 'yarn' | 'pnpm';
|
|
4
|
+
export type PackageManagerConfig = {
|
|
5
|
+
manager: PackageManager;
|
|
6
|
+
productionOnly?: boolean;
|
|
7
|
+
};
|
|
3
8
|
export interface ServerConfig {
|
|
4
9
|
host: string;
|
|
5
10
|
port: number;
|
|
@@ -9,7 +14,7 @@ export interface ServerConfig {
|
|
|
9
14
|
password?: string;
|
|
10
15
|
agent?: string;
|
|
11
16
|
deployPath: string;
|
|
12
|
-
packageManager?:
|
|
17
|
+
packageManager?: PackageManagerConfig;
|
|
13
18
|
initCmd?: string;
|
|
14
19
|
}
|
|
15
20
|
export type ServerConfigInput = Partial<ServerConfig> & Pick<ServerConfig, 'host' | 'deployPath'>;
|
|
@@ -68,7 +73,7 @@ export type ScenarioInput = string[] | {
|
|
|
68
73
|
export interface DeployerConfig {
|
|
69
74
|
rootDir: string;
|
|
70
75
|
servers: Record<string, ServerConfig>;
|
|
71
|
-
packageManager?:
|
|
76
|
+
packageManager?: PackageManagerConfig;
|
|
72
77
|
files?: FilesConfig;
|
|
73
78
|
symlinks?: SymlinkConfig[];
|
|
74
79
|
tasks?: Record<string, TaskDef>;
|
package/dist/defaultTasks.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Exception } from './utils/index.js';
|
|
2
1
|
import chalk from 'chalk';
|
|
3
2
|
import path from 'node:path';
|
|
3
|
+
import { Exception } from './utils/index.js';
|
|
4
4
|
function buildRsyncCommand(server, source, dest, files) {
|
|
5
5
|
const args = ['rsync', '-avz', '--delete', '--progress=info2'];
|
|
6
6
|
// ssh shell
|
|
@@ -59,19 +59,26 @@ const symlinksTask = async (ctx, ph) => {
|
|
|
59
59
|
}
|
|
60
60
|
};
|
|
61
61
|
const depInstallTask = async (ctx) => {
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
62
|
+
const config = {
|
|
63
|
+
manager: 'npm',
|
|
64
|
+
productionOnly: true,
|
|
65
|
+
...ctx.config.packageManager,
|
|
66
|
+
...ctx.server.packageManager,
|
|
67
|
+
};
|
|
68
|
+
let cmd = `${config.manager} install`;
|
|
69
|
+
if (config.productionOnly) {
|
|
70
|
+
if (config.manager === 'npm') {
|
|
71
|
+
cmd += ' --omit=dev';
|
|
72
|
+
}
|
|
73
|
+
else if (config.manager === 'yarn') {
|
|
74
|
+
cmd += ' --production';
|
|
75
|
+
}
|
|
76
|
+
else if (config.manager === 'pnpm') {
|
|
77
|
+
cmd += ' --prod';
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
throw new Exception(`Unsupported package manager "${config.manager}"`, 1774823752134);
|
|
81
|
+
}
|
|
75
82
|
}
|
|
76
83
|
await ctx.run(cmd);
|
|
77
84
|
};
|