kirby-deploy 0.3.0 → 0.3.3

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 CHANGED
@@ -46,7 +46,12 @@ var ConfigSchema = object({
46
46
  token: optional(string()),
47
47
  remoteDir: optional(string()),
48
48
  folderStructure: optional(
49
- union([literal("flat"), literal("public"), literal("composer"), FolderStructureSchema])
49
+ union([
50
+ literal("flat"),
51
+ literal("public"),
52
+ literal("composer"),
53
+ FolderStructureSchema
54
+ ])
50
55
  ),
51
56
  checkComposerLock: optional(boolean()),
52
57
  callWebhooks: optional(boolean()),
@@ -63,6 +68,7 @@ var ConfigSchema = object({
63
68
 
64
69
  // src/config.ts
65
70
  var loadConfig = async () => {
71
+ var _a;
66
72
  let { config, configFile } = await load({
67
73
  name: "kirby-deploy",
68
74
  dotenv: true
@@ -96,7 +102,7 @@ ${info}`);
96
102
  } else if (config.folderStructure === "flat") {
97
103
  folderStructure = {
98
104
  content: "content",
99
- media: "site/media",
105
+ media: "media",
100
106
  accounts: "site/accounts",
101
107
  sessions: "site/sessions",
102
108
  cache: "site/cache",
@@ -128,6 +134,7 @@ ${info}`);
128
134
  include: [],
129
135
  includeGlob: [],
130
136
  ...config,
137
+ url: (_a = config.url) == null ? void 0 : _a.replace(/\/$/, ""),
131
138
  folderStructure,
132
139
  lftpSettings: {
133
140
  "ftp:ssl-force": true,
@@ -156,7 +163,11 @@ var cat = (file, { host, user, password, lftpSettings }) => {
156
163
  const child = isWindows ? spawnSync("wsl", ["lftp", "-c", commands.join("; ")], {
157
164
  encoding: "utf-8"
158
165
  }) : spawnSync("lftp", ["-c", commands.join("; ")], { encoding: "utf-8" });
159
- if (child.stderr) consola2.error(child.stderr);
166
+ if (child.stderr) {
167
+ if (child.stderr.includes("550")) return void 0;
168
+ consola2.error(child.stderr);
169
+ return void 0;
170
+ }
160
171
  return child.stdout;
161
172
  };
162
173
 
@@ -275,7 +286,7 @@ var sync = async (source, mode, config) => {
275
286
  const targetName = mode === "push" ? "remote" : "local";
276
287
  const webhookBase = `${config.url}/plugin-kirby-deploy`;
277
288
  const shouldCallWebhooks = mode === "push" && config.callWebhooks;
278
- const destination = source === "./" ? config.remoteDir : `./${join2(config.remoteDir, source)}`;
289
+ const destination = source === "./" ? config.remoteDir : join2(config.remoteDir, source);
279
290
  if (shouldCallWebhooks && !config.token) {
280
291
  consola5.error("token needed to call webhooks");
281
292
  return false;
@@ -492,7 +503,7 @@ var main = defineCommand4({
492
503
  encoding: "utf-8"
493
504
  });
494
505
  const remoteComposerLock = cat("./composer.lock", config);
495
- const skipVendor = localComposerLock === remoteComposerLock;
506
+ const skipVendor = remoteComposerLock !== void 0 && localComposerLock === remoteComposerLock;
496
507
  if (skipVendor) {
497
508
  exclude.push("^vendor/", "^kirby/");
498
509
  consola9.info("Skipping vendor\n");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kirby-deploy",
3
- "version": "0.3.0",
3
+ "version": "0.3.3",
4
4
  "main": "./dist/index.js",
5
5
  "type": "module",
6
6
  "bin": {
@@ -9,6 +9,15 @@
9
9
  "keywords": [],
10
10
  "author": "Arno Schlipf",
11
11
  "license": "MIT",
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "https://github.com/arnoson/kirby-deploy"
15
+ },
16
+ "scripts": {
17
+ "build": "tsup src/index.ts src/cli.ts --format esm --dts",
18
+ "dev": "tsup src/index.ts src/cli.ts --format esm --watch",
19
+ "type-check": "tsc --noEmit"
20
+ },
12
21
  "devDependencies": {
13
22
  "@prettier/plugin-php": "^0.24.0",
14
23
  "@types/node": "^20.16.10",
@@ -21,10 +30,5 @@
21
30
  "citty": "^0.1.6",
22
31
  "consola": "^3.2.3",
23
32
  "valibot": "^1.0.0"
24
- },
25
- "scripts": {
26
- "build": "tsup src/index.ts src/cli.ts --format esm --dts",
27
- "dev": "tsup src/index.ts src/cli.ts --format esm --watch",
28
- "type-check": "tsc --noEmit"
29
33
  }
30
- }
34
+ }
@@ -52,7 +52,9 @@ export const main = defineCommand({
52
52
  encoding: 'utf-8',
53
53
  })
54
54
  const remoteComposerLock = cat('./composer.lock', config)
55
- const skipVendor = localComposerLock === remoteComposerLock
55
+ const skipVendor =
56
+ remoteComposerLock !== undefined &&
57
+ localComposerLock === remoteComposerLock
56
58
  if (skipVendor) {
57
59
  exclude.push('^vendor/', '^kirby/')
58
60
  consola.info('Skipping vendor\n')
package/src/config.ts CHANGED
@@ -44,7 +44,7 @@ export const loadConfig = async (): Promise<ConfigResolved | null> => {
44
44
  // 'flat' structure is the default.
45
45
  folderStructure = {
46
46
  content: 'content',
47
- media: 'site/media',
47
+ media: 'media',
48
48
  accounts: 'site/accounts',
49
49
  sessions: 'site/sessions',
50
50
  cache: 'site/cache',
@@ -77,6 +77,7 @@ export const loadConfig = async (): Promise<ConfigResolved | null> => {
77
77
  include: [],
78
78
  includeGlob: [],
79
79
  ...config,
80
+ url: config.url?.replace(/\/$/, ''),
80
81
  folderStructure,
81
82
  lftpSettings: {
82
83
  'ftp:ssl-force': true,
package/src/lftp/cat.ts CHANGED
@@ -24,6 +24,11 @@ export const cat = (
24
24
  })
25
25
  : spawnSync('lftp', ['-c', commands.join('; ')], { encoding: 'utf-8' })
26
26
 
27
- if (child.stderr) consola.error(child.stderr)
27
+ if (child.stderr) {
28
+ // 550 means the file doesn't exist, silently return undefined
29
+ if (child.stderr.includes('550')) return undefined
30
+ consola.error(child.stderr)
31
+ return undefined
32
+ }
28
33
  return child.stdout
29
34
  }
package/src/sync.ts CHANGED
@@ -14,7 +14,7 @@ export const sync = async (
14
14
  const webhookBase = `${config.url}/plugin-kirby-deploy`
15
15
  const shouldCallWebhooks = mode === 'push' && config.callWebhooks
16
16
  const destination =
17
- source === './' ? config.remoteDir : `./${join(config.remoteDir, source)}`
17
+ source === './' ? config.remoteDir : join(config.remoteDir, source)
18
18
 
19
19
  if (shouldCallWebhooks && !config.token) {
20
20
  consola.error('token needed to call webhooks')
package/src/types.ts CHANGED
@@ -32,7 +32,12 @@ export const ConfigSchema = object({
32
32
  token: optional(string()),
33
33
  remoteDir: optional(string()),
34
34
  folderStructure: optional(
35
- union([literal('flat'), literal('public'), literal('composer'), FolderStructureSchema]),
35
+ union([
36
+ literal('flat'),
37
+ literal('public'),
38
+ literal('composer'),
39
+ FolderStructureSchema,
40
+ ]),
36
41
  ),
37
42
  checkComposerLock: optional(boolean()),
38
43
  callWebhooks: optional(boolean()),