d3ployer 0.0.14 → 0.0.15

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 CHANGED
@@ -119,6 +119,19 @@ files: [
119
119
  ]
120
120
  ```
121
121
 
122
+ Each entry can also include per-entry rsync options:
123
+
124
+ ```ts
125
+ files: {
126
+ localPath: './dist',
127
+ exclude: ['node_modules'],
128
+ rsync: {
129
+ delete: false, // don't delete extra files on remote (default: true for upload, false for download)
130
+ dryRun: true, // preview changes without applying them
131
+ },
132
+ }
133
+ ```
134
+
122
135
  ### `symlinks`
123
136
 
124
137
  Create symlinks on the remote server.
package/dist/def.d.ts CHANGED
@@ -19,11 +19,16 @@ export interface ServerConfig {
19
19
  initCmd?: string;
20
20
  }
21
21
  export type ServerConfigInput = Partial<ServerConfig> & Pick<ServerConfig, 'host' | 'deployPath'>;
22
+ export type RsyncOptions = {
23
+ delete?: boolean;
24
+ dryRun?: boolean;
25
+ };
22
26
  export interface FilesConfigBase {
23
27
  localPath?: string;
24
28
  remotePath?: string;
25
29
  include?: string[];
26
30
  exclude?: string[];
31
+ rsync?: RsyncOptions;
27
32
  }
28
33
  export type FilesConfig = FilesConfigBase | FilesConfigBase[];
29
34
  export interface SymlinkConfig {
package/dist/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
- export type { AuthMethod, DeployerConfig, DeployerConfigInput, FilesConfig, LogsConfig, Placeholders, ScenarioDef, ScenarioInput, ServerConfig, ServerConfigInput, SymlinkConfig, TaskContext, TaskDef, TaskFn, TaskInput, TaskSkipFn, } from './def.js';
1
+ export type { AuthMethod, DeployerConfig, DeployerConfigInput, FilesConfig, LogsConfig, Placeholders, RsyncOptions, ScenarioDef, ScenarioInput, ServerConfig, ServerConfigInput, SymlinkConfig, TaskContext, TaskDef, TaskFn, TaskInput, TaskSkipFn, } from './def.js';
2
2
  export { defineConfig, defineTask } from './config.js';
3
3
  export { runScenario, runTask } from './runner.js';
4
4
  export { loadConfig, findConfigFile } from './configLoader.js';
5
5
  export { buildRsyncCommand, downloadSkip, downloadTask } from './tasks/index.js';
6
- export type { RsyncOptions } from './tasks/index.js';
@@ -26,7 +26,7 @@ export const downloadTask = async (ctx, ph) => {
26
26
  const dest = localBase.endsWith('/') ? localBase : localBase + '/';
27
27
  const command = buildRsyncCommand(ctx.server, source, dest, filesEntry, {
28
28
  delete: false,
29
- ...ctx.taskConfig,
29
+ ...filesEntry.rsync,
30
30
  });
31
31
  console.log(chalk.grey(command));
32
32
  await ctx.runLocal(command);
@@ -1,6 +1,2 @@
1
- import type { FilesConfigBase, ServerConfig } from '../../def.js';
2
- export type RsyncOptions = {
3
- delete?: boolean;
4
- dryRun?: boolean;
5
- };
1
+ import type { FilesConfigBase, RsyncOptions, ServerConfig } from '../../def.js';
6
2
  export declare function buildRsyncCommand(server: ServerConfig, source: string, dest: string, files: FilesConfigBase, options?: RsyncOptions): string;
@@ -1,6 +1,5 @@
1
1
  import type { ScenarioDef, TaskDef } from '../def.js';
2
2
  export { buildRsyncCommand } from './helpers/rsync.js';
3
- export type { RsyncOptions } from './helpers/rsync.js';
4
3
  export { downloadSkip, downloadTask } from './download.js';
5
4
  export declare const defaultTasks: Record<string, TaskDef>;
6
5
  export declare const defaultScenarios: Record<string, ScenarioDef>;
@@ -1,3 +1,3 @@
1
- import type { TaskFn, TaskSkipFn } from '../def.js';
1
+ import type { FilesConfig, TaskFn, TaskSkipFn } from '../def.js';
2
2
  export declare const uploadSkip: TaskSkipFn;
3
- export declare const uploadTask: TaskFn;
3
+ export declare const uploadTask: TaskFn<FilesConfig>;
@@ -8,9 +8,10 @@ export const uploadSkip = (ctx) => {
8
8
  : false;
9
9
  };
10
10
  export const uploadTask = async (ctx, ph) => {
11
- const filesArray = ctx.config.files instanceof Array
12
- ? ctx.config.files
13
- : [ctx.config.files];
11
+ const configSource = ctx.taskConfig ?? ctx.config.files;
12
+ const filesArray = configSource instanceof Array
13
+ ? configSource
14
+ : [configSource];
14
15
  for (const filesEntry of filesArray) {
15
16
  const localBase = filesEntry.localPath?.startsWith('/')
16
17
  ? filesEntry.localPath
@@ -23,7 +24,7 @@ export const uploadTask = async (ctx, ph) => {
23
24
  await ctx.run(`mkdir -p ${remotePath}`);
24
25
  const command = buildRsyncCommand(ctx.server, source, dest, filesEntry, {
25
26
  delete: true,
26
- ...ctx.taskConfig,
27
+ ...filesEntry.rsync,
27
28
  });
28
29
  console.log(chalk.grey(command));
29
30
  await ctx.runLocal(command);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "d3ployer",
3
- "version": "0.0.14",
3
+ "version": "0.0.15",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "bin": {