campaign-cli 0.7.6 → 0.7.7

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
@@ -20,7 +20,7 @@ Full article in the blog post [Getting started with acc](https://myrosblog.com/a
20
20
  ```bash
21
21
  $ npm install -g campaign-cli
22
22
 
23
- $ acc auth init --host https://instance.com --user username --password --alias staging
23
+ $ acc auth init --host https://instance.com --user username --pass --alias staging
24
24
 
25
25
  $ acc instance pull --alias staging
26
26
  # Downloaded /Administration/Configuration/Form rendering
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "campaign-cli",
3
- "version": "0.7.6",
3
+ "version": "0.7.7",
4
4
  "description": "Save time, reduce risk and improve code health with acc CLI",
5
5
  "keywords": [
6
6
  "adobe",
@@ -19,21 +19,21 @@ class CampaignAuth {
19
19
  * Creates a new CampaignAuth instance.
20
20
  *
21
21
  * @param {Object} sdk - ACC JS SDK instance
22
- * @param {Object} config - Configstore instance for persistent storage
23
- * @throws {CampaignError} Throws if SDK or config parameters are missing
22
+ * @param {Object} auth - Configstore instance for persistent storage
23
+ * @throws {CampaignError} Throws if SDK or auth parameters are missing
24
24
  *
25
25
  * @example
26
- * const auth = new CampaignAuth(sdk, config);
26
+ * const auth = new CampaignAuth(sdk, auth);
27
27
  */
28
- constructor(sdk, config) {
29
- if (!sdk || !config) {
28
+ constructor(sdk, auth) {
29
+ if (!sdk || !auth) {
30
30
  throw new CampaignError(
31
31
  "SDK and Configstore instances are required to initialize CampaignAuth.",
32
32
  );
33
33
  }
34
34
  this.sdk = sdk;
35
- this.config = config;
36
- this.instances = config.get(this.INSTANCES_KEY) || {};
35
+ this.auth = auth;
36
+ this.instances = auth.get(this.INSTANCES_KEY) || {};
37
37
  this.instanceIds = Object.keys(this.instances);
38
38
  }
39
39
 
@@ -69,7 +69,7 @@ class CampaignAuth {
69
69
  );
70
70
  }
71
71
  const { alias, host, user, password } = options;
72
- this.config.set(`${this.INSTANCES_KEY}.${alias}`, { host, user, password });
72
+ this.auth.set(`${this.INSTANCES_KEY}.${alias}`, { host, user, password });
73
73
  console.log(`✅ Instance ${alias} added successfully.`);
74
74
  return this.login(options);
75
75
  }
@@ -87,7 +87,7 @@ class CampaignAuth {
87
87
  */
88
88
  async login(options) {
89
89
  const { host, user, password } =
90
- this.config.get(`instances.${options.alias}`) || {};
90
+ this.auth.get(`instances.${options.alias}`) || {};
91
91
  if (!host || !user || !password) {
92
92
  throw new CampaignError(
93
93
  `Authentication with alias "${options.alias}" doesn't exist. Use "acc auth list" to see all configured instances.`,
@@ -117,7 +117,8 @@ class CampaignAuth {
117
117
  * auth.list(); // Lists all configured instances
118
118
  */
119
119
  list() {
120
- console.log(`📚 Reading ${this.instanceIds.length} instance(s)`);
120
+ console.log(`📚 Reading from authentication file ${this.auth.path} `);
121
+ console.log(`📚 Listing ${this.instanceIds.length} instance(s)`);
121
122
  if(this.instanceIds.length === 0) {
122
123
  console.log(` No instances configured yet. Use "campaign auth init" to add an instance.`);
123
124
  return;
package/src/main.js CHANGED
@@ -22,17 +22,16 @@ const defaultConfigPath = path.join(process.cwd(), "acc.config.json"); // defaul
22
22
 
23
23
  const vAcc = packageJson.version;
24
24
  const vSdk = sdk.getSDKVersion().version;
25
- const pathConfig = "config.path";
26
- console.log(
27
- `🏠 acc ${vAcc} initialized with Adobe acc-js-sdk ${vSdk} and authentication from ${pathConfig}`,
25
+ console.log(`🏠 acc ${vAcc} initialized with @adobe/acc-js-sdk ${vSdk}`);
26
+ // blog post tracking
27
+ const homepage = packageJson.homepage.replace(
28
+ "utm_campaign=package-json",
29
+ "utm_campaign=acc-cli",
28
30
  );
29
- const homepage = packageJson.homepage.replace('utm_campaign=package-json', 'utm_campaign=acc-cli')
30
31
 
31
32
  program
32
33
  .name("acc")
33
- .description(
34
- `${packageJson.description}. Documentation on ${homepage}`,
35
- )
34
+ .description(`${packageJson.description}. Documentation on ${homepage}`)
36
35
  .version(vAcc);
37
36
 
38
37
  // AUTH
@@ -51,7 +50,7 @@ program
51
50
  "URL of Adobe Campaign root, e.g. http://localhost:8080",
52
51
  )
53
52
  .requiredOption("--user <user>", "Operator username")
54
- .requiredOption("--password <pwd>", "Operator password")
53
+ .requiredOption("--pass <pwd>", "Operator password")
55
54
  .action(async (options) => {
56
55
  try {
57
56
  await auth.init(options);