@vaharoni/devops 1.1.5 → 1.1.7

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/README.md CHANGED
@@ -29,12 +29,12 @@ Currently, the repo works with `bun` as the package manager for node and `uv` fo
29
29
  Run this in your local copy of the devops folder:
30
30
  ```shell
31
31
  bun link
32
+ bun run build
32
33
  ```
33
34
 
34
35
  Run this in a local package using the project for testing:
35
36
  ```shell
36
37
  bun link @vaharoni/devops
37
- bun run build
38
38
  ```
39
39
 
40
40
  When done:
@@ -70,6 +70,7 @@ export declare class CommandExecutor {
70
70
  _prepareFullCommand(): string;
71
71
  _getProcessEnv(envOverride?: {}): {
72
72
  MONOREPO_ENV: string | undefined;
73
+ MONOREPO_ROOT: string;
73
74
  TZ?: string;
74
75
  NODE_ENV?: string;
75
76
  };
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/cli/common.ts"],"names":[],"mappings":"AAMA,KAAK,UAAU,GAAG;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IAC7C,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAQF,qBAAa,gBAAgB;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,OAAO,CAAC;IACnB,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,OAAO,CAAC;gBAEV,QAAQ,EAAE,MAAM,EAAE;IAsB9B,eAAe,CACb,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,IAAI,CAAC,sBAAsB,EAAE,KAAK,CAAM,GAChD,eAAe;IAiBlB,YAAY,CAAC,EACX,MAAW,EACX,Q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,CAAC,OAAO,CAAC,EAAE;QACb,cAAc,CAAC,EAAE,KAAK,CAAC;QACvB,QAAQ,CAAC,EAAE,KAAK,CAAC;QACjB,GAAG,CAAC,EAAE,MAAM,CAAC;KACd,GAAG,MAAM;IACV,IAAI,CAAC,OAAO,EAAE;QAAE,cAAc,CAAC,EAAE,KAAK,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG;QACvE,UAAU,EAAE,MAAM,CAAC;QACnB,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;KAChB;IACD,IAAI,CAAC,OAAO,EAAE;QACZ,cAAc,EAAE,IAAI,CAAC;QACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,GAAG,CAAC,EAAE,MAAM,CAAC;KACd,GAAG,MAAM;IA6BV,kIAAkI;IAClI,KAAK,CAAC,EAAE,GAAQ,EAAE;;KAAK;IAiCvB,mBAAmB;IAmBnB,cAAc,CAAC,WAAW,KAAK;;;;;;IAI/B,kBAAkB;IASlB,kBAAkB;CASnB;AAED,wBAAgB,iBAAiB,CAAC,GAAG,CAAC,EAAE,MAAM,YAS7C;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAGrD;AAED,qBAAa,YAAY;IACX,OAAO,CAAC,KAAK;IAAU,OAAO,CAAC,IAAI;gBAA3B,KAAK,EAAE,MAAM,EAAU,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAEnF,QAAQ,CAAC,GAAG,EAAE,MAAM;IAQpB,QAAQ,CAAC,GAAG,EAAE,MAAM;CAGrB"}
@@ -172,7 +172,7 @@ export class CommandExecutor {
172
172
  _prepareFullCommand() {
173
173
  const envPrefix = this.env ? this._envInjectorPrefix() : "";
174
174
  const fullCommand = [envPrefix, this.commandStr].join(" ").trim();
175
- const envPrefixLog = this.env ? `MONOREPO_ENV=${this.env}` : "";
175
+ const envPrefixLog = this.env ? `MONOREPO_ENV=${this.env} MONOREPO_ROOT=${process.cwd()}` : "";
176
176
  const fullCommandLog = [envPrefixLog, fullCommand].join(" ").trim();
177
177
  if (this.redactedCommand) {
178
178
  console.warn(chalk.yellow(fullCommandLog.replace(this.commandStr, this.redactedCommand)));
@@ -183,7 +183,7 @@ export class CommandExecutor {
183
183
  return fullCommand;
184
184
  }
185
185
  _getProcessEnv(envOverride = {}) {
186
- return { ...process.env, MONOREPO_ENV: this.env, ...envOverride };
186
+ return { ...process.env, MONOREPO_ENV: this.env, MONOREPO_ROOT: process.cwd(), ...envOverride };
187
187
  }
188
188
  _envInjectorPrefix() {
189
189
  const envFiles = dotEnvFilesForEnv(this.env);
@@ -8,13 +8,13 @@ export function workspaces() {
8
8
  return _workspaces;
9
9
  const nodeWorkspacesData = nodeWorkspaces();
10
10
  const pythonWorkspacesData = pythonWorkspaces();
11
- Object.values(nodeWorkspacesData).forEach(data => {
11
+ Object.values(nodeWorkspacesData).forEach((data) => {
12
12
  _workspaces[data.name] = {
13
13
  rootPath: data.rootPath,
14
- packageDataEntries: [data]
14
+ packageDataEntries: [data],
15
15
  };
16
16
  });
17
- Object.values(pythonWorkspacesData).forEach(data => {
17
+ Object.values(pythonWorkspacesData).forEach((data) => {
18
18
  const existing = _workspaces[data.name];
19
19
  if (existing) {
20
20
  if (existing.rootPath !== data.rootPath) {
@@ -26,7 +26,7 @@ export function workspaces() {
26
26
  else {
27
27
  _workspaces[data.name] = {
28
28
  rootPath: data.rootPath,
29
- packageDataEntries: []
29
+ packageDataEntries: [],
30
30
  };
31
31
  }
32
32
  _workspaces[data.name].packageDataEntries.push(data);
@@ -21,7 +21,7 @@ export class PackageDataProcessor {
21
21
  console.error(`Error parsing ${packageFilePath}: ${parsedRes.error}`);
22
22
  process.exit(1);
23
23
  }
24
- const rootDir = path.dirname(packageFilePath);
24
+ const rootDir = path.relative(process.cwd(), path.dirname(packageFilePath));
25
25
  const name = this.nameExtractor(parsedRes.data);
26
26
  this.workspaceNames.add(name);
27
27
  this.loadedFiles[rootDir] = { name, data: parsedRes.data };
@@ -1 +1 @@
1
- {"version":3,"file":"process-package-json.d.ts","sourceRoot":"","sources":["../../../src/libs/discovery/process-package-json.ts"],"names":[],"mappings":"AAIA,OAAO,EAAyB,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAWtE,wBAAgB,cAAc,gCA+B7B"}
1
+ {"version":3,"file":"process-package-json.d.ts","sourceRoot":"","sources":["../../../src/libs/discovery/process-package-json.ts"],"names":[],"mappings":"AAIA,OAAO,EAAyB,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAYtE,wBAAgB,cAAc,gCAqC7B"}
@@ -4,13 +4,14 @@ import { globSync } from "glob";
4
4
  import path from "path";
5
5
  import { packageFileNodeSchema } from "../../types";
6
6
  import { PackageDataProcessor } from "./process-common";
7
- const rootPkgJsonPath = path.join(process.cwd(), "package.json");
7
+ const rootPath = process.env.MONOREPO_ROOT || process.cwd();
8
+ const rootPkgJsonPath = path.join(rootPath, "package.json");
8
9
  const rootPkgJson = JSON.parse(fs.readFileSync(rootPkgJsonPath, "utf8"));
9
10
  const _workspaces = {};
10
11
  let _workspacesLoaded = false;
11
12
  export function nodeWorkspaces() {
12
13
  if (!_workspacesLoaded) {
13
- const allPackageJsons = (rootPkgJson.workspaces ?? []).flatMap((workspaceGlob) => globSync(path.join(workspaceGlob, "package.json")));
14
+ const allPackageJsons = (rootPkgJson.workspaces ?? []).flatMap((workspaceGlob) => globSync(path.join(rootPath, workspaceGlob, "package.json")));
14
15
  const processor = new PackageDataProcessor({
15
16
  language: "node",
16
17
  pathList: allPackageJsons,
@@ -18,11 +19,16 @@ export function nodeWorkspaces() {
18
19
  fileParser: JSON.parse,
19
20
  nameExtractor: (data) => data.name,
20
21
  });
21
- processor.convert((data) => {
22
+ processor
23
+ .convert((data) => {
22
24
  const { dependencies, ...rest } = data;
23
25
  const dependencyNames = Object.keys(dependencies ?? []);
24
- return { ...rest, dependencyNames: processor.filterDependencies(dependencyNames) };
25
- }).forEach(pkgData => {
26
+ return {
27
+ ...rest,
28
+ dependencyNames: processor.filterDependencies(dependencyNames),
29
+ };
30
+ })
31
+ .forEach((pkgData) => {
26
32
  _workspaces[pkgData.name] = pkgData;
27
33
  });
28
34
  console.warn(chalk.yellow(
@@ -1 +1 @@
1
- {"version":3,"file":"process-pyproject-toml.d.ts","sourceRoot":"","sources":["../../../src/libs/discovery/process-pyproject-toml.ts"],"names":[],"mappings":"AAEA,OAAO,EAA2B,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAOxE,wBAAgB,gBAAgB,gCAiC/B"}
1
+ {"version":3,"file":"process-pyproject-toml.d.ts","sourceRoot":"","sources":["../../../src/libs/discovery/process-pyproject-toml.ts"],"names":[],"mappings":"AAEA,OAAO,EAA2B,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AASxE,wBAAgB,gBAAgB,gCAqC/B"}
@@ -2,12 +2,14 @@ import chalk from "chalk";
2
2
  import { globSync } from "glob";
3
3
  import { packageFilePythonSchema } from "../../types";
4
4
  import { PackageDataProcessor } from "./process-common";
5
- import TOML from '@iarna/toml';
5
+ import TOML from "@iarna/toml";
6
+ import path from "path";
7
+ const rootPath = process.env.MONOREPO_ROOT || process.cwd();
6
8
  const _workspaces = {};
7
9
  let _workspacesLoaded = false;
8
10
  export function pythonWorkspaces() {
9
11
  if (!_workspacesLoaded) {
10
- const allPyprojectTomls = globSync("**/*/pyproject.toml");
12
+ const allPyprojectTomls = globSync(path.join(rootPath, "**/*/pyproject.toml"));
11
13
  const processor = new PackageDataProcessor({
12
14
  language: "python",
13
15
  pathList: allPyprojectTomls,
@@ -15,16 +17,18 @@ export function pythonWorkspaces() {
15
17
  fileParser: TOML.parse,
16
18
  nameExtractor: (data) => data.project.name,
17
19
  });
18
- processor.convert((data) => {
20
+ processor
21
+ .convert((data) => {
19
22
  const deployment = data.tool?.devops?.deployment;
20
23
  const scripts = data.tool?.devops?.scripts;
21
24
  const dependencyNames = data.project.dependencies ?? [];
22
25
  return {
23
26
  scripts,
24
27
  deployment,
25
- dependencyNames: processor.filterDependencies(dependencyNames)
28
+ dependencyNames: processor.filterDependencies(dependencyNames),
26
29
  };
27
- }).forEach(pkgData => {
30
+ })
31
+ .forEach((pkgData) => {
28
32
  _workspaces[pkgData.name] = pkgData;
29
33
  });
30
34
  console.warn(chalk.yellow(
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vaharoni/devops",
3
3
  "type": "module",
4
- "version": "1.1.5",
4
+ "version": "1.1.7",
5
5
  "description": "Devops utility",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
package/src/cli/common.ts CHANGED
@@ -251,7 +251,7 @@ export class CommandExecutor {
251
251
  const envPrefix = this.env ? this._envInjectorPrefix() : "";
252
252
  const fullCommand = [envPrefix, this.commandStr].join(" ").trim();
253
253
 
254
- const envPrefixLog = this.env ? `MONOREPO_ENV=${this.env}` : "";
254
+ const envPrefixLog = this.env ? `MONOREPO_ENV=${this.env} MONOREPO_ROOT=${process.cwd()}` : "";
255
255
  const fullCommandLog = [envPrefixLog, fullCommand].join(" ").trim();
256
256
  if (this.redactedCommand) {
257
257
  console.warn(
@@ -267,7 +267,7 @@ export class CommandExecutor {
267
267
  }
268
268
 
269
269
  _getProcessEnv(envOverride = {}) {
270
- return { ...process.env, MONOREPO_ENV: this.env, ...envOverride };
270
+ return { ...process.env, MONOREPO_ENV: this.env, MONOREPO_ROOT: process.cwd(), ...envOverride };
271
271
  }
272
272
 
273
273
  _envInjectorPrefix() {
@@ -11,14 +11,14 @@ export function workspaces() {
11
11
  const nodeWorkspacesData = nodeWorkspaces();
12
12
  const pythonWorkspacesData = pythonWorkspaces();
13
13
 
14
- Object.values(nodeWorkspacesData).forEach(data => {
14
+ Object.values(nodeWorkspacesData).forEach((data) => {
15
15
  _workspaces[data.name] = {
16
16
  rootPath: data.rootPath,
17
- packageDataEntries: [data]
17
+ packageDataEntries: [data],
18
18
  };
19
- })
19
+ });
20
20
 
21
- Object.values(pythonWorkspacesData).forEach(data => {
21
+ Object.values(pythonWorkspacesData).forEach((data) => {
22
22
  const existing = _workspaces[data.name];
23
23
  if (existing) {
24
24
  if (existing.rootPath !== data.rootPath) {
@@ -29,11 +29,11 @@ export function workspaces() {
29
29
  } else {
30
30
  _workspaces[data.name] = {
31
31
  rootPath: data.rootPath,
32
- packageDataEntries: []
32
+ packageDataEntries: [],
33
33
  };
34
34
  }
35
35
  _workspaces[data.name].packageDataEntries.push(data);
36
- })
36
+ });
37
37
  _workspacesLoaded = true;
38
38
  return _workspaces;
39
39
  }
@@ -34,7 +34,7 @@ export class PackageDataProcessor<T> {
34
34
  console.error(`Error parsing ${packageFilePath}: ${parsedRes.error}`);
35
35
  process.exit(1);
36
36
  }
37
- const rootDir = path.dirname(packageFilePath);
37
+ const rootDir = path.relative(process.cwd(), path.dirname(packageFilePath));
38
38
  const name = this.nameExtractor(parsedRes.data)
39
39
  this.workspaceNames.add(name);
40
40
  this.loadedFiles[rootDir] = { name, data: parsedRes.data };
@@ -5,7 +5,8 @@ import path from "path";
5
5
  import { packageFileNodeSchema, type PackageData } from "../../types";
6
6
  import { PackageDataProcessor } from "./process-common";
7
7
 
8
- const rootPkgJsonPath = path.join(process.cwd(), "package.json");
8
+ const rootPath = process.env.MONOREPO_ROOT || process.cwd();
9
+ const rootPkgJsonPath = path.join(rootPath, "package.json");
9
10
  const rootPkgJson = JSON.parse(fs.readFileSync(rootPkgJsonPath, "utf8")) as {
10
11
  workspaces: string[];
11
12
  };
@@ -15,8 +16,9 @@ let _workspacesLoaded = false;
15
16
 
16
17
  export function nodeWorkspaces() {
17
18
  if (!_workspacesLoaded) {
18
- const allPackageJsons = (rootPkgJson.workspaces ?? []).flatMap((workspaceGlob) =>
19
- globSync(path.join(workspaceGlob, "package.json"))
19
+ const allPackageJsons = (rootPkgJson.workspaces ?? []).flatMap(
20
+ (workspaceGlob) =>
21
+ globSync(path.join(rootPath, workspaceGlob, "package.json"))
20
22
  );
21
23
 
22
24
  const processor = new PackageDataProcessor({
@@ -27,13 +29,18 @@ export function nodeWorkspaces() {
27
29
  nameExtractor: (data) => data.name,
28
30
  });
29
31
 
30
- processor.convert((data) => {
31
- const { dependencies, ...rest } = data;
32
- const dependencyNames = Object.keys(dependencies ?? []);
33
- return { ...rest, dependencyNames: processor.filterDependencies(dependencyNames) };
34
- }).forEach(pkgData => {
35
- _workspaces[pkgData.name] = pkgData
36
- })
32
+ processor
33
+ .convert((data) => {
34
+ const { dependencies, ...rest } = data;
35
+ const dependencyNames = Object.keys(dependencies ?? []);
36
+ return {
37
+ ...rest,
38
+ dependencyNames: processor.filterDependencies(dependencyNames),
39
+ };
40
+ })
41
+ .forEach((pkgData) => {
42
+ _workspaces[pkgData.name] = pkgData;
43
+ });
37
44
 
38
45
  console.warn(
39
46
  chalk.yellow(
@@ -44,4 +51,4 @@ export function nodeWorkspaces() {
44
51
  _workspacesLoaded = true;
45
52
  }
46
53
  return _workspaces;
47
- }
54
+ }
@@ -2,14 +2,18 @@ import chalk from "chalk";
2
2
  import { globSync } from "glob";
3
3
  import { packageFilePythonSchema, type PackageData } from "../../types";
4
4
  import { PackageDataProcessor } from "./process-common";
5
- import TOML from '@iarna/toml';
5
+ import TOML from "@iarna/toml";
6
+ import path from "path";
6
7
 
8
+ const rootPath = process.env.MONOREPO_ROOT || process.cwd();
7
9
  const _workspaces: Record<string, PackageData> = {};
8
10
  let _workspacesLoaded = false;
9
11
 
10
12
  export function pythonWorkspaces() {
11
13
  if (!_workspacesLoaded) {
12
- const allPyprojectTomls = globSync("**/*/pyproject.toml");
14
+ const allPyprojectTomls = globSync(
15
+ path.join(rootPath, "**/*/pyproject.toml")
16
+ );
13
17
  const processor = new PackageDataProcessor({
14
18
  language: "python",
15
19
  pathList: allPyprojectTomls,
@@ -18,18 +22,20 @@ export function pythonWorkspaces() {
18
22
  nameExtractor: (data) => data.project.name,
19
23
  });
20
24
 
21
- processor.convert((data) => {
22
- const deployment = data.tool?.devops?.deployment;
23
- const scripts = data.tool?.devops?.scripts;
24
- const dependencyNames = data.project.dependencies ?? [];
25
- return {
26
- scripts,
27
- deployment,
28
- dependencyNames: processor.filterDependencies(dependencyNames)
29
- }
30
- }).forEach(pkgData => {
31
- _workspaces[pkgData.name] = pkgData
32
- })
25
+ processor
26
+ .convert((data) => {
27
+ const deployment = data.tool?.devops?.deployment;
28
+ const scripts = data.tool?.devops?.scripts;
29
+ const dependencyNames = data.project.dependencies ?? [];
30
+ return {
31
+ scripts,
32
+ deployment,
33
+ dependencyNames: processor.filterDependencies(dependencyNames),
34
+ };
35
+ })
36
+ .forEach((pkgData) => {
37
+ _workspaces[pkgData.name] = pkgData;
38
+ });
33
39
 
34
40
  console.warn(
35
41
  chalk.yellow(
@@ -40,4 +46,4 @@ export function pythonWorkspaces() {
40
46
  _workspacesLoaded = true;
41
47
  }
42
48
  return _workspaces;
43
- }
49
+ }