dxfl 0.5.3 → 0.6.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/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ # v0.6.0
2
+
3
+ - Allow passing a URL as the website name
4
+
5
+ # v0.5.4, v0.5.5
6
+
7
+ - Fix bug when deploying compressed files in subdirectories (introduced in 0.5.0)
8
+
1
9
  # v0.5.3
2
10
 
3
11
  - Update @aws-sdk/client-s3 to include patch for CVE-2026-26278 (cleaning 0.5.1 and 0.5.2)
package/README.md CHANGED
@@ -146,26 +146,26 @@ allowed_origins = "https://www.example.com"
146
146
  # Required parameter.
147
147
 
148
148
  # HTTP methods allowed in a cross-origin request (in response to a preflight request).
149
- allowed_method = "GET"
149
+ allowed_methods = "GET"
150
150
  # Possible values:
151
- # - allowed_method = "*" : wild card to allow all methods (only GET/HEAD are currently supported by the server)
152
- # - allowed_method = "GET" : string of http method ("GET" or "HEAD")
153
- # - allowed_method = ["GET", "HEAD"] : array of string http methods
151
+ # - allowed_methods = "*" : wild card to allow all methods (only GET/HEAD are currently supported by the server)
152
+ # - allowed_methods = "GET" : string of http method ("GET" or "HEAD")
153
+ # - allowed_methods = ["GET", "HEAD"] : array of string http methods
154
154
  # Optional parameter. Default value: ["GET", "HEAD"]
155
155
 
156
156
  # Request headers allowed in a preflight request.
157
- allowed_header = "Authorization"
157
+ allowed_headers = "Authorization"
158
158
  # Possible values:
159
- # - allowed_header = "*" : wildcard to allow all headers
160
- # - allowed_header = "Authorization" : string of http header
161
- # - allowed_header = ["Authorization", "Age"] : array of string http header
159
+ # - allowed_headers = "*" : wildcard to allow all headers
160
+ # - allowed_headers = "Authorization" : string of http header
161
+ # - allowed_headers = ["Authorization", "Age"] : array of string http header
162
162
  # Optional parameter. Default value : []
163
163
 
164
164
  # Response headers you want to make available to JavaScript in response to a cross-origin request.
165
- expose_header = "Content-Encoding"
165
+ expose_headers = "Content-Encoding"
166
166
  # Possible values:
167
- # - expose_header = "Content-Encoding" : string of http header
168
- # - expose_header = ["Content-Encoding", "Kuma-Revision"] : array of string http header
167
+ # - expose_headers = "Content-Encoding" : string of http header
168
+ # - expose_headers = ["Content-Encoding", "Kuma-Revision"] : array of string http header
169
169
  # Optional Parameter. Default value : []
170
170
  ```
171
171
 
package/dist/deploy.js CHANGED
@@ -13,7 +13,7 @@ import { PromisePool } from "@supercharge/promise-pool";
13
13
  import { deleteBucketFile, deleteBucketFiles, getBucketCredentials, getBucket, getBucketFiles, putEmptyObjectRedirect, uploadFile, setObjectHeaders, } from "./bucket.js";
14
14
  import { ErrorMsg } from "./error.js";
15
15
  import { fileContentType, supportedHeaders, } from "./headers.js";
16
- import { confirmationPrompt, filterMap, formatBytesHuman, formatCount, getFileMd5, gzipFile, mapEq, mkTmpDir, sum, } from "./utils.js";
16
+ import { confirmationPrompt, filterMap, formatBytesHuman, formatCount, getFileMd5, gzipFile, mapEq, mkTmpDir, sum, websiteIdBestEffort, } from "./utils.js";
17
17
  import { evalHeadersRules, equalBucketRedirect, getBucketConfig, putBucketWebsiteConfig, readConfigFile, } from "./website_config.js";
18
18
  // Walks through the local directory at path `dir`, and for each file it contains, returns :
19
19
  // - `localPath`: its path on the local filesystem (includes `dir`). On windows, this path
@@ -83,7 +83,10 @@ export function compressSelectedLocalFiles(localFiles, localCfg) {
83
83
  if (headers.compress) {
84
84
  compressed = true;
85
85
  if (headers.compress == "gzip") {
86
- const compressedPath = path.join(tmpDir, f.s3Path);
86
+ // use the original file md5 as filename, this prevents conflicts
87
+ // and is easier than reusing f.s3Path or f.localPath
88
+ // (no need to create subdirectories or handle path delimiters portably)
89
+ const compressedPath = path.join(tmpDir, f.md5);
87
90
  yield gzipFile(localPath, compressedPath);
88
91
  const [stat, compressedMd5] = yield Promise.all([
89
92
  fs.promises.stat(compressedPath),
@@ -426,13 +429,15 @@ export function deploy(website, localFolder, options) {
426
429
  }
427
430
  // Read and validate the local configuration file before doing anything else
428
431
  const localWebsiteConfig = yield readConfigFile(options.configFile);
432
+ // Interpret the name of the website
433
+ const websiteId = websiteIdBestEffort(website);
429
434
  process.stdout.write("Fetching the website configuration and metadata...\n");
430
435
  const [localFiles, [bucket, remoteFiles, remoteWebsiteConfig]] = yield Promise.all([
431
436
  // Get paths & size of the local files to deploy
432
437
  getLocalFilesWithInfo(localFolder),
433
438
  // Get the bucket, list of files stored in the bucket, and bucket website config
434
439
  (() => __awaiter(this, void 0, void 0, function* () {
435
- const bucket = yield getBucket(website, yield getBucketCredentials(website));
440
+ const bucket = yield getBucket(websiteId, yield getBucketCredentials(websiteId));
436
441
  const remoteFiles = yield getBucketFiles(bucket);
437
442
  // This can be slow because it needs to query each object in the bucket.
438
443
  const remoteWebsiteConfig = yield getBucketConfig(bucket, [
package/dist/empty.js CHANGED
@@ -9,14 +9,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import { getBucket, getBucketCredentials, getBucketFiles, deleteBucketFiles, } from "./bucket.js";
11
11
  import { ErrorMsg } from "./error.js";
12
- import { confirmationPrompt, formatBytesHuman, formatCount, sum, } from "./utils.js";
12
+ import { confirmationPrompt, formatBytesHuman, formatCount, sum, websiteIdBestEffort, } from "./utils.js";
13
13
  export function empty(website, options) {
14
14
  return __awaiter(this, void 0, void 0, function* () {
15
15
  if (options.dryRun && options.yes) {
16
16
  throw new ErrorMsg("options --yes and --dry-run cannot be passed at the same time");
17
17
  }
18
18
  process.stdout.write("Fetching the website configuration and metadata...\n");
19
- const bucket = yield getBucket(website, yield getBucketCredentials(website));
19
+ // Interpret the name of the website
20
+ const websiteId = websiteIdBestEffort(website);
21
+ const bucket = yield getBucket(websiteId, yield getBucketCredentials(websiteId));
20
22
  const filesToDelete = [...(yield getBucketFiles(bucket))].map(([name, { size }]) => ({
21
23
  name,
22
24
  size,
package/dist/index.js CHANGED
@@ -4,9 +4,9 @@ import { withHandleErrors } from "./error.js";
4
4
  import { login, logout } from "./auth.js";
5
5
  import { deploy } from "./deploy.js";
6
6
  import { empty } from "./empty.js";
7
- import { vhostsList } from "./vhosts.js";
7
+ import { list } from "./vhosts.js";
8
8
  import { inspect } from "./inspect.js";
9
- program.name("dxfl").description("Deuxfleurs CLI tool").version("0.5.3");
9
+ program.name("dxfl").description("Deuxfleurs CLI tool").version("0.6.0");
10
10
  program
11
11
  .command("login")
12
12
  .description("Link your Deuxfleurs account with this tool.")
@@ -15,7 +15,7 @@ program
15
15
  program
16
16
  .command("list")
17
17
  .description("List all your websites")
18
- .action(() => withHandleErrors(vhostsList));
18
+ .action(() => withHandleErrors(list));
19
19
  program
20
20
  .command("inspect")
21
21
  .description("Show your website details")
package/dist/inspect.js CHANGED
@@ -9,14 +9,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import { WebsiteApi } from "guichet-sdk-ts";
11
11
  import { openApiConf } from "./auth.js";
12
- import { formatBytesHuman, separator } from "./utils.js";
12
+ import { formatBytesHuman, separator, websiteIdBestEffort } from "./utils.js";
13
13
  import { styleText } from "node:util";
14
14
  export function inspect(website, options) {
15
15
  return __awaiter(this, void 0, void 0, function* () {
16
16
  var _a, _b, _c;
17
+ const websiteId = websiteIdBestEffort(website); // Interpret the name of the website
17
18
  const conf = yield openApiConf();
18
19
  const web = new WebsiteApi(conf);
19
- let siteData = yield web.getWebsite({ vhost: website });
20
+ let siteData = yield web.getWebsite({ vhost: websiteId });
20
21
  const q = siteData.quotaSize;
21
22
  const v = siteData.vhost;
22
23
  const kId = siteData === null || siteData === void 0 ? void 0 : siteData.accessKeyId;
@@ -0,0 +1 @@
1
+ {"root":["../auth.ts","../bucket.ts","../deploy.ts","../empty.ts","../error.ts","../guichet.ts","../headers.ts","../index.ts","../inspect.ts","../utils.ts","../vhosts.ts","../website_config.ts"],"version":"5.9.3"}
package/dist/utils.js CHANGED
@@ -23,6 +23,7 @@ import { pipeline } from "node:stream/promises";
23
23
  import { styleText } from "node:util";
24
24
  import zlib from "node:zlib";
25
25
  import readline from "readline/promises";
26
+ import URI from "fast-uri";
26
27
  import { ErrorMsg } from "./error.js";
27
28
  export function getFileMd5(file) {
28
29
  return __awaiter(this, void 0, void 0, function* () {
@@ -150,3 +151,15 @@ export function mapEq(m1, m2) {
150
151
  return (m1.size === m2.size &&
151
152
  Array.from(m1.keys()).every(key => m1.get(key) == m2.get(key)));
152
153
  }
154
+ // Accept {http,https}://website{,/} as identifier for "website".
155
+ // (Useful to allow copy-pasting URLs into the terminal.)
156
+ export function websiteIdBestEffort(website) {
157
+ const asURI = URI.parse(website);
158
+ if (!asURI.error &&
159
+ asURI.host &&
160
+ (asURI.scheme == "http" || asURI.scheme == "https") &&
161
+ (asURI.path == "" || asURI.path == "/")) {
162
+ return asURI.host;
163
+ }
164
+ return website;
165
+ }
package/dist/vhosts.js CHANGED
@@ -11,7 +11,7 @@ import { WebsiteApi } from "guichet-sdk-ts";
11
11
  import { openApiConf } from "./auth.js";
12
12
  import { separator } from "./utils.js";
13
13
  import { styleText } from "node:util";
14
- export function vhostsList() {
14
+ export function list() {
15
15
  return __awaiter(this, void 0, void 0, function* () {
16
16
  var _a, _b, _c;
17
17
  const conf = yield openApiConf();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dxfl",
3
- "version": "0.5.3",
3
+ "version": "0.6.0",
4
4
  "description": "",
5
5
  "license": "EUPL-1.2",
6
6
  "author": "Deuxfleurs Team <coucou@deuxfleurs.fr>",
@@ -23,7 +23,7 @@
23
23
  "prettier-check": "npx prettier . --check"
24
24
  },
25
25
  "dependencies": {
26
- "@aws-sdk/client-s3": "^3.1012.0",
26
+ "@aws-sdk/client-s3": "^3.1014.0",
27
27
  "@commander-js/extra-typings": "^14.0.0",
28
28
  "@supercharge/promise-pool": "^3.2.0",
29
29
  "@types/node": "^25.2.1",
@@ -42,10 +42,5 @@
42
42
  "devDependencies": {
43
43
  "onchange": "^7.1.0",
44
44
  "prettier": "3.5.3"
45
- },
46
- "overrides": {
47
- "@aws-sdk/xml-builder": {
48
- "fast-xml-parser": "^5.5.6"
49
- }
50
45
  }
51
46
  }