@arcgis/components-build-utils 5.0.0-next.57 → 5.0.0-next.59

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.
@@ -0,0 +1,2 @@
1
+ import { Command } from '@commander-js/extra-typings';
2
+ export declare const registerCommand: (command: Command) => undefined;
@@ -0,0 +1,2 @@
1
+ import { Command } from '@commander-js/extra-typings';
2
+ export declare const registerCommand: (command: Command) => undefined;
@@ -10,7 +10,7 @@ export declare function error(...messages: unknown[]): void;
10
10
  * This is used to indicate a fatal error that cannot be recovered from.
11
11
  */
12
12
  export declare function errorAndExit(...messages: unknown[]): never;
13
- export declare function sh(command: string, options?: Partial<ExecSyncOptionsWithStringEncoding>): string;
13
+ export declare function sh(command: string, options?: Partial<ExecSyncOptionsWithStringEncoding>, quiet?: boolean): string;
14
14
  export declare function findRepositoryRoot(): string;
15
15
  export declare function isURL(source: string): boolean;
16
16
  /**
@@ -63,4 +63,8 @@ export declare function getAffectedPackages(changed: Iterable<string>, options?:
63
63
  * Helper to check if an error is a SIGINT (interrupt) error.
64
64
  */
65
65
  export declare function isSigint(err: unknown): boolean;
66
+ export declare function getBranchName(): string;
67
+ export declare function getStagedFiles(options?: Partial<ExecSyncOptionsWithStringEncoding>): string[];
68
+ export declare function commitStagedFiles(messages: string, options?: Partial<ExecSyncOptionsWithStringEncoding>): void;
69
+ export declare function pushCommits(options?: Partial<ExecSyncOptionsWithStringEncoding>): void;
66
70
  export {};
@@ -10,7 +10,7 @@ export declare function error(...messages: unknown[]): void;
10
10
  * This is used to indicate a fatal error that cannot be recovered from.
11
11
  */
12
12
  export declare function errorAndExit(...messages: unknown[]): never;
13
- export declare function sh(command: string, options?: Partial<ExecSyncOptionsWithStringEncoding>): string;
13
+ export declare function sh(command: string, options?: Partial<ExecSyncOptionsWithStringEncoding>, quiet?: boolean): string;
14
14
  export declare function findRepositoryRoot(): string;
15
15
  export declare function isURL(source: string): boolean;
16
16
  /**
@@ -63,4 +63,8 @@ export declare function getAffectedPackages(changed: Iterable<string>, options?:
63
63
  * Helper to check if an error is a SIGINT (interrupt) error.
64
64
  */
65
65
  export declare function isSigint(err: unknown): boolean;
66
+ export declare function getBranchName(): string;
67
+ export declare function getStagedFiles(options?: Partial<ExecSyncOptionsWithStringEncoding>): string[];
68
+ export declare function commitStagedFiles(messages: string, options?: Partial<ExecSyncOptionsWithStringEncoding>): void;
69
+ export declare function pushCommits(options?: Partial<ExecSyncOptionsWithStringEncoding>): void;
66
70
  export {};
package/dist/index.cjs CHANGED
@@ -132,10 +132,13 @@ const path = isPosix ? path$1.posix : {
132
132
  const cachedPackageJson = {};
133
133
  const cachedPackageJsonPromises = {};
134
134
  let rootPackageJsonLocation;
135
- function retrievePackageJson(location) {
135
+ function retrievePackageJson(location, cache = true) {
136
136
  const packageJsonPath = location ? path.resolve(location, "package.json") : rootPackageJsonLocation ??= findPath("package.json");
137
- cachedPackageJson[packageJsonPath] ??= JSON.parse(node_fs.readFileSync(packageJsonPath, "utf-8"));
138
- return cachedPackageJson[packageJsonPath];
137
+ if (cache) {
138
+ cachedPackageJson[packageJsonPath] ??= JSON.parse(node_fs.readFileSync(packageJsonPath, "utf-8"));
139
+ return cachedPackageJson[packageJsonPath];
140
+ }
141
+ return JSON.parse(node_fs.readFileSync(packageJsonPath, "utf-8"));
139
142
  }
140
143
  async function asyncRetrievePackageJson(location = getCwd()) {
141
144
  const packageJsonPath = path.resolve(location, "package.json");
package/dist/index.js CHANGED
@@ -108,10 +108,13 @@ const path = isPosix ? posix : {
108
108
  const cachedPackageJson = {};
109
109
  const cachedPackageJsonPromises = {};
110
110
  let rootPackageJsonLocation;
111
- function retrievePackageJson(location) {
111
+ function retrievePackageJson(location, cache = true) {
112
112
  const packageJsonPath = location ? path.resolve(location, "package.json") : rootPackageJsonLocation ??= findPath("package.json");
113
- cachedPackageJson[packageJsonPath] ??= JSON.parse(readFileSync(packageJsonPath, "utf-8"));
114
- return cachedPackageJson[packageJsonPath];
113
+ if (cache) {
114
+ cachedPackageJson[packageJsonPath] ??= JSON.parse(readFileSync(packageJsonPath, "utf-8"));
115
+ return cachedPackageJson[packageJsonPath];
116
+ }
117
+ return JSON.parse(readFileSync(packageJsonPath, "utf-8"));
115
118
  }
116
119
  async function asyncRetrievePackageJson(location = getCwd()) {
117
120
  const packageJsonPath = path.resolve(location, "package.json");
@@ -32,8 +32,9 @@ export type MiniPackageJson = {
32
32
  deployBuilds?: Record<string, unknown>;
33
33
  };
34
34
  };
35
- export declare function retrievePackageJson(location?: string): MiniPackageJson;
35
+ export declare function retrievePackageJson(location?: string, cache?: boolean): MiniPackageJson;
36
36
  export declare function asyncRetrievePackageJson(location?: string): Promise<MiniPackageJson>;
37
+ export declare function asyncWritePackageJson(location: string, content: MiniPackageJson): Promise<string>;
37
38
  /**
38
39
  * Returns an absolute path to the root of a package in node_modules, without
39
40
  * trailing slash.
@@ -32,8 +32,9 @@ export type MiniPackageJson = {
32
32
  deployBuilds?: Record<string, unknown>;
33
33
  };
34
34
  };
35
- export declare function retrievePackageJson(location?: string): MiniPackageJson;
35
+ export declare function retrievePackageJson(location?: string, cache?: boolean): MiniPackageJson;
36
36
  export declare function asyncRetrievePackageJson(location?: string): Promise<MiniPackageJson>;
37
+ export declare function asyncWritePackageJson(location: string, content: MiniPackageJson): Promise<string>;
37
38
  /**
38
39
  * Returns an absolute path to the root of a package in node_modules, without
39
40
  * trailing slash.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/components-build-utils",
3
- "version": "5.0.0-next.57",
3
+ "version": "5.0.0-next.59",
4
4
  "description": "Collection of common internal build-time patterns and utilities for ArcGIS Maps SDK for JavaScript components.",
5
5
  "homepage": "https://developers.arcgis.com/javascript/latest/",
6
6
  "type": "module",