@arcgis/components-build-utils 5.0.0-next.127 → 5.0.0-next.128

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;
@@ -1 +1,2 @@
1
+ #!/usr/bin/env node
1
2
  export {};
@@ -1 +1,2 @@
1
+ #!/usr/bin/env node
1
2
  export {};
@@ -1,5 +1,5 @@
1
1
  import { Command } from '@commander-js/extra-typings';
2
- import { PackageWalkerItem } from './utils/utils.ts';
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/utils.ts';
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[];
@@ -11,12 +11,6 @@ export declare function error(...messages: unknown[]): void;
11
11
  */
12
12
  export declare function errorAndExit(...messages: unknown[]): never;
13
13
  export declare function findRepositoryRoot(): string;
14
- export declare function isURL(source: string): boolean;
15
- /**
16
- * Returns a list of all package paths in the workspace,
17
- * as resolved from workspaces in root package.json
18
- */
19
- export declare function getWorkspacesPackagePaths(includeRootPackage?: boolean): Promise<string[]>;
20
14
  export type PackageWalkerItem = PackageWalkerResult<MiniPackageJson>;
21
15
  type PackageWalkerResult<T> = {
22
16
  /**
@@ -63,8 +57,5 @@ export declare function getAffectedPackages(changed: Iterable<string>, options?:
63
57
  */
64
58
  export declare function isSigint(err: unknown): boolean;
65
59
  export declare function getBranchName(): string;
66
- export declare function getStagedFiles(options?: Partial<ExecSyncOptionsWithStringEncoding>): string[];
67
- export declare function getModifiedFiles(options?: Partial<ExecSyncOptionsWithStringEncoding>): string[];
68
- export declare function commitStagedFiles(messages: string, options?: Partial<ExecSyncOptionsWithStringEncoding>): void;
69
60
  export declare function pushCommits(options?: Partial<ExecSyncOptionsWithStringEncoding>): void;
70
61
  export {};
@@ -11,12 +11,6 @@ export declare function error(...messages: unknown[]): void;
11
11
  */
12
12
  export declare function errorAndExit(...messages: unknown[]): never;
13
13
  export declare function findRepositoryRoot(): string;
14
- export declare function isURL(source: string): boolean;
15
- /**
16
- * Returns a list of all package paths in the workspace,
17
- * as resolved from workspaces in root package.json
18
- */
19
- export declare function getWorkspacesPackagePaths(includeRootPackage?: boolean): Promise<string[]>;
20
14
  export type PackageWalkerItem = PackageWalkerResult<MiniPackageJson>;
21
15
  type PackageWalkerResult<T> = {
22
16
  /**
@@ -63,8 +57,5 @@ export declare function getAffectedPackages(changed: Iterable<string>, options?:
63
57
  */
64
58
  export declare function isSigint(err: unknown): boolean;
65
59
  export declare function getBranchName(): string;
66
- export declare function getStagedFiles(options?: Partial<ExecSyncOptionsWithStringEncoding>): string[];
67
- export declare function getModifiedFiles(options?: Partial<ExecSyncOptionsWithStringEncoding>): string[];
68
- export declare function commitStagedFiles(messages: string, options?: Partial<ExecSyncOptionsWithStringEncoding>): void;
69
60
  export declare function pushCommits(options?: Partial<ExecSyncOptionsWithStringEncoding>): void;
70
61
  export {};
@@ -1,3 +1,4 @@
1
+ import { MiniPackageJson } from '../../packageJson.ts';
1
2
  /**
2
3
  * Fetch all published versions for a package.
3
4
  */
@@ -32,3 +33,11 @@ export declare function undeprecate(pkgSpec: string, options: {
32
33
  stdout?: string;
33
34
  error?: unknown;
34
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,3 +1,4 @@
1
+ import { MiniPackageJson } from '../../packageJson.ts';
1
2
  /**
2
3
  * Fetch all published versions for a package.
3
4
  */
@@ -32,3 +33,11 @@ export declare function undeprecate(pkgSpec: string, options: {
32
33
  stdout?: string;
33
34
  error?: unknown;
34
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;
@@ -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;
package/dist/file.d.cts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { ExecSyncOptionsWithStringEncoding } from 'node:child_process';
2
2
  export declare const existsAsync: (file: string) => Promise<boolean>;
3
3
  /** Wrapper for execSync to execute shell commands */
4
- export declare function shSync(command: string, options?: Partial<ExecSyncOptionsWithStringEncoding>): string;
5
- export declare function sh(command: string, options?: Partial<ExecSyncOptionsWithStringEncoding>): Promise<string>;
4
+ export declare function sh(command: string, options?: Partial<ExecSyncOptionsWithStringEncoding>): string;
5
+ export declare function asyncSh(command: string, options?: Partial<ExecSyncOptionsWithStringEncoding>): Promise<string>;
6
6
  export declare function createFileIfNotExists(filePath: string, content: string): Promise<void>;
7
7
  /**
8
8
  * Climb the directory tree upward, until found a directory that contains the
package/dist/file.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { ExecSyncOptionsWithStringEncoding } from 'node:child_process';
2
2
  export declare const existsAsync: (file: string) => Promise<boolean>;
3
3
  /** Wrapper for execSync to execute shell commands */
4
- export declare function shSync(command: string, options?: Partial<ExecSyncOptionsWithStringEncoding>): string;
5
- export declare function sh(command: string, options?: Partial<ExecSyncOptionsWithStringEncoding>): Promise<string>;
4
+ export declare function sh(command: string, options?: Partial<ExecSyncOptionsWithStringEncoding>): string;
5
+ export declare function asyncSh(command: string, options?: Partial<ExecSyncOptionsWithStringEncoding>): Promise<string>;
6
6
  export declare function createFileIfNotExists(filePath: string, content: string): Promise<void>;
7
7
  /**
8
8
  * Climb the directory tree upward, until found a directory that contains the
package/dist/index.cjs CHANGED
@@ -34,7 +34,7 @@ const existsAsync = async (file) => (
34
34
  // which interferes with debugging when "Pause on caught exceptions" is enabled
35
35
  await new Promise((resolve2) => node_fs.access(file, promises.constants.F_OK, (error) => resolve2(!error)))
36
36
  );
37
- function shSync(command, options = {}) {
37
+ function sh(command, options = {}) {
38
38
  try {
39
39
  const normalizedOptions = { encoding: "utf8", ...options };
40
40
  return node_child_process.execSync(command.trim(), normalizedOptions).trim();
@@ -374,7 +374,7 @@ exports.isPosix = isPosix;
374
374
  exports.normalizePath = normalizePath;
375
375
  exports.path = path;
376
376
  exports.retrievePackageJson = retrievePackageJson;
377
- exports.sh = shSync;
377
+ exports.sh = sh;
378
378
  exports.toPosixPathSeparators = toPosixPathSeparators;
379
379
  exports.toSystemPathSeparators = toSystemPathSeparators;
380
380
  exports.vitePresetPlugin = vitePresetPlugin;
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { existsAsync, shSync as sh, createFileIfNotExists, findPath, asyncFindPath } from './file.ts';
1
+ export { existsAsync, sh, createFileIfNotExists, findPath, asyncFindPath } from './file.ts';
2
2
  export { gitIgnoreFileToGlobs, gitIgnoreToGlob } from './glob.ts';
3
3
  export { isPosix, toPosixPathSeparators, normalizePath, toSystemPathSeparators, getCwd, path } from './path.ts';
4
4
  export { type MiniPackageJson, retrievePackageJson, asyncRetrievePackageJson, fetchPackageLocation, detectPackageManager, } from './packageJson.ts';
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { existsAsync, shSync as sh, createFileIfNotExists, findPath, asyncFindPath } from './file.ts';
1
+ export { existsAsync, sh, createFileIfNotExists, findPath, asyncFindPath } from './file.ts';
2
2
  export { gitIgnoreFileToGlobs, gitIgnoreToGlob } from './glob.ts';
3
3
  export { isPosix, toPosixPathSeparators, normalizePath, toSystemPathSeparators, getCwd, path } from './path.ts';
4
4
  export { type MiniPackageJson, retrievePackageJson, asyncRetrievePackageJson, fetchPackageLocation, detectPackageManager, } from './packageJson.ts';
package/dist/index.js CHANGED
@@ -10,7 +10,7 @@ const existsAsync = async (file) => (
10
10
  // which interferes with debugging when "Pause on caught exceptions" is enabled
11
11
  await new Promise((resolve2) => access(file, constants.F_OK, (error) => resolve2(!error)))
12
12
  );
13
- function shSync(command, options = {}) {
13
+ function sh(command, options = {}) {
14
14
  try {
15
15
  const normalizedOptions = { encoding: "utf8", ...options };
16
16
  return execSync(command.trim(), normalizedOptions).trim();
@@ -351,7 +351,7 @@ export {
351
351
  normalizePath,
352
352
  path,
353
353
  retrievePackageJson,
354
- shSync as sh,
354
+ sh,
355
355
  toPosixPathSeparators,
356
356
  toSystemPathSeparators,
357
357
  vitePresetPlugin
@@ -9,7 +9,6 @@ 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;
@@ -42,6 +41,6 @@ export declare function asyncWritePackageJson(location: string, content: MiniPac
42
41
  */
43
42
  export declare function fetchPackageLocation(packageName: string, cwd?: string): Promise<string>;
44
43
  /**
45
- * Detect if current repository/monorepo uses npm, yarn or pnpm
44
+ * Detect if current repository/monorepo uses npm, pnpm, or yarn
46
45
  */
47
46
  export declare function detectPackageManager(cwd?: string): string;
@@ -9,7 +9,6 @@ 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;
@@ -42,6 +41,6 @@ export declare function asyncWritePackageJson(location: string, content: MiniPac
42
41
  */
43
42
  export declare function fetchPackageLocation(packageName: string, cwd?: string): Promise<string>;
44
43
  /**
45
- * Detect if current repository/monorepo uses npm, yarn or pnpm
44
+ * Detect if current repository/monorepo uses npm, pnpm, or yarn
46
45
  */
47
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.127",
3
+ "version": "5.0.0-next.128",
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,12 +18,13 @@
18
18
  "dist/"
19
19
  ],
20
20
  "bin": {
21
- "awc": "src/commands/run-wrapper.js"
21
+ "awc": "src/commands/run.ts"
22
22
  },
23
23
  "license": "SEE LICENSE IN LICENSE.md",
24
24
  "dependencies": {
25
25
  "@actions/core": "^1.11.0",
26
26
  "@commander-js/extra-typings": "^14.0.0",
27
+ "@pnpm/workspace.read-manifest": "^1000.2.7",
27
28
  "chalk": "^5.4.1",
28
29
  "commander": "^14.0.0",
29
30
  "fast-glob": "^3.3.3",
@@ -31,7 +32,7 @@
31
32
  "glob": "^11.0.3",
32
33
  "ora": "^8.2.0",
33
34
  "p-limit": "^7.1.1",
34
- "semver": "^7.7.2",
35
+ "semver": "^7.7.3",
35
36
  "split2": "^4.2.0",
36
37
  "tslib": "^2.8.1",
37
38
  "vite": "^7.2.2",
@@ -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
+ });
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env node
2
- // Register tsx's TypeScript loader that will do on the fly transpilation of any
3
- // imported .ts file
4
- import "tsx";
5
- // This still has to be async import until native TS support in Node 24
6
- await import("./run.ts");