avo 3.2.2 → 3.2.4

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.
Files changed (3) hide show
  1. package/README.md +12 -21
  2. package/cli.js +22 -16
  3. package/package.json +6 -3
package/README.md CHANGED
@@ -1,6 +1,12 @@
1
- ![https://www.avo.app](https://firebasestorage.googleapis.com/v0/b/avo-frontpage.appspot.com/o/logo%2Fassets%2Favo.png?alt=media&token=2acfd7bd-2faf-4787-a450-8f99c407a483)
1
+ # Avo CLI
2
2
 
3
- ## Install
3
+ Better event tracking, **faster**.
4
+
5
+ ![https://www.avo.app](https://cdn.avo.app/assets/avo-cado.png)
6
+
7
+ The Avo CLI gives you access to [Avo Codegen](https://www.avo.app/docs/implementation/devs-101) right from your command line. It allows you to pull [your Avo tracking plan](http://avo.app/schemas/default) as type-safe functions for each of your events, making analytics implementation quick and seamless. Avo Codegen supports a variety of [platforms, programming languages and destinations](https://www.avo.app/docs/implementation/supported-programming-languages).
8
+
9
+ ## Installation
4
10
 
5
11
  Avo runs on Node `>=14.16`. To install the latest version of Avo CLI, run this command:
6
12
 
@@ -15,6 +21,7 @@ $ avo --help
15
21
  avo command
16
22
 
17
23
  Commands:
24
+ avo login Log into the Avo platform
18
25
  avo init Initialize an Avo workspace in the current folder
19
26
  avo pull [source] Pull analytics wrappers from Avo workspace
20
27
  avo checkout [branch] Switch branches [aliases: branch]
@@ -23,7 +30,6 @@ Commands:
23
30
  avo merge main Pull the Avo main branch into your current branch
24
31
  avo conflict Resolve git conflicts in Avo files [aliases: resolve, conflicts]
25
32
  avo edit Open the Avo workspace in your browser
26
- avo login Log into the Avo platform
27
33
  avo logout Log out from the Avo platform
28
34
  avo whoami Shows the currently logged in username
29
35
 
@@ -34,24 +40,9 @@ Options:
34
40
  --help Show help [boolean]
35
41
  ```
36
42
 
37
- For more detailed documentation, visit [https://www.avo.app/docs/commands](https://www.avo.app/docs/commands)
38
-
39
- ## Caught a Bug?
43
+ For more documentation, visit [https://www.avo.app/docs/implementation/cli](https://www.avo.app/docs/implementation/cli)
40
44
 
41
- Thank you, you are precious to us :hug: Please send an email to friends@avo.app or file an issue here on GitHub.
42
45
 
43
- ## How to contribute
44
-
45
- Make your changes and add them to the _Unreleased_ section in CHANGELOG.md
46
-
47
- ## How to Create a Release
48
-
49
- 1. Verify that the changes in the _Unrelased_ section in CHANGELOG.md are accurate, create a new heading with the correct semantic version then move the content from the _Unreleased_ section there
50
- 2. Update the semantic version in `package.json` to match the one you just created in the changelog
51
- 3. Commit with the message "Release <version>" and push the changes
52
- 4. Publish the package to npm (you'll need to be a maintainer of the avo project in npm)
53
-
54
- ```
55
- npm publish
56
- ```
46
+ **Caught a Bug?** Thank you, you are precious to us :hug: Please create a issue on the GitHub repo or send an email to friends@avo.app. We'll do our best to resolve it quickly!
57
47
 
48
+ **To create a release:** Verify that the changes in the _Unreleased_ section in CHANGELOG.md are accurate, create a new heading with the correct semantic version then move the content from the _Unreleased_ section there • Update the semantic version in `package.json` to match the one you just created in the changelog • Commit with the message "Release <version>" and push the changes • Publish the package to npm (you'll need to be a maintainer of the avo project in npm): `npm publish`
package/cli.js CHANGED
@@ -140,7 +140,7 @@ function responseToError(response) {
140
140
  case 401:
141
141
  return 'Unauthorized';
142
142
  case 403:
143
- return 'Forbidden. Do you have the required permissions? Some commands editor or admin access.';
143
+ return 'Forbidden. Do you have the required permissions? Some commands require editor or admin access.';
144
144
  case 404:
145
145
  return 'Not Found';
146
146
  default:
@@ -387,11 +387,14 @@ function extractConflictingFiles(str) {
387
387
  }
388
388
  return [files[0].join('\n'), files[1].join('\n')];
389
389
  }
390
- const BRANCH_UP_TO_DATE = 'branch-up-to-date';
391
- const BRANCH_NOT_UP_TO_DATE = 'branch-not-up-to-date';
390
+ var BranchStatus;
391
+ (function (BranchStatus) {
392
+ BranchStatus["BRANCH_UP_TO_DATE"] = "branch-up-to-date";
393
+ BranchStatus["BRANCH_NOT_UP_TO_DATE"] = "branch-not-up-to-date";
394
+ })(BranchStatus || (BranchStatus = {}));
392
395
  function getMasterStatus(json) {
393
396
  if (json.branch.id === 'master') {
394
- return Promise.resolve(BRANCH_UP_TO_DATE);
397
+ return Promise.resolve(BranchStatus.BRANCH_UP_TO_DATE);
395
398
  }
396
399
  return api
397
400
  .request('POST', '/c/v1/master', {
@@ -402,7 +405,9 @@ function getMasterStatus(json) {
402
405
  branchId: json.branch.id,
403
406
  },
404
407
  })
405
- .then(({ pullRequired }) => pullRequired ? BRANCH_NOT_UP_TO_DATE : BRANCH_UP_TO_DATE);
408
+ .then(({ pullRequired }) => pullRequired
409
+ ? BranchStatus.BRANCH_NOT_UP_TO_DATE
410
+ : BranchStatus.BRANCH_UP_TO_DATE);
406
411
  }
407
412
  function pullMaster(json) {
408
413
  if (json.branch.name === 'main') {
@@ -431,7 +436,7 @@ function promptPullMaster(json) {
431
436
  return getMasterStatus(json)
432
437
  .then((branchStatus) => {
433
438
  cancelWait();
434
- if (branchStatus === BRANCH_NOT_UP_TO_DATE) {
439
+ if (branchStatus === BranchStatus.BRANCH_NOT_UP_TO_DATE) {
435
440
  return inquirer
436
441
  .prompt([
437
442
  {
@@ -447,7 +452,7 @@ function promptPullMaster(json) {
447
452
  return Promise.resolve([branchStatus]);
448
453
  })
449
454
  .then(([branchStatus, answer]) => {
450
- if (branchStatus === BRANCH_UP_TO_DATE) {
455
+ if (branchStatus === BranchStatus.BRANCH_UP_TO_DATE) {
451
456
  report.success('Branch is up to date with main');
452
457
  return Promise.resolve(json);
453
458
  }
@@ -489,7 +494,7 @@ function requireAuth(argv, cb) {
489
494
  function init() {
490
495
  const makeAvoJson = (schema) => {
491
496
  report.success(`Initialized for workspace ${cyan(schema.name)}`);
492
- return {
497
+ return Promise.resolve({
493
498
  avo: {
494
499
  version: semver.major(pkg.version),
495
500
  },
@@ -501,7 +506,7 @@ function init() {
501
506
  id: 'master',
502
507
  name: 'main',
503
508
  },
504
- };
509
+ });
505
510
  };
506
511
  wait('Initializing');
507
512
  return api
@@ -545,7 +550,10 @@ function validateAvoJson(json) {
545
550
  return init();
546
551
  }
547
552
  // augment the latest major version into avo.json
548
- return { ...json, avo: { ...json.avo, version: semver.major(pkg.version) } };
553
+ return Promise.resolve({
554
+ ...json,
555
+ avo: { ...json.avo, version: semver.major(pkg.version) },
556
+ });
549
557
  }
550
558
  function fetchBranches(json) {
551
559
  wait('Fetching open branches');
@@ -744,7 +752,7 @@ function loadAvoJson() {
744
752
  }
745
753
  });
746
754
  }
747
- function loadAvoJsonOrInit({ argv, skipPullMaster, skipInit }) {
755
+ function loadAvoJsonOrInit({ argv, skipPullMaster, skipInit, }) {
748
756
  return pify(fs.readFile)('avo.json', 'utf8')
749
757
  .then((avoFile) => {
750
758
  if (hasMergeConflicts(avoFile)) {
@@ -842,7 +850,7 @@ function selectSource(sourceToAdd, json) {
842
850
  .then((data) => {
843
851
  cancelWait();
844
852
  const existingSources = json.sources ?? [];
845
- let sources = data.sources
853
+ const sources = data.sources
846
854
  .filter((source) => !existingSources.find(({ id }) => source.id === id))
847
855
  .sort((a, b) => {
848
856
  if (a.name < b.name)
@@ -960,8 +968,7 @@ function selectSource(sourceToAdd, json) {
960
968
  interfacePath: relativeInterfacePath,
961
969
  };
962
970
  }
963
- sources = (json.sources ?? []).concat([source]);
964
- const newJson = { ...json, sources };
971
+ const newJson = { ...json, sources: [...(json.sources ?? []), source] };
965
972
  report.info(`Added source ${source.name} to the project`);
966
973
  report.info(`Run 'avo pull "${source.name}"' to pull the latest analytics wrapper for this source`);
967
974
  return newJson;
@@ -976,7 +983,7 @@ function pull(sourceFilter, json) {
976
983
  wait(`Pulling ${sourceNames.join(', ')}`);
977
984
  return getMasterStatus(json)
978
985
  .then((masterStatus) => {
979
- if (masterStatus === BRANCH_NOT_UP_TO_DATE) {
986
+ if (masterStatus === BranchStatus.BRANCH_NOT_UP_TO_DATE) {
980
987
  report.warn(`Your branch '${json.branch.name}' is not up to date with Avo main. To merge latest Avo main into the branch, run 'avo merge main'.`);
981
988
  }
982
989
  return Promise.resolve();
@@ -1406,7 +1413,6 @@ yargs(hideBin(process.argv)) // eslint-disable-line no-unused-expressions
1406
1413
  builder: (yargs) => yargs
1407
1414
  .option('branch', {
1408
1415
  describe: 'Name of Avo branch to pull from',
1409
- default: 'main',
1410
1416
  type: 'string',
1411
1417
  })
1412
1418
  .option('f', {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "avo",
3
- "version": "3.2.2",
3
+ "version": "3.2.4",
4
4
  "type": "module",
5
5
  "description": "The command-line interface for Avo",
6
6
  "author": "Avo (https://www.avo.app)",
@@ -48,20 +48,23 @@
48
48
  "portfinder": "^1.0.28",
49
49
  "semver": "^7.3.7",
50
50
  "update-notifier": "^6.0.2",
51
- "uuid": "^8.3.2",
51
+ "uuid": "^9.0.0",
52
52
  "write": "^2.0.0",
53
53
  "write-json-file": "^5.0.0",
54
54
  "yargs": "^17.2.1",
55
55
  "yurnalist": "^2.1.0"
56
56
  },
57
57
  "devDependencies": {
58
+ "@types/ignore-walk": "^4.0.0",
59
+ "@types/minimatch": "^5.1.2",
60
+ "@types/node": "^18.7.18",
58
61
  "@typescript-eslint/eslint-plugin": "^5.30.5",
59
62
  "@typescript-eslint/parser": "^5.30.5",
60
63
  "eslint": "^7.32.0 || ^8.2.0",
61
64
  "eslint-config-airbnb-base": "^15.0.0",
62
65
  "eslint-config-prettier": "^8.5.0",
63
66
  "eslint-plugin-import": "^2.25.2",
64
- "prettier": "2.7.1",
67
+ "prettier": "2.8.1",
65
68
  "typescript": "^4.7.4"
66
69
  }
67
70
  }