@constructor-io/constructorio-connect-cli 1.15.3 → 1.15.5

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/README.md CHANGED
@@ -38,12 +38,12 @@ With the new repository initialized, you can start developing your catalog integ
38
38
  * [`constructorio-connect-cli generate-fixture`](#constructorio-connect-cli-generate-fixture)
39
39
  * [`constructorio-connect-cli help [COMMAND]`](#constructorio-connect-cli-help-command)
40
40
  * [`constructorio-connect-cli init NAME`](#constructorio-connect-cli-init-name)
41
- * [`constructorio-connect-cli refresh-connections-command`](#constructorio-connect-cli-refresh-connections-command)
41
+ * [`constructorio-connect-cli refresh-connections`](#constructorio-connect-cli-refresh-connections)
42
42
  * [`constructorio-connect-cli trigger-catalog-sync`](#constructorio-connect-cli-trigger-catalog-sync)
43
43
 
44
44
  ## `constructorio-connect-cli deploy ENV`
45
45
 
46
- Deploys all templates defined on the `connectrc.js` file to the specified environment, after running tests ('--force' to skip).
46
+ Deploys all templates defined on the `connectrc.js` file to the specified environment, after running tests ('--force' to skip).
47
47
 
48
48
  ```
49
49
  USAGE
@@ -56,7 +56,6 @@ FLAGS
56
56
  -f, --force Skip tests before deploying
57
57
 
58
58
  DESCRIPTION
59
-
60
59
  Deploys all templates defined on the `connectrc.js` file to the specified environment, after running tests ('--force'
61
60
  to skip).
62
61
 
@@ -118,17 +117,13 @@ USAGE
118
117
  $ constructorio-connect-cli generate-fixture
119
118
 
120
119
  DESCRIPTION
121
-
122
120
  This command will fetch one fixture from the server and save it into a specified file. This fixture file will be an
123
121
  example of how the data would be passed to the connector when executing the templates.
124
-
125
122
  You are expected to customize this file to match the data you expect to cover in a template execution (e.g. an item
126
123
  with stock, a variation with missing data), etc. Note that you can have multiple fixtures of the same type to cover
127
124
  different scenarios.
128
-
129
125
  Finally, if the file already exists you'll be prompted to overwrite it.
130
126
 
131
-
132
127
  EXAMPLES
133
128
  $ constructorio-connect-cli generate-fixture
134
129
  ```
@@ -174,24 +169,28 @@ EXAMPLES
174
169
  ```
175
170
 
176
171
 
177
- ## `constructorio-connect-cli refresh-connections-command`
172
+ ## `constructorio-connect-cli refresh-connections`
173
+
174
+ Refresh the connections list
178
175
 
179
176
  ```
180
177
  USAGE
181
- $ constructorio-connect-cli refresh-connections-command
178
+ $ constructorio-connect-cli refresh-connections
179
+
180
+ DESCRIPTION
181
+ Refresh the connections list
182
182
  ```
183
183
 
184
184
 
185
185
  ## `constructorio-connect-cli trigger-catalog-sync`
186
186
 
187
- Triggers a catalog sync for selected connection.
187
+ Triggers a catalog sync for selected connection.
188
188
 
189
189
  ```
190
190
  USAGE
191
191
  $ constructorio-connect-cli trigger-catalog-sync
192
192
 
193
193
  DESCRIPTION
194
-
195
194
  Triggers a catalog sync for selected connection.
196
195
 
197
196
  The script will use the `CONNECT_AUTH_TOKEN` environment variable to authenticate with Constructor.
@@ -9,7 +9,8 @@
9
9
  "execute": "constructorio-connect-cli execute",
10
10
  "deploy": "constructorio-connect-cli deploy",
11
11
  "generate-fixture": "constructorio-connect-cli generate-fixture",
12
- "trigger-catalog-sync": "constructorio-connect-cli trigger-catalog-sync"
12
+ "trigger-catalog-sync": "constructorio-connect-cli trigger-catalog-sync",
13
+ "refresh": "constructorio-connect-cli refresh-connections"
13
14
  },
14
15
  "devDependencies": {
15
16
  "@babel/preset-env": "^7.26.9",
@@ -1,4 +1,4 @@
1
- import { RefreshConnectionsCommand } from "./refresh-connections-command";
1
+ import { RefreshConnectionsCommand } from "./refresh-connections";
2
2
  export default class Deploy extends RefreshConnectionsCommand {
3
3
  static args: {
4
4
  env: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
@@ -1 +1 @@
1
- {"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAE1E,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,yBAAyB;IAC3D,MAAM,CAAC,IAAI;;MAMT;IAEF,MAAM,CAAC,KAAK;;MAKV;IAEF,MAAM,CAAC,WAAW,SAGqF;IAEvG,MAAM,CAAC,QAAQ,WAKb;IAEI,UAAU,IAAI,OAAO,CAAC,GAAG,CAAC;CA+DjC"}
1
+ {"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAElE,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,yBAAyB;IAC3D,MAAM,CAAC,IAAI;;MAMT;IAEF,MAAM,CAAC,KAAK;;MAKV;IAEF,MAAM,CAAC,WAAW,SAC0N;IAE5O,MAAM,CAAC,QAAQ,WAKb;IAEI,UAAU,IAAI,OAAO,CAAC,GAAG,CAAC;CA+DjC"}
@@ -12,9 +12,9 @@ const template_source_code_1 = require("../customer/template-source-code");
12
12
  const ux_action_1 = require("../helpers/ux-action");
13
13
  const deploy_request_1 = require("../http/deploy-request");
14
14
  const render_tip_1 = require("../rendering/render-tip");
15
- const refresh_connections_command_1 = require("./refresh-connections-command");
15
+ const refresh_connections_1 = require("./refresh-connections");
16
16
  const child_process_1 = require("child_process");
17
- class Deploy extends refresh_connections_command_1.RefreshConnectionsCommand {
17
+ class Deploy extends refresh_connections_1.RefreshConnectionsCommand {
18
18
  static args = {
19
19
  env: core_1.Args.string({
20
20
  options: ["development", "qa", "production", "demo"],
@@ -28,10 +28,7 @@ class Deploy extends refresh_connections_command_1.RefreshConnectionsCommand {
28
28
  description: "Skip tests before deploying",
29
29
  }),
30
30
  };
31
- static description = `
32
- Deploys all templates defined on the \`connectrc.js\` file to the specified environment, after running tests ('--force' to skip).
33
-
34
- The script will use the \`CONNECT_AUTH_TOKEN\` environment variable to authenticate with Constructor.`;
31
+ static description = "Deploys all templates defined on the `connectrc.js` file to the specified environment, after running tests ('--force' to skip). \n\nThe script will use the `CONNECT_AUTH_TOKEN` environment variable to authenticate with Constructor.";
35
32
  static examples = [
36
33
  "$ <%= config.bin %> deploy development",
37
34
  "$ <%= config.bin %> deploy qa",
@@ -1,4 +1,4 @@
1
- import { RefreshConnectionsCommand } from "./refresh-connections-command";
1
+ import { RefreshConnectionsCommand } from "./refresh-connections";
2
2
  export declare const executePromptMessages: {
3
3
  readonly template: "Select a template to execute";
4
4
  readonly fixture: "Select a catalog fixture to run the template against";
@@ -1 +1 @@
1
- {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../src/commands/execute.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAE1E,eAAO,MAAM,qBAAqB;;;;;CAKxB,CAAC;AAEX;;;GAGG;AACH,UAAU,iBAAiB;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAYD,qBAAa,OAAQ,SAAQ,yBAAyB;IACpD,MAAM,CAAC,KAAK;;;;;MAgBV;IAEF,MAAM,CAAC,WAAW,SACkK;IAEpL,MAAM,CAAC,QAAQ,WAOb;IAEF,KAAK,EAAE,iBAAiB,CAAM;IAExB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;YAkCnB,UAAU;YAsBV,oBAAoB;YAoDpB,wBAAwB;YA2BxB,wBAAwB;CAevC"}
1
+ {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../src/commands/execute.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAElE,eAAO,MAAM,qBAAqB;;;;;CAKxB,CAAC;AAEX;;;GAGG;AACH,UAAU,iBAAiB;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAYD,qBAAa,OAAQ,SAAQ,yBAAyB;IACpD,MAAM,CAAC,KAAK;;;;;MAgBV;IAEF,MAAM,CAAC,WAAW,SACkK;IAEpL,MAAM,CAAC,QAAQ,WAOb;IAEF,KAAK,EAAE,iBAAiB,CAAM;IAExB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;YAkCnB,UAAU;YAsBV,oBAAoB;YAoDpB,wBAAwB;YA2BxB,wBAAwB;CAevC"}
@@ -19,14 +19,14 @@ const template_source_code_1 = require("../customer/template-source-code");
19
19
  const ux_action_1 = require("../helpers/ux-action");
20
20
  const print_warnings_1 = require("../helpers/print-warnings");
21
21
  const extract_template_type_1 = require("../helpers/extract-template-type");
22
- const refresh_connections_command_1 = require("./refresh-connections-command");
22
+ const refresh_connections_1 = require("./refresh-connections");
23
23
  exports.executePromptMessages = {
24
24
  template: "Select a template to execute",
25
25
  fixture: "Select a catalog fixture to run the template against",
26
26
  external: "Select external data to run the template against",
27
27
  connection: "Select a connection to execute templates against",
28
28
  };
29
- class Execute extends refresh_connections_command_1.RefreshConnectionsCommand {
29
+ class Execute extends refresh_connections_1.RefreshConnectionsCommand {
30
30
  static flags = {
31
31
  "template-path": core_1.Flags.string({
32
32
  description: "The path to the template to execute. Must be in the 'src/templates' directory.",
@@ -1,4 +1,4 @@
1
- import { RefreshConnectionsCommand } from "./refresh-connections-command";
1
+ import { RefreshConnectionsCommand } from "./refresh-connections";
2
2
  export default class GenerateFixture extends RefreshConnectionsCommand {
3
3
  static args: {};
4
4
  static description: string;
@@ -1 +1 @@
1
- {"version":3,"file":"generate-fixture.d.ts","sourceRoot":"","sources":["../../src/commands/generate-fixture.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAE1E,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,yBAAyB;IACpE,MAAM,CAAC,IAAI,KAAM;IAEjB,MAAM,CAAC,WAAW,SAIhB;IAEF,MAAM,CAAC,QAAQ,WAA4C;IAErD,UAAU,IAAI,OAAO,CAAC,GAAG,CAAC;IA2DhC,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;CAU9C"}
1
+ {"version":3,"file":"generate-fixture.d.ts","sourceRoot":"","sources":["../../src/commands/generate-fixture.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAElE,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,yBAAyB;IACpE,MAAM,CAAC,IAAI,KAAM;IAEjB,MAAM,CAAC,WAAW,SACsgB;IAExhB,MAAM,CAAC,QAAQ,WAA4C;IAErD,UAAU,IAAI,OAAO,CAAC,GAAG,CAAC;IA2DhC,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;CAU9C"}
@@ -16,14 +16,10 @@ const render_tip_1 = require("../rendering/render-tip");
16
16
  const types_1 = require("../types");
17
17
  const check_if_connection_needs_mapping_1 = require("../helpers/check-if-connection-needs-mapping");
18
18
  const select_connections_1 = require("../prompt-data/select-connections");
19
- const refresh_connections_command_1 = require("./refresh-connections-command");
20
- class GenerateFixture extends refresh_connections_command_1.RefreshConnectionsCommand {
19
+ const refresh_connections_1 = require("./refresh-connections");
20
+ class GenerateFixture extends refresh_connections_1.RefreshConnectionsCommand {
21
21
  static args = {};
22
- static description = `
23
- This command will fetch one fixture from the server and save it into a specified file. This fixture file will be an example of how the data would be passed to the connector when executing the templates.\n
24
- You are expected to customize this file to match the data you expect to cover in a template execution (e.g. an item with stock, a variation with missing data), etc. Note that you can have multiple fixtures of the same type to cover different scenarios.\n
25
- Finally, if the file already exists you'll be prompted to overwrite it.
26
- `;
22
+ static description = "This command will fetch one fixture from the server and save it into a specified file. This fixture file will be an example of how the data would be passed to the connector when executing the templates.\n You are expected to customize this file to match the data you expect to cover in a template execution (e.g. an item with stock, a variation with missing data), etc. Note that you can have multiple fixtures of the same type to cover different scenarios.\n Finally, if the file already exists you'll be prompted to overwrite it.";
27
23
  static examples = ["$ <%= config.bin %> generate-fixture"];
28
24
  async runCommand() {
29
25
  const connection = await (0, select_connections_1.selectConnections)("Choose the connection to generate the fixture for");
@@ -1,5 +1,6 @@
1
1
  import { Command } from "@oclif/core";
2
2
  export declare abstract class RefreshConnectionsCommand extends Command {
3
+ static description: string;
3
4
  abstract runCommand(): Promise<any>;
4
5
  run(): Promise<any>;
5
6
  /**
@@ -12,4 +13,4 @@ export declare abstract class RefreshConnectionsCommand extends Command {
12
13
  */
13
14
  private shouldAutoRefreshConnections;
14
15
  }
15
- //# sourceMappingURL=refresh-connections-command.d.ts.map
16
+ //# sourceMappingURL=refresh-connections.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refresh-connections.d.ts","sourceRoot":"","sources":["../../src/commands/refresh-connections.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAKtC,8BAAsB,yBAA0B,SAAQ,OAAO;IAC7D,MAAM,CAAC,WAAW,SAAkC;IAEpD,QAAQ,CAAC,UAAU,IAAI,OAAO,CAAC,GAAG,CAAC;IAE7B,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC;IASzB;;;;;;;OAOG;IACH,OAAO,CAAC,4BAA4B;CAerC"}
@@ -2,14 +2,17 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RefreshConnectionsCommand = void 0;
4
4
  const core_1 = require("@oclif/core");
5
- const refresh_connections_list_1 = require("../helpers/refresh-connections-list");
6
5
  const prepend_file_sync_1 = require("../helpers/prepend-file-sync");
6
+ const refresh_connections_list_1 = require("../helpers/refresh-connections-list");
7
7
  class RefreshConnectionsCommand extends core_1.Command {
8
+ static description = "Refresh the connections list";
8
9
  async run() {
9
10
  if (this.shouldAutoRefreshConnections()) {
10
11
  await (0, refresh_connections_list_1.refreshConnectionsList)();
11
12
  }
12
- return await this.runCommand();
13
+ if (this.runCommand) {
14
+ return await this.runCommand();
15
+ }
13
16
  }
14
17
  /**
15
18
  * Checks if the connections list should be automatically refreshed if
@@ -1,4 +1,4 @@
1
- import { RefreshConnectionsCommand } from "./refresh-connections-command";
1
+ import { RefreshConnectionsCommand } from "./refresh-connections";
2
2
  export default class TriggerCatalogSync extends RefreshConnectionsCommand {
3
3
  static args: {};
4
4
  static description: string;
@@ -1 +1 @@
1
- {"version":3,"file":"trigger-catalog-sync.d.ts","sourceRoot":"","sources":["../../src/commands/trigger-catalog-sync.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAE1E,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,yBAAyB;IACvE,MAAM,CAAC,IAAI,KAAM;IAEjB,MAAM,CAAC,WAAW,SAGqF;IAEvG,MAAM,CAAC,QAAQ,WAA2B;IAEpC,UAAU,IAAI,OAAO,CAAC,GAAG,CAAC;CASjC"}
1
+ {"version":3,"file":"trigger-catalog-sync.d.ts","sourceRoot":"","sources":["../../src/commands/trigger-catalog-sync.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAElE,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,yBAAyB;IACvE,MAAM,CAAC,IAAI,KAAM;IAEjB,MAAM,CAAC,WAAW,SAC2I;IAE7J,MAAM,CAAC,QAAQ,WAA2B;IAEpC,UAAU,IAAI,OAAO,CAAC,GAAG,CAAC;CASjC"}
@@ -3,13 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const trigger_catalog_sync_1 = require("../http/trigger-catalog-sync");
4
4
  const select_connections_1 = require("../prompt-data/select-connections");
5
5
  const render_tip_1 = require("../rendering/render-tip");
6
- const refresh_connections_command_1 = require("./refresh-connections-command");
7
- class TriggerCatalogSync extends refresh_connections_command_1.RefreshConnectionsCommand {
6
+ const refresh_connections_1 = require("./refresh-connections");
7
+ class TriggerCatalogSync extends refresh_connections_1.RefreshConnectionsCommand {
8
8
  static args = {};
9
- static description = `
10
- Triggers a catalog sync for selected connection.
11
-
12
- The script will use the \`CONNECT_AUTH_TOKEN\` environment variable to authenticate with Constructor.`;
9
+ static description = "Triggers a catalog sync for selected connection. \n\nThe script will use the `CONNECT_AUTH_TOKEN` environment variable to authenticate with Constructor.";
13
10
  static examples = ["$ <%= config.bin %>"];
14
11
  async runCommand() {
15
12
  const connection = await (0, select_connections_1.selectConnections)("Choose the connection to a trigger catalog sync");
@@ -10,7 +10,9 @@ export declare function getRepositoryConfigFile(): Promise<Config>;
10
10
  * Reads the content of the connectrc.js file and returns the connections object and the content of the file
11
11
  * @returns The connections object and the content of the connectrc.js file in {@link RawConfigContent}
12
12
  */
13
- export declare function getRepositoryConnectionsAndConfig(): Promise<RawConfigContent>;
13
+ export declare function getRepositoryConnectionsAndConfig({ shouldPrintExecutionWarnings, }?: {
14
+ shouldPrintExecutionWarnings?: boolean | undefined;
15
+ }): Promise<RawConfigContent>;
14
16
  interface RawConfigContent {
15
17
  fileContent: string;
16
18
  existingConnections: ConnectionConfigDict;
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/customer/config.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAIlE;;;;;GAKG;AACH,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,MAAM,CAAC,CAsC/D;AAED;;;GAGG;AACH,wBAAsB,iCAAiC,IAAI,OAAO,CAAC,gBAAgB,CAAC,CA4CnF;AA+HD,UAAU,gBAAgB;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,mBAAmB,EAAE,oBAAoB,CAAC;CAC3C"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/customer/config.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAIlE;;;;;GAKG;AACH,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,MAAM,CAAC,CAsC/D;AAED;;;GAGG;AACH,wBAAsB,iCAAiC,CAAC,EACtD,4BAAmC,GACpC;;CAAK,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA+CjC;AA+HD,UAAU,gBAAgB;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,mBAAmB,EAAE,oBAAoB,CAAC;CAC3C"}
@@ -80,7 +80,7 @@ pointing to the correct connectrc.js directory.`,
80
80
  * Reads the content of the connectrc.js file and returns the connections object and the content of the file
81
81
  * @returns The connections object and the content of the connectrc.js file in {@link RawConfigContent}
82
82
  */
83
- async function getRepositoryConnectionsAndConfig() {
83
+ async function getRepositoryConnectionsAndConfig({ shouldPrintExecutionWarnings = true, } = {}) {
84
84
  const configPath = (0, path_1.getCustomerOSSpecificPath)("connectrc.js");
85
85
  const fileContent = await readRawConfigFile(configPath);
86
86
  // Get the connections object from the content of the connectrc.js file
@@ -106,16 +106,18 @@ async function getRepositoryConnectionsAndConfig() {
106
106
  if (hasParseObjectError(error) && !connectionsStr.includes("process.env")) {
107
107
  return handleParseObjectError(error, connectionsStr, fileContent);
108
108
  }
109
- (0, print_warnings_1.printExecutionWarnings)({
110
- warnings: [
111
- {
112
- type: "Config",
113
- critical: true,
114
- message: `Failed to parse the connections object in connectrc.js. Are you running a custom setup?`,
115
- },
116
- ],
117
- showDocsLink: false,
118
- });
109
+ if (shouldPrintExecutionWarnings) {
110
+ (0, print_warnings_1.printExecutionWarnings)({
111
+ warnings: [
112
+ {
113
+ type: "Config",
114
+ critical: true,
115
+ message: `Failed to parse the connections object in connectrc.js. Are you running a custom setup?`,
116
+ },
117
+ ],
118
+ showDocsLink: false,
119
+ });
120
+ }
119
121
  return { fileContent, existingConnections: {} };
120
122
  }
121
123
  }
@@ -1 +1 @@
1
- {"version":3,"file":"lint-config-file.d.ts","sourceRoot":"","sources":["../../src/helpers/lint-config-file.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,wBAAsB,cAAc,kBAQnC;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,iBA2BpD"}
1
+ {"version":3,"file":"lint-config-file.d.ts","sourceRoot":"","sources":["../../src/helpers/lint-config-file.ts"],"names":[],"mappings":"AAcA;;GAEG;AACH,wBAAsB,cAAc,kBAenC;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,iBAkBpD"}
@@ -36,16 +36,30 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.lintConfigFile = lintConfigFile;
37
37
  exports.addRuleToConfig = addRuleToConfig;
38
38
  const child_process_1 = require("child_process");
39
+ const fs_1 = require("fs");
39
40
  const fs = __importStar(require("fs/promises"));
40
41
  const path_1 = require("../customer/path");
42
+ /**
43
+ * Gets the eslint config file path
44
+ */
45
+ function getEslintConfigPath() {
46
+ return (0, fs_1.existsSync)("eslint.config.js")
47
+ ? "eslint.config.js"
48
+ : "eslint.config.mjs";
49
+ }
41
50
  /**
42
51
  * Adds rules to the eslint config file and then executes npm run lint
43
52
  */
44
53
  async function lintConfigFile() {
45
- await addRuleToConfig([
46
- `'@stylistic/js/quote-props': ['error', 'as-needed']`,
47
- `'@stylistic/js/comma-dangle': ['error', 'always-multiline']`,
48
- ]);
54
+ const eslintConfigPath = getEslintConfigPath();
55
+ const rulePrefix = eslintConfigPath.endsWith(".mjs")
56
+ ? "@stylistic"
57
+ : "@stylistic/js";
58
+ const rules = [
59
+ `'${rulePrefix}/quote-props': ['error', 'as-needed']`,
60
+ `'${rulePrefix}/comma-dangle': ['error', 'always-multiline']`,
61
+ ];
62
+ await addRuleToConfig(rules);
49
63
  const repoPath = (0, path_1.getCustomerOSSpecificPath)("");
50
64
  (0, child_process_1.execSync)(`(cd ${repoPath} && eslint . --fix)`);
51
65
  }
@@ -56,23 +70,15 @@ async function lintConfigFile() {
56
70
  * where '@stylistic/js/quote-props' is in single quotes
57
71
  */
58
72
  async function addRuleToConfig(rules) {
59
- const eslintConfigPath = (0, path_1.getCustomerOSSpecificPath)("eslint.config.js");
73
+ const eslintConfigPath = getEslintConfigPath();
60
74
  const eslintConfig = await fs.readFile(eslintConfigPath, "utf-8");
61
75
  const missingRules = rules.filter((rule) => {
62
- // Extract rule names (part between single quotes, eg: "@stylistic/js/quote-props")
63
- // to check for existence
64
76
  const ruleNameMatch = rule.match(/^'([^']+)'/);
65
- // If we can't extract rule name, don't add it to eslint
66
- if (!ruleNameMatch)
67
- return false;
68
- const ruleName = ruleNameMatch[1];
69
- return !eslintConfig.includes(ruleName);
77
+ return ruleNameMatch && !eslintConfig.includes(ruleNameMatch[1]);
70
78
  });
71
- if (missingRules.length === 0) {
79
+ if (missingRules.length === 0)
72
80
  return;
73
- }
74
- // Add all missing rules
75
- const rulesString = missingRules.map((rule) => `${rule},`).join("\n ");
76
- const updatedConfig = eslintConfig.replace(/(rules:\s*\{\s*)/, `$1${rulesString}\n `);
81
+ const rulesString = missingRules.map((rule) => ` ${rule},`).join("\n");
82
+ const updatedConfig = eslintConfig.replace(/(rules:\s*\{\s*)/, `$1\n${rulesString}\n`);
77
83
  await fs.writeFile(eslintConfigPath, updatedConfig, "utf-8");
78
84
  }
@@ -1 +1 @@
1
- {"version":3,"file":"refresh-connections-list.d.ts","sourceRoot":"","sources":["../../src/helpers/refresh-connections-list.ts"],"names":[],"mappings":"AAeA,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,IAAI,CAAC,CAa5D"}
1
+ {"version":3,"file":"refresh-connections-list.d.ts","sourceRoot":"","sources":["../../src/helpers/refresh-connections-list.ts"],"names":[],"mappings":"AAgBA,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,IAAI,CAAC,CAgB5D"}
@@ -44,6 +44,7 @@ const build_config_file_1 = require("./build-config-file");
44
44
  const lint_config_file_1 = require("./lint-config-file");
45
45
  const should_update_connections_list_1 = require("./should-update-connections-list");
46
46
  const ux_action_1 = require("./ux-action");
47
+ const fs_1 = require("fs");
47
48
  async function refreshConnectionsList() {
48
49
  try {
49
50
  const shouldUpdate = await checkConfigFileState();
@@ -51,7 +52,9 @@ async function refreshConnectionsList() {
51
52
  return;
52
53
  }
53
54
  await updateConfigFile();
54
- await (0, lint_config_file_1.lintConfigFile)();
55
+ if ((0, fs_1.existsSync)("eslint.config.js") || (0, fs_1.existsSync)("eslint.config.mjs")) {
56
+ await (0, lint_config_file_1.lintConfigFile)();
57
+ }
55
58
  }
56
59
  catch (error) {
57
60
  core_1.ux.stdout(`Error refreshing connections list: ${error.message}`);
@@ -85,7 +88,9 @@ async function checkConfigFileState() {
85
88
  async function updateConfigFile() {
86
89
  const formattedConnections = await fetchNewConnections();
87
90
  const rcPath = (0, path_1.getCustomerOSSpecificPath)("connectrc.js");
88
- const { fileContent } = await (0, config_1.getRepositoryConnectionsAndConfig)();
91
+ const { fileContent } = await (0, config_1.getRepositoryConnectionsAndConfig)({
92
+ shouldPrintExecutionWarnings: false,
93
+ });
89
94
  if (!fileContent) {
90
95
  return;
91
96
  }
package/dist/version.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- declare const _default: "1.15.3";
1
+ declare const _default: "1.15.5";
2
2
  export default _default;
3
3
  //# sourceMappingURL=version.d.ts.map
package/dist/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = '1.15.3';
3
+ exports.default = '1.15.5';
@@ -15,7 +15,7 @@
15
15
  "required": true
16
16
  }
17
17
  },
18
- "description": "\n Deploys all templates defined on the `connectrc.js` file to the specified environment, after running tests ('--force' to skip).\n\n The script will use the `CONNECT_AUTH_TOKEN` environment variable to authenticate with Constructor.",
18
+ "description": "Deploys all templates defined on the `connectrc.js` file to the specified environment, after running tests ('--force' to skip). \n\nThe script will use the `CONNECT_AUTH_TOKEN` environment variable to authenticate with Constructor.",
19
19
  "examples": [
20
20
  "$ <%= config.bin %> deploy development",
21
21
  "$ <%= config.bin %> deploy qa",
@@ -106,7 +106,7 @@
106
106
  "generate-fixture": {
107
107
  "aliases": [],
108
108
  "args": {},
109
- "description": "\nThis command will fetch one fixture from the server and save it into a specified file. This fixture file will be an example of how the data would be passed to the connector when executing the templates.\n\nYou are expected to customize this file to match the data you expect to cover in a template execution (e.g. an item with stock, a variation with missing data), etc. Note that you can have multiple fixtures of the same type to cover different scenarios.\n\nFinally, if the file already exists you'll be prompted to overwrite it.\n ",
109
+ "description": "This command will fetch one fixture from the server and save it into a specified file. This fixture file will be an example of how the data would be passed to the connector when executing the templates.\n You are expected to customize this file to match the data you expect to cover in a template execution (e.g. an item with stock, a variation with missing data), etc. Note that you can have multiple fixtures of the same type to cover different scenarios.\n Finally, if the file already exists you'll be prompted to overwrite it.",
110
110
  "examples": [
111
111
  "$ <%= config.bin %> generate-fixture"
112
112
  ],
@@ -156,13 +156,14 @@
156
156
  "init.js"
157
157
  ]
158
158
  },
159
- "refresh-connections-command": {
159
+ "refresh-connections": {
160
160
  "aliases": [],
161
161
  "args": {},
162
+ "description": "Refresh the connections list",
162
163
  "flags": {},
163
164
  "hasDynamicHelp": false,
164
165
  "hiddenAliases": [],
165
- "id": "refresh-connections-command",
166
+ "id": "refresh-connections",
166
167
  "pluginAlias": "@constructor-io/constructorio-connect-cli",
167
168
  "pluginName": "@constructor-io/constructorio-connect-cli",
168
169
  "pluginType": "core",
@@ -172,13 +173,13 @@
172
173
  "relativePath": [
173
174
  "dist",
174
175
  "commands",
175
- "refresh-connections-command.js"
176
+ "refresh-connections.js"
176
177
  ]
177
178
  },
178
179
  "trigger-catalog-sync": {
179
180
  "aliases": [],
180
181
  "args": {},
181
- "description": "\n Triggers a catalog sync for selected connection.\n\n The script will use the `CONNECT_AUTH_TOKEN` environment variable to authenticate with Constructor.",
182
+ "description": "Triggers a catalog sync for selected connection. \n\nThe script will use the `CONNECT_AUTH_TOKEN` environment variable to authenticate with Constructor.",
182
183
  "examples": [
183
184
  "$ <%= config.bin %>"
184
185
  ],
@@ -199,5 +200,5 @@
199
200
  ]
200
201
  }
201
202
  },
202
- "version": "1.15.3"
203
+ "version": "1.15.5"
203
204
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructor-io/constructorio-connect-cli",
3
- "version": "1.15.3",
3
+ "version": "1.15.5",
4
4
  "description": "CLI tool to enable users to interface with the Constructor Connect Ecosystem",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -82,7 +82,7 @@
82
82
  "@types/fs-extra": "^11.0.4",
83
83
  "@types/jest": "^29.5.12",
84
84
  "@types/mock-fs": "^4.13.4",
85
- "cross-env": "^7.0.3",
85
+ "cross-env": "^10.0.0",
86
86
  "eslint": "^9.25.0",
87
87
  "eslint-plugin-prettier": "^5.2.6",
88
88
  "eslint-plugin-promise": "^6.6.0",
@@ -90,7 +90,7 @@
90
90
  "jest": "^29.7.0",
91
91
  "license-checker": "^25.0.1",
92
92
  "mock-fs": "^5.2.0",
93
- "nock": "14.0.5",
93
+ "nock": "14.0.8",
94
94
  "oclif": "^4.17.42",
95
95
  "prettier": "^3.2.5",
96
96
  "prettier-2": "npm:prettier@^2.8.8",
@@ -1 +0,0 @@
1
- {"version":3,"file":"refresh-connections-command.d.ts","sourceRoot":"","sources":["../../src/commands/refresh-connections-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAKtC,8BAAsB,yBAA0B,SAAQ,OAAO;IAC7D,QAAQ,CAAC,UAAU,IAAI,OAAO,CAAC,GAAG,CAAC;IAE7B,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC;IAOzB;;;;;;;OAOG;IACH,OAAO,CAAC,4BAA4B;CAerC"}