This commit is contained in:
Larry Kiniu 2021-08-26 11:09:40 +03:00
Родитель 8663e086fa
Коммит 60a7c462b7
45 изменённых файлов: 269 добавлений и 156 удалений

Просмотреть файл

@ -17,8 +17,8 @@ Build all packages
$ yarn lage build
```
Build a single package _e.g build @ardiffact/azure-artifact-storage_
Build a single package _e.g build @microsoft/azure-artifact-storage_
```sh
$ yarn lage build --to @ardiffact/azure-artifact-storage
$ yarn lage build --to @microsoft/azure-artifact-storage
```

Просмотреть файл

@ -109,7 +109,7 @@
/**
* (REQUIRED) Whether to generate an API report.
*/
"enabled": false,
"enabled": true
/**
* The filename for the API report files. It will be combined with "reportFolder" or "reportTempFolder" to produce
@ -135,7 +135,7 @@
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
* DEFAULT VALUE: "<projectFolder>/etc/"
*/
"reportFolder": "../../api/report"
// "reportFolder": "<projectFolder>/etc/",
/**
* Specifies the folder where the temporary report file is written. The file name portion is determined by
@ -181,7 +181,7 @@
/**
* (REQUIRED) Whether to generate the .d.ts rollup file.
*/
"enabled": false
"enabled": true
/**
* Specifies the output path for a .d.ts rollup file to be generated without any trimming.

Просмотреть файл

@ -1,11 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [@ardiffact/azure-artifact-storage](./azure-artifact-storage.md) &gt; [AzureBlobStorageConfig](./azure-artifact-storage.azureblobstorageconfig.md) &gt; [accountName](./azure-artifact-storage.azureblobstorageconfig.accountname.md)
## AzureBlobStorageConfig.accountName property
<b>Signature:</b>
```typescript
accountName: string;
```

Просмотреть файл

@ -1,11 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [@ardiffact/azure-artifact-storage](./azure-artifact-storage.md) &gt; [AzureBlobStorageConfig](./azure-artifact-storage.azureblobstorageconfig.md) &gt; [container](./azure-artifact-storage.azureblobstorageconfig.container.md)
## AzureBlobStorageConfig.container property
<b>Signature:</b>
```typescript
container: string;
```

Просмотреть файл

@ -1,11 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [@ardiffact/azure-artifact-storage](./azure-artifact-storage.md) &gt; [AzureBlobStorageConfig](./azure-artifact-storage.azureblobstorageconfig.md) &gt; [storageKey](./azure-artifact-storage.azureblobstorageconfig.storagekey.md)
## AzureBlobStorageConfig.storageKey property
<b>Signature:</b>
```typescript
storageKey: string;
```

Просмотреть файл

@ -1,11 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [@ardiffact/azure-artifact-storage](./azure-artifact-storage.md) &gt; [RemoteArtifact](./azure-artifact-storage.remoteartifact.md) &gt; [name](./azure-artifact-storage.remoteartifact.name.md)
## RemoteArtifact.name property
<b>Signature:</b>
```typescript
name: string;
```

Просмотреть файл

@ -1,11 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [@ardiffact/azure-artifact-storage](./azure-artifact-storage.md) &gt; [RemoteArtifact](./azure-artifact-storage.remoteartifact.md) &gt; [url](./azure-artifact-storage.remoteartifact.url.md)
## RemoteArtifact.url property
<b>Signature:</b>
```typescript
url: string;
```

Просмотреть файл

@ -1,34 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [@ardiffact/bundle-size-differ](./bundle-size-differ.md) &gt; [diff](./bundle-size-differ.diff.md)
## diff() function
Calculates the diff between two sets of bundle stats
<b>Signature:</b>
```typescript
export declare function diff(baselineDir: string, candidateDir: string, fileFilter?: string | string[], filter?: string | string[], remoteArtifactManifests?: {
baseline: string | RemoteArtifact[];
candidate: string | RemoteArtifact[];
hostUrl: string;
}): Promise<FileDiffResults>;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| baselineDir | string | Directory containing webpack stat files of the baseline |
| candidateDir | string | Directory containing webpack stat files of the candidate |
| fileFilter | string \| string\[\] | Optionally pass filter to omit certain files using [globby](https://github.com/sindresorhus/globby#usage) syntax |
| filter | string \| string\[\] | Filter out certain assets for the bundle size calculation |
| remoteArtifactManifests | { baseline: string \| [RemoteArtifact](./azure-artifact-storage.remoteartifact.md)<!-- -->\[\]; candidate: string \| [RemoteArtifact](./azure-artifact-storage.remoteartifact.md)<!-- -->\[\]; hostUrl: string; } | Either a path on disk to the serialized JSON manifest or the [RemoteArtifact](./azure-artifact-storage.remoteartifact.md) list manifest object itself |
<b>Returns:</b>
Promise&lt;[FileDiffResults](./bundle-size-differ.filediffresults.md)<!-- -->&gt;
The diff object

Просмотреть файл

@ -1,17 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [@ardiffact/bundle-size-differ](./bundle-size-differ.md) &gt; [FileDiffResults](./bundle-size-differ.filediffresults.md)
## FileDiffResults type
<b>Signature:</b>
```typescript
export declare type FileDiffResults = {
withDifferences: FileDiffResultWithComparisonToolUrl[];
newFiles: FileDiffResult[];
removedFiles: FileToDiffDescriptor[];
};
```
<b>References:</b> [FileDiffResultWithComparisonToolUrl](./bundle-size-differ.filediffresultwithcomparisontoolurl.md)

Просмотреть файл

@ -1,13 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [@ardiffact/bundle-size-differ](./bundle-size-differ.md) &gt; [FileDiffResultWithComparisonToolUrl](./bundle-size-differ.filediffresultwithcomparisontoolurl.md)
## FileDiffResultWithComparisonToolUrl type
<b>Signature:</b>
```typescript
export declare type FileDiffResultWithComparisonToolUrl = FileDiffResult & {
comparisonToolUrl?: string;
};
```

Просмотреть файл

@ -1,14 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md)
## API Reference
## Packages
| Package | Description |
| --- | --- |
| [@ardiffact/azure-artifact-storage](./azure-artifact-storage.md) | |
| [@ardiffact/bundle-size-differ](./bundle-size-differ.md) | A library for generating a diff object between two sets of webpack bundle stat files |
| [@ardiffact/bundle-size-report](./bundle-size-report.md) | A library for generating a markdown report for a bundle stats diff |

Просмотреть файл

@ -3,8 +3,8 @@
"name": "ardiffact",
"version": "0.1.0",
"description": "plugin based tool for diffing artifacts",
"repository": "git@github.com:oliwheeler/ardiffact.git",
"author": "Oliver Wheeler <olwheele@microsoft.com>",
"repository": "https://github.com/microsoft/ardiffact.git",
"author": "Larry Kiniu <lkiniu@microsoft.com>",
"license": "MIT",
"scripts": {
"build": "lage build",

Просмотреть файл

@ -0,0 +1,30 @@
/// <reference types="node" />
export declare interface AzureBlobStorageConfig {
accountName: string;
storageKey: string;
container: string;
}
export declare function downloadArtifacts(config: AzureBlobStorageConfig, prefix: string, downloadDirectory?: string, filter?: string | string[], gzip?: boolean): Promise<{
name: string;
path?: string;
}[]>;
export declare function generateArtifactSasTokens(config: AzureBlobStorageConfig, prefix: string, filter?: string | string[]): Promise<RemoteArtifact[]>;
export declare function getArtifacts(config: AzureBlobStorageConfig, prefix: string, filter?: string | string[], gzip?: boolean): Promise<{
name: string;
artifact: Buffer;
}[]>;
export declare function listArtifacts(config: AzureBlobStorageConfig, prefix: string, filter?: string | string[]): Promise<string[]>;
export declare interface RemoteArtifact {
name: string;
url: string;
}
export declare const uploadArtifacts: (dirPath: string, prefix: string, config: AzureBlobStorageConfig, gzip?: boolean | undefined) => Promise<void>;
export { }

Просмотреть файл

@ -1,11 +1,11 @@
{
"name": "@ardiffact/azure-artifact-storage",
"name": "@microsoft/azure-artifact-storage",
"version": "0.3.4",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/oliwheeler/ardiffact.git",
"url": "https://github.com/microsoft/ardiffact.git",
"directory": "packages/azure-artifact-storage"
},
"license": "MIT",

Просмотреть файл

@ -0,0 +1,49 @@
## API Report File for "@microsoft/azure-artifact-storage"
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts
// @public (undocumented)
export interface AzureBlobStorageConfig {
// (undocumented)
accountName: string;
// (undocumented)
container: string;
// (undocumented)
storageKey: string;
}
// @public (undocumented)
export function downloadArtifacts(config: AzureBlobStorageConfig, prefix: string, downloadDirectory?: string, filter?: string | string[], gzip?: boolean): Promise<{
name: string;
path?: string;
}[]>;
// @public (undocumented)
export function generateArtifactSasTokens(config: AzureBlobStorageConfig, prefix: string, filter?: string | string[]): Promise<RemoteArtifact[]>;
// @public (undocumented)
export function getArtifacts(config: AzureBlobStorageConfig, prefix: string, filter?: string | string[], gzip?: boolean): Promise<{
name: string;
artifact: Buffer;
}[]>;
// @public (undocumented)
export function listArtifacts(config: AzureBlobStorageConfig, prefix: string, filter?: string | string[]): Promise<string[]>;
// @public (undocumented)
export interface RemoteArtifact {
// (undocumented)
name: string;
// (undocumented)
url: string;
}
// @public (undocumented)
export const uploadArtifacts: (dirPath: string, prefix: string, config: AzureBlobStorageConfig, gzip?: boolean | undefined) => Promise<void>;
// (No @packageDocumentation comment for this package)
```

81
packages/webpack-stats-differ/dist/webpack-stats-differ.d.ts поставляемый Normal file
Просмотреть файл

@ -0,0 +1,81 @@
/**
* A library for generating a diff object between two sets of webpack bundle stat files
* @packageDocumentation
*/
import { RemoteArtifact } from '@microsoft/azure-artifact-storage';
import { Stats } from 'webpack';
declare type Asset = Exclude<Stats.ToJsonOutput["assets"], undefined>[number];
declare interface AssetStats {
assetName: string;
candidateAssetSize: number;
baselineAssetSize: number;
isSizeReduction: boolean;
isSizeIncrease: boolean;
isRemoved: boolean;
isAdded: boolean;
sizeDiff: number;
}
declare interface ChangedStats {
increased: AssetStats[];
decreased: AssetStats[];
}
/**
* Calculates the diff between two sets of bundle stats
*
* @param baselineDir - Directory containing webpack stat files of the baseline
* @param candidateDir - Directory containing webpack stat files of the candidate
* @param fileFilter - Optionally pass filter to omit certain files using {@link https://github.com/sindresorhus/globby#usage | globby} syntax
* @param filter - Filter out certain assets for the bundle size calculation
* @param remoteArtifactManifests - Either a path on disk to the serialized JSON manifest or the
* {@link @microsoft/azure-artifact-storage#RemoteArtifact} list manifest object itself
* @returns The diff object
*
* @public
*/
export declare function diff(baselineDir: string, candidateDir: string, fileFilter?: string | string[], filter?: string | string[], remoteArtifactManifests?: {
baseline: string | RemoteArtifact[];
candidate: string | RemoteArtifact[];
hostUrl: string;
}): Promise<FileDiffResults>;
declare interface DiffStats {
isChanged: boolean;
newAssets: AssetStats[];
removedAssets: AssetStats[];
changedStats: ChangedStats;
unchangedStats: AssetStats[];
}
declare interface FileDiffResult {
name: string;
diffStats: DiffStats;
}
export declare type FileDiffResults = {
withDifferences: FileDiffResultWithComparisonToolUrl[];
newFiles: FileDiffResult[];
removedFiles: FileToDiffDescriptor[];
};
export declare type FileDiffResultWithComparisonToolUrl = FileDiffResult & {
comparisonToolUrl?: string;
};
declare interface FileToDiffDescriptor {
name: string;
baselinePath: string;
}
/** Returns a readable name of the asset
*
* @param asset - webpack stats asset
* @internal
*/
export declare function getFriendlyAssetName(asset: Pick<Asset, "name" | "chunkNames" | "chunks">): string;
export { }

Просмотреть файл

@ -1,12 +1,12 @@
{
"name": "@ardiffact/bundle-size-differ",
"name": "@microsoft/webpack-stats-differ",
"version": "0.2.5",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/oliwheeler/ardiffact.git",
"directory": "packages/bundle-size-differ"
"url": "https://github.com/microsoft/ardiffact.git",
"directory": "packages/webpack-stats-differ"
},
"license": "MIT",
"scripts": {
@ -26,7 +26,7 @@
"lodash": "^4.17.21",
"upath": "^2.0.1",
"@mixer/webpack-bundle-compare": "^0.1.0",
"@ardiffact/azure-artifact-storage": "*"
"@microsoft/azure-artifact-storage": "*"
},
"devDependencies": {
"@babel/preset-env": "^7.12.1",

Просмотреть файл

@ -8,7 +8,7 @@ import {
import { FilePair, pairFiles, pairRemoteArtifacts } from "./pairFiles";
import * as fs from "fs";
import globby from "globby";
import { RemoteArtifact } from "@ardiffact/azure-artifact-storage";
import { RemoteArtifact } from "@microsoft/azure-artifact-storage";
export {
FileDiffResultWithComparisonToolUrl,
FileDiffResults,
@ -23,7 +23,7 @@ import { generateComparisonAddress } from "./comparisonAddress";
* @param fileFilter - Optionally pass filter to omit certain files using {@link https://github.com/sindresorhus/globby#usage | globby} syntax
* @param filter - Filter out certain assets for the bundle size calculation
* @param remoteArtifactManifests - Either a path on disk to the serialized JSON manifest or the
* {@link @ardiffact/azure-artifact-storage#RemoteArtifact} list manifest object itself
* {@link @microsoft/azure-artifact-storage#RemoteArtifact} list manifest object itself
* @returns The diff object
*
* @public

Просмотреть файл

@ -1,6 +1,6 @@
import * as fs from "fs";
import { basename } from "path";
import { RemoteArtifact } from "@ardiffact/azure-artifact-storage";
import { RemoteArtifact } from "@microsoft/azure-artifact-storage";
export const getFileNames = (dirPath: string) => fs.promises.readdir(dirPath);
export const pairFiles = (pathsA: string[], pathsB: string[]): FilePair[] => {

Просмотреть файл

@ -0,0 +1,41 @@
## API Report File for "@microsoft/webpack-stats-differ"
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts
import { RemoteArtifact } from '@microsoft/azure-artifact-storage';
import { Stats } from 'webpack';
// @public
export function diff(baselineDir: string, candidateDir: string, fileFilter?: string | string[], filter?: string | string[], remoteArtifactManifests?: {
baseline: string | RemoteArtifact[];
candidate: string | RemoteArtifact[];
hostUrl: string;
}): Promise<FileDiffResults>;
// @public (undocumented)
export type FileDiffResults = {
withDifferences: FileDiffResultWithComparisonToolUrl[];
newFiles: FileDiffResult[];
removedFiles: FileToDiffDescriptor[];
};
// @public (undocumented)
export type FileDiffResultWithComparisonToolUrl = FileDiffResult & {
comparisonToolUrl?: string;
};
// Warning: (ae-forgotten-export) The symbol "Asset" needs to be exported by the entry point index.d.ts
// Warning: (ae-internal-missing-underscore) The name "getFriendlyAssetName" should be prefixed with an underscore because the declaration is marked as @internal
//
// @internal
export function getFriendlyAssetName(asset: Pick<Asset, "name" | "chunkNames" | "chunks">): string;
// Warnings were encountered during analysis:
//
// src/diffAssets.ts:10:3 - (ae-forgotten-export) The symbol "FileDiffResult" needs to be exported by the entry point index.d.ts
// src/diffAssets.ts:12:3 - (ae-forgotten-export) The symbol "FileToDiffDescriptor" needs to be exported by the entry point index.d.ts
```

22
packages/webpack-stats-report/dist/webpack-stats-report.d.ts поставляемый Normal file
Просмотреть файл

@ -0,0 +1,22 @@
/**
* A library for generating a markdown report for a bundle stats diff
* @packageDocumentation
*/
import { FileDiffResults } from '@microsoft/webpack-stats-differ';
/**
*
* @param bundleStatsResults - Diff results created by {@link @microsoft/webpack-stats-differ#FileDiffResults} object
* @returns markdown report
*/
export declare function createReport(bundleStatsResults: FileDiffResults, minimumIncrease?: number): string;
/**
*
* @param filePath - path to webpack bundle stats file
* @internal
*/
export declare function getAppName(filePath: string): string;
export { }

Просмотреть файл

@ -1,12 +1,12 @@
{
"name": "@ardiffact/bundle-size-report",
"name": "@microsoft/webpack-stats-report",
"version": "0.3.0",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/oliwheeler/ardiffact.git",
"directory": "packages/bundle-size-report"
"url": "https://github.com/microsoft/ardiffact.git",
"directory": "packages/webpack-stats-report"
},
"license": "MIT",
"scripts": {
@ -20,7 +20,7 @@
"lib/**/*.d.ts"
],
"dependencies": {
"@ardiffact/bundle-size-differ": "*",
"@microsoft/webpack-stats-differ": "*",
"lodash": "^4.17.21"
},
"devDependencies": {

Просмотреть файл

@ -1,11 +1,16 @@
import { FileDiffResults } from "@ardiffact/bundle-size-differ";
import { FileDiffResults } from "@microsoft/webpack-stats-differ";
import { createDetailedReport, createNoChangeReport } from "./createReport";
import { createReportData } from "./createReportData";
/**
<<<<<<< HEAD:packages/bundle-size-report/src/composeReport.ts
* Generates a bundle size report from webpack bundle stats diff
* @param bundleStatsResults - Diff results created by {@link @ardiffact/bundle-size-differ#FileDiffResults} object
* @param minimumIncrease - number indicating the smallest increase in bytes that must be reported
=======
*
* @param bundleStatsResults - Diff results created by {@link @microsoft/webpack-stats-differ#FileDiffResults} object
>>>>>>> d19b976 (change package names and scopes):packages/webpack-stats-report/src/composeReport.ts
* @returns markdown report
*/
export function createReport(bundleStatsResults: FileDiffResults, minimumIncrease: number = 0): string {

Просмотреть файл

@ -1,5 +1,5 @@
import { concat } from "lodash";
import { FileDiffResultWithComparisonToolUrl } from "@ardiffact/bundle-size-differ";
import { FileDiffResultWithComparisonToolUrl } from "@microsoft/webpack-stats-differ";
import { compose, filter, first, identity, join, tail } from "lodash/fp";
import * as path from "path";

Просмотреть файл

@ -0,0 +1,18 @@
## API Report File for "@microsoft/webpack-stats-report"
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts
import { FileDiffResults } from '@microsoft/webpack-stats-differ';
// @public (undocumented)
export function createReport(bundleStatsResults: FileDiffResults, minimumIncrease?: number): string;
// Warning: (ae-internal-missing-underscore) The name "getAppName" should be prefixed with an underscore because the declaration is marked as @internal
//
// @internal (undocumented)
export function getAppName(filePath: string): string;
```

Просмотреть файл

@ -9,7 +9,7 @@
"exclude": ["./src/**/*.test.ts"],
"references": [
{
"path": "../bundle-size-differ/tsconfig.json"
"path": "../webpack-stats-differ/tsconfig.json"
}
]
}