@lage-run/hasher 0.1.2 → 0.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.
package/CHANGELOG.json CHANGED
@@ -2,7 +2,52 @@
2
2
  "name": "@lage-run/hasher",
3
3
  "entries": [
4
4
  {
5
- "date": "Fri, 18 Nov 2022 19:52:27 GMT",
5
+ "date": "Wed, 08 Mar 2023 00:05:07 GMT",
6
+ "tag": "@lage-run/hasher_v0.2.0",
7
+ "version": "0.2.0",
8
+ "comments": {
9
+ "minor": [
10
+ {
11
+ "author": "kchau@microsoft.com",
12
+ "package": "@lage-run/hasher",
13
+ "commit": "e2eb2c00d1b23e2c65943e9c64134c14e04f985f",
14
+ "comment": "allows global script cache"
15
+ }
16
+ ]
17
+ }
18
+ },
19
+ {
20
+ "date": "Tue, 21 Feb 2023 21:30:37 GMT",
21
+ "tag": "@lage-run/hasher_v0.1.3",
22
+ "version": "0.1.3",
23
+ "comments": {
24
+ "none": [
25
+ {
26
+ "author": "kchau@microsoft.com",
27
+ "package": "@lage-run/hasher",
28
+ "commit": "d7a8a3fa2bcf434c59bea26d5964dd7235998ad2",
29
+ "comment": "fixing tests"
30
+ }
31
+ ]
32
+ }
33
+ },
34
+ {
35
+ "date": "Wed, 15 Feb 2023 16:51:15 GMT",
36
+ "tag": "@lage-run/hasher_v0.1.3",
37
+ "version": "0.1.3",
38
+ "comments": {
39
+ "patch": [
40
+ {
41
+ "author": "renovate@whitesourcesoftware.com",
42
+ "package": "@lage-run/hasher",
43
+ "commit": "b8e0ead727b1e7f7065f853e0a1ae677f4455a5b",
44
+ "comment": "Update dependency workspace-tools to v0.30.0"
45
+ }
46
+ ]
47
+ }
48
+ },
49
+ {
50
+ "date": "Fri, 18 Nov 2022 19:52:38 GMT",
6
51
  "tag": "@lage-run/hasher_v0.1.2",
7
52
  "version": "0.1.2",
8
53
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,28 @@
1
1
  # Change Log - @lage-run/hasher
2
2
 
3
- This log was last generated on Fri, 18 Nov 2022 19:52:27 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 08 Mar 2023 00:05:07 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 0.2.0
8
+
9
+ Wed, 08 Mar 2023 00:05:07 GMT
10
+
11
+ ### Minor changes
12
+
13
+ - allows global script cache (kchau@microsoft.com)
14
+
15
+ ## 0.1.3
16
+
17
+ Wed, 15 Feb 2023 16:51:15 GMT
18
+
19
+ ### Patches
20
+
21
+ - Update dependency workspace-tools to v0.30.0 (renovate@whitesourcesoftware.com)
22
+
7
23
  ## 0.1.2
8
24
 
9
- Fri, 18 Nov 2022 19:52:27 GMT
25
+ Fri, 18 Nov 2022 19:52:38 GMT
10
26
 
11
27
  ### Patches
12
28
 
@@ -26,13 +26,13 @@ function createPackageHashes(root, workspaceInfo, repoHashes) {
26
26
  // key: path/to/package (packageRoot), value: array of a tuple of [file, hash]
27
27
  const packageHashes = {};
28
28
  for (const [entry, value] of Object.entries(repoHashes)){
29
- const pathParts1 = entry.split(/[\\/]/);
29
+ const pathParts = entry.split(/[\\/]/);
30
30
  let node = pathTree;
31
31
  const packagePathParts = [];
32
- for (const part1 of pathParts1){
33
- if (node[part1]) {
34
- node = node[part1];
35
- packagePathParts.push(part1);
32
+ for (const part of pathParts){
33
+ if (node[part]) {
34
+ node = node[part];
35
+ packagePathParts.push(part);
36
36
  } else {
37
37
  break;
38
38
  }
@@ -240,8 +240,8 @@ function getPackageDeps(packagePath = process.cwd(), excludedPaths, gitPath) {
240
240
  }
241
241
  }
242
242
  const currentlyChangedFileHashes = getGitHashForFiles(filesToHash, packagePath, gitPath);
243
- for (const [filename1, hash] of currentlyChangedFileHashes){
244
- result.set(filename1, hash);
243
+ for (const [filename, hash] of currentlyChangedFileHashes){
244
+ result.set(filename, hash);
245
245
  }
246
246
  return result;
247
247
  }
@@ -170,8 +170,8 @@ function applyWorkingTreeState(rootDirectory, state, gitPath) {
170
170
  const len = hashes.length;
171
171
  for(let i = 0; i < len; i++){
172
172
  const hash = hashes[i];
173
- const filePath1 = filesToHash[i];
174
- state.set(filePath1, hash);
173
+ const filePath = filesToHash[i];
174
+ state.set(filePath, hash);
175
175
  }
176
176
  }
177
177
  }
@@ -62,10 +62,10 @@ async function generateHashOfFiles(packageRoot, repoInfo) {
62
62
  const normalized = _path.default.normalize(packageRoot) + _path.sep;
63
63
  const files = Object.keys(repoHashes).filter((f)=>_path.default.join(root, f).includes(normalized));
64
64
  files.sort((a, b)=>a.localeCompare(b));
65
- const hashes1 = [];
65
+ const hashes = [];
66
66
  for (const file of files){
67
- hashes1.push(file, repoHashes[file]);
67
+ hashes.push(file, repoHashes[file]);
68
68
  }
69
- return (0, _helpersJs.hashStrings)(hashes1);
69
+ return (0, _helpersJs.hashStrings)(hashes);
70
70
  }
71
71
  }
@@ -1,5 +1,5 @@
1
1
  import type { RepoInfo } from "./repoInfo.js";
2
- export declare type PackageHashInfo = {
2
+ export type PackageHashInfo = {
3
3
  name: string;
4
4
  filesHash: string;
5
5
  dependenciesHash: string;
File without changes
package/lib/hasher.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";
package/lib/index.js CHANGED
@@ -53,11 +53,11 @@ class Hasher {
53
53
  ];
54
54
  const done = [];
55
55
  while(queue.length > 0){
56
- const packageRoot1 = queue.shift();
57
- if (!packageRoot1) {
56
+ const packageRoot = queue.shift();
57
+ if (!packageRoot) {
58
58
  continue;
59
59
  }
60
- const packageHash = await (0, _hashOfPackageJs.getPackageHash)(packageRoot1, this.repoInfo);
60
+ const packageHash = await (0, _hashOfPackageJs.getPackageHash)(packageRoot, this.repoInfo);
61
61
  addToQueue(packageHash.internalDependencies, queue, done, workspaceInfo);
62
62
  done.push(packageHash);
63
63
  }
@@ -1,8 +1,8 @@
1
1
  import type { ParsedLock, WorkspaceInfo } from "workspace-tools";
2
- export declare type Dependencies = {
2
+ export type Dependencies = {
3
3
  [key in string]: string;
4
4
  };
5
- export declare type ExternalDependenciesQueue = {
5
+ export type ExternalDependenciesQueue = {
6
6
  name: string;
7
7
  versionRange: string;
8
8
  }[];
@@ -1,5 +1,5 @@
1
1
  import type { WorkspaceInfo } from "workspace-tools";
2
- export declare type Dependencies = {
2
+ export type Dependencies = {
3
3
  [key in string]: string;
4
4
  };
5
5
  export declare function filterInternalDependencies(dependencies: Dependencies, workspaces: WorkspaceInfo): string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lage-run/hasher",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "description": "Hasher for Lage Targets",
5
5
  "repository": {
6
6
  "url": "https://github.com/microsoft/lage"
@@ -9,14 +9,14 @@
9
9
  "main": "lib/index.js",
10
10
  "types": "lib/index.d.ts",
11
11
  "scripts": {
12
- "build": "monorepo-scripts tsc",
13
- "start": "monorepo-scripts tsc -w --preserveWatchOutput",
14
- "test": "monorepo-scripts jest",
12
+ "build": "tsc",
13
+ "start": "tsc -w --preserveWatchOutput",
14
+ "test": "jest",
15
15
  "lint": "monorepo-scripts lint"
16
16
  },
17
17
  "dependencies": {
18
18
  "execa": "5.1.1",
19
- "workspace-tools": "0.29.1",
19
+ "workspace-tools": "0.30.0",
20
20
  "find-up": "^5.0.0"
21
21
  },
22
22
  "devDependencies": {