@atlaskit/dependency-version-analytics 1.4.1 → 1.4.3

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/dependency-version-analytics
2
2
 
3
+ ## 1.4.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`50cf866a219`](https://bitbucket.org/atlassian/atlassian-frontend/commits/50cf866a219) - bump semver
8
+
9
+ ## 1.4.2
10
+
11
+ ### Patch Changes
12
+
13
+ - [`9d00501a414`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9d00501a414) - Ensure legacy types are published for TS 4.5-4.8
14
+
3
15
  ## 1.4.1
4
16
 
5
17
  ### Patch Changes
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/dependency-version-analytics",
3
- "version": "1.4.1",
3
+ "version": "1.4.3",
4
4
  "sideEffects": false
5
5
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/dependency-version-analytics",
3
- "version": "1.4.1",
3
+ "version": "1.4.3",
4
4
  "sideEffects": false
5
5
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/dependency-version-analytics",
3
- "version": "1.4.1",
3
+ "version": "1.4.3",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1,4 @@
1
+ /// <reference lib="es2017.object" />
2
+ export declare function run({ dev }: {
3
+ dev: boolean;
4
+ }): Promise<void> | Promise<import("./types").UpgradeEvent[]>;
@@ -0,0 +1,2 @@
1
+ import type { LogResult } from 'simple-git';
2
+ export declare const generateLogs: (fileChanges: string[][]) => LogResult;
@@ -0,0 +1,2 @@
1
+ export { default as populateProduct } from './product';
2
+ export { default as populatePackage } from './package';
@@ -0,0 +1,41 @@
1
+ /** Workspace code */
2
+ import { DependencyMap } from '../types';
3
+ import type { DefaultLogFields, ListLogLine } from 'simple-git';
4
+ /**
5
+ * Stores the state of atlaskit dependencies in a repository
6
+ */
7
+ export declare class DependencyStore {
8
+ private cwd;
9
+ /** Mapping of dependency names to arrays of unique dependency type + versions */
10
+ private dependencies;
11
+ /** Mapping of workspaces to their dependency map. Each dependency in their map links to an entry in `dependencies` */
12
+ private workspaces;
13
+ /** Set of workspace globs. Used to verify that a package.json is a valid workspace */
14
+ private workspaceGlobs;
15
+ private initialised;
16
+ private supportedScopes;
17
+ private supportedPackages;
18
+ constructor(cwd: string | undefined, supportedScopes: string[], supportedPackages: string[]);
19
+ /** Scans the repo for dependencies at the specified git ref and return the flattened dependency map */
20
+ initialise(gitRef: string | undefined): Promise<DependencyMap>;
21
+ /** Updates the repo dependency store based on the changes in `logItem`.
22
+ * Returns the updated flattened dependencies
23
+ */
24
+ update(logItem: DefaultLogFields & ListLogLine): Promise<DependencyMap>;
25
+ /** Retrieve a flattened list of p repo dependencies.
26
+ * If multiple versions of a dependency exist, the lowest version is returned.
27
+ * If the dependency is listed under multiple dependency types, 'dependencies' is prioritised over 'devDependencies'
28
+ */
29
+ private getFlattenedDeps;
30
+ private assertInitialised;
31
+ /** Scans all workspaces in repo and rebuilds dependency store */
32
+ private resetStore;
33
+ private getWorkspaceDependencies;
34
+ private updateWorkspaces;
35
+ private addDependency;
36
+ private removeDependency;
37
+ private getSupportedDependencies;
38
+ private static getMinimumVersion;
39
+ private static transformDepName;
40
+ private static transformDepVersion;
41
+ }
@@ -0,0 +1,7 @@
1
+ import { PopulateHistoricDataFlags } from './types';
2
+ import { UpgradeEvent } from '../../types';
3
+ export type PopulatePackageFlags = PopulateHistoricDataFlags & {
4
+ since?: string;
5
+ pkg: string;
6
+ };
7
+ export default function populatePackage(flags: PopulatePackageFlags): Promise<UpgradeEvent[]>;
@@ -0,0 +1,10 @@
1
+ import { PopulateHistoricDataFlags } from './types';
2
+ export type PopulateProductFlags = PopulateHistoricDataFlags & {
3
+ csv: boolean;
4
+ product: string;
5
+ reset: boolean;
6
+ statlas?: boolean;
7
+ tag?: string;
8
+ supportedPackages?: string;
9
+ };
10
+ export default function populateProduct(flags: PopulateProductFlags): Promise<void>;
@@ -0,0 +1,19 @@
1
+ import { DependencyType } from '../../types';
2
+ export type PopulateHistoricDataFlags = {
3
+ cwd?: string;
4
+ dev: boolean;
5
+ dryRun: boolean;
6
+ limit?: number;
7
+ interactive: boolean;
8
+ includeRestrictedScopes?: boolean;
9
+ };
10
+ export type DependencyMap = {
11
+ [name: string]: {
12
+ version: string;
13
+ type: DependencyType;
14
+ };
15
+ };
16
+ export type PackageChange = {
17
+ deps: DependencyMap;
18
+ date: string;
19
+ };
@@ -0,0 +1,8 @@
1
+ export declare const getSupportedScopes: (enableNonAtlaskitPackages?: boolean) => string[];
2
+ export declare const isPackageFromSupportedScopes: (packageName: string, supportedScopes?: string[]) => boolean;
3
+ /**
4
+ *
5
+ * Checks if the package is from supported scope
6
+ * and if so, the package is also from supported package list.
7
+ */
8
+ export declare const isPackageSupported: (packageName: string, supportedPackages?: string[], supportedScopes?: string[]) => boolean;
@@ -0,0 +1,3 @@
1
+ import { PackageChange } from '../types';
2
+ /** Generates a CSV of product package changes over time */
3
+ export declare const generateCSV: (packageChanges: PackageChange[]) => string;
@@ -0,0 +1,19 @@
1
+ export declare const DEFAULT_TAG = "atlaskit-dependency-version-analytics-last-run";
2
+ export declare const DEP_TYPES: readonly [
3
+ {
4
+ readonly packageJsonKey: "devDependencies";
5
+ readonly depTypeName: "devDependency";
6
+ },
7
+ {
8
+ readonly packageJsonKey: "dependencies";
9
+ readonly depTypeName: "dependency";
10
+ },
11
+ {
12
+ readonly packageJsonKey: "peerDependencies";
13
+ readonly depTypeName: "peerDependency";
14
+ },
15
+ {
16
+ readonly packageJsonKey: "optionalDependencies";
17
+ readonly depTypeName: "optionalDependency";
18
+ }
19
+ ];
@@ -0,0 +1,3 @@
1
+ export { populateProduct, populatePackage, } from './commands/populate-historic-data';
2
+ export { sendAnalytics } from './util/analytics';
3
+ export type { DependencyType, UpgradeType, UpgradeSubType, UpgradeEvent, } from './types';
@@ -0,0 +1,25 @@
1
+ import { ReleaseType } from 'semver';
2
+ export type DependencyType = 'devDependency' | 'dependency' | 'optionalDependency' | 'peerDependency';
3
+ export type UpgradeType = 'add' | 'upgrade' | 'remove' | 'downgrade';
4
+ export type UpgradeSubType = ReleaseType | null;
5
+ export type UpgradeEvent = {
6
+ dependencyName: string;
7
+ versionString: string;
8
+ major: string | null;
9
+ minor: string | null;
10
+ patch: string | null;
11
+ date: string;
12
+ upgradeType: UpgradeType;
13
+ upgradeSubType: UpgradeSubType;
14
+ cliVersion: string;
15
+ latestTag: string | null;
16
+ nextTag: string | null;
17
+ hotfixTag: string | null;
18
+ rcTag: string | null;
19
+ dependencyType?: DependencyType;
20
+ historical?: boolean;
21
+ commitHash?: string;
22
+ };
23
+ export type DistTagsType = {
24
+ [tag: string]: string;
25
+ };
@@ -0,0 +1,12 @@
1
+ import { UpgradeEvent, DependencyType, DistTagsType } from '../types';
2
+ export declare function createUpgradeEvent(name: string, version: string | undefined, previousVersion: string | undefined, date: string, optionalEventArgs?: {
3
+ commitHash?: string;
4
+ dependencyType?: DependencyType;
5
+ historical?: boolean;
6
+ }, tags?: DistTagsType): UpgradeEvent | null;
7
+ export declare function sendAnalytics(analyticsEvents: UpgradeEvent[], { dev, limit, product, skipPrompt, }: {
8
+ dev?: boolean;
9
+ limit?: number;
10
+ product: string;
11
+ skipPrompt?: boolean;
12
+ }): Promise<void>;
@@ -0,0 +1,2 @@
1
+ /** Generic assertion function */
2
+ export declare function assert(condition: any, msg?: string): asserts condition;
@@ -0,0 +1 @@
1
+ export default function (name: string): string | null;
@@ -0,0 +1 @@
1
+ export default function getFileHistoryFromGit(fileName: string): Promise<string>;
@@ -0,0 +1,8 @@
1
+ import { DistTagsType } from '../types';
2
+ export type PackageVersionHistoryAndTagsType = {
3
+ time: {
4
+ [version: string]: string;
5
+ };
6
+ 'dist-tags': DistTagsType;
7
+ };
8
+ export default function getPackageVersionHistoryAndTags(packageName: string): Promise<PackageVersionHistoryAndTagsType>;
@@ -0,0 +1,14 @@
1
+ import type { LogResult } from 'simple-git';
2
+ export declare function getChangesSince(since?: string): Promise<LogResult>;
3
+ export declare function tagCommit(tag: string): Promise<string>;
4
+ export declare function doesTagExist(tag: string): Promise<boolean>;
5
+ export declare function refetchTag(tag: string): Promise<{
6
+ fetchTagResult: import("simple-git").FetchResult | undefined;
7
+ }>;
8
+ export declare function getHash(ref: string): Promise<string>;
9
+ export declare function showFile(ref: string, filename: string, opts?: {
10
+ cwd?: string;
11
+ }): import("simple-git").Response<string>;
12
+ export declare function getFiles(ref: string, glob: string, opts?: {
13
+ cwd?: string;
14
+ }): Promise<string[]>;
@@ -0,0 +1,5 @@
1
+ export type Meta = {
2
+ lastRunHash: string;
3
+ };
4
+ export declare function getMeta(product: string): Promise<Meta | null>;
5
+ export declare function uploadMeta(product: string, lastRunHash: string): Promise<void>;
@@ -0,0 +1,2 @@
1
+ export declare function getWorkspaceGlobs(ref: string, cwd: string): Promise<Set<string> | null>;
2
+ export declare function getWorkspacePaths(ref: string, workspaceGlobs: Set<string>, cwd: string): Promise<string[]>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/dependency-version-analytics",
3
- "version": "1.4.1",
3
+ "version": "1.4.3",
4
4
  "description": "Tool to pull atlaskit version history from a repo",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -36,7 +36,7 @@
36
36
  "meow": "^8.1.1",
37
37
  "micromatch": "^4.0.2",
38
38
  "node-fetch": "^2.6.7",
39
- "semver": "^7.3.0",
39
+ "semver": "^7.5.2",
40
40
  "simple-git": "^3.16.0"
41
41
  },
42
42
  "peerDependencies": {