@atlaskit/dependency-version-analytics 1.1.0 → 1.2.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 (44) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +5 -3
  3. package/dist/cjs/cli.js +52 -17
  4. package/dist/cjs/commands/populate-historic-data/index.js +2 -2
  5. package/dist/cjs/commands/populate-historic-data/lib/dependency-store.js +227 -451
  6. package/dist/cjs/commands/populate-historic-data/package.js +30 -73
  7. package/dist/cjs/commands/populate-historic-data/product.js +129 -289
  8. package/dist/cjs/commands/populate-historic-data/util/allowed-scopes.js +15 -0
  9. package/dist/cjs/commands/populate-historic-data/util/generate-csv.js +16 -21
  10. package/dist/cjs/constants.js +2 -2
  11. package/dist/cjs/index.js +3 -3
  12. package/dist/cjs/util/analytics.js +77 -102
  13. package/dist/cjs/util/get-file-history-from-git.js +4 -4
  14. package/dist/cjs/util/get-package-version-history.js +5 -5
  15. package/dist/cjs/util/git.js +75 -205
  16. package/dist/cjs/util/statlas.js +27 -97
  17. package/dist/cjs/util/yarn.js +40 -101
  18. package/dist/cjs/version.json +1 -1
  19. package/dist/es2019/cli.js +10 -4
  20. package/dist/es2019/commands/populate-historic-data/lib/dependency-store.js +6 -4
  21. package/dist/es2019/commands/populate-historic-data/package.js +4 -2
  22. package/dist/es2019/commands/populate-historic-data/product.js +8 -6
  23. package/dist/es2019/commands/populate-historic-data/util/allowed-scopes.js +7 -0
  24. package/dist/es2019/commands/populate-historic-data/util/generate-csv.js +1 -1
  25. package/dist/es2019/version.json +1 -1
  26. package/dist/esm/cli.js +8 -3
  27. package/dist/esm/commands/populate-historic-data/lib/dependency-store.js +20 -15
  28. package/dist/esm/commands/populate-historic-data/package.js +20 -17
  29. package/dist/esm/commands/populate-historic-data/product.js +45 -42
  30. package/dist/esm/commands/populate-historic-data/util/allowed-scopes.js +11 -0
  31. package/dist/esm/commands/populate-historic-data/util/generate-csv.js +1 -1
  32. package/dist/esm/util/analytics.js +4 -3
  33. package/dist/esm/util/git.js +14 -13
  34. package/dist/esm/util/statlas.js +8 -7
  35. package/dist/esm/util/yarn.js +6 -5
  36. package/dist/esm/version.json +1 -1
  37. package/dist/types/commands/populate-historic-data/lib/dependency-store.d.ts +3 -2
  38. package/dist/types/commands/populate-historic-data/types.d.ts +3 -2
  39. package/dist/types/commands/populate-historic-data/util/allowed-scopes.d.ts +2 -0
  40. package/dist/types/commands/populate-historic-data/util/generate-csv.d.ts +2 -2
  41. package/package.json +2 -2
  42. package/report.api.md +1 -0
  43. package/tmp/api-report-tmp.d.ts +1 -0
  44. package/tokenize-arg-string.ts +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/dependency-version-analytics
2
2
 
3
+ ## 1.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`b734af05daf`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b734af05daf) - Added support for non-ak scoped packages
8
+
3
9
  ## 1.1.0
4
10
 
5
11
  ### Minor Changes
package/README.md CHANGED
@@ -26,7 +26,7 @@ $ atlaskit-version-analytics populate-product jira
26
26
 
27
27
  #### Description
28
28
 
29
- Reads the git history of changes to package.json in the current branch (assumed to be master) since the tool was last run, tracks changes to atlaskit dependencies and sends analytics in the format specified by http://go.atlassian.com/dataportal/analytics/registry/17058.
29
+ Reads the git history of changes to package.json in the current branch (assumed to be master) since the tool was last run, tracks changes to dependencies and sends analytics in the format specified by http://go.atlassian.com/dataportal/analytics/registry/17058.
30
30
 
31
31
  This command is intended to be used in product CI pipelines to record dep changes over time.
32
32
 
@@ -34,9 +34,11 @@ Dependency versions are compared to the versions when the tool was last run, whi
34
34
 
35
35
  For initial publishing of historical events, the `--reset` flag can be used to send changes that have occurred since the start of history.
36
36
 
37
+ For supported package scopes [refer](./src/commands/populate-historic-data/util/allowed-scopes.ts)
38
+
37
39
  ### populate-package \<package>
38
40
 
39
- Sends analytics events for published versions of the specified atlaskit package.
41
+ Sends analytics events for published versions of the specified package.
40
42
 
41
43
  Run `yarn dependency-version-analytics --help` for more info.
42
44
 
@@ -50,7 +52,7 @@ $ atlaskit-version-analytics populate-package @atlaskit/button
50
52
 
51
53
  Reads the version history of the package from npm and sends events for versions published since the time specified by `--since`, or all versions if not specified.
52
54
 
53
- This command will be used to record when atlaskit publish new versions of their packages in this repo https://bitbucket.org/atlassian/atlaskit-version-analytics.
55
+ This command will be used to record when new versions of the supported packages are published in this repo https://bitbucket.org/atlassian/atlaskit-version-analytics.
54
56
 
55
57
  ## Local development
56
58
 
package/dist/cjs/cli.js CHANGED
@@ -5,17 +5,49 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.run = run;
8
- var _toArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toArray"));
9
8
  var _chalk = _interopRequireDefault(require("chalk"));
10
9
  var _meow = _interopRequireDefault(require("meow"));
11
10
  var _populateHistoricData = require("./commands/populate-historic-data");
12
11
  /// <reference lib="es2017.object" />
13
12
 
14
13
  // prettier-ignore
15
- var HELP_MSG = "\n".concat(_chalk.default.green('Global options'), "\n ").concat(_chalk.default.yellow('--dev'), " Send analytics to dev analytics pipeline instead of prod\n ").concat(_chalk.default.yellow('--dryRun'), " Performs a dry run, prints analytics events to console in JSON format instead of sending them\n ").concat(_chalk.default.yellow('--limit'), " Limit the number of events sent, used for validation purposes\n ").concat(_chalk.default.yellow('--no-interactive'), " Disable any interactive prompts\n\n").concat(_chalk.default.yellow.bold('[populate-product] <product>'), "\n Sends analytics events for atlaskit dependency versions changes in package.json.\n\n Detects changes since the last time the tool was run by storing the last run in either statlas (--statlas flag) or using the\n 'atlaskit-dependency-version-analytics-last-run' git tag.\n If running the tool for the first time (last run does not exist), --reset must be used to detect changes since the beginning of the repo.\n\n ").concat(_chalk.default.green('Options'), "\n ").concat(_chalk.default.yellow('--csv'), " Prints AK dependency history in CSV format\n ").concat(_chalk.default.yellow('--reset'), " Reset change detection to detect changes from the beginning of time\n ").concat(_chalk.default.yellow('--tag'), " Specify a different tag to mark when the tool was last run\n ").concat(_chalk.default.yellow('--statlas'), " Use statlas rather than git tags for storing and sourcing last run info\n\n ").concat(_chalk.default.green('Examples'), "\n ").concat(_chalk.default.dim('$ atlaskit-version-analytics populate-product jira'), "\n\n").concat(_chalk.default.yellow.bold('[populate-package] <package>'), "\n Sends analytics events for published versions of the specified atlaskit package.\n\n ").concat(_chalk.default.green('Options'), "\n ").concat(_chalk.default.yellow('--since'), " Only publish versions since the following JS date string (exclusive)\n\n ").concat(_chalk.default.green('Examples'), "\n ").concat(_chalk.default.dim('$ atlaskit-version-analytics populate-package @atlaskit/button'), "\n");
16
- function run(_ref) {
17
- var dev = _ref.dev;
18
- var cli = (0, _meow.default)(HELP_MSG, {
14
+ const HELP_MSG = `
15
+ ${_chalk.default.green('Global options')}
16
+ ${_chalk.default.yellow('--dev')} Send analytics to dev analytics pipeline instead of prod
17
+ ${_chalk.default.yellow('--dryRun')} Performs a dry run, prints analytics events to console in JSON format instead of sending them
18
+ ${_chalk.default.yellow('--limit')} Limit the number of events sent, used for validation purposes
19
+ ${_chalk.default.yellow('--no-interactive')} Disable any interactive prompts
20
+ ${_chalk.default.yellow('--include-restricted-scopes')} Include analytics for @atlassian and @atlassiansox scoped packages as well
21
+
22
+ ${_chalk.default.yellow.bold('[populate-product] <product>')}
23
+ Sends analytics events for atlaskit dependency versions changes in package.json.
24
+
25
+ Detects changes since the last time the tool was run by storing the last run in either statlas (--statlas flag) or using the
26
+ 'atlaskit-dependency-version-analytics-last-run' git tag.
27
+ If running the tool for the first time (last run does not exist), --reset must be used to detect changes since the beginning of the repo.
28
+
29
+ ${_chalk.default.green('Options')}
30
+ ${_chalk.default.yellow('--csv')} Prints dependency history in CSV format
31
+ ${_chalk.default.yellow('--reset')} Reset change detection to detect changes from the beginning of time
32
+ ${_chalk.default.yellow('--tag')} Specify a different tag to mark when the tool was last run
33
+ ${_chalk.default.yellow('--statlas')} Use statlas rather than git tags for storing and sourcing last run info
34
+
35
+ ${_chalk.default.green('Examples')}
36
+ ${_chalk.default.dim('$ atlaskit-version-analytics populate-product jira')}
37
+
38
+ ${_chalk.default.yellow.bold('[populate-package] <package>')}
39
+ Sends analytics events for published versions of the specified package.
40
+
41
+ ${_chalk.default.green('Options')}
42
+ ${_chalk.default.yellow('--since')} Only publish versions since the following JS date string (exclusive)
43
+
44
+ ${_chalk.default.green('Examples')}
45
+ ${_chalk.default.dim('$ atlaskit-version-analytics populate-package @atlaskit/button')}
46
+ `;
47
+ function run({
48
+ dev
49
+ }) {
50
+ const cli = (0, _meow.default)(HELP_MSG, {
19
51
  flags: {
20
52
  csv: {
21
53
  type: 'boolean'
@@ -45,15 +77,16 @@ function run(_ref) {
45
77
  },
46
78
  statlas: {
47
79
  type: 'boolean'
80
+ },
81
+ includeRestrictedScopes: {
82
+ type: 'boolean'
48
83
  }
49
84
  }
50
85
  });
51
- var _cli$input = (0, _toArray2.default)(cli.input),
52
- command = _cli$input[0],
53
- inputs = _cli$input.slice(1);
54
- var limit = cli.flags.limit != null ? +cli.flags.limit : undefined;
86
+ const [command, ...inputs] = cli.input;
87
+ const limit = cli.flags.limit != null ? +cli.flags.limit : undefined;
55
88
  if (command === 'populate-product') {
56
- var product = inputs[0];
89
+ const product = inputs[0];
57
90
  if (!product) {
58
91
  console.error(_chalk.default.red('Must pass a product parameter'));
59
92
  process.exit(1);
@@ -63,14 +96,15 @@ function run(_ref) {
63
96
  dev: dev || cli.flags.dev || false,
64
97
  dryRun: cli.flags.dryRun || false,
65
98
  interactive: cli.flags.interactive,
66
- limit: limit,
67
- product: product,
99
+ limit,
100
+ product,
68
101
  reset: cli.flags.reset || false,
69
102
  statlas: cli.flags.statlas,
70
- tag: cli.flags.tag
103
+ tag: cli.flags.tag,
104
+ includeRestrictedScopes: cli.flags.includeRestrictedScopes || false
71
105
  });
72
106
  } else if (command === 'populate-package') {
73
- var pkg = inputs[0];
107
+ const pkg = inputs[0];
74
108
  if (!pkg) {
75
109
  console.error(_chalk.default.red('Must pass a package parameter'));
76
110
  process.exit(1);
@@ -79,9 +113,10 @@ function run(_ref) {
79
113
  dev: dev || cli.flags.dev || false,
80
114
  dryRun: cli.flags.dryRun || false,
81
115
  interactive: cli.flags.interactive,
82
- limit: limit,
83
- pkg: pkg,
84
- since: cli.flags.since
116
+ limit,
117
+ pkg,
118
+ since: cli.flags.since,
119
+ includeRestrictedScopes: cli.flags.includeRestrictedScopes || false
85
120
  });
86
121
  }
87
122
 
@@ -6,13 +6,13 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  Object.defineProperty(exports, "populatePackage", {
8
8
  enumerable: true,
9
- get: function get() {
9
+ get: function () {
10
10
  return _package.default;
11
11
  }
12
12
  });
13
13
  Object.defineProperty(exports, "populateProduct", {
14
14
  enumerable: true,
15
- get: function get() {
15
+ get: function () {
16
16
  return _product.default;
17
17
  }
18
18
  });