forked from microsoft/rushstack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tune up package documentation, add links to the new API reference web…
…site
- Loading branch information
Showing
19 changed files
with
107 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,6 +82,4 @@ export class PluginFeatureInitialization { | |
} | ||
|
||
|
||
// (No @packageDocumentation comment for this package) | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,4 @@ export interface ITaskWriter { | |
} | ||
|
||
|
||
// (No @packageDocumentation comment for this package) | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,32 @@ | ||
# @microsoft/package-deps-hash | ||
|
||
`package-deps-hash` is a general utility for building a JSON object containing the git hashes of all files used to produce a given package. Only | ||
files in a git repo that are not in .gitignore will be considered in building the hash. | ||
The `package-deps-hash` library generates a JSON object containing the git hashes of all files used to produce | ||
a given package. This is useful for scenarios where you want to define a "change receipt" file to be published | ||
with a package. The [Rush](https://rushjs.io/) tool uses this library to implement incremental build detection. | ||
|
||
This utility is useful for scenarios where you want to define a "change receipt" file to be published with a package. The file content | ||
and the current state of the package can be compared then to determine if the package needs to be rebuilt. | ||
Only files in a git repo that are not in .gitignore will be considered in building the hash. The file content and | ||
the current state of the package can be compared then to determine whether the package needs to be rebuilt. | ||
|
||
Internally it uses the GIT hashes to derive the hashes for package content. This allows the process to piggyback off GIT's hashing | ||
optimizations, as opposed to creating a more elaborate diffing scheme. | ||
Internally it uses the GIT hashes to derive the hashes for package content. This allows the process to leverage Git's | ||
hash optimizations, as opposed to creating a more elaborate diffing scheme. | ||
|
||
NOTE: GIT is required to be accessible in the command line path. | ||
NOTE: Git is required to be accessible in the command line path. | ||
|
||
## Usage | ||
|
||
|
||
``` | ||
```ts | ||
let _ = require('lodash'); | ||
let { getPackageDeps } = require('@microsoft/package-deps-hash'); | ||
|
||
// Gets the current deps object for the current working directory | ||
let deps = getPackageDeps(); | ||
let existingDeps = JSON.parse(fs.readFileSync('deps.json)); | ||
let existingDeps = JSON.parse(fs.readFileSync('package-deps.json')); | ||
|
||
if (_.isEqual(deps, existingDeps)) { | ||
// Skip re-building package. | ||
} else { | ||
// Rebuild package. | ||
} | ||
``` | ||
|
||
## API | ||
--- | ||
### getPackageDeps(packageFolderPath, exclusions) | ||
|
||
Gets an object containing all of the file hashes. | ||
|
||
#### Parameters | ||
|name|type|description| | ||
|----|----|-----------| | ||
|packageFolderPath|(string, optional, default: cwd())|The folder path to derive the package dependencies from. This is typically the folder containing package.json.| | ||
|exclusions| (string[], optional)|An optional array of file path exclusions. If a file should be omitted from the list of dependencies, use this to exclude it.| | ||
|
||
API documentation for this package: https://rushstack.io/pages/api/package-deps-hash/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,18 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
// See LICENSE in the project root for license information. | ||
|
||
/** @public */ | ||
/** | ||
* The data structure returned by {@link getPackageDeps}. | ||
* @public | ||
*/ | ||
export interface IPackageDeps { | ||
/** | ||
* The `key` is a source file path, relative to the package folder. The value is the Git hash. | ||
*/ | ||
files: { [key: string]: string }; | ||
|
||
/** | ||
* An optional field used to story command-line arguments for the build. | ||
*/ | ||
arguments?: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,17 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
// See LICENSE in the project root for license information. | ||
|
||
/** | ||
* This package builds a JSON object containing the git hashes of all files used to produce a given NPM package. | ||
* The {@link https://rushjs.io/ | Rush} tool uses this library to implement incremental build detection. | ||
* | ||
* @remarks | ||
* | ||
* For more info, please see the package {@link https://www.npmjs.com/package/@microsoft/package-deps-hash | ||
* | README}. | ||
* | ||
* @packageDocumentation | ||
*/ | ||
|
||
export { getPackageDeps } from './getPackageDeps'; | ||
export { IPackageDeps } from './IPackageDeps'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters