@arcgis/components-build-utils 5.0.0-next.13 → 5.0.0-next.130
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/dist/commands/compare-rss.d.cts +3 -3
- package/dist/commands/compare-rss.d.ts +3 -3
- package/dist/commands/migrate-repo-issues/devtopia.d.cts +2 -2
- package/dist/commands/migrate-repo-issues/devtopia.d.ts +2 -2
- package/dist/commands/migrate-repo-issues/zentopia.d.cts +6 -6
- package/dist/commands/migrate-repo-issues/zentopia.d.ts +6 -6
- package/dist/commands/publish.d.cts +2 -0
- package/dist/commands/publish.d.ts +2 -0
- package/dist/commands/run.d.cts +1 -0
- package/dist/commands/run.d.ts +1 -0
- package/dist/commands/scan-dist.d.cts +1 -1
- package/dist/commands/scan-dist.d.ts +1 -1
- package/dist/commands/update-core-dep.d.cts +2 -0
- package/dist/commands/update-core-dep.d.ts +2 -0
- package/dist/commands/{utils.d.cts → utils/commands.d.cts} +3 -8
- package/dist/commands/{utils.d.ts → utils/commands.d.ts} +3 -8
- package/dist/commands/utils/github-actions.d.cts +8 -0
- package/dist/commands/utils/github-actions.d.ts +8 -0
- package/dist/commands/{npm-utils.d.cts → utils/npm.d.cts} +16 -2
- package/dist/commands/{npm-utils.d.ts → utils/npm.d.ts} +16 -2
- package/dist/commands/workspaces-list.d.cts +2 -0
- package/dist/commands/workspaces-list.d.ts +2 -0
- package/dist/file.d.cts +3 -1
- package/dist/file.d.ts +3 -1
- package/dist/index.cjs +44 -10
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +44 -10
- package/dist/monorepoConfig.d.cts +1 -0
- package/dist/monorepoConfig.d.ts +1 -0
- package/dist/packageJson.d.cts +4 -3
- package/dist/packageJson.d.ts +4 -3
- package/package.json +6 -4
- package/src/commands/run.ts +46 -0
- package/src/commands/run-wrapper.js +0 -6
- /package/dist/commands/{create-mock-doc.d.cts → deployable-projects.d.cts} +0 -0
- /package/dist/commands/{create-mock-doc.d.ts → deployable-projects.d.ts} +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
/**
|
|
3
3
|
* !important
|
|
4
|
-
* The class makes a TLS request to
|
|
5
|
-
* You need to make sure node trusts the certificate authority that signed the certificate used by
|
|
4
|
+
* The class makes a TLS request to webgis
|
|
5
|
+
* You need to make sure node trusts the certificate authority that signed the certificate used by webgis.esri.com
|
|
6
6
|
*
|
|
7
7
|
* Include your certificate authority in the NODE_EXTRA_CA_CERTS environment variable
|
|
8
|
-
* Reference: https://
|
|
8
|
+
* Reference: https://webgis.esri.com/webgis/components/devops/troubleshoot/troubleshoot#certificate-verification-failure
|
|
9
9
|
*/
|
|
10
10
|
export declare const registerCommand: (command: Command) => undefined;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
/**
|
|
3
3
|
* !important
|
|
4
|
-
* The class makes a TLS request to
|
|
5
|
-
* You need to make sure node trusts the certificate authority that signed the certificate used by
|
|
4
|
+
* The class makes a TLS request to webgis
|
|
5
|
+
* You need to make sure node trusts the certificate authority that signed the certificate used by webgis.esri.com
|
|
6
6
|
*
|
|
7
7
|
* Include your certificate authority in the NODE_EXTRA_CA_CERTS environment variable
|
|
8
|
-
* Reference: https://
|
|
8
|
+
* Reference: https://webgis.esri.com/webgis/components/devops/troubleshoot/troubleshoot#certificate-verification-failure
|
|
9
9
|
*/
|
|
10
10
|
export declare const registerCommand: (command: Command) => undefined;
|
|
@@ -7,10 +7,10 @@ export interface Issue {
|
|
|
7
7
|
};
|
|
8
8
|
}
|
|
9
9
|
declare class Devtopia {
|
|
10
|
-
readonly owner: string;
|
|
11
|
-
readonly name: string;
|
|
12
10
|
private issuesPerPage;
|
|
13
11
|
constructor(owner: string, name: string);
|
|
12
|
+
readonly owner: string;
|
|
13
|
+
readonly name: string;
|
|
14
14
|
/**
|
|
15
15
|
* Requests to github graphql server
|
|
16
16
|
*/
|
|
@@ -7,10 +7,10 @@ export interface Issue {
|
|
|
7
7
|
};
|
|
8
8
|
}
|
|
9
9
|
declare class Devtopia {
|
|
10
|
-
readonly owner: string;
|
|
11
|
-
readonly name: string;
|
|
12
10
|
private issuesPerPage;
|
|
13
11
|
constructor(owner: string, name: string);
|
|
12
|
+
readonly owner: string;
|
|
13
|
+
readonly name: string;
|
|
14
14
|
/**
|
|
15
15
|
* Requests to github graphql server
|
|
16
16
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Issue } from './devtopia';
|
|
1
|
+
import { Issue } from './devtopia.ts';
|
|
2
2
|
export type IssueWithZenhub = {
|
|
3
3
|
gitHubId: string;
|
|
4
4
|
zenhubId: string;
|
|
@@ -30,17 +30,17 @@ export type IssueWithZenhub = {
|
|
|
30
30
|
* You need to make sure node trusts the certificate authority that signed the certificate used by zentopia.esri.com
|
|
31
31
|
*
|
|
32
32
|
* Include your certificate authority in the NODE_EXTRA_CA_CERTS environment variable
|
|
33
|
-
* Reference: https://
|
|
33
|
+
* Reference: https://webgis.esri.com/webgis/components/devops/troubleshoot/troubleshoot#certificate-verification-failure
|
|
34
34
|
*/
|
|
35
35
|
declare class Zentopia {
|
|
36
|
-
readonly repoId: number;
|
|
37
|
-
readonly workspaceId: string;
|
|
38
|
-
readonly token?: string | undefined;
|
|
39
36
|
private _issueIdCache;
|
|
40
37
|
private _pipelinesCache?;
|
|
41
38
|
private _sprintsCache?;
|
|
42
39
|
private _releasesCache?;
|
|
43
|
-
constructor(repoId: number, workspaceId: string, token?: string
|
|
40
|
+
constructor(repoId: number, workspaceId: string, token?: string);
|
|
41
|
+
readonly repoId: number;
|
|
42
|
+
readonly workspaceId: string;
|
|
43
|
+
readonly token?: string;
|
|
44
44
|
/**
|
|
45
45
|
* Requests to graphql server
|
|
46
46
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Issue } from './devtopia';
|
|
1
|
+
import { Issue } from './devtopia.ts';
|
|
2
2
|
export type IssueWithZenhub = {
|
|
3
3
|
gitHubId: string;
|
|
4
4
|
zenhubId: string;
|
|
@@ -30,17 +30,17 @@ export type IssueWithZenhub = {
|
|
|
30
30
|
* You need to make sure node trusts the certificate authority that signed the certificate used by zentopia.esri.com
|
|
31
31
|
*
|
|
32
32
|
* Include your certificate authority in the NODE_EXTRA_CA_CERTS environment variable
|
|
33
|
-
* Reference: https://
|
|
33
|
+
* Reference: https://webgis.esri.com/webgis/components/devops/troubleshoot/troubleshoot#certificate-verification-failure
|
|
34
34
|
*/
|
|
35
35
|
declare class Zentopia {
|
|
36
|
-
readonly repoId: number;
|
|
37
|
-
readonly workspaceId: string;
|
|
38
|
-
readonly token?: string | undefined;
|
|
39
36
|
private _issueIdCache;
|
|
40
37
|
private _pipelinesCache?;
|
|
41
38
|
private _sprintsCache?;
|
|
42
39
|
private _releasesCache?;
|
|
43
|
-
constructor(repoId: number, workspaceId: string, token?: string
|
|
40
|
+
constructor(repoId: number, workspaceId: string, token?: string);
|
|
41
|
+
readonly repoId: number;
|
|
42
|
+
readonly workspaceId: string;
|
|
43
|
+
readonly token?: string;
|
|
44
44
|
/**
|
|
45
45
|
* Requests to graphql server
|
|
46
46
|
*/
|
package/dist/commands/run.d.cts
CHANGED
package/dist/commands/run.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Command } from '@commander-js/extra-typings';
|
|
2
|
-
import { PackageWalkerItem } from './utils';
|
|
2
|
+
import { PackageWalkerItem } from './utils/commands.ts';
|
|
3
3
|
export declare const registerCommand: (command: Command) => undefined;
|
|
4
4
|
export declare function scanDist({ blocklistedNames }: {
|
|
5
5
|
blocklistedNames?: string[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Command } from '@commander-js/extra-typings';
|
|
2
|
-
import { PackageWalkerItem } from './utils';
|
|
2
|
+
import { PackageWalkerItem } from './utils/commands.ts';
|
|
3
3
|
export declare const registerCommand: (command: Command) => undefined;
|
|
4
4
|
export declare function scanDist({ blocklistedNames }: {
|
|
5
5
|
blocklistedNames?: string[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ExecSyncOptionsWithStringEncoding } from 'node:child_process';
|
|
2
|
-
import { MiniPackageJson } from '
|
|
2
|
+
import { MiniPackageJson } from '../../packageJson.ts';
|
|
3
3
|
/**
|
|
4
4
|
* Sets the exit code to 1 and prints the error message to stderr.
|
|
5
5
|
* This is used to indicate an error condition in the script.
|
|
@@ -10,14 +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;
|
|
14
13
|
export declare function findRepositoryRoot(): string;
|
|
15
|
-
export declare function isURL(source: string): boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Returns a list of all package paths in the workspace,
|
|
18
|
-
* as resolved from workspaces in root package.json
|
|
19
|
-
*/
|
|
20
|
-
export declare function getWorkspacesPackagePaths(includeRootPackage?: boolean): Promise<string[]>;
|
|
21
14
|
export type PackageWalkerItem = PackageWalkerResult<MiniPackageJson>;
|
|
22
15
|
type PackageWalkerResult<T> = {
|
|
23
16
|
/**
|
|
@@ -63,4 +56,6 @@ export declare function getAffectedPackages(changed: Iterable<string>, options?:
|
|
|
63
56
|
* Helper to check if an error is a SIGINT (interrupt) error.
|
|
64
57
|
*/
|
|
65
58
|
export declare function isSigint(err: unknown): boolean;
|
|
59
|
+
export declare function getBranchName(): string;
|
|
60
|
+
export declare function pushCommits(options?: Partial<ExecSyncOptionsWithStringEncoding>): void;
|
|
66
61
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ExecSyncOptionsWithStringEncoding } from 'node:child_process';
|
|
2
|
-
import { MiniPackageJson } from '
|
|
2
|
+
import { MiniPackageJson } from '../../packageJson.ts';
|
|
3
3
|
/**
|
|
4
4
|
* Sets the exit code to 1 and prints the error message to stderr.
|
|
5
5
|
* This is used to indicate an error condition in the script.
|
|
@@ -10,14 +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;
|
|
14
13
|
export declare function findRepositoryRoot(): string;
|
|
15
|
-
export declare function isURL(source: string): boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Returns a list of all package paths in the workspace,
|
|
18
|
-
* as resolved from workspaces in root package.json
|
|
19
|
-
*/
|
|
20
|
-
export declare function getWorkspacesPackagePaths(includeRootPackage?: boolean): Promise<string[]>;
|
|
21
14
|
export type PackageWalkerItem = PackageWalkerResult<MiniPackageJson>;
|
|
22
15
|
type PackageWalkerResult<T> = {
|
|
23
16
|
/**
|
|
@@ -63,4 +56,6 @@ export declare function getAffectedPackages(changed: Iterable<string>, options?:
|
|
|
63
56
|
* Helper to check if an error is a SIGINT (interrupt) error.
|
|
64
57
|
*/
|
|
65
58
|
export declare function isSigint(err: unknown): boolean;
|
|
59
|
+
export declare function getBranchName(): string;
|
|
60
|
+
export declare function pushCommits(options?: Partial<ExecSyncOptionsWithStringEncoding>): void;
|
|
66
61
|
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const markdownLog: string[];
|
|
2
|
+
export declare function addKeyValueToOutput(key: string, value: string[] | string): void;
|
|
3
|
+
export declare function addMarkdownToOutput(key?: string): void;
|
|
4
|
+
export declare function addHeadingToSummary(text: string, level?: 1 | 2 | 3): void;
|
|
5
|
+
export declare function addLineToSummary(text: string): void;
|
|
6
|
+
export declare function addListToSummary(items: string[], ordered?: boolean): void;
|
|
7
|
+
export declare function addNewlineToSummary(): void;
|
|
8
|
+
export declare function writeSummary(): void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const markdownLog: string[];
|
|
2
|
+
export declare function addKeyValueToOutput(key: string, value: string[] | string): void;
|
|
3
|
+
export declare function addMarkdownToOutput(key?: string): void;
|
|
4
|
+
export declare function addHeadingToSummary(text: string, level?: 1 | 2 | 3): void;
|
|
5
|
+
export declare function addLineToSummary(text: string): void;
|
|
6
|
+
export declare function addListToSummary(items: string[], ordered?: boolean): void;
|
|
7
|
+
export declare function addNewlineToSummary(): void;
|
|
8
|
+
export declare function writeSummary(): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { MiniPackageJson } from '../../packageJson.ts';
|
|
2
2
|
/**
|
|
3
3
|
* Fetch all published versions for a package.
|
|
4
4
|
*/
|
|
@@ -20,10 +20,24 @@ export declare function isVersionDeprecated(pkgName: string, version: string, op
|
|
|
20
20
|
* Request npm deprecation for the `package@range` specification
|
|
21
21
|
*/
|
|
22
22
|
export declare function deprecate(pkgSpec: string, options: {
|
|
23
|
-
authToken?: string;
|
|
24
23
|
message: string;
|
|
25
24
|
verbose: boolean;
|
|
26
25
|
}): Promise<{
|
|
27
26
|
stdout?: string;
|
|
28
27
|
error?: unknown;
|
|
29
28
|
}>;
|
|
29
|
+
export declare function undeprecate(pkgSpec: string, options: {
|
|
30
|
+
message: string;
|
|
31
|
+
verbose: boolean;
|
|
32
|
+
}): Promise<{
|
|
33
|
+
stdout?: string;
|
|
34
|
+
error?: unknown;
|
|
35
|
+
}>;
|
|
36
|
+
/**
|
|
37
|
+
* Get the necessary env variables and command line args to authenticate against a given registry.
|
|
38
|
+
*/
|
|
39
|
+
export declare function getRegistryEnvAndArgs(packageName: string, registryPath: string): {
|
|
40
|
+
args: string[];
|
|
41
|
+
env: Record<string, string>;
|
|
42
|
+
};
|
|
43
|
+
export declare function isPackageAlreadyPublished(packageJson: MiniPackageJson): boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { MiniPackageJson } from '../../packageJson.ts';
|
|
2
2
|
/**
|
|
3
3
|
* Fetch all published versions for a package.
|
|
4
4
|
*/
|
|
@@ -20,10 +20,24 @@ export declare function isVersionDeprecated(pkgName: string, version: string, op
|
|
|
20
20
|
* Request npm deprecation for the `package@range` specification
|
|
21
21
|
*/
|
|
22
22
|
export declare function deprecate(pkgSpec: string, options: {
|
|
23
|
-
authToken?: string;
|
|
24
23
|
message: string;
|
|
25
24
|
verbose: boolean;
|
|
26
25
|
}): Promise<{
|
|
27
26
|
stdout?: string;
|
|
28
27
|
error?: unknown;
|
|
29
28
|
}>;
|
|
29
|
+
export declare function undeprecate(pkgSpec: string, options: {
|
|
30
|
+
message: string;
|
|
31
|
+
verbose: boolean;
|
|
32
|
+
}): Promise<{
|
|
33
|
+
stdout?: string;
|
|
34
|
+
error?: unknown;
|
|
35
|
+
}>;
|
|
36
|
+
/**
|
|
37
|
+
* Get the necessary env variables and command line args to authenticate against a given registry.
|
|
38
|
+
*/
|
|
39
|
+
export declare function getRegistryEnvAndArgs(packageName: string, registryPath: string): {
|
|
40
|
+
args: string[];
|
|
41
|
+
env: Record<string, string>;
|
|
42
|
+
};
|
|
43
|
+
export declare function isPackageAlreadyPublished(packageJson: MiniPackageJson): boolean;
|
package/dist/file.d.cts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { ExecSyncOptionsWithStringEncoding } from 'node:child_process';
|
|
1
2
|
export declare const existsAsync: (file: string) => Promise<boolean>;
|
|
2
3
|
/** Wrapper for execSync to execute shell commands */
|
|
3
|
-
export declare
|
|
4
|
+
export declare function sh(command: string, options?: Partial<ExecSyncOptionsWithStringEncoding>): string;
|
|
5
|
+
export declare function asyncSh(command: string, options?: Partial<ExecSyncOptionsWithStringEncoding>): Promise<string>;
|
|
4
6
|
export declare function createFileIfNotExists(filePath: string, content: string): Promise<void>;
|
|
5
7
|
/**
|
|
6
8
|
* Climb the directory tree upward, until found a directory that contains the
|
package/dist/file.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { ExecSyncOptionsWithStringEncoding } from 'node:child_process';
|
|
1
2
|
export declare const existsAsync: (file: string) => Promise<boolean>;
|
|
2
3
|
/** Wrapper for execSync to execute shell commands */
|
|
3
|
-
export declare
|
|
4
|
+
export declare function sh(command: string, options?: Partial<ExecSyncOptionsWithStringEncoding>): string;
|
|
5
|
+
export declare function asyncSh(command: string, options?: Partial<ExecSyncOptionsWithStringEncoding>): Promise<string>;
|
|
4
6
|
export declare function createFileIfNotExists(filePath: string, content: string): Promise<void>;
|
|
5
7
|
/**
|
|
6
8
|
* Climb the directory tree upward, until found a directory that contains the
|
package/dist/index.cjs
CHANGED
|
@@ -24,16 +24,46 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
24
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
25
25
|
const node_fs = require("node:fs");
|
|
26
26
|
const promises = require("node:fs/promises");
|
|
27
|
-
const node_child_process = require("node:child_process");
|
|
28
27
|
const path$1 = require("path");
|
|
29
28
|
const node_url = require("node:url");
|
|
29
|
+
const node_child_process = require("node:child_process");
|
|
30
|
+
const node_util = require("node:util");
|
|
30
31
|
const node_module = require("node:module");
|
|
31
32
|
const existsAsync = async (file) => (
|
|
32
33
|
// Using un-promisified version because promises version creates exceptions
|
|
33
34
|
// which interferes with debugging when "Pause on caught exceptions" is enabled
|
|
34
35
|
await new Promise((resolve2) => node_fs.access(file, promises.constants.F_OK, (error) => resolve2(!error)))
|
|
35
36
|
);
|
|
36
|
-
|
|
37
|
+
function sh(command, options = {}) {
|
|
38
|
+
try {
|
|
39
|
+
const normalizedOptions = { encoding: "utf8", ...options };
|
|
40
|
+
return node_child_process.execSync(command.trim(), normalizedOptions).trim();
|
|
41
|
+
} catch (error) {
|
|
42
|
+
makeExecErrorReadable(error);
|
|
43
|
+
throw error;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function makeExecErrorReadable(error) {
|
|
47
|
+
if (error instanceof Error && error.stack && "output" in error && Array.isArray(error.output) && "status" in error) {
|
|
48
|
+
const stackIndex = error.stack.indexOf("\n at ");
|
|
49
|
+
if (stackIndex !== -1) {
|
|
50
|
+
const output = error.output.filter(Boolean).join("\n").trim();
|
|
51
|
+
const newHeader = `${node_util.styleText("red", error.message)} (exit code: ${String(error.status)})
|
|
52
|
+
${output}`;
|
|
53
|
+
const oldStackFrames = error.stack.substring(stackIndex);
|
|
54
|
+
error.stack = `Error: ${newHeader}${oldStackFrames}`;
|
|
55
|
+
}
|
|
56
|
+
Object.defineProperties(error, {
|
|
57
|
+
output: { enumerable: false },
|
|
58
|
+
stdout: { enumerable: false },
|
|
59
|
+
stderr: { enumerable: false },
|
|
60
|
+
signal: { enumerable: false },
|
|
61
|
+
status: { enumerable: false },
|
|
62
|
+
pid: { enumerable: false },
|
|
63
|
+
stdio: { enumerable: false }
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
37
67
|
async function createFileIfNotExists(filePath, content) {
|
|
38
68
|
await promises.mkdir(path$1.dirname(filePath), { recursive: true });
|
|
39
69
|
if (!await existsAsync(filePath)) {
|
|
@@ -43,7 +73,7 @@ async function createFileIfNotExists(filePath, content) {
|
|
|
43
73
|
function findPath(target, startDirectory = process.cwd()) {
|
|
44
74
|
const resolvedStartDirectory = startDirectory.startsWith("file:///") ? path$1.dirname(node_url.fileURLToPath(startDirectory)) : path$1.resolve(startDirectory);
|
|
45
75
|
const parentPath = resolvedStartDirectory.split(path$1.sep);
|
|
46
|
-
while (parentPath.length >
|
|
76
|
+
while (parentPath.length > searchStopIndex) {
|
|
47
77
|
const fullPath = path$1.join(
|
|
48
78
|
...path$1.sep === "/" ? ["/"] : [],
|
|
49
79
|
...parentPath,
|
|
@@ -56,10 +86,11 @@ function findPath(target, startDirectory = process.cwd()) {
|
|
|
56
86
|
}
|
|
57
87
|
return void 0;
|
|
58
88
|
}
|
|
89
|
+
const searchStopIndex = 0;
|
|
59
90
|
async function asyncFindPath(target, startDirectory = process.cwd()) {
|
|
60
91
|
const resolvedStartDirectory = startDirectory.startsWith("file:///") ? path$1.dirname(node_url.fileURLToPath(startDirectory)) : path$1.resolve(startDirectory);
|
|
61
92
|
const parentPath = resolvedStartDirectory.split(path$1.sep);
|
|
62
|
-
while (parentPath.length >
|
|
93
|
+
while (parentPath.length > searchStopIndex) {
|
|
63
94
|
const fullPath = path$1.join(
|
|
64
95
|
...path$1.sep === "/" ? ["/"] : [],
|
|
65
96
|
...parentPath,
|
|
@@ -132,13 +163,16 @@ const path = isPosix ? path$1.posix : {
|
|
|
132
163
|
const cachedPackageJson = {};
|
|
133
164
|
const cachedPackageJsonPromises = {};
|
|
134
165
|
let rootPackageJsonLocation;
|
|
135
|
-
function retrievePackageJson(location) {
|
|
166
|
+
function retrievePackageJson(location, cache = true) {
|
|
136
167
|
const packageJsonPath = location ? path.resolve(location, "package.json") : rootPackageJsonLocation ??= findPath("package.json");
|
|
137
|
-
|
|
138
|
-
|
|
168
|
+
if (cache) {
|
|
169
|
+
cachedPackageJson[packageJsonPath] ??= JSON.parse(node_fs.readFileSync(packageJsonPath, "utf-8"));
|
|
170
|
+
return cachedPackageJson[packageJsonPath];
|
|
171
|
+
}
|
|
172
|
+
return JSON.parse(node_fs.readFileSync(packageJsonPath, "utf-8"));
|
|
139
173
|
}
|
|
140
|
-
async function asyncRetrievePackageJson(location
|
|
141
|
-
const packageJsonPath = path.resolve(location, "package.json");
|
|
174
|
+
async function asyncRetrievePackageJson(location) {
|
|
175
|
+
const packageJsonPath = location ? path.resolve(location, "package.json") : rootPackageJsonLocation ??= findPath("package.json");
|
|
142
176
|
if (packageJsonPath in cachedPackageJson) {
|
|
143
177
|
return cachedPackageJson[packageJsonPath];
|
|
144
178
|
}
|
|
@@ -212,7 +246,7 @@ function vitePresetPlugin({
|
|
|
212
246
|
build: {
|
|
213
247
|
// REFACTOR: get this from tsconfig
|
|
214
248
|
// It's a best practice to let the final bundler down-level as needed.
|
|
215
|
-
target: target ?? "
|
|
249
|
+
target: target ?? "es2024"
|
|
216
250
|
},
|
|
217
251
|
define: env.mode === "test" ? {
|
|
218
252
|
"process.env.ESRI_INTERNAL": true
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { existsAsync, sh, createFileIfNotExists, findPath, asyncFindPath } from './file';
|
|
2
|
-
export { gitIgnoreFileToGlobs, gitIgnoreToGlob } from './glob';
|
|
3
|
-
export { isPosix, toPosixPathSeparators, normalizePath, toSystemPathSeparators, getCwd, path } from './path';
|
|
4
|
-
export { type MiniPackageJson, retrievePackageJson, asyncRetrievePackageJson, fetchPackageLocation, detectPackageManager, } from './packageJson';
|
|
5
|
-
export { vitePresetPlugin, type DependencyManagementOptions, externalizeDependencies } from './vite';
|
|
1
|
+
export { existsAsync, sh, createFileIfNotExists, findPath, asyncFindPath } from './file.ts';
|
|
2
|
+
export { gitIgnoreFileToGlobs, gitIgnoreToGlob } from './glob.ts';
|
|
3
|
+
export { isPosix, toPosixPathSeparators, normalizePath, toSystemPathSeparators, getCwd, path } from './path.ts';
|
|
4
|
+
export { type MiniPackageJson, retrievePackageJson, asyncRetrievePackageJson, fetchPackageLocation, detectPackageManager, } from './packageJson.ts';
|
|
5
|
+
export { vitePresetPlugin, type DependencyManagementOptions, externalizeDependencies } from './vite.ts';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { existsAsync, sh, createFileIfNotExists, findPath, asyncFindPath } from './file';
|
|
2
|
-
export { gitIgnoreFileToGlobs, gitIgnoreToGlob } from './glob';
|
|
3
|
-
export { isPosix, toPosixPathSeparators, normalizePath, toSystemPathSeparators, getCwd, path } from './path';
|
|
4
|
-
export { type MiniPackageJson, retrievePackageJson, asyncRetrievePackageJson, fetchPackageLocation, detectPackageManager, } from './packageJson';
|
|
5
|
-
export { vitePresetPlugin, type DependencyManagementOptions, externalizeDependencies } from './vite';
|
|
1
|
+
export { existsAsync, sh, createFileIfNotExists, findPath, asyncFindPath } from './file.ts';
|
|
2
|
+
export { gitIgnoreFileToGlobs, gitIgnoreToGlob } from './glob.ts';
|
|
3
|
+
export { isPosix, toPosixPathSeparators, normalizePath, toSystemPathSeparators, getCwd, path } from './path.ts';
|
|
4
|
+
export { type MiniPackageJson, retrievePackageJson, asyncRetrievePackageJson, fetchPackageLocation, detectPackageManager, } from './packageJson.ts';
|
|
5
|
+
export { vitePresetPlugin, type DependencyManagementOptions, externalizeDependencies } from './vite.ts';
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,45 @@
|
|
|
1
1
|
import { access, existsSync, readFileSync } from "node:fs";
|
|
2
2
|
import { constants, mkdir, writeFile, readFile } from "node:fs/promises";
|
|
3
|
-
import { execSync } from "node:child_process";
|
|
4
3
|
import { dirname, resolve, sep, join, posix, win32 } from "path";
|
|
5
4
|
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { execSync } from "node:child_process";
|
|
6
|
+
import { styleText } from "node:util";
|
|
6
7
|
import { builtinModules } from "node:module";
|
|
7
8
|
const existsAsync = async (file) => (
|
|
8
9
|
// Using un-promisified version because promises version creates exceptions
|
|
9
10
|
// which interferes with debugging when "Pause on caught exceptions" is enabled
|
|
10
11
|
await new Promise((resolve2) => access(file, constants.F_OK, (error) => resolve2(!error)))
|
|
11
12
|
);
|
|
12
|
-
|
|
13
|
+
function sh(command, options = {}) {
|
|
14
|
+
try {
|
|
15
|
+
const normalizedOptions = { encoding: "utf8", ...options };
|
|
16
|
+
return execSync(command.trim(), normalizedOptions).trim();
|
|
17
|
+
} catch (error) {
|
|
18
|
+
makeExecErrorReadable(error);
|
|
19
|
+
throw error;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function makeExecErrorReadable(error) {
|
|
23
|
+
if (error instanceof Error && error.stack && "output" in error && Array.isArray(error.output) && "status" in error) {
|
|
24
|
+
const stackIndex = error.stack.indexOf("\n at ");
|
|
25
|
+
if (stackIndex !== -1) {
|
|
26
|
+
const output = error.output.filter(Boolean).join("\n").trim();
|
|
27
|
+
const newHeader = `${styleText("red", error.message)} (exit code: ${String(error.status)})
|
|
28
|
+
${output}`;
|
|
29
|
+
const oldStackFrames = error.stack.substring(stackIndex);
|
|
30
|
+
error.stack = `Error: ${newHeader}${oldStackFrames}`;
|
|
31
|
+
}
|
|
32
|
+
Object.defineProperties(error, {
|
|
33
|
+
output: { enumerable: false },
|
|
34
|
+
stdout: { enumerable: false },
|
|
35
|
+
stderr: { enumerable: false },
|
|
36
|
+
signal: { enumerable: false },
|
|
37
|
+
status: { enumerable: false },
|
|
38
|
+
pid: { enumerable: false },
|
|
39
|
+
stdio: { enumerable: false }
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
13
43
|
async function createFileIfNotExists(filePath, content) {
|
|
14
44
|
await mkdir(dirname(filePath), { recursive: true });
|
|
15
45
|
if (!await existsAsync(filePath)) {
|
|
@@ -19,7 +49,7 @@ async function createFileIfNotExists(filePath, content) {
|
|
|
19
49
|
function findPath(target, startDirectory = process.cwd()) {
|
|
20
50
|
const resolvedStartDirectory = startDirectory.startsWith("file:///") ? dirname(fileURLToPath(startDirectory)) : resolve(startDirectory);
|
|
21
51
|
const parentPath = resolvedStartDirectory.split(sep);
|
|
22
|
-
while (parentPath.length >
|
|
52
|
+
while (parentPath.length > searchStopIndex) {
|
|
23
53
|
const fullPath = join(
|
|
24
54
|
...sep === "/" ? ["/"] : [],
|
|
25
55
|
...parentPath,
|
|
@@ -32,10 +62,11 @@ function findPath(target, startDirectory = process.cwd()) {
|
|
|
32
62
|
}
|
|
33
63
|
return void 0;
|
|
34
64
|
}
|
|
65
|
+
const searchStopIndex = 0;
|
|
35
66
|
async function asyncFindPath(target, startDirectory = process.cwd()) {
|
|
36
67
|
const resolvedStartDirectory = startDirectory.startsWith("file:///") ? dirname(fileURLToPath(startDirectory)) : resolve(startDirectory);
|
|
37
68
|
const parentPath = resolvedStartDirectory.split(sep);
|
|
38
|
-
while (parentPath.length >
|
|
69
|
+
while (parentPath.length > searchStopIndex) {
|
|
39
70
|
const fullPath = join(
|
|
40
71
|
...sep === "/" ? ["/"] : [],
|
|
41
72
|
...parentPath,
|
|
@@ -108,13 +139,16 @@ const path = isPosix ? posix : {
|
|
|
108
139
|
const cachedPackageJson = {};
|
|
109
140
|
const cachedPackageJsonPromises = {};
|
|
110
141
|
let rootPackageJsonLocation;
|
|
111
|
-
function retrievePackageJson(location) {
|
|
142
|
+
function retrievePackageJson(location, cache = true) {
|
|
112
143
|
const packageJsonPath = location ? path.resolve(location, "package.json") : rootPackageJsonLocation ??= findPath("package.json");
|
|
113
|
-
|
|
114
|
-
|
|
144
|
+
if (cache) {
|
|
145
|
+
cachedPackageJson[packageJsonPath] ??= JSON.parse(readFileSync(packageJsonPath, "utf-8"));
|
|
146
|
+
return cachedPackageJson[packageJsonPath];
|
|
147
|
+
}
|
|
148
|
+
return JSON.parse(readFileSync(packageJsonPath, "utf-8"));
|
|
115
149
|
}
|
|
116
|
-
async function asyncRetrievePackageJson(location
|
|
117
|
-
const packageJsonPath = path.resolve(location, "package.json");
|
|
150
|
+
async function asyncRetrievePackageJson(location) {
|
|
151
|
+
const packageJsonPath = location ? path.resolve(location, "package.json") : rootPackageJsonLocation ??= findPath("package.json");
|
|
118
152
|
if (packageJsonPath in cachedPackageJson) {
|
|
119
153
|
return cachedPackageJson[packageJsonPath];
|
|
120
154
|
}
|
|
@@ -188,7 +222,7 @@ function vitePresetPlugin({
|
|
|
188
222
|
build: {
|
|
189
223
|
// REFACTOR: get this from tsconfig
|
|
190
224
|
// It's a best practice to let the final bundler down-level as needed.
|
|
191
|
-
target: target ?? "
|
|
225
|
+
target: target ?? "es2024"
|
|
192
226
|
},
|
|
193
227
|
define: env.mode === "test" ? {
|
|
194
228
|
"process.env.ESRI_INTERNAL": true
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../../../monorepo.config.ts';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../../../monorepo.config.ts';
|
package/dist/packageJson.d.cts
CHANGED
|
@@ -9,10 +9,10 @@ export type MiniPackageJson = {
|
|
|
9
9
|
"version": string;
|
|
10
10
|
"private"?: boolean;
|
|
11
11
|
"type"?: "commonjs" | "module";
|
|
12
|
-
"workspaces"?: string[];
|
|
13
12
|
"publishConfig"?: {
|
|
14
13
|
access?: string;
|
|
15
14
|
registry?: string;
|
|
15
|
+
provenance?: boolean;
|
|
16
16
|
};
|
|
17
17
|
"files"?: string[];
|
|
18
18
|
"dependencies"?: Record<string, string | undefined>;
|
|
@@ -32,14 +32,15 @@ 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.
|
|
40
41
|
*/
|
|
41
42
|
export declare function fetchPackageLocation(packageName: string, cwd?: string): Promise<string>;
|
|
42
43
|
/**
|
|
43
|
-
* Detect if current repository/monorepo uses npm,
|
|
44
|
+
* Detect if current repository/monorepo uses npm, pnpm, or yarn
|
|
44
45
|
*/
|
|
45
46
|
export declare function detectPackageManager(cwd?: string): string;
|
package/dist/packageJson.d.ts
CHANGED
|
@@ -9,10 +9,10 @@ export type MiniPackageJson = {
|
|
|
9
9
|
"version": string;
|
|
10
10
|
"private"?: boolean;
|
|
11
11
|
"type"?: "commonjs" | "module";
|
|
12
|
-
"workspaces"?: string[];
|
|
13
12
|
"publishConfig"?: {
|
|
14
13
|
access?: string;
|
|
15
14
|
registry?: string;
|
|
15
|
+
provenance?: boolean;
|
|
16
16
|
};
|
|
17
17
|
"files"?: string[];
|
|
18
18
|
"dependencies"?: Record<string, string | undefined>;
|
|
@@ -32,14 +32,15 @@ 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.
|
|
40
41
|
*/
|
|
41
42
|
export declare function fetchPackageLocation(packageName: string, cwd?: string): Promise<string>;
|
|
42
43
|
/**
|
|
43
|
-
* Detect if current repository/monorepo uses npm,
|
|
44
|
+
* Detect if current repository/monorepo uses npm, pnpm, or yarn
|
|
44
45
|
*/
|
|
45
46
|
export declare function detectPackageManager(cwd?: string): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcgis/components-build-utils",
|
|
3
|
-
"version": "5.0.0-next.
|
|
3
|
+
"version": "5.0.0-next.130",
|
|
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",
|
|
@@ -18,11 +18,13 @@
|
|
|
18
18
|
"dist/"
|
|
19
19
|
],
|
|
20
20
|
"bin": {
|
|
21
|
-
"awc": "src/commands/run
|
|
21
|
+
"awc": "src/commands/run.ts"
|
|
22
22
|
},
|
|
23
23
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
24
24
|
"dependencies": {
|
|
25
|
+
"@actions/core": "^1.11.0",
|
|
25
26
|
"@commander-js/extra-typings": "^14.0.0",
|
|
27
|
+
"@pnpm/workspace.read-manifest": "^1000.2.7",
|
|
26
28
|
"chalk": "^5.4.1",
|
|
27
29
|
"commander": "^14.0.0",
|
|
28
30
|
"fast-glob": "^3.3.3",
|
|
@@ -30,10 +32,10 @@
|
|
|
30
32
|
"glob": "^11.0.3",
|
|
31
33
|
"ora": "^8.2.0",
|
|
32
34
|
"p-limit": "^7.1.1",
|
|
33
|
-
"semver": "^7.7.
|
|
35
|
+
"semver": "^7.7.3",
|
|
34
36
|
"split2": "^4.2.0",
|
|
35
37
|
"tslib": "^2.8.1",
|
|
36
|
-
"vite": "^7.
|
|
38
|
+
"vite": "^7.2.2",
|
|
37
39
|
"vite-plugin-dts": "^4.5.4"
|
|
38
40
|
}
|
|
39
41
|
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command } from "@commander-js/extra-typings";
|
|
3
|
+
import fs from "node:fs";
|
|
4
|
+
|
|
5
|
+
interface CommandModule {
|
|
6
|
+
registerCommand: (program: Command) => void;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const program = new Command();
|
|
10
|
+
|
|
11
|
+
program.name("components-build-utils").description("Util scripts for working with monorepo components");
|
|
12
|
+
|
|
13
|
+
const commandsDirectory = import.meta.dirname;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* If CLI is called with a specific command, only load that command.
|
|
17
|
+
* Otherwise, load all.
|
|
18
|
+
*/
|
|
19
|
+
const commandName = process.argv[2];
|
|
20
|
+
const commandsToLoad =
|
|
21
|
+
commandName !== undefined && commandName !== "help" && !commandName.startsWith("-")
|
|
22
|
+
? [`${commandName}.ts`]
|
|
23
|
+
: fs.readdirSync(commandsDirectory);
|
|
24
|
+
// Load all commands in the ./commands directory
|
|
25
|
+
Promise.all(
|
|
26
|
+
commandsToLoad.map(async (file) => {
|
|
27
|
+
if (!file.endsWith(".ts")) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
let command: CommandModule;
|
|
31
|
+
try {
|
|
32
|
+
command = (await import(`./${file}`)) as CommandModule;
|
|
33
|
+
} catch {
|
|
34
|
+
console.error(`error: unknown command: ${file.slice(0, -".ts".length)}`);
|
|
35
|
+
process.exit(1);
|
|
36
|
+
}
|
|
37
|
+
if (typeof command.registerCommand === "function") {
|
|
38
|
+
command.registerCommand(program);
|
|
39
|
+
}
|
|
40
|
+
}),
|
|
41
|
+
)
|
|
42
|
+
.then(() => program.parse())
|
|
43
|
+
.catch((error) => {
|
|
44
|
+
console.error(error);
|
|
45
|
+
process.exit(1);
|
|
46
|
+
});
|
|
File without changes
|
|
File without changes
|