dxfl 0.3.2 → 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/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # v0.4.0
2
+
3
+ - `deploy`: allow to specify a custom config file with `--config-file` or `-c`
4
+
1
5
  # v0.3.2
2
6
 
3
7
  - update `@aws-sdk/client-s3` 3.983.0 → 3.1004.0
package/README.md CHANGED
@@ -40,6 +40,12 @@ Or only display the changes without applying them, with the `--dry-run` option:
40
40
  dxfl deploy example.com _public --dry-run
41
41
  ```
42
42
 
43
+ You can also specify a custom TOML configuration file to use instead of the default `deuxfleurs.toml`, with the `--config-file` option:
44
+
45
+ ```
46
+ dxfl deploy example.com _public --config-file custom.toml
47
+ ```
48
+
43
49
  Use the `empty` command to delete all files from a website (required before deleting it):
44
50
 
45
51
  ```
@@ -54,10 +60,10 @@ dxfl inspect example.com
54
60
 
55
61
  ## Website configuration
56
62
 
57
- `dxfl deploy` reads a `deuxfleurs.toml` configuration file (if it exists in the current directory).
63
+ `dxfl deploy` reads a TOML configuration file, `deuxfleurs.toml` by default (if it exists in the current directory), or the one specified with the `--config-file` option.
58
64
  This file can be used to specify website configuration metadata such as redirections.
59
65
 
60
- Your `deuxfleurs.toml` should follow the following structure:
66
+ Your configuration file should follow the following structure:
61
67
 
62
68
  ```toml
63
69
  # Filename added after URLs that point to directories.
package/dist/deploy.js CHANGED
@@ -323,10 +323,8 @@ export function deploy(website, localFolder, options) {
323
323
  if (options.dryRun && options.yes) {
324
324
  throw new ErrorMsg("options --yes and --dry-run cannot be passed at the same time");
325
325
  }
326
- // TODO: make this configurable
327
- const website_config_path = "deuxfleurs.toml";
328
326
  // Read and validate the local configuration file before doing anything else
329
- const localWebsiteConfig = yield readConfigFile(website_config_path);
327
+ const localWebsiteConfig = yield readConfigFile(options.configFile);
330
328
  process.stdout.write("Fetching the website configuration and metadata...\n");
331
329
  const [localFiles, [bucket, remoteFiles, remoteWebsiteConfig]] = yield Promise.all([
332
330
  // Get paths & size of the local files to deploy
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.2");
9
+ program.name("dxfl").description("Deuxfleurs CLI tool").version("0.4.0");
10
10
  program
11
11
  .command("login")
12
12
  .description("Link your Deuxfleurs account with this tool.")
@@ -29,6 +29,7 @@ program
29
29
  .argument("<local_folder>", "your local folder")
30
30
  .option("-n, --dry-run", "do a trial run without making actual changes")
31
31
  .option("-y, --yes", "apply the changes without asking for confirmation")
32
+ .option("-c, --config-file <path>", "apply a custom TOML config file")
32
33
  .action((website, localFolder, options) => withHandleErrors(() => deploy(website, localFolder, options)));
33
34
  program
34
35
  .command("empty")
@@ -54,7 +54,15 @@ export function equalCorsRules(c1, c2) {
54
54
  // Parsing: TOML -> untyped object
55
55
  function readConfigFileObject(filename) {
56
56
  return __awaiter(this, void 0, void 0, function* () {
57
- if (!fs.existsSync(filename)) {
57
+ if (filename != undefined) {
58
+ if (!fs.existsSync(filename)) {
59
+ throw new ErrorMsg(`${filename} configuration file not found`);
60
+ }
61
+ }
62
+ else if (fs.existsSync("deuxfleurs.toml")) {
63
+ filename = "deuxfleurs.toml";
64
+ }
65
+ else {
58
66
  return {};
59
67
  }
60
68
  let strConf;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dxfl",
3
- "version": "0.3.2",
3
+ "version": "0.4.0",
4
4
  "description": "",
5
5
  "license": "EUPL-1.2",
6
6
  "author": "Deuxfleurs Team <coucou@deuxfleurs.fr>",