dxfl 0.3.0 → 0.3.1

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/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # v0.3.1
2
+
3
+ - fix `deuxfleurs.toml`: always pass the user-provided value of index_page to garage
4
+
1
5
  # v0.3.0
2
6
 
3
7
  - improve `list` presentation
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import { deploy } from "./deploy.js";
6
6
  import { empty } from "./empty.js";
7
7
  import { vhostsList } from "./vhosts.js";
8
8
  import { inspect } from "./inspect.js";
9
- program.name("dxfl").description("Deuxfleurs CLI tool").version("0.3.0");
9
+ program.name("dxfl").description("Deuxfleurs CLI tool").version("0.3.1");
10
10
  program
11
11
  .command("login")
12
12
  .description("Link your Deuxfleurs account with this tool.")
@@ -143,8 +143,8 @@ function unescape(s) {
143
143
  }
144
144
  }
145
145
  function interpConfig(rawcfg) {
146
- var _a, _b, _c, _d, _e;
147
- function interpRedirect(i, r) {
146
+ var _a, _b, _c, _d, _e, _f;
147
+ function interpRedirect(r) {
148
148
  var _a, _b;
149
149
  const rfrom = withErrorMsg(() => unescape(r.from), msg => `from: ${msg}`);
150
150
  const rto = withErrorMsg(() => unescape(r.to), msg => `to: ${msg}`);
@@ -264,7 +264,7 @@ function interpConfig(rawcfg) {
264
264
  return s !== null && s !== void 0 ? s : def;
265
265
  };
266
266
  // use index.html as default index page
267
- const index_page = withDefault(rawcfg.index_page, "index.html");
267
+ const index_page = (_a = rawcfg.index_page) !== null && _a !== void 0 ? _a : "index.html";
268
268
  // use error.html as default error page
269
269
  const error_page = withDefault(rawcfg.error_page, "error.html");
270
270
  let cfg = {
@@ -274,9 +274,9 @@ function interpConfig(rawcfg) {
274
274
  object_redirects: new Map(),
275
275
  cors_rules: [],
276
276
  };
277
- for (const [i, raw] of ((_a = rawcfg.redirects) !== null && _a !== void 0 ? _a : []).entries()) {
277
+ for (const [i, raw] of ((_b = rawcfg.redirects) !== null && _b !== void 0 ? _b : []).entries()) {
278
278
  // `i+1` is only used for display: start counting redirects from 1 instead of 0
279
- const r = withErrorMsg(() => interpRedirect(i + 1, raw), msg => `Redirect ${i + 1}: ${msg}`);
279
+ const r = withErrorMsg(() => interpRedirect(raw), msg => `Redirect ${i + 1}: ${msg}`);
280
280
  if (r.kind == "bucket") {
281
281
  cfg.bucket_redirects.push(r.r);
282
282
  }
@@ -287,15 +287,15 @@ function interpConfig(rawcfg) {
287
287
  cfg.object_redirects.set(r.from, r.to);
288
288
  }
289
289
  }
290
- for (const [_, raw] of ((_b = rawcfg.cors) !== null && _b !== void 0 ? _b : []).entries()) {
290
+ for (const [_, raw] of ((_c = rawcfg.cors) !== null && _c !== void 0 ? _c : []).entries()) {
291
291
  const interpRawArray = (x) => {
292
292
  return typeof x === "string" ? [x] : x;
293
293
  };
294
294
  cfg.cors_rules.push({
295
295
  allowed_origins: interpRawArray(raw.allowed_origins),
296
- allowed_methods: interpRawArray((_c = raw.allowed_methods) !== null && _c !== void 0 ? _c : ["GET", "HEAD"]),
297
- allowed_headers: interpRawArray((_d = raw.allowed_methods) !== null && _d !== void 0 ? _d : []),
298
- expose_headers: interpRawArray((_e = raw.expose_headers) !== null && _e !== void 0 ? _e : []),
296
+ allowed_methods: interpRawArray((_d = raw.allowed_methods) !== null && _d !== void 0 ? _d : ["GET", "HEAD"]),
297
+ allowed_headers: interpRawArray((_e = raw.allowed_methods) !== null && _e !== void 0 ? _e : []),
298
+ expose_headers: interpRawArray((_f = raw.expose_headers) !== null && _f !== void 0 ? _f : []),
299
299
  });
300
300
  }
301
301
  return cfg;
@@ -431,10 +431,10 @@ export function putBucketWebsiteConfig(bucket, index_page, error_page, bucket_re
431
431
  return __awaiter(this, void 0, void 0, function* () {
432
432
  // TODO: printing to show what changes are being applied?
433
433
  const WebsiteConfiguration = {};
434
- if (error_page) {
434
+ if (error_page != undefined) {
435
435
  WebsiteConfiguration.ErrorDocument = { Key: error_page };
436
436
  }
437
- if (index_page) {
437
+ if (index_page != undefined) {
438
438
  WebsiteConfiguration.IndexDocument = { Suffix: index_page };
439
439
  }
440
440
  if (bucket_redirects.length > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dxfl",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "",
5
5
  "license": "EUPL-1.2",
6
6
  "author": "Deuxfleurs Team <coucou@deuxfleurs.fr>",