avo 1.6.1 → 2.0.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.
Files changed (5) hide show
  1. package/Avo.js +780 -773
  2. package/README.md +4 -1
  3. package/cli.js +50 -45
  4. package/package.json +12 -24
  5. package/CHANGELOG.md +0 -182
package/README.md CHANGED
@@ -48,7 +48,10 @@ yarn commit
48
48
 
49
49
  ## How to Create a Release
50
50
 
51
+ 1. Update the semantic version in `package.json`
52
+ 2. Publish the package to npm
53
+
51
54
  ```
52
- npm run release-it
55
+ npm publish
53
56
  ```
54
57
 
package/cli.js CHANGED
@@ -1,35 +1,42 @@
1
1
  #!/usr/bin/env node
2
- const _ = require('lodash');
3
- const {cyan, gray, red, bold, underline} = require('chalk');
4
- const dateFns = require('date-fns');
5
- const fs = require('fs');
6
- const http = require('http');
7
- const inquirer = require('inquirer');
8
- const jwt = require('jsonwebtoken');
9
- const loadJsonFile = require('load-json-file');
10
- const logSymbols = require('log-symbols');
11
- const opn = require('opn');
12
- const ora = require('ora');
13
- const path = require('path');
14
- const pify = require('pify');
15
- const portfinder = require('portfinder');
16
- const querystring = require('querystring');
17
- const request = require('request');
18
- const report = require('yurnalist');
19
- const semver = require('semver');
20
- const updateNotifier = require('update-notifier');
21
- const url = require('url');
22
- const util = require('util');
23
- const uuidv4 = require('uuid/v4');
24
- const walk = require('ignore-walk');
25
- const writeFile = require('write');
26
- const writeJsonFile = require('write-json-file');
27
- const Configstore = require('configstore');
28
- const Minimatch = require('minimatch').Minimatch;
29
- const Inspector = require('node-avo-inspector');
30
-
31
- const pkg = require('./package.json');
32
- const Avo = require('./Avo.js');
2
+ import ora from 'ora';
3
+ import chalk from 'chalk'
4
+ import minimatch from 'minimatch';
5
+ import _ from 'lodash';
6
+ import dateFns from 'date-fns';
7
+ import fs from 'fs';
8
+ import http from 'http';
9
+ import inquirer from 'inquirer';
10
+ import jwt from 'jsonwebtoken';
11
+ import loadJsonFile from 'load-json-file';
12
+ import logSymbols from 'log-symbols';
13
+ import opn from 'opn';
14
+ import path from 'path';
15
+ import pify from 'pify';
16
+ import portfinder from 'portfinder';
17
+ import querystring from 'querystring';
18
+ import request from 'request';
19
+ import report from 'yurnalist';
20
+ import semver from 'semver';
21
+ import updateNotifier from 'update-notifier';
22
+ import url from 'url';
23
+ import util from 'util';
24
+ import {v4 as uuidv4} from 'uuid';
25
+ import walk from 'ignore-walk';
26
+ import writeFile from 'write';
27
+ import writeJsonFile from 'write-json-file';
28
+ import Configstore from 'configstore';
29
+ import Inspector from 'node-avo-inspector';
30
+ import yargs from 'yargs';
31
+ import { hideBin } from 'yargs/helpers'
32
+ import httpShutdown from 'http-shutdown';
33
+ import fuzzypath from 'inquirer-fuzzy-path';
34
+
35
+ import Avo from './Avo.js';
36
+ const pkg = JSON.parse(fs.readFileSync('./package.json'));
37
+
38
+ const Minimatch = minimatch.Minimatch;
39
+ const {cyan, gray, red, bold, underline} = chalk;
33
40
 
34
41
  const customAnalyticsDestination = {
35
42
  make: function make(production) {
@@ -65,7 +72,7 @@ Avo.initAvo(
65
72
  );
66
73
 
67
74
  // register inquirer-file-path
68
- inquirer.registerPrompt('fuzzypath', require('inquirer-fuzzy-path'));
75
+ inquirer.registerPrompt('fuzzypath', fuzzypath);
69
76
 
70
77
  updateNotifier({pkg: pkg}).notify();
71
78
 
@@ -122,12 +129,6 @@ function _request(options, logOptions) {
122
129
  qsLog = JSON.stringify(options.qs);
123
130
  }
124
131
 
125
- if (!logOptions.skipRequestBody) {
126
- bodyLog = options.body || options.form || '';
127
- }
128
-
129
- // logger.debug(">>> HTTP REQUEST", options.method, options.url, qsLog, "\n", bodyLog);
130
-
131
132
  return new Promise(function(resolve, reject) {
132
133
  var req = request(options, function(err, response, body) {
133
134
  if (err) {
@@ -685,6 +686,7 @@ function codegen(json, result) {
685
686
  let targets = result.sources;
686
687
  let newJson = Object.assign({}, _.cloneDeep(json), {schema: schema});
687
688
  let warnings = result.warnings;
689
+ let errors = result.errors;
688
690
 
689
691
  newJson.sources = newJson.sources.map(source => {
690
692
  let target = _.find(targets, target => target.id === source.id);
@@ -704,13 +706,17 @@ function codegen(json, result) {
704
706
 
705
707
  let sourceTasks = targets.map(target => {
706
708
  return Promise.all(
707
- target.code.map(code => writeFile.promise(code.path, code.content))
709
+ target.code.map(code => writeFile(code.path, code.content))
708
710
  );
709
711
  });
710
712
 
711
713
  let avoJsonTask = writeAvoJson(newJson);
712
714
 
713
715
  Promise.all(_.concat([avoJsonTask], sourceTasks)).then(() => {
716
+ if (errors !== undefined && errors !== null && errors !== "") {
717
+ report.warn(errors + "\n");
718
+ }
719
+
714
720
  if (warnings !== undefined && warnings !== null && Array.isArray(warnings)) {
715
721
  warnings.forEach(warning => {
716
722
  report.warn(warning);
@@ -969,11 +975,13 @@ function pull(sourceFilter, json) {
969
975
  branchId: json.branch.id,
970
976
  sources: _.map(sources, source => {
971
977
  return {id: source.id, path: source.path};
972
- })
978
+ }),
979
+ force: json.force || false
973
980
  }
974
981
  });
975
982
  })
976
983
  .then(res => {
984
+
977
985
  cancelWait();
978
986
  let result = res.body;
979
987
  if (result.ok) {
@@ -1282,7 +1290,7 @@ function status(source, json, argv) {
1282
1290
  });
1283
1291
  }
1284
1292
 
1285
- require('yargs')
1293
+ yargs(hideBin(process.argv))
1286
1294
  .usage('$0 command')
1287
1295
  .scriptName('avo')
1288
1296
  .option('v', {
@@ -1655,9 +1663,6 @@ require('yargs')
1655
1663
  report.info(`Currently on branch '${json.branch.name}'`);
1656
1664
  return getSource(argv, json);
1657
1665
  })
1658
- .then(([source, json]) => {
1659
- return writeAvoJson(json).then(json => [source, json]);
1660
- })
1661
1666
  .then(([source, json]) => {
1662
1667
  return status(source, json, argv);
1663
1668
  })
@@ -2140,7 +2145,7 @@ function _loginWithLocalhost(port) {
2140
2145
  _respondWithRedirect(req, res, api.authOrigin + '/auth/cli/error');
2141
2146
  });
2142
2147
 
2143
- server = require('http-shutdown')(server);
2148
+ server = httpShutdown(server);
2144
2149
 
2145
2150
  server.listen(port, function() {
2146
2151
  report.info(`Visit this URL on any device to login: ${link(authUrl)}`);
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "avo",
3
- "version": "1.6.1",
3
+ "version": "2.0.0",
4
+ "type": "module",
4
5
  "description": "The command-line interface for Avo",
5
6
  "author": "Avo (https://www.avo.app)",
6
7
  "repository": {
@@ -13,11 +14,9 @@
13
14
  "avo": "cli.js"
14
15
  },
15
16
  "engines": {
16
- "node": ">=6"
17
+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
17
18
  },
18
19
  "scripts": {
19
- "commit": "git-cz",
20
- "release": "release-it",
21
20
  "postinstall": "node cli.js track-install"
22
21
  },
23
22
  "files": [
@@ -30,36 +29,25 @@
30
29
  "date-fns": "1.30.1",
31
30
  "http-shutdown": "1.2.0",
32
31
  "ignore-walk": "3.0.1",
33
- "inquirer": "6.2.0",
32
+ "inquirer": "8.2",
34
33
  "inquirer-fuzzy-path": "2.3.0",
35
34
  "jsonwebtoken": "8.4.0",
36
35
  "load-json-file": "5.1.0",
37
- "lodash": "4.17.19",
36
+ "lodash": "4.17.21",
38
37
  "log-symbols": "2.2.0",
39
38
  "minimatch": "3.0.4",
40
39
  "node-avo-inspector": "^1.0.1",
41
40
  "opn": "5.4.0",
42
- "ora": "3.0.0",
41
+ "ora": "6.0.1",
43
42
  "pify": "4.0.1",
44
- "portfinder": "1.0.19",
43
+ "portfinder": "1.0.28",
45
44
  "request": "2.88.0",
46
45
  "semver": "5.6.0",
47
- "update-notifier": "2.5.0",
48
- "uuid": "3.3.2",
49
- "write": "1.0.3",
46
+ "update-notifier": "5.1",
47
+ "uuid": "8.3.2",
48
+ "write": "2.0.0",
50
49
  "write-json-file": "3.0.2",
51
- "yargs": "12.0.5",
52
- "yurnalist": "1.0.5"
53
- },
54
- "devDependencies": {
55
- "commitizen": "3.0.5",
56
- "conventional-changelog-cli": "2.0.11",
57
- "cz-conventional-changelog": "2.1.0",
58
- "release-it": "8.2.0"
59
- },
60
- "config": {
61
- "commitizen": {
62
- "path": "cz-conventional-changelog"
63
- }
50
+ "yargs": "17.2.1",
51
+ "yurnalist": "2.1.0"
64
52
  }
65
53
  }
package/CHANGELOG.md DELETED
@@ -1,182 +0,0 @@
1
- ## [1.5.1](https://github.com/avohq/avo/compare/1.5.0...1.5.1) (2021-03-16)
2
-
3
- * Fix a bug preventing users from being not able to pick a location for their avo.json file
4
-
5
- ## [1.5.0](https://github.com/avohq/avo/compare/1.4.2...1.5.0) (2021-03-16)
6
-
7
- * Rename the master branch to main
8
- * Update dependencies
9
- * Faster autocompletion in big projects
10
-
11
- ## [1.4.2](https://github.com/avohq/avo/compare/1.4.1...1.4.2) (2020-06-10)
12
-
13
-
14
-
15
- ## [1.4.1](https://github.com/avohq/avo/compare/1.4.1-beta.0...1.4.1) (2019-11-20)
16
-
17
-
18
-
19
- ## [1.4.1-beta.0](https://github.com/avohq/avo/compare/1.4.0...1.4.1-beta.0) (2019-11-20)
20
-
21
-
22
- ### Bug Fixes
23
-
24
- * Fix postinstall crash on Windows ([8b13c83](https://github.com/avohq/avo/commit/8b13c83))
25
-
26
-
27
-
28
- # [1.4.0](https://github.com/avohq/avo/compare/1.4.0-beta.3...1.4.0) (2019-10-29)
29
-
30
-
31
-
32
- # [1.4.0-beta.3](https://github.com/avohq/avo/compare/1.4.0-beta.2...1.4.0-beta.3) (2019-10-21)
33
-
34
-
35
- ### Bug Fixes
36
-
37
- * Updated analytics for merge conflict resolver ([07b0958](https://github.com/avohq/avo/commit/07b0958))
38
-
39
-
40
-
41
- # [1.4.0-beta.2](https://github.com/avohq/avo/compare/1.4.0-beta.1...1.4.0-beta.2) (2019-10-21)
42
-
43
-
44
- ### Bug Fixes
45
-
46
- * Fix authentication when resolving merge conflicts ([efda141](https://github.com/avohq/avo/commit/efda141))
47
-
48
-
49
-
50
- # [1.4.0-beta.1](https://github.com/avohq/avo/compare/1.4.0-beta.0...1.4.0-beta.1) (2019-10-21)
51
-
52
-
53
-
54
- # [1.4.0-beta.0](https://github.com/avohq/avo/compare/1.3.6...1.4.0-beta.0) (2019-10-21)
55
-
56
-
57
- ### Features
58
-
59
- * Resolve simple merge conflicts in Avo files automatically ([886cc7f](https://github.com/avohq/avo/commit/886cc7f))
60
-
61
-
62
-
63
- ## [1.3.6](https://github.com/avohq/avo/compare/1.3.5...1.3.6) (2019-08-21)
64
-
65
-
66
- ### Bug Fixes
67
-
68
- * Request and handle gzipped responses ([c108ccf](https://github.com/avohq/avo/commit/c108ccf))
69
-
70
-
71
-
72
- ## [1.3.5](https://github.com/avohq/avo/compare/1.3.4...1.3.5) (2019-07-01)
73
-
74
-
75
- ### Bug Fixes
76
-
77
- * Suggest a command if provided command is unknown ([24f9345](https://github.com/avohq/avo/commit/24f9345))
78
-
79
-
80
-
81
- ## [1.3.4](https://github.com/avohq/avo/compare/1.3.3...1.3.4) (2019-07-01)
82
-
83
-
84
- ### Bug Fixes
85
-
86
- * Fixes issue where switching branch doesn't carry which source is being generated ([f851f0e](https://github.com/avohq/avo/commit/f851f0e))
87
-
88
-
89
-
90
- ## [1.3.3](https://github.com/avohq/avo/compare/1.3.2...1.3.3) (2019-04-05)
91
-
92
-
93
- ### Bug Fixes
94
-
95
- * Prevent crash if analytics endpoint fails ([a38e608](https://github.com/avohq/avo/commit/a38e608))
96
-
97
-
98
-
99
- ## [1.3.2](https://github.com/avohq/avo/compare/1.3.1...1.3.2) (2019-03-10)
100
-
101
-
102
- ### Bug Fixes
103
-
104
- * Use object.assign instead of spread syntax ([1b50034](https://github.com/avohq/avo/commit/1b50034))
105
-
106
-
107
-
108
- ## [1.3.1](https://github.com/avohq/avo/compare/1.3.0...1.3.1) (2019-02-26)
109
-
110
-
111
- ### Bug Fixes
112
-
113
- * Fix module map parsing for multi-line comments ([eb9796b](https://github.com/avohq/avo/commit/eb9796b))
114
-
115
-
116
-
117
- # [1.3.0](https://github.com/avohq/avo/compare/1.2.4...1.3.0) (2019-02-25)
118
-
119
-
120
- ### Features
121
-
122
- * Read analytics wrapper module name from source file ([3867652](https://github.com/avohq/avo/commit/3867652))
123
-
124
-
125
-
126
- ## [1.2.4](https://github.com/avohq/avo/compare/1.2.3...1.2.4) (2019-02-18)
127
-
128
-
129
-
130
- ## [1.2.3](https://github.com/avohq/avo/compare/1.2.2...1.2.3) (2019-02-18)
131
-
132
-
133
-
134
- ## [1.2.2](https://github.com/avohq/avo/compare/1.2.1...1.2.2) (2019-02-18)
135
-
136
-
137
-
138
- ## [1.2.1](https://github.com/avohq/avo/compare/1.2.0...1.2.1) (2019-02-17)
139
-
140
-
141
- ### Bug Fixes
142
-
143
- * Non-destructive changes to sources json when pulling ([171851e](https://github.com/avohq/avo/commit/171851e))
144
-
145
-
146
-
147
- # [1.2.0](https://github.com/avohq/avo/compare/1.1.2...1.2.0) (2019-02-17)
148
-
149
-
150
- ### Features
151
-
152
- * avo status with simple linting ([#2](https://github.com/avohq/avo/issues/2)) ([51adb92](https://github.com/avohq/avo/commit/51adb92))
153
-
154
-
155
-
156
- ## [1.1.2](https://github.com/avohq/avo/compare/1.1.1...1.1.2) (2019-02-16)
157
-
158
-
159
- ### Bug Fixes
160
-
161
- * avo pull source does not pull all sources if it is missing ([80c1048](https://github.com/avohq/avo/commit/80c1048))
162
-
163
-
164
-
165
- ## [1.1.1](https://github.com/avohq/avo/compare/1.1.0...1.1.1) (2019-02-12)
166
-
167
-
168
-
169
- # [1.1.0](https://github.com/avohq/avo/compare/1.0.1...1.1.0) (2019-02-12)
170
-
171
-
172
- ### Features
173
-
174
- * Add avo status command ([9d32c1f](https://github.com/avohq/avo/commit/9d32c1f))
175
-
176
-
177
-
178
- ## [1.0.1](https://github.com/avohq/avo/compare/1.0.0...1.0.1) (2019-01-18)
179
-
180
-
181
-
182
- # 1.0.0 (2019-01-18)