kirby-deploy 0.1.0 → 0.3.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 +31 -17
- package/dist/index.d.ts +19 -17
- package/package.json +4 -4
- package/src/commands/accounts.ts +1 -1
- package/src/commands/content.ts +1 -1
- package/src/commands/languages.ts +1 -1
- package/src/commands/main.ts +2 -1
- package/src/config.ts +13 -2
- package/src/lftp/cat.ts +1 -1
- package/src/lftp/mirror.ts +1 -1
- package/src/sync.ts +1 -1
- package/src/types.ts +2 -1
- package/src/utils.ts +1 -1
package/dist/cli.js
CHANGED
|
@@ -5,7 +5,7 @@ import { runMain } from "citty";
|
|
|
5
5
|
|
|
6
6
|
// src/commands/main.ts
|
|
7
7
|
import { defineCommand as defineCommand4 } from "citty";
|
|
8
|
-
import consola9 from "consola";
|
|
8
|
+
import { consola as consola9 } from "consola";
|
|
9
9
|
import { colors as colors6 } from "consola/utils";
|
|
10
10
|
import { readFileSync } from "fs";
|
|
11
11
|
import { join as join6, relative } from "path/posix";
|
|
@@ -13,7 +13,7 @@ import { cwd as cwd2 } from "process";
|
|
|
13
13
|
|
|
14
14
|
// src/config.ts
|
|
15
15
|
import { loadConfig as load } from "c12";
|
|
16
|
-
import consola from "consola";
|
|
16
|
+
import { consola } from "consola";
|
|
17
17
|
import { flatten, parse } from "valibot";
|
|
18
18
|
|
|
19
19
|
// src/types.ts
|
|
@@ -35,6 +35,7 @@ var FolderStructureSchema = object({
|
|
|
35
35
|
accounts: string(),
|
|
36
36
|
sessions: string(),
|
|
37
37
|
cache: string(),
|
|
38
|
+
logs: string(),
|
|
38
39
|
site: string()
|
|
39
40
|
});
|
|
40
41
|
var ConfigSchema = object({
|
|
@@ -45,7 +46,7 @@ var ConfigSchema = object({
|
|
|
45
46
|
token: optional(string()),
|
|
46
47
|
remoteDir: optional(string()),
|
|
47
48
|
folderStructure: optional(
|
|
48
|
-
union([literal("flat"), literal("public"), FolderStructureSchema])
|
|
49
|
+
union([literal("flat"), literal("public"), literal("composer"), FolderStructureSchema])
|
|
49
50
|
),
|
|
50
51
|
checkComposerLock: optional(boolean()),
|
|
51
52
|
callWebhooks: optional(boolean()),
|
|
@@ -89,6 +90,7 @@ ${info}`);
|
|
|
89
90
|
accounts: "storage/accounts",
|
|
90
91
|
sessions: "storage/sessions",
|
|
91
92
|
cache: "storage/cache",
|
|
93
|
+
logs: "storage/logs",
|
|
92
94
|
site: "site"
|
|
93
95
|
};
|
|
94
96
|
} else if (config.folderStructure === "flat") {
|
|
@@ -98,6 +100,17 @@ ${info}`);
|
|
|
98
100
|
accounts: "site/accounts",
|
|
99
101
|
sessions: "site/sessions",
|
|
100
102
|
cache: "site/cache",
|
|
103
|
+
logs: "site/logs",
|
|
104
|
+
site: "site"
|
|
105
|
+
};
|
|
106
|
+
} else if (config.folderStructure === "composer") {
|
|
107
|
+
folderStructure = {
|
|
108
|
+
content: "data/storage/content",
|
|
109
|
+
media: "public/media",
|
|
110
|
+
accounts: "data/storage/accounts",
|
|
111
|
+
sessions: "data/runtime/sessions",
|
|
112
|
+
cache: "data/runtime/cache",
|
|
113
|
+
logs: "data/runtime/logs",
|
|
101
114
|
site: "site"
|
|
102
115
|
};
|
|
103
116
|
} else {
|
|
@@ -127,7 +140,7 @@ ${info}`);
|
|
|
127
140
|
|
|
128
141
|
// src/lftp/cat.ts
|
|
129
142
|
import { spawnSync } from "child_process";
|
|
130
|
-
import consola2 from "consola";
|
|
143
|
+
import { consola as consola2 } from "consola";
|
|
131
144
|
import { platform } from "os";
|
|
132
145
|
var cat = (file, { host, user, password, lftpSettings }) => {
|
|
133
146
|
const commands = [
|
|
@@ -148,14 +161,14 @@ var cat = (file, { host, user, password, lftpSettings }) => {
|
|
|
148
161
|
};
|
|
149
162
|
|
|
150
163
|
// src/sync.ts
|
|
151
|
-
import consola5 from "consola";
|
|
164
|
+
import { consola as consola5 } from "consola";
|
|
152
165
|
import { join as join2 } from "path/posix";
|
|
153
166
|
|
|
154
167
|
// src/lftp/mirror.ts
|
|
155
|
-
import consola3 from "consola";
|
|
168
|
+
import { consola as consola3 } from "consola";
|
|
156
169
|
import { colors } from "consola/utils";
|
|
157
|
-
import { spawn } from "
|
|
158
|
-
import { platform as platform2 } from "
|
|
170
|
+
import { spawn } from "child_process";
|
|
171
|
+
import { platform as platform2 } from "os";
|
|
159
172
|
var mirror = (source, destination, flags, { lftpSettings, host, user, password, verbose }) => {
|
|
160
173
|
const commands = [
|
|
161
174
|
...Object.entries(lftpSettings).map(
|
|
@@ -212,13 +225,13 @@ ${colors.bgBlue(" LFTP ")} ${commands.join("; ")}
|
|
|
212
225
|
};
|
|
213
226
|
|
|
214
227
|
// src/utils.ts
|
|
215
|
-
import consola4 from "consola";
|
|
228
|
+
import { consola as consola4 } from "consola";
|
|
216
229
|
import { colors as colors2 } from "consola/utils";
|
|
217
|
-
import { spawnSync as spawnSync2 } from "
|
|
218
|
-
import { existsSync } from "
|
|
219
|
-
import { join } from "
|
|
220
|
-
import { cwd, stdin as input, stdout as output } from "
|
|
221
|
-
import * as readline from "
|
|
230
|
+
import { spawnSync as spawnSync2 } from "child_process";
|
|
231
|
+
import { existsSync } from "fs";
|
|
232
|
+
import { join } from "path";
|
|
233
|
+
import { cwd, stdin as input, stdout as output } from "process";
|
|
234
|
+
import * as readline from "readline";
|
|
222
235
|
var upperFirst = (string2) => string2.charAt(0).toUpperCase() + string2.slice(1);
|
|
223
236
|
var isGit = () => existsSync(join(cwd(), ".git"));
|
|
224
237
|
var getBranch = () => {
|
|
@@ -339,7 +352,7 @@ var sync = async (source, mode, config) => {
|
|
|
339
352
|
|
|
340
353
|
// src/commands/accounts.ts
|
|
341
354
|
import { defineCommand } from "citty";
|
|
342
|
-
import consola6 from "consola";
|
|
355
|
+
import { consola as consola6 } from "consola";
|
|
343
356
|
import { colors as colors3 } from "consola/utils";
|
|
344
357
|
import { join as join3 } from "path/posix";
|
|
345
358
|
var syncAccounts = async (mode) => {
|
|
@@ -375,7 +388,7 @@ var accountsPull = defineCommand({ run: () => syncAccounts("pull") });
|
|
|
375
388
|
|
|
376
389
|
// src/commands/content.ts
|
|
377
390
|
import { defineCommand as defineCommand2 } from "citty";
|
|
378
|
-
import consola7 from "consola";
|
|
391
|
+
import { consola as consola7 } from "consola";
|
|
379
392
|
import { colors as colors4 } from "consola/utils";
|
|
380
393
|
import { join as join4 } from "path/posix";
|
|
381
394
|
var syncContent = async (mode) => {
|
|
@@ -410,7 +423,7 @@ var contentPull = defineCommand2({ run: () => syncContent("pull") });
|
|
|
410
423
|
|
|
411
424
|
// src/commands/languages.ts
|
|
412
425
|
import { defineCommand as defineCommand3 } from "citty";
|
|
413
|
-
import consola8 from "consola";
|
|
426
|
+
import { consola as consola8 } from "consola";
|
|
414
427
|
import { colors as colors5 } from "consola/utils";
|
|
415
428
|
import { join as join5 } from "path/posix";
|
|
416
429
|
var syncLanguages = async (mode) => {
|
|
@@ -461,6 +474,7 @@ var main = defineCommand4({
|
|
|
461
474
|
`^${relative(cwd2(), folderStructure.accounts)}`,
|
|
462
475
|
`^${relative(cwd2(), folderStructure.sessions)}`,
|
|
463
476
|
`^${relative(cwd2(), folderStructure.cache)}`,
|
|
477
|
+
`^${relative(cwd2(), folderStructure.logs)}`,
|
|
464
478
|
`^${relative(cwd2(), join6(folderStructure.site, "languages"))}`
|
|
465
479
|
];
|
|
466
480
|
const excludeGlob = [...config.excludeGlob, ".*", ".*/"];
|
package/dist/index.d.ts
CHANGED
|
@@ -5,28 +5,29 @@ declare const ConfigSchema: valibot.ObjectSchema<{
|
|
|
5
5
|
readonly host: valibot.StringSchema<undefined>;
|
|
6
6
|
readonly user: valibot.StringSchema<undefined>;
|
|
7
7
|
readonly password: valibot.StringSchema<undefined>;
|
|
8
|
-
readonly url: valibot.OptionalSchema<valibot.StringSchema<undefined>,
|
|
9
|
-
readonly token: valibot.OptionalSchema<valibot.StringSchema<undefined>,
|
|
10
|
-
readonly remoteDir: valibot.OptionalSchema<valibot.StringSchema<undefined>,
|
|
11
|
-
readonly folderStructure: valibot.OptionalSchema<valibot.UnionSchema<[valibot.LiteralSchema<"flat", undefined>, valibot.LiteralSchema<"public", undefined>, valibot.ObjectSchema<{
|
|
8
|
+
readonly url: valibot.OptionalSchema<valibot.StringSchema<undefined>, undefined>;
|
|
9
|
+
readonly token: valibot.OptionalSchema<valibot.StringSchema<undefined>, undefined>;
|
|
10
|
+
readonly remoteDir: valibot.OptionalSchema<valibot.StringSchema<undefined>, undefined>;
|
|
11
|
+
readonly folderStructure: valibot.OptionalSchema<valibot.UnionSchema<[valibot.LiteralSchema<"flat", undefined>, valibot.LiteralSchema<"public", undefined>, valibot.LiteralSchema<"composer", undefined>, valibot.ObjectSchema<{
|
|
12
12
|
readonly content: valibot.StringSchema<undefined>;
|
|
13
13
|
readonly media: valibot.StringSchema<undefined>;
|
|
14
14
|
readonly accounts: valibot.StringSchema<undefined>;
|
|
15
15
|
readonly sessions: valibot.StringSchema<undefined>;
|
|
16
16
|
readonly cache: valibot.StringSchema<undefined>;
|
|
17
|
+
readonly logs: valibot.StringSchema<undefined>;
|
|
17
18
|
readonly site: valibot.StringSchema<undefined>;
|
|
18
|
-
}, undefined>], undefined>,
|
|
19
|
-
readonly checkComposerLock: valibot.OptionalSchema<valibot.BooleanSchema<undefined>,
|
|
20
|
-
readonly callWebhooks: valibot.OptionalSchema<valibot.BooleanSchema<undefined>,
|
|
21
|
-
readonly dryRun: valibot.OptionalSchema<valibot.BooleanSchema<undefined>,
|
|
22
|
-
readonly verbose: valibot.OptionalSchema<valibot.BooleanSchema<undefined>,
|
|
23
|
-
readonly parallel: valibot.OptionalSchema<valibot.NumberSchema<undefined>,
|
|
24
|
-
readonly exclude: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>,
|
|
25
|
-
readonly excludeGlob: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>,
|
|
26
|
-
readonly include: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>,
|
|
27
|
-
readonly includeGlob: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>,
|
|
28
|
-
readonly lftpSettings: valibot.OptionalSchema<valibot.RecordSchema<valibot.StringSchema<undefined>, valibot.AnySchema, undefined>,
|
|
29
|
-
readonly lftpFlags: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>,
|
|
19
|
+
}, undefined>], undefined>, undefined>;
|
|
20
|
+
readonly checkComposerLock: valibot.OptionalSchema<valibot.BooleanSchema<undefined>, undefined>;
|
|
21
|
+
readonly callWebhooks: valibot.OptionalSchema<valibot.BooleanSchema<undefined>, undefined>;
|
|
22
|
+
readonly dryRun: valibot.OptionalSchema<valibot.BooleanSchema<undefined>, undefined>;
|
|
23
|
+
readonly verbose: valibot.OptionalSchema<valibot.BooleanSchema<undefined>, undefined>;
|
|
24
|
+
readonly parallel: valibot.OptionalSchema<valibot.NumberSchema<undefined>, undefined>;
|
|
25
|
+
readonly exclude: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, undefined>;
|
|
26
|
+
readonly excludeGlob: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, undefined>;
|
|
27
|
+
readonly include: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, undefined>;
|
|
28
|
+
readonly includeGlob: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, undefined>;
|
|
29
|
+
readonly lftpSettings: valibot.OptionalSchema<valibot.RecordSchema<valibot.StringSchema<undefined>, valibot.AnySchema, undefined>, undefined>;
|
|
30
|
+
readonly lftpFlags: valibot.OptionalSchema<valibot.ArraySchema<valibot.StringSchema<undefined>, undefined>, undefined>;
|
|
30
31
|
}, undefined>;
|
|
31
32
|
type Config = InferInput<typeof ConfigSchema>;
|
|
32
33
|
|
|
@@ -37,12 +38,13 @@ declare const defineConfig: (config: Config) => {
|
|
|
37
38
|
url?: string | undefined;
|
|
38
39
|
token?: string | undefined;
|
|
39
40
|
remoteDir?: string | undefined;
|
|
40
|
-
folderStructure?: "flat" | "public" | {
|
|
41
|
+
folderStructure?: "flat" | "public" | "composer" | {
|
|
41
42
|
content: string;
|
|
42
43
|
media: string;
|
|
43
44
|
accounts: string;
|
|
44
45
|
sessions: string;
|
|
45
46
|
cache: string;
|
|
47
|
+
logs: string;
|
|
46
48
|
site: string;
|
|
47
49
|
} | undefined;
|
|
48
50
|
checkComposerLock?: boolean | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kirby-deploy",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -10,17 +10,17 @@
|
|
|
10
10
|
"author": "Arno Schlipf",
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"@prettier/plugin-php": "^0.
|
|
13
|
+
"@prettier/plugin-php": "^0.24.0",
|
|
14
14
|
"@types/node": "^20.16.10",
|
|
15
15
|
"prettier": "^3.3.3",
|
|
16
16
|
"tsup": "^8.3.0",
|
|
17
17
|
"typescript": "^5.6.2"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"c12": "^
|
|
20
|
+
"c12": "^3.0.0",
|
|
21
21
|
"citty": "^0.1.6",
|
|
22
22
|
"consola": "^3.2.3",
|
|
23
|
-
"valibot": "^0.
|
|
23
|
+
"valibot": "^1.0.0"
|
|
24
24
|
},
|
|
25
25
|
"scripts": {
|
|
26
26
|
"build": "tsup src/index.ts src/cli.ts --format esm --dts",
|
package/src/commands/accounts.ts
CHANGED
package/src/commands/content.ts
CHANGED
package/src/commands/main.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineCommand } from 'citty'
|
|
2
|
-
import consola from 'consola'
|
|
2
|
+
import { consola } from 'consola'
|
|
3
3
|
import { colors } from 'consola/utils'
|
|
4
4
|
import { readFileSync } from 'fs'
|
|
5
5
|
import { join, relative } from 'path/posix'
|
|
@@ -33,6 +33,7 @@ export const main = defineCommand({
|
|
|
33
33
|
`^${relative(cwd(), folderStructure.accounts)}`,
|
|
34
34
|
`^${relative(cwd(), folderStructure.sessions)}`,
|
|
35
35
|
`^${relative(cwd(), folderStructure.cache)}`,
|
|
36
|
+
`^${relative(cwd(), folderStructure.logs)}`,
|
|
36
37
|
`^${relative(cwd(), join(folderStructure.site, 'languages'))}`,
|
|
37
38
|
]
|
|
38
39
|
const excludeGlob = [...config.excludeGlob, '.*', '.*/']
|
package/src/config.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { loadConfig as load } from 'c12'
|
|
2
|
-
import consola from 'consola'
|
|
2
|
+
import { consola } from 'consola'
|
|
3
3
|
import { flatten, parse } from 'valibot'
|
|
4
4
|
import { Config, ConfigResolved, ConfigSchema, FolderStructure } from './types'
|
|
5
5
|
|
|
@@ -28,7 +28,6 @@ export const loadConfig = async (): Promise<ConfigResolved | null> => {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
// Resolve shorthands
|
|
31
|
-
|
|
32
31
|
let folderStructure: FolderStructure
|
|
33
32
|
config.folderStructure ??= 'flat'
|
|
34
33
|
if (config.folderStructure === 'public') {
|
|
@@ -38,6 +37,7 @@ export const loadConfig = async (): Promise<ConfigResolved | null> => {
|
|
|
38
37
|
accounts: 'storage/accounts',
|
|
39
38
|
sessions: 'storage/sessions',
|
|
40
39
|
cache: 'storage/cache',
|
|
40
|
+
logs: 'storage/logs',
|
|
41
41
|
site: 'site',
|
|
42
42
|
}
|
|
43
43
|
} else if (config.folderStructure === 'flat') {
|
|
@@ -48,6 +48,17 @@ export const loadConfig = async (): Promise<ConfigResolved | null> => {
|
|
|
48
48
|
accounts: 'site/accounts',
|
|
49
49
|
sessions: 'site/sessions',
|
|
50
50
|
cache: 'site/cache',
|
|
51
|
+
logs: 'site/logs',
|
|
52
|
+
site: 'site',
|
|
53
|
+
}
|
|
54
|
+
} else if (config.folderStructure === 'composer') {
|
|
55
|
+
folderStructure = {
|
|
56
|
+
content: 'data/storage/content',
|
|
57
|
+
media: 'public/media',
|
|
58
|
+
accounts: 'data/storage/accounts',
|
|
59
|
+
sessions: 'data/runtime/sessions',
|
|
60
|
+
cache: 'data/runtime/cache',
|
|
61
|
+
logs: 'data/runtime/logs',
|
|
51
62
|
site: 'site',
|
|
52
63
|
}
|
|
53
64
|
} else {
|
package/src/lftp/cat.ts
CHANGED
package/src/lftp/mirror.ts
CHANGED
package/src/sync.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -18,6 +18,7 @@ export const FolderStructureSchema = object({
|
|
|
18
18
|
accounts: string(),
|
|
19
19
|
sessions: string(),
|
|
20
20
|
cache: string(),
|
|
21
|
+
logs: string(),
|
|
21
22
|
site: string(),
|
|
22
23
|
})
|
|
23
24
|
|
|
@@ -31,7 +32,7 @@ export const ConfigSchema = object({
|
|
|
31
32
|
token: optional(string()),
|
|
32
33
|
remoteDir: optional(string()),
|
|
33
34
|
folderStructure: optional(
|
|
34
|
-
union([literal('flat'), literal('public'), FolderStructureSchema]),
|
|
35
|
+
union([literal('flat'), literal('public'), literal('composer'), FolderStructureSchema]),
|
|
35
36
|
),
|
|
36
37
|
checkComposerLock: optional(boolean()),
|
|
37
38
|
callWebhooks: optional(boolean()),
|
package/src/utils.ts
CHANGED