kirby-deploy 0.3.3 → 0.4.0
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/cli.js +72 -23
- package/dist/index.d.ts +2 -0
- package/package.json +1 -1
- package/src/commands/accounts.ts +17 -3
- package/src/commands/content.ts +17 -3
- package/src/commands/languages.ts +17 -3
- package/src/commands/main.ts +17 -8
- package/src/config.ts +1 -0
- package/src/lftp/mirror.ts +3 -0
- package/src/sync.ts +2 -2
- package/src/types.ts +1 -0
package/dist/cli.js
CHANGED
|
@@ -57,6 +57,7 @@ var ConfigSchema = object({
|
|
|
57
57
|
callWebhooks: optional(boolean()),
|
|
58
58
|
dryRun: optional(boolean()),
|
|
59
59
|
verbose: optional(boolean()),
|
|
60
|
+
force: optional(boolean()),
|
|
60
61
|
parallel: optional(number()),
|
|
61
62
|
exclude: optional(array(string())),
|
|
62
63
|
excludeGlob: optional(array(string())),
|
|
@@ -126,6 +127,7 @@ ${info}`);
|
|
|
126
127
|
remoteDir: "./",
|
|
127
128
|
dryRun: true,
|
|
128
129
|
verbose: false,
|
|
130
|
+
force: false,
|
|
129
131
|
parallel: 10,
|
|
130
132
|
checkComposerLock: true,
|
|
131
133
|
callWebhooks: true,
|
|
@@ -203,6 +205,9 @@ var mirror = (source, destination, flags, { lftpSettings, host, user, password,
|
|
|
203
205
|
if (match = line.match(/Transferring file `(.*)'/)) {
|
|
204
206
|
hasChanges = true;
|
|
205
207
|
consola3.log(colors.blue(`\u2192 ${match[1]}`));
|
|
208
|
+
} else if (match = line.match(/Making directory `(.*)'/)) {
|
|
209
|
+
hasChanges = true;
|
|
210
|
+
consola3.log(colors.blue(`\u2192 ${match[1]}`));
|
|
206
211
|
} else if (match = line.match(/Removing old (?:file|directory) `(.*)'/)) {
|
|
207
212
|
hasChanges = true;
|
|
208
213
|
consola3.log(colors.red(`\u2A2F ${match[1]}`));
|
|
@@ -297,11 +302,11 @@ var sync = async (source, mode, config) => {
|
|
|
297
302
|
}
|
|
298
303
|
const flags = [
|
|
299
304
|
"--continue",
|
|
300
|
-
"--only-newer",
|
|
301
305
|
"--overwrite",
|
|
302
|
-
"--use-cache",
|
|
303
306
|
"--delete",
|
|
304
307
|
"--verbose",
|
|
308
|
+
!config.force && "--use-cache",
|
|
309
|
+
config.force && "--transfer-all",
|
|
305
310
|
reverse && "--reverse",
|
|
306
311
|
...config.exclude.map((path) => `--exclude ${path}`),
|
|
307
312
|
...config.excludeGlob.map((path) => `--exclude-glob ${path}`),
|
|
@@ -366,7 +371,7 @@ import { defineCommand } from "citty";
|
|
|
366
371
|
import { consola as consola6 } from "consola";
|
|
367
372
|
import { colors as colors3 } from "consola/utils";
|
|
368
373
|
import { join as join3 } from "path/posix";
|
|
369
|
-
var syncAccounts = async (mode) => {
|
|
374
|
+
var syncAccounts = async (mode, force = false) => {
|
|
370
375
|
const config = await loadConfig();
|
|
371
376
|
if (!config) return;
|
|
372
377
|
const { accounts } = config.folderStructure;
|
|
@@ -391,18 +396,30 @@ var syncAccounts = async (mode) => {
|
|
|
391
396
|
excludeGlob: [".*", ".*/"],
|
|
392
397
|
include: [".htpasswd"],
|
|
393
398
|
// Make sure account passwords are synced.
|
|
394
|
-
includeGlob: []
|
|
399
|
+
includeGlob: [],
|
|
400
|
+
force
|
|
395
401
|
});
|
|
396
402
|
};
|
|
397
|
-
var
|
|
398
|
-
|
|
403
|
+
var forceArg = {
|
|
404
|
+
type: "boolean",
|
|
405
|
+
description: "Transfer all files unconditionally, ignoring timestamps and cache",
|
|
406
|
+
default: false
|
|
407
|
+
};
|
|
408
|
+
var accountsPush = defineCommand({
|
|
409
|
+
args: { force: forceArg },
|
|
410
|
+
run: ({ args }) => syncAccounts("push", args.force)
|
|
411
|
+
});
|
|
412
|
+
var accountsPull = defineCommand({
|
|
413
|
+
args: { force: forceArg },
|
|
414
|
+
run: ({ args }) => syncAccounts("pull", args.force)
|
|
415
|
+
});
|
|
399
416
|
|
|
400
417
|
// src/commands/content.ts
|
|
401
418
|
import { defineCommand as defineCommand2 } from "citty";
|
|
402
419
|
import { consola as consola7 } from "consola";
|
|
403
420
|
import { colors as colors4 } from "consola/utils";
|
|
404
421
|
import { join as join4 } from "path/posix";
|
|
405
|
-
var syncContent = async (mode) => {
|
|
422
|
+
var syncContent = async (mode, force = false) => {
|
|
406
423
|
const config = await loadConfig();
|
|
407
424
|
if (!config) return;
|
|
408
425
|
const { content } = config.folderStructure;
|
|
@@ -426,18 +443,30 @@ var syncContent = async (mode) => {
|
|
|
426
443
|
exclude: [],
|
|
427
444
|
excludeGlob: [".*", ".*/"],
|
|
428
445
|
include: [],
|
|
429
|
-
includeGlob: []
|
|
446
|
+
includeGlob: [],
|
|
447
|
+
force
|
|
430
448
|
});
|
|
431
449
|
};
|
|
432
|
-
var
|
|
433
|
-
|
|
450
|
+
var forceArg2 = {
|
|
451
|
+
type: "boolean",
|
|
452
|
+
description: "Transfer all files unconditionally, ignoring timestamps and cache",
|
|
453
|
+
default: false
|
|
454
|
+
};
|
|
455
|
+
var contentPush = defineCommand2({
|
|
456
|
+
args: { force: forceArg2 },
|
|
457
|
+
run: ({ args }) => syncContent("push", args.force)
|
|
458
|
+
});
|
|
459
|
+
var contentPull = defineCommand2({
|
|
460
|
+
args: { force: forceArg2 },
|
|
461
|
+
run: ({ args }) => syncContent("pull", args.force)
|
|
462
|
+
});
|
|
434
463
|
|
|
435
464
|
// src/commands/languages.ts
|
|
436
465
|
import { defineCommand as defineCommand3 } from "citty";
|
|
437
466
|
import { consola as consola8 } from "consola";
|
|
438
467
|
import { colors as colors5 } from "consola/utils";
|
|
439
468
|
import { join as join5 } from "path/posix";
|
|
440
|
-
var syncLanguages = async (mode) => {
|
|
469
|
+
var syncLanguages = async (mode, force = false) => {
|
|
441
470
|
const config = await loadConfig();
|
|
442
471
|
if (!config) return;
|
|
443
472
|
const { site } = config.folderStructure;
|
|
@@ -461,15 +490,34 @@ var syncLanguages = async (mode) => {
|
|
|
461
490
|
exclude: [],
|
|
462
491
|
excludeGlob: [".*", ".*/"],
|
|
463
492
|
include: [],
|
|
464
|
-
includeGlob: []
|
|
493
|
+
includeGlob: [],
|
|
494
|
+
force
|
|
465
495
|
});
|
|
466
496
|
};
|
|
467
|
-
var
|
|
468
|
-
|
|
497
|
+
var forceArg3 = {
|
|
498
|
+
type: "boolean",
|
|
499
|
+
description: "Transfer all files unconditionally, ignoring timestamps and cache",
|
|
500
|
+
default: false
|
|
501
|
+
};
|
|
502
|
+
var languagesPush = defineCommand3({
|
|
503
|
+
args: { force: forceArg3 },
|
|
504
|
+
run: ({ args }) => syncLanguages("push", args.force)
|
|
505
|
+
});
|
|
506
|
+
var languagesPull = defineCommand3({
|
|
507
|
+
args: { force: forceArg3 },
|
|
508
|
+
run: ({ args }) => syncLanguages("pull", args.force)
|
|
509
|
+
});
|
|
469
510
|
|
|
470
511
|
// src/commands/main.ts
|
|
471
512
|
var main = defineCommand4({
|
|
472
|
-
|
|
513
|
+
args: {
|
|
514
|
+
force: {
|
|
515
|
+
type: "boolean",
|
|
516
|
+
description: "Transfer all files unconditionally, ignoring timestamps and cache",
|
|
517
|
+
default: false
|
|
518
|
+
}
|
|
519
|
+
},
|
|
520
|
+
run: async ({ args, rawArgs, cmd }) => {
|
|
473
521
|
const [firstArg] = rawArgs;
|
|
474
522
|
const subCommands = Object.keys(cmd.subCommands ?? {});
|
|
475
523
|
const isSubCommand = subCommands.includes(firstArg);
|
|
@@ -480,13 +528,13 @@ var main = defineCommand4({
|
|
|
480
528
|
const exclude = [
|
|
481
529
|
...config.exclude,
|
|
482
530
|
"^node_modules/",
|
|
483
|
-
`^${relative(cwd2(), folderStructure.content)}
|
|
484
|
-
`^${relative(cwd2(), folderStructure.media)}
|
|
485
|
-
`^${relative(cwd2(), folderStructure.accounts)}
|
|
486
|
-
`^${relative(cwd2(), folderStructure.sessions)}
|
|
487
|
-
`^${relative(cwd2(), folderStructure.cache)}
|
|
488
|
-
`^${relative(cwd2(), folderStructure.logs)}
|
|
489
|
-
`^${relative(cwd2(), join6(folderStructure.site, "languages"))}
|
|
531
|
+
`^${relative(cwd2(), folderStructure.content)}/.`,
|
|
532
|
+
`^${relative(cwd2(), folderStructure.media)}/.`,
|
|
533
|
+
`^${relative(cwd2(), folderStructure.accounts)}/.`,
|
|
534
|
+
`^${relative(cwd2(), folderStructure.sessions)}/.`,
|
|
535
|
+
`^${relative(cwd2(), folderStructure.cache)}/.`,
|
|
536
|
+
`^${relative(cwd2(), folderStructure.logs)}/.`,
|
|
537
|
+
`^${relative(cwd2(), join6(folderStructure.site, "languages"))}/.`
|
|
490
538
|
];
|
|
491
539
|
const excludeGlob = [...config.excludeGlob, ".*", ".*/"];
|
|
492
540
|
const include = config.include;
|
|
@@ -514,7 +562,8 @@ var main = defineCommand4({
|
|
|
514
562
|
exclude,
|
|
515
563
|
excludeGlob,
|
|
516
564
|
include,
|
|
517
|
-
includeGlob
|
|
565
|
+
includeGlob,
|
|
566
|
+
force: args.force
|
|
518
567
|
});
|
|
519
568
|
},
|
|
520
569
|
subCommands: {
|
package/dist/index.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ declare const ConfigSchema: valibot.ObjectSchema<{
|
|
|
21
21
|
readonly callWebhooks: valibot.OptionalSchema<valibot.BooleanSchema<undefined>, undefined>;
|
|
22
22
|
readonly dryRun: valibot.OptionalSchema<valibot.BooleanSchema<undefined>, undefined>;
|
|
23
23
|
readonly verbose: valibot.OptionalSchema<valibot.BooleanSchema<undefined>, undefined>;
|
|
24
|
+
readonly force: valibot.OptionalSchema<valibot.BooleanSchema<undefined>, undefined>;
|
|
24
25
|
readonly parallel: valibot.OptionalSchema<valibot.NumberSchema<undefined>, undefined>;
|
|
25
26
|
readonly exclude: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, undefined>;
|
|
26
27
|
readonly excludeGlob: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, undefined>;
|
|
@@ -51,6 +52,7 @@ declare const defineConfig: (config: Config) => {
|
|
|
51
52
|
callWebhooks?: boolean | undefined;
|
|
52
53
|
dryRun?: boolean | undefined;
|
|
53
54
|
verbose?: boolean | undefined;
|
|
55
|
+
force?: boolean | undefined;
|
|
54
56
|
parallel?: number | undefined;
|
|
55
57
|
exclude?: string[] | undefined;
|
|
56
58
|
excludeGlob?: string[] | undefined;
|
package/package.json
CHANGED
package/src/commands/accounts.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { loadConfig } from '../config'
|
|
|
6
6
|
import { sync } from '../sync'
|
|
7
7
|
import { getBranch, upperFirst } from '../utils'
|
|
8
8
|
|
|
9
|
-
const syncAccounts = async (mode: 'pull' | 'push') => {
|
|
9
|
+
const syncAccounts = async (mode: 'pull' | 'push', force = false) => {
|
|
10
10
|
const config = await loadConfig()
|
|
11
11
|
if (!config) return
|
|
12
12
|
|
|
@@ -33,8 +33,22 @@ const syncAccounts = async (mode: 'pull' | 'push') => {
|
|
|
33
33
|
excludeGlob: ['.*', '.*/'],
|
|
34
34
|
include: ['.htpasswd'], // Make sure account passwords are synced.
|
|
35
35
|
includeGlob: [],
|
|
36
|
+
force,
|
|
36
37
|
})
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
const forceArg = {
|
|
41
|
+
type: 'boolean',
|
|
42
|
+
description:
|
|
43
|
+
'Transfer all files unconditionally, ignoring timestamps and cache',
|
|
44
|
+
default: false,
|
|
45
|
+
} as const
|
|
46
|
+
|
|
47
|
+
export const accountsPush = defineCommand({
|
|
48
|
+
args: { force: forceArg },
|
|
49
|
+
run: ({ args }) => syncAccounts('push', args.force),
|
|
50
|
+
})
|
|
51
|
+
export const accountsPull = defineCommand({
|
|
52
|
+
args: { force: forceArg },
|
|
53
|
+
run: ({ args }) => syncAccounts('pull', args.force),
|
|
54
|
+
})
|
package/src/commands/content.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { loadConfig } from '../config'
|
|
|
6
6
|
import { sync } from '../sync'
|
|
7
7
|
import { getBranch, upperFirst } from '../utils'
|
|
8
8
|
|
|
9
|
-
const syncContent = async (mode: 'pull' | 'push') => {
|
|
9
|
+
const syncContent = async (mode: 'pull' | 'push', force = false) => {
|
|
10
10
|
const config = await loadConfig()
|
|
11
11
|
if (!config) return
|
|
12
12
|
|
|
@@ -33,8 +33,22 @@ const syncContent = async (mode: 'pull' | 'push') => {
|
|
|
33
33
|
excludeGlob: ['.*', '.*/'],
|
|
34
34
|
include: [],
|
|
35
35
|
includeGlob: [],
|
|
36
|
+
force,
|
|
36
37
|
})
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
const forceArg = {
|
|
41
|
+
type: 'boolean',
|
|
42
|
+
description:
|
|
43
|
+
'Transfer all files unconditionally, ignoring timestamps and cache',
|
|
44
|
+
default: false,
|
|
45
|
+
} as const
|
|
46
|
+
|
|
47
|
+
export const contentPush = defineCommand({
|
|
48
|
+
args: { force: forceArg },
|
|
49
|
+
run: ({ args }) => syncContent('push', args.force),
|
|
50
|
+
})
|
|
51
|
+
export const contentPull = defineCommand({
|
|
52
|
+
args: { force: forceArg },
|
|
53
|
+
run: ({ args }) => syncContent('pull', args.force),
|
|
54
|
+
})
|
|
@@ -6,7 +6,7 @@ import { loadConfig } from '../config'
|
|
|
6
6
|
import { sync } from '../sync'
|
|
7
7
|
import { getBranch, upperFirst } from '../utils'
|
|
8
8
|
|
|
9
|
-
const syncLanguages = async (mode: 'pull' | 'push') => {
|
|
9
|
+
const syncLanguages = async (mode: 'pull' | 'push', force = false) => {
|
|
10
10
|
const config = await loadConfig()
|
|
11
11
|
if (!config) return
|
|
12
12
|
|
|
@@ -33,8 +33,22 @@ const syncLanguages = async (mode: 'pull' | 'push') => {
|
|
|
33
33
|
excludeGlob: ['.*', '.*/'],
|
|
34
34
|
include: [],
|
|
35
35
|
includeGlob: [],
|
|
36
|
+
force,
|
|
36
37
|
})
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
const forceArg = {
|
|
41
|
+
type: 'boolean',
|
|
42
|
+
description:
|
|
43
|
+
'Transfer all files unconditionally, ignoring timestamps and cache',
|
|
44
|
+
default: false,
|
|
45
|
+
} as const
|
|
46
|
+
|
|
47
|
+
export const languagesPush = defineCommand({
|
|
48
|
+
args: { force: forceArg },
|
|
49
|
+
run: ({ args }) => syncLanguages('push', args.force),
|
|
50
|
+
})
|
|
51
|
+
export const languagesPull = defineCommand({
|
|
52
|
+
args: { force: forceArg },
|
|
53
|
+
run: ({ args }) => syncLanguages('pull', args.force),
|
|
54
|
+
})
|
package/src/commands/main.ts
CHANGED
|
@@ -13,7 +13,15 @@ import { contentPull, contentPush } from './content'
|
|
|
13
13
|
import { languagesPull, languagesPush } from './languages'
|
|
14
14
|
|
|
15
15
|
export const main = defineCommand({
|
|
16
|
-
|
|
16
|
+
args: {
|
|
17
|
+
force: {
|
|
18
|
+
type: 'boolean',
|
|
19
|
+
description:
|
|
20
|
+
'Transfer all files unconditionally, ignoring timestamps and cache',
|
|
21
|
+
default: false,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
run: async ({ args, rawArgs, cmd }) => {
|
|
17
25
|
// Todo: find a cleaner way to prevent the main command from running when
|
|
18
26
|
// when a sub command is run.
|
|
19
27
|
const [firstArg] = rawArgs
|
|
@@ -28,13 +36,13 @@ export const main = defineCommand({
|
|
|
28
36
|
const exclude = [
|
|
29
37
|
...config.exclude,
|
|
30
38
|
'^node_modules/',
|
|
31
|
-
`^${relative(cwd(), folderStructure.content)}
|
|
32
|
-
`^${relative(cwd(), folderStructure.media)}
|
|
33
|
-
`^${relative(cwd(), folderStructure.accounts)}
|
|
34
|
-
`^${relative(cwd(), folderStructure.sessions)}
|
|
35
|
-
`^${relative(cwd(), folderStructure.cache)}
|
|
36
|
-
`^${relative(cwd(), folderStructure.logs)}
|
|
37
|
-
`^${relative(cwd(), join(folderStructure.site, 'languages'))}
|
|
39
|
+
`^${relative(cwd(), folderStructure.content)}/.`,
|
|
40
|
+
`^${relative(cwd(), folderStructure.media)}/.`,
|
|
41
|
+
`^${relative(cwd(), folderStructure.accounts)}/.`,
|
|
42
|
+
`^${relative(cwd(), folderStructure.sessions)}/.`,
|
|
43
|
+
`^${relative(cwd(), folderStructure.cache)}/.`,
|
|
44
|
+
`^${relative(cwd(), folderStructure.logs)}/.`,
|
|
45
|
+
`^${relative(cwd(), join(folderStructure.site, 'languages'))}/.`,
|
|
38
46
|
]
|
|
39
47
|
const excludeGlob = [...config.excludeGlob, '.*', '.*/']
|
|
40
48
|
const include = config.include
|
|
@@ -67,6 +75,7 @@ export const main = defineCommand({
|
|
|
67
75
|
excludeGlob,
|
|
68
76
|
include,
|
|
69
77
|
includeGlob,
|
|
78
|
+
force: args.force,
|
|
70
79
|
})
|
|
71
80
|
},
|
|
72
81
|
subCommands: {
|
package/src/config.ts
CHANGED
package/src/lftp/mirror.ts
CHANGED
|
@@ -42,6 +42,9 @@ export const mirror = (
|
|
|
42
42
|
if ((match = line.match(/Transferring file `(.*)'/))) {
|
|
43
43
|
hasChanges = true
|
|
44
44
|
consola.log(colors.blue(`→ ${match[1]}`))
|
|
45
|
+
} else if ((match = line.match(/Making directory `(.*)'/))) {
|
|
46
|
+
hasChanges = true
|
|
47
|
+
consola.log(colors.blue(`→ ${match[1]}`))
|
|
45
48
|
} else if (
|
|
46
49
|
(match = line.match(/Removing old (?:file|directory) `(.*)'/))
|
|
47
50
|
) {
|
package/src/sync.ts
CHANGED
|
@@ -28,11 +28,11 @@ export const sync = async (
|
|
|
28
28
|
|
|
29
29
|
const flags = [
|
|
30
30
|
'--continue',
|
|
31
|
-
'--only-newer',
|
|
32
31
|
'--overwrite',
|
|
33
|
-
'--use-cache',
|
|
34
32
|
'--delete',
|
|
35
33
|
'--verbose',
|
|
34
|
+
!config.force && '--use-cache',
|
|
35
|
+
config.force && '--transfer-all',
|
|
36
36
|
reverse && '--reverse',
|
|
37
37
|
...config.exclude.map((path: string) => `--exclude ${path}`),
|
|
38
38
|
...config.excludeGlob.map((path: string) => `--exclude-glob ${path}`),
|
package/src/types.ts
CHANGED
|
@@ -43,6 +43,7 @@ export const ConfigSchema = object({
|
|
|
43
43
|
callWebhooks: optional(boolean()),
|
|
44
44
|
dryRun: optional(boolean()),
|
|
45
45
|
verbose: optional(boolean()),
|
|
46
|
+
force: optional(boolean()),
|
|
46
47
|
parallel: optional(number()),
|
|
47
48
|
exclude: optional(array(string())),
|
|
48
49
|
excludeGlob: optional(array(string())),
|