@apitree.cz/cli 0.1.2 → 0.2.0-next.2f66920943b2cd7b1ab4cfc027f7735e2a3db039

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.
Files changed (43) hide show
  1. package/dist/commands/sync-project-references/action.d.ts +2 -2
  2. package/dist/commands/sync-project-references/action.js +12 -24
  3. package/dist/commands/sync-project-references/action.js.map +1 -1
  4. package/dist/commands/sync-project-references/config-schema.d.ts +1 -9
  5. package/dist/commands/sync-project-references/config-schema.js +4 -4
  6. package/dist/commands/sync-project-references/config-schema.js.map +1 -1
  7. package/dist/commands/sync-project-references/default-config.d.ts +0 -2
  8. package/dist/commands/sync-project-references/default-config.js +0 -2
  9. package/dist/commands/sync-project-references/default-config.js.map +1 -1
  10. package/dist/commands/sync-project-references/get-config.d.ts +4 -2
  11. package/dist/commands/sync-project-references/get-config.js +3 -4
  12. package/dist/commands/sync-project-references/get-config.js.map +1 -1
  13. package/dist/commands/sync-project-references/get-existing-ts-config-path.d.ts +1 -1
  14. package/dist/commands/sync-project-references/get-existing-ts-config-path.js +2 -3
  15. package/dist/commands/sync-project-references/get-existing-ts-config-path.js.map +1 -1
  16. package/dist/commands/sync-project-references/get-references.d.ts +7 -10
  17. package/dist/commands/sync-project-references/get-references.js +8 -8
  18. package/dist/commands/sync-project-references/get-references.js.map +1 -1
  19. package/dist/commands/sync-project-references/get-target-build-config.d.ts +1 -1
  20. package/dist/commands/sync-project-references/get-target-build-config.js +4 -5
  21. package/dist/commands/sync-project-references/get-target-build-config.js.map +1 -1
  22. package/dist/commands/sync-project-references/get-workspace-dependencies.d.ts +15 -0
  23. package/dist/commands/sync-project-references/get-workspace-dependencies.js +13 -0
  24. package/dist/commands/sync-project-references/get-workspace-dependencies.js.map +1 -0
  25. package/dist/commands/sync-project-references/get-workspaces.d.ts +5 -5
  26. package/dist/commands/sync-project-references/get-workspaces.js +5 -34
  27. package/dist/commands/sync-project-references/get-workspaces.js.map +1 -1
  28. package/dist/commands/sync-project-references/run-hooks.js +3 -5
  29. package/dist/commands/sync-project-references/run-hooks.js.map +1 -1
  30. package/dist/commands/sync-project-references/types.d.ts +3 -16
  31. package/dist/commands/sync-project-references/update-ts-configs.d.ts +3 -10
  32. package/dist/commands/sync-project-references/update-ts-configs.js +1 -2
  33. package/dist/commands/sync-project-references/update-ts-configs.js.map +1 -1
  34. package/dist/utils.d.ts +3 -0
  35. package/dist/utils.js +3 -0
  36. package/dist/utils.js.map +1 -1
  37. package/package.json +2 -7
  38. package/dist/commands/sync-project-references/get-package-dependencies.d.ts +0 -10
  39. package/dist/commands/sync-project-references/get-package-dependencies.js +0 -14
  40. package/dist/commands/sync-project-references/get-package-dependencies.js.map +0 -1
  41. package/dist/commands/sync-project-references/get-root.d.ts +0 -1
  42. package/dist/commands/sync-project-references/get-root.js +0 -2
  43. package/dist/commands/sync-project-references/get-root.js.map +0 -1
@@ -1,3 +1,3 @@
1
1
  import type { GetConfigProps } from './get-config.js';
2
- export type ActionProps = GetConfigProps;
3
- export declare const action: (props: ActionProps) => Promise<void>;
2
+ export type ActionProps = Pick<GetConfigProps, 'config'>;
3
+ export declare const action: ({ config }: ActionProps) => Promise<void>;
@@ -1,41 +1,29 @@
1
+ import { relative } from 'node:path';
1
2
  import { logger } from '../../utils.js';
2
3
  import { getConfig } from './get-config.js';
3
- import { getPackageDependencies } from './get-package-dependencies.js';
4
4
  import { getReferences } from './get-references.js';
5
5
  import { getWorkspaces } from './get-workspaces.js';
6
6
  import { runHooks } from './run-hooks.js';
7
7
  import { updateTsConfigs } from './update-ts-configs.js';
8
- export const action = async (props) => {
9
- const config = await getConfig(props);
10
- const workspaces = await getWorkspaces(config.scopes);
11
- const sync = workspaces.flatMap(({ directory, packages }) => packages.map(async (workspacePackage) => {
12
- logger.info(`Syncing project references for ${directory}/${workspacePackage}`);
13
- const otherWorkspaces = workspaces.map(({ directory, packages }) => ({
14
- directory,
15
- packages: packages.filter((otherPackage) => otherPackage !== workspacePackage),
16
- }));
17
- const packageDependencies = await getPackageDependencies({
18
- directory,
19
- workspacePackage,
20
- scopes: config.scopes,
21
- });
8
+ export const action = async ({ config }) => {
9
+ const { workspaces, rootDir } = await getWorkspaces();
10
+ const { hooks, tsConfigs } = await getConfig({ config, rootDir });
11
+ const sync = workspaces.flatMap(async (workspacePackage) => {
12
+ logger.info(`Syncing project references for ./${relative(rootDir, workspacePackage.dir)}`);
22
13
  return updateTsConfigs({
23
- directory,
24
14
  references: await getReferences({
25
- directory,
26
- otherWorkspaces,
27
- packageDependencies,
28
- scopes: config.scopes,
29
- tsConfigs: config.tsConfigs,
15
+ tsConfigs,
16
+ workspacePackage,
17
+ workspaces,
30
18
  }),
31
- tsConfigs: Object.values(config.tsConfigs),
19
+ tsConfigs: Object.values(tsConfigs),
32
20
  workspacePackage,
33
21
  });
34
- }));
22
+ });
35
23
  if (sync.length === 0) {
36
24
  return logger.warn('No project references to sync.');
37
25
  }
38
26
  const paths = await Promise.all(sync);
39
- await runHooks(config.hooks, paths.flat());
27
+ await runHooks(hooks, paths.flat());
40
28
  };
41
29
  //# sourceMappingURL=action.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"action.js","sourceRoot":"","sources":["../../../src/commands/sync-project-references/action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAGxC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAIzD,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,EAAE,KAAkB,EAAE,EAAE;IACjD,MAAM,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ACH,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,OAAO,MAAM,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;IACvD,CAAC;IACD,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACtC,MAAM,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;AACtC,CAAC,CAAC"}
@@ -2,15 +2,11 @@ import { z } from 'zod';
2
2
  export declare const configSchema: z.ZodObject<{
3
3
  hooks: z.ZodOptional<z.ZodObject<{
4
4
  afterSync: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
5
- runner: z.ZodOptional<z.ZodEnum<["npx", "pnpm", "yarn"]>>;
6
5
  }, "strip", z.ZodTypeAny, {
7
6
  afterSync?: string[] | undefined;
8
- runner?: "npx" | "pnpm" | "yarn" | undefined;
9
7
  }, {
10
8
  afterSync?: string[] | undefined;
11
- runner?: "npx" | "pnpm" | "yarn" | undefined;
12
9
  }>>;
13
- scopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
14
10
  tsConfigs: z.ZodOptional<z.ZodObject<{
15
11
  build: z.ZodOptional<z.ZodString>;
16
12
  cjs: z.ZodOptional<z.ZodString>;
@@ -27,12 +23,10 @@ export declare const configSchema: z.ZodObject<{
27
23
  default?: string | undefined;
28
24
  esm?: string | undefined;
29
25
  }>>;
30
- }, "strip", z.ZodTypeAny, {
26
+ }, "strict", z.ZodTypeAny, {
31
27
  hooks?: {
32
28
  afterSync?: string[] | undefined;
33
- runner?: "npx" | "pnpm" | "yarn" | undefined;
34
29
  } | undefined;
35
- scopes?: string[] | undefined;
36
30
  tsConfigs?: {
37
31
  build?: string | undefined;
38
32
  cjs?: string | undefined;
@@ -42,9 +36,7 @@ export declare const configSchema: z.ZodObject<{
42
36
  }, {
43
37
  hooks?: {
44
38
  afterSync?: string[] | undefined;
45
- runner?: "npx" | "pnpm" | "yarn" | undefined;
46
39
  } | undefined;
47
- scopes?: string[] | undefined;
48
40
  tsConfigs?: {
49
41
  build?: string | undefined;
50
42
  cjs?: string | undefined;
@@ -1,12 +1,11 @@
1
1
  import { z } from 'zod';
2
- export const configSchema = z.object({
2
+ export const configSchema = z
3
+ .object({
3
4
  hooks: z
4
5
  .object({
5
6
  afterSync: z.array(z.string()).optional(),
6
- runner: z.enum(['npx', 'pnpm', 'yarn']).optional(),
7
7
  })
8
8
  .optional(),
9
- scopes: z.array(z.string()).optional(),
10
9
  tsConfigs: z
11
10
  .object({
12
11
  build: z.string().optional(),
@@ -15,5 +14,6 @@ export const configSchema = z.object({
15
14
  esm: z.string().optional(),
16
15
  })
17
16
  .optional(),
18
- });
17
+ })
18
+ .strict();
19
19
  //# sourceMappingURL=config-schema.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"config-schema.js","sourceRoot":"","sources":["../../../src/commands/sync-project-references/config-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,KAAK,EAAE,CAAC;SACL,MAAM,CAAC;QACN,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;QACzC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,QAAQ,EAAE;KACnD,CAAC;SACD,QAAQ,EAAE;IACb,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IACtC,SAAS,EAAE,CAAC;SACT,MAAM,CAAC;QACN,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC5B,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC1B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC9B,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KAC3B,CAAC;SACD,QAAQ,EAAE;CACd,CAAkD,CAAC"}
1
+ {"version":3,"file":"config-schema.js","sourceRoot":"","sources":["../../../src/commands/sync-project-references/config-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC;KAC1B,MAAM,CAAC;IACN,KAAK,EAAE,CAAC;SACL,MAAM,CAAC;QACN,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;KAC1C,CAAC;SACD,QAAQ,EAAE;IACb,SAAS,EAAE,CAAC;SACT,MAAM,CAAC;QACN,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC5B,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC1B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC9B,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KAC3B,CAAC;SACD,QAAQ,EAAE;CACd,CAAC;KACD,MAAM,EAAmD,CAAC"}
@@ -1,5 +1,4 @@
1
1
  declare const defaultConfig: {
2
- scopes: string[];
3
2
  tsConfigs: {
4
3
  default: string;
5
4
  build: string;
@@ -8,7 +7,6 @@ declare const defaultConfig: {
8
7
  };
9
8
  hooks: {
10
9
  afterSync: string[];
11
- runner: "pnpm";
12
10
  };
13
11
  };
14
12
  export default defaultConfig;
@@ -1,5 +1,4 @@
1
1
  const defaultConfig = {
2
- scopes: ['@apitree.cz'],
3
2
  tsConfigs: {
4
3
  default: 'tsconfig.json',
5
4
  build: 'tsconfig.build.json',
@@ -8,7 +7,6 @@ const defaultConfig = {
8
7
  },
9
8
  hooks: {
10
9
  afterSync: ['prettier --write'],
11
- runner: 'pnpm',
12
10
  },
13
11
  };
14
12
  export default defaultConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"default-config.js","sourceRoot":"","sources":["../../../src/commands/sync-project-references/default-config.ts"],"names":[],"mappings":"AAEA,MAAM,aAAa,GAAG;IACpB,MAAM,EAAE,CAAC,aAAa,CAAC;IACvB,SAAS,EAAE;QACT,OAAO,EAAE,eAAe;QACxB,KAAK,EAAE,qBAAqB;QAC5B,GAAG,EAAE,yBAAyB;QAC9B,GAAG,EAAE,yBAAyB;KAC/B;IACD,KAAK,EAAE;QACL,SAAS,EAAE,CAAC,kBAAkB,CAAC;QAC/B,MAAM,EAAE,MAAM;KACf;CACoC,CAAC;AAExC,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"default-config.js","sourceRoot":"","sources":["../../../src/commands/sync-project-references/default-config.ts"],"names":[],"mappings":"AAEA,MAAM,aAAa,GAAG;IACpB,SAAS,EAAE;QACT,OAAO,EAAE,eAAe;QACxB,KAAK,EAAE,qBAAqB;QAC5B,GAAG,EAAE,yBAAyB;QAC9B,GAAG,EAAE,yBAAyB;KAC/B;IACD,KAAK,EAAE;QACL,SAAS,EAAE,CAAC,kBAAkB,CAAC;KAChC;CACoC,CAAC;AAExC,eAAe,aAAa,CAAC"}
@@ -3,13 +3,16 @@ export interface GetConfigProps {
3
3
  * Path to config file (e.g. `./sync-project-references.config.js`).
4
4
  */
5
5
  config?: string | undefined;
6
+ /**
7
+ * Root directory to search for the config file.
8
+ */
9
+ rootDir: string;
6
10
  }
7
11
  /**
8
12
  * Returns config object from a provided path.
9
13
  * If the config file does not exist, returns default config.
10
14
  */
11
15
  export declare const getConfig: (props: GetConfigProps) => Promise<{
12
- scopes: string[];
13
16
  tsConfigs: {
14
17
  default: string;
15
18
  build: string;
@@ -18,6 +21,5 @@ export declare const getConfig: (props: GetConfigProps) => Promise<{
18
21
  };
19
22
  hooks: {
20
23
  afterSync: string[];
21
- runner: "pnpm";
22
24
  };
23
25
  }>;
@@ -5,16 +5,15 @@ import { pathExists } from 'path-exists';
5
5
  import { ZodError } from 'zod';
6
6
  import { configSchema } from './config-schema.js';
7
7
  import * as defaultConfig from './default-config.js';
8
- import { getRoot } from './get-root.js';
9
- const getPath = async ({ config }) => {
8
+ const getPath = async ({ config, rootDir }) => {
10
9
  if (config) {
11
- const path = isAbsolute(config) ? config : join(getRoot(), config);
10
+ const path = isAbsolute(config) ? config : join(rootDir, config);
12
11
  if (await pathExists(path)) {
13
12
  return path;
14
13
  }
15
14
  throw new Error(`Config '${path}' does not exist.`);
16
15
  }
17
- const fallback = join(getRoot(), 'sync-project-references.config.js');
16
+ const fallback = join(rootDir, 'sync-project-references.config.js');
18
17
  if (await pathExists(fallback)) {
19
18
  return fallback;
20
19
  }
@@ -1 +1 @@
1
- {"version":3,"file":"get-config.js","sourceRoot":"","sources":["../../../src/commands/sync-project-references/get-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE7C,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,SAAS,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAE/B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,aAAa,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AASxC,MAAM,OAAO,GAAG,KAAK,EAAE,EAAE,MAAM,EAAkB,EAAE,EAAE;IACnD,IAAI,MAAM,EAAE,CAAC;QACX,MAAM,IAAI,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,EAA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,EAAE,MAAiB,EAAE,EAAE,CAAC,MAAM;SAC7C,CAAC,CAAC;IACL,CAAC;IACD,OAAO,aAAa,CAAC,OAAO,CAAC;AAC/B,CAAC,CAAC"}
@@ -8,4 +8,4 @@ export interface GetExistingTsConfigPathProps extends WorkspacePackageProps {
8
8
  /**
9
9
  * Returns path to TS config file of a provided name if it exists.
10
10
  */
11
- export declare const getExistingTsConfigPath: ({ directory, tsConfig, workspacePackage, }: GetExistingTsConfigPathProps) => Promise<string | undefined>;
11
+ export declare const getExistingTsConfigPath: ({ tsConfig, workspacePackage }: GetExistingTsConfigPathProps) => Promise<string | undefined>;
@@ -1,11 +1,10 @@
1
1
  import { join } from 'node:path';
2
2
  import { pathExists } from 'path-exists';
3
- import { getRoot } from './get-root.js';
4
3
  /**
5
4
  * Returns path to TS config file of a provided name if it exists.
6
5
  */
7
- export const getExistingTsConfigPath = async ({ directory, tsConfig, workspacePackage, }) => {
8
- const path = join(getRoot(), directory, workspacePackage, tsConfig);
6
+ export const getExistingTsConfigPath = async ({ tsConfig, workspacePackage }) => {
7
+ const path = join(workspacePackage.dir, tsConfig);
9
8
  const exists = await pathExists(path);
10
9
  return exists ? path : undefined;
11
10
  };
@@ -1 +1 @@
1
- {"version":3,"file":"get-existing-ts-config-path.js","sourceRoot":"","sources":["../../../src/commands/sync-project-references/get-existing-ts-config-path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAUxC;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,KAAK,EAAE,EAC5C,SAAS,EACT,QAAQ,EACR,gBAAgB,GACa,EAAE,EAAE;IACjC,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,gBAAgB,EAAE,QAAQ,CAAC,CAAC;IACpE,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,IAAI,CAAC,CAAC;IACtC,OAAO,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;AACnC,CAAC,CAAC"}
1
+ {"version":3,"file":"get-existing-ts-config-path.js","sourceRoot":"","sources":["../../../src/commands/sync-project-references/get-existing-ts-config-path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAWzC;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,KAAK,EAAE,EAAE,QAAQ,EAAE,gBAAgB,EAAgC,EAAE,EAAE;IAC5G,MAAM,IAAI,GAAG,IAAI,CAAC,gBAAgB,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;IAClD,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,IAAI,CAAC,CAAC;IACtC,OAAO,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;AACnC,CAAC,CAAC"}
@@ -1,21 +1,18 @@
1
- import type { Object } from 'ts-toolbelt';
2
- import type { getPackageDependencies } from './get-package-dependencies.js';
1
+ import type { Package } from '@manypkg/get-packages';
3
2
  import type { GetTargetBuildConfigProps } from './get-target-build-config.js';
4
- import type { getWorkspaces } from './get-workspaces.js';
5
- import type { SyncProjectReferencesConfig, WorkspacePackageProps } from './types.js';
6
- export interface GetReferencesProps extends Pick<GetTargetBuildConfigProps, 'tsConfigs'>, Object.NonNullable<Pick<Required<SyncProjectReferencesConfig>, 'scopes'>>, Pick<WorkspacePackageProps, 'directory'> {
3
+ export interface GetReferencesProps extends Pick<GetTargetBuildConfigProps, 'tsConfigs'> {
7
4
  /**
8
- * Object containing package type and list of its internal (scoped) dependencies.
5
+ * Workspace package to check and update references for.
9
6
  */
10
- packageDependencies: Awaited<ReturnType<typeof getPackageDependencies>>;
7
+ workspacePackage: Package;
11
8
  /**
12
- * List of filtered workspaces (without the one currently being processed).
9
+ * List of workspaces to search for package references.
13
10
  */
14
- otherWorkspaces: Awaited<ReturnType<typeof getWorkspaces>>;
11
+ workspaces: Package[];
15
12
  }
16
13
  /**
17
14
  * Returns list of package references to be added to its TS config.
18
15
  */
19
- export declare const getReferences: ({ directory, packageDependencies: { dependencies, type }, otherWorkspaces, scopes, tsConfigs, }: GetReferencesProps) => Promise<{
16
+ export declare const getReferences: ({ tsConfigs, workspacePackage, workspaces }: GetReferencesProps) => Promise<{
20
17
  path: string;
21
18
  }[]>;
@@ -1,22 +1,22 @@
1
- import { join } from 'node:path';
1
+ import { join, relative } from 'node:path';
2
2
  import { notNil } from '@apitree.cz/ts-utils';
3
3
  import { getTargetBuildConfig } from './get-target-build-config.js';
4
+ import { getWorkspaceDependencies } from './get-workspace-dependencies.js';
4
5
  /**
5
6
  * Returns list of package references to be added to its TS config.
6
7
  */
7
- export const getReferences = async ({ directory, packageDependencies: { dependencies, type }, otherWorkspaces, scopes, tsConfigs, }) => {
8
- const references = await Promise.all(dependencies.map(async (packageDependency) => {
9
- const workspacePackage = packageDependency.replaceAll(new RegExp(`^(${scopes.join('|')})/`, 'g'), '');
10
- const workspace = otherWorkspaces.find(({ packages }) => packages.includes(workspacePackage));
8
+ export const getReferences = async ({ tsConfigs, workspacePackage, workspaces }) => {
9
+ const { dependencies, type } = await getWorkspaceDependencies({ workspacePackage, workspaces });
10
+ const references = await Promise.all(dependencies.map(async (dependency) => {
11
+ const workspace = workspaces.find(({ packageJson }) => packageJson.name === dependency);
11
12
  if (workspace) {
12
13
  const buildConfig = await getTargetBuildConfig({
13
- directory: workspace.directory,
14
14
  tsConfigs,
15
15
  type,
16
- workspacePackage,
16
+ workspacePackage: workspace,
17
17
  });
18
18
  return {
19
- path: join(directory === workspace.directory ? '../' : `../../${workspace.directory}`, buildConfig),
19
+ path: join(relative(workspacePackage.dir, workspace.dir), buildConfig),
20
20
  };
21
21
  }
22
22
  }));
@@ -1 +1 @@
1
- {"version":3,"file":"get-references.js","sourceRoot":"","sources":["../../../src/commands/sync-project-references/get-references.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAK9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAkBpE;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,EAAE,EAClC,SAAS,EACT,mBAAmB,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,EAC3C,eAAe,EACf,MAAM,EACN,SAAS,GACU,EAAE,EAAE;IACvB,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,GAAG,CAClC,YAAY,CAAC,GAAG,CAAC,KAAK,EAAE,iBAAiB,EAAE,EAAE;QAC3C,MAAM,gBAAgB,GAAG,iBAAiB,CAAC,UAAU,CAAC,IAAI,MAAM,CAAC,KAAK,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;QACtG,MAAM,SAAS,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC,CAAC;QAC9F,IAAI,SAAS,EAAE,CAAC;YACd,MAAM,WAAW,GAAG,MAAM,oBAAoB,CAAC;gBAC7C,SAAS,EAAE,SAAS,CAAC,SAAS;gBAC9B,SAAS;gBACT,IAAI;gBACJ,gBAAgB;aACjB,CAAC,CAAC;YACH,OAAO;gBACL,IAAI,EAAE,IAAI,CAAC,SAAS,KAAK,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,SAAS,CAAC,SAAS,EAAE,EAAE,WAAW,CAAC;aACpG,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CACH,CAAC;IACF,OAAO,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AAChF,CAAC,CAAC"}
1
+ {"version":3,"file":"get-references.js","sourceRoot":"","sources":["../../../src/commands/sync-project-references/get-references.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAI9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAa3E;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,EAAE,EAAE,SAAS,EAAE,gBAAgB,EAAE,UAAU,EAAsB,EAAE,EAAE;IACrG,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,GAAG,MAAM,wBAAwB,CAAC,EAAE,gBAAgB,EAAE,UAAU,EAAE,CAAC,CAAC;IAChG,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,GAAG,CAClC,YAAY,CAAC,GAAG,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE;QACpC,MAAM,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC;QACxF,IAAI,SAAS,EAAE,CAAC;YACd,MAAM,WAAW,GAAG,MAAM,oBAAoB,CAAC;gBAC7C,SAAS;gBACT,IAAI;gBACJ,gBAAgB,EAAE,SAAS;aAC5B,CAAC,CAAC;YACH,OAAO;gBACL,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,GAAG,EAAE,SAAS,CAAC,GAAG,CAAC,EAAE,WAAW,CAAC;aACvE,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CACH,CAAC;IACF,OAAO,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AAChF,CAAC,CAAC"}
@@ -13,4 +13,4 @@ export interface GetTargetBuildConfigProps extends WorkspacePackageProps {
13
13
  /**
14
14
  * Returns target TS build config path relative to workspace root.
15
15
  */
16
- export declare const getTargetBuildConfig: ({ directory, type, tsConfigs, workspacePackage, }: GetTargetBuildConfigProps) => Promise<string>;
16
+ export declare const getTargetBuildConfig: ({ type, tsConfigs, workspacePackage: { dir }, }: GetTargetBuildConfigProps) => Promise<string>;
@@ -1,14 +1,13 @@
1
1
  import { join } from 'node:path';
2
2
  import { pathExists } from 'path-exists';
3
- import { getRoot } from './get-root.js';
4
3
  /**
5
4
  * Returns target TS build config path relative to workspace root.
6
5
  */
7
- export const getTargetBuildConfig = async ({ directory, type, tsConfigs, workspacePackage, }) => {
8
- const tsConfig = join(workspacePackage, type === 'module' ? tsConfigs.esm : tsConfigs.cjs);
9
- if (await pathExists(join(getRoot(), directory, tsConfig))) {
6
+ export const getTargetBuildConfig = async ({ type, tsConfigs, workspacePackage: { dir }, }) => {
7
+ const tsConfig = type === 'module' ? tsConfigs.esm : tsConfigs.cjs;
8
+ if (await pathExists(join(dir, tsConfig))) {
10
9
  return tsConfig;
11
10
  }
12
- return join(workspacePackage, tsConfigs.build);
11
+ return tsConfigs.build;
13
12
  };
14
13
  //# sourceMappingURL=get-target-build-config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-target-build-config.js","sourceRoot":"","sources":["../../../src/commands/sync-project-references/get-target-build-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAcxC;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,EAAE,EACzC,SAAS,EACT,IAAI,EACJ,SAAS,EACT,gBAAgB,GACU,EAAE,EAAE;IAC9B,MAAM,QAAQ,GAAG,IAAI,CAAC,gBAAgB,EAAE,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAC3F,IAAI,MAAM,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC;QAC3D,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,OAAO,IAAI,CAAC,gBAAgB,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;AACjD,CAAC,CAAC"}
1
+ {"version":3,"file":"get-target-build-config.js","sourceRoot":"","sources":["../../../src/commands/sync-project-references/get-target-build-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAgBzC;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,EAAE,EACzC,IAAI,EACJ,SAAS,EACT,gBAAgB,EAAE,EAAE,GAAG,EAAE,GACC,EAAE,EAAE;IAC9B,MAAM,QAAQ,GAAG,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC;IACnE,IAAI,MAAM,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC;QAC1C,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,OAAO,SAAS,CAAC,KAAK,CAAC;AACzB,CAAC,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { Package } from '@manypkg/get-packages';
2
+ import type { WorkspacePackageProps } from './types.js';
3
+ export interface GetPackageDependenciesProps extends WorkspacePackageProps {
4
+ /**
5
+ * List of workspaces to search for package dependencies.
6
+ */
7
+ workspaces: Package[];
8
+ }
9
+ /**
10
+ * Returns object containing package type and list of its internal (scoped) dependencies.
11
+ */
12
+ export declare const getWorkspaceDependencies: ({ workspacePackage, workspaces }: GetPackageDependenciesProps) => Promise<{
13
+ type: string;
14
+ dependencies: string[];
15
+ }>;
@@ -0,0 +1,13 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ import { join } from 'node:path';
3
+ /**
4
+ * Returns object containing package type and list of its internal (scoped) dependencies.
5
+ */
6
+ export const getWorkspaceDependencies = async ({ workspacePackage, workspaces }) => {
7
+ const { dependencies = {}, devDependencies = {}, type = 'module', } = JSON.parse(await readFile(join(workspacePackage.dir, 'package.json'), 'utf8'));
8
+ return {
9
+ type,
10
+ dependencies: [...Object.keys(dependencies), ...Object.keys(devDependencies)].filter((dependency) => workspaces.some(({ packageJson }) => packageJson.name === dependency)),
11
+ };
12
+ };
13
+ //# sourceMappingURL=get-workspace-dependencies.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-workspace-dependencies.js","sourceRoot":"","sources":["../../../src/commands/sync-project-references/get-workspace-dependencies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAajC;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,KAAK,EAAE,EAAE,gBAAgB,EAAE,UAAU,EAA+B,EAAE,EAAE;IAC9G,MAAM,EACJ,YAAY,GAAG,EAAE,EACjB,eAAe,GAAG,EAAE,EACpB,IAAI,GAAG,QAAQ,GAChB,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,IAAI,CAAC,gBAAgB,CAAC,GAAG,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAIhF,CAAC;IACF,OAAO;QACL,IAAI;QACJ,YAAY,EAAE,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,EAAE,CAClG,UAAU,CAAC,IAAI,CAAC,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,KAAK,UAAU,CAAC,CACtE;KACF,CAAC;AACJ,CAAC,CAAC"}
@@ -1,7 +1,7 @@
1
1
  /**
2
- * Returns list of workspaces with their root directory (e.g. `./packages`) and workspace folder names.
2
+ * Returns list of workspaces and their root directory.
3
3
  */
4
- export declare const getWorkspaces: (scopes: string[]) => Promise<{
5
- directory: string;
6
- packages: string[];
7
- }[]>;
4
+ export declare const getWorkspaces: () => Promise<{
5
+ workspaces: import("@manypkg/get-packages").Package[];
6
+ rootDir: string;
7
+ }>;
@@ -1,38 +1,9 @@
1
- import { readFile, readdir } from 'node:fs/promises';
2
- import { join } from 'node:path';
3
- import { notNil } from '@apitree.cz/ts-utils';
4
- import { pathExists } from 'path-exists';
5
- import { getRoot } from './get-root.js';
6
- const getValidPackages = async (dirents, scopes) => {
7
- const names = await Promise.all(dirents.map(async (dirent) => {
8
- const packageJsonPath = join(dirent.path, dirent.name, 'package.json');
9
- if (await pathExists(packageJsonPath)) {
10
- const { name = '' } = JSON.parse(await readFile(packageJsonPath, 'utf8'));
11
- if (scopes.some((scope) => name.startsWith(scope))) {
12
- return name;
13
- }
14
- }
15
- }));
16
- return names.filter(notNil).map((name) => name.replaceAll(new RegExp(`^(${scopes.join('|')})/`, 'g'), ''));
17
- };
1
+ import { getPackages } from '@manypkg/get-packages';
18
2
  /**
19
- * Returns list of workspaces with their root directory (e.g. `./packages`) and workspace folder names.
3
+ * Returns list of workspaces and their root directory.
20
4
  */
21
- export const getWorkspaces = async (scopes) => {
22
- const root = getRoot();
23
- const packageJsonPath = join(root, 'package.json');
24
- const { workspaces = [] } = JSON.parse(await readFile(packageJsonPath, 'utf8'));
25
- const directories = workspaces.map((workspace) => workspace.replace('/*', ''));
26
- return Promise.all(directories.map(async (directory) => {
27
- const packages = await readdir(join(root, directory), {
28
- encoding: 'utf8',
29
- recursive: false,
30
- withFileTypes: true,
31
- });
32
- return {
33
- directory,
34
- packages: await getValidPackages(packages, scopes),
35
- };
36
- }));
5
+ export const getWorkspaces = async () => {
6
+ const { packages: workspaces, rootDir } = await getPackages(process.cwd());
7
+ return { workspaces, rootDir };
37
8
  };
38
9
  //# sourceMappingURL=get-workspaces.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-workspaces.js","sourceRoot":"","sources":["../../../src/commands/sync-project-references/get-workspaces.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,MAAM,gBAAgB,GAAG,KAAK,EAAE,OAAiB,EAAE,MAAgB,EAAE,EAAE;IACrE,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,GAAG,CAC7B,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;QAC3B,MAAM,eAAe,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;QACvE,IAAI,MAAM,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC;YACtC,MAAM,EAAE,IAAI,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,eAAe,EAAE,MA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AAM,gBAAgB,CAAC,QAAQ,EAAE,MAAM,CAAC;SACnD,CAAC;IACJ,CAAC,CAAC,CACH,CAAC;AACJ,CAAC,CAAC"}
1
+ {"version":3,"file":"get-workspaces.js","sourceRoot":"","sources":["../../../src/commands/sync-project-references/get-workspaces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,IAAI,EAAE;IACtC,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,MAAM,WAAW,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAC3E,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC;AACjC,CAAC,CAAC"}
@@ -1,8 +1,6 @@
1
- import childProcess from 'node:child_process';
2
- import { promisify } from 'node:util';
3
- const exec = promisify(childProcess.exec);
1
+ import { exec } from '../../utils.js';
4
2
  export const runHooks = async (hooks, paths) => {
5
- const { afterSync, runner } = hooks;
6
- await Promise.all(afterSync.map((hook) => exec(`${runner} ${hook} ${paths.join(' ')}`)));
3
+ const { afterSync } = hooks;
4
+ await Promise.all(afterSync.map((hook) => exec(`pnpm ${hook} ${paths.join(' ')}`)));
7
5
  };
8
6
  //# sourceMappingURL=run-hooks.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"run-hooks.js","sourceRoot":"","sources":["../../../src/commands/sync-project-references/run-hooks.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAMtC,MAAM,IAAI,GAAG,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;AAE1C,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,EAAE,KAA+D,EAAE,KAAe,EAAE,EAAE;IACjH,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IACpC,MAAM,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,MAAM,IAAI,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAC3F,CAAC,CAAC"}
1
+ {"version":3,"file":"run-hooks.js","sourceRoot":"","sources":["../../../src/commands/sync-project-references/run-hooks.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAItC,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,EAAE,KAA+D,EAAE,KAAe,EAAE,EAAE;IACjH,MAAM,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;IAC5B,MAAM,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AACtF,CAAC,CAAC"}
@@ -1,14 +1,10 @@
1
+ import type { Package } from '@manypkg/get-packages';
1
2
  export interface SyncProjectReferencesHooks {
2
3
  /**
3
4
  * Hook called after the project references are synced.
4
5
  * @defaultValue `['prettier --write']`
5
6
  */
6
7
  afterSync?: string[] | undefined;
7
- /**
8
- * Package manager runner to use for running the hooks.
9
- * @defaultValue `'pnpm'`
10
- */
11
- runner?: 'npx' | 'pnpm' | 'yarn' | undefined;
12
8
  }
13
9
  export interface SyncProjectReferencesTsConfigs {
14
10
  /**
@@ -37,11 +33,6 @@ export interface SyncProjectReferencesConfig {
37
33
  * Custom hooks to run as parts of the sync process.
38
34
  */
39
35
  hooks?: SyncProjectReferencesHooks | undefined;
40
- /**
41
- * Packages scope to use for the project.
42
- * @defaultValue `['@apitree.cz']`
43
- */
44
- scopes?: string[] | undefined;
45
36
  /**
46
37
  * Custom names for TS config files.
47
38
  */
@@ -49,11 +40,7 @@ export interface SyncProjectReferencesConfig {
49
40
  }
50
41
  export interface WorkspacePackageProps {
51
42
  /**
52
- * Workspace root directory (e.g. `./packages`).
53
- */
54
- directory: string;
55
- /**
56
- * Workspace package name (e.g. `cli`).
43
+ * Workspace package.
57
44
  */
58
- workspacePackage: string;
45
+ workspacePackage: Package;
59
46
  }
@@ -1,13 +1,6 @@
1
1
  import type { getReferences } from './get-references.js';
2
- export interface UpdateTsConfigsProps {
3
- /**
4
- * Workspace root directory (e.g. `./packages`).
5
- */
6
- directory: string;
7
- /**
8
- * Workspace package name (e.g. `cli`).
9
- */
10
- workspacePackage: string;
2
+ import type { WorkspacePackageProps } from './types.js';
3
+ export interface UpdateTsConfigsProps extends WorkspacePackageProps {
11
4
  /**
12
5
  * List of workspace package references.
13
6
  */
@@ -20,4 +13,4 @@ export interface UpdateTsConfigsProps {
20
13
  /**
21
14
  * Updates references in all configured TS configs. Returns list of updated TS config paths.
22
15
  */
23
- export declare const updateTsConfigs: ({ directory, references, tsConfigs, workspacePackage }: UpdateTsConfigsProps) => Promise<string[]>;
16
+ export declare const updateTsConfigs: ({ references, tsConfigs, workspacePackage }: UpdateTsConfigsProps) => Promise<string[]>;
@@ -4,10 +4,9 @@ import { getExistingTsConfigPath } from './get-existing-ts-config-path.js';
4
4
  /**
5
5
  * Updates references in all configured TS configs. Returns list of updated TS config paths.
6
6
  */
7
- export const updateTsConfigs = async ({ directory, references, tsConfigs, workspacePackage }) => {
7
+ export const updateTsConfigs = async ({ references, tsConfigs, workspacePackage }) => {
8
8
  const paths = await Promise.all(tsConfigs.map(async (tsConfig) => {
9
9
  const tsConfigPath = await getExistingTsConfigPath({
10
- directory,
11
10
  tsConfig,
12
11
  workspacePackage,
13
12
  });
@@ -1 +1 @@
1
- {"version":3,"file":"update-ts-configs.js","sourceRoot":"","sources":["../../../src/commands/sync-project-references/update-ts-configs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,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E,gBAAgB,EAAwB,EAAE,EAAE;IACzG,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,GAAG,CAC7B,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE;QAC/B,MAAM,YAAY,GAAG,MAAM,uBAAuB,CAAC;YACjD,QAAQ;YACR,gBAAgB;SACjB,CAAC,CAAC;QACH,IAAI,YAAY,EAAE,CAAC;YACjB,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC,CAAuC,CAAC;YAC5G,YAAY,CAAC,UAAU,GAAG,UAAU,CAAC;YACrC,MAAM,SAAS,CAAC,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC;YAC5D,OAAO,YAAY,CAAC;QACtB,CAAC;IACH,CAAC,CAAC,CACH,CAAC;IACF,OAAO,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAC9B,CAAC,CAAC"}
package/dist/utils.d.ts CHANGED
@@ -1,3 +1,6 @@
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ import childProcess from 'node:child_process';
3
+ export declare const exec: typeof childProcess.exec.__promisify__;
1
4
  export declare const logger: {
2
5
  info: {
3
6
  (...data: any[]): void;
package/dist/utils.js CHANGED
@@ -1,4 +1,7 @@
1
+ import childProcess from 'node:child_process';
2
+ import { promisify } from 'node:util';
1
3
  import { program } from '@commander-js/extra-typings';
4
+ export const exec = promisify(childProcess.exec);
2
5
  /* eslint-disable no-console */
3
6
  export const logger = {
4
7
  info: console.info,
package/dist/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAEtD,+BAA+B;AAC/B,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,IAAI,EAAE,OAAO,CAAC,IAAI;IAClB,IAAI,EAAE,OAAO,CAAC,IAAI;CACnB,CAAC;AACF,8BAA8B;AAE9B,MAAM,CAAC,MAAM,GAAG,GAAG,KAAK,EAAE,MAAqB,EAAE,EAAE;IACjD,IAAI,CAAC;QACH,MAAM,MAAM,CAAC;IACf,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IAC/B,CAAC;AACH,CAAC,CAAC"}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAEtD,MAAM,CAAC,MAAM,IAAI,GAAG,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;AAEjD,+BAA+B;AAC/B,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,IAAI,EAAE,OAAO,CAAC,IAAI;IAClB,IAAI,EAAE,OAAO,CAAC,IAAI;CACnB,CAAC;AACF,8BAA8B;AAE9B,MAAM,CAAC,MAAM,GAAG,GAAG,KAAK,EAAE,MAAqB,EAAE,EAAE;IACjD,IAAI,CAAC;QACH,MAAM,MAAM,CAAC;IACf,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IAC/B,CAAC;AACH,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apitree.cz/cli",
3
- "version": "0.1.2",
3
+ "version": "0.2.0-next.2f66920943b2cd7b1ab4cfc027f7735e2a3db039",
4
4
  "description": "Command line interface for ApiTree projects",
5
5
  "repository": {
6
6
  "type": "git",
@@ -19,6 +19,7 @@
19
19
  ],
20
20
  "dependencies": {
21
21
  "@commander-js/extra-typings": "^11.1.0",
22
+ "@manypkg/get-packages": "^2.2.0",
22
23
  "commander": "^11.1.0",
23
24
  "deepmerge": "^4.3.1",
24
25
  "path-exists": "^5.0.0",
@@ -31,12 +32,6 @@
31
32
  "typescript": "^5.3.3",
32
33
  "@apitree.cz/typedoc-config": "0.1.1"
33
34
  },
34
- "export": {
35
- ".": {
36
- "import": "./dist/index.js",
37
- "types": "./dist/index.d.ts"
38
- }
39
- },
40
35
  "scripts": {
41
36
  "prebuild": "rimraf dist tsconfig.build.tsbuildinfo",
42
37
  "build": "tsc --build tsconfig.build.json",
@@ -1,10 +0,0 @@
1
- import type { Object as ObjectType } from 'ts-toolbelt';
2
- import type { SyncProjectReferencesConfig, WorkspacePackageProps } from './types.js';
3
- export type GetPackageDependenciesProps = ObjectType.NonNullable<Pick<Required<SyncProjectReferencesConfig>, 'scopes'>> & WorkspacePackageProps;
4
- /**
5
- * Returns object containing package type and list of its internal (scoped) dependencies.
6
- */
7
- export declare const getPackageDependencies: ({ directory, scopes, workspacePackage }: GetPackageDependenciesProps) => Promise<{
8
- type: string;
9
- dependencies: string[];
10
- }>;
@@ -1,14 +0,0 @@
1
- import { readFile } from 'node:fs/promises';
2
- import { join } from 'node:path';
3
- import { getRoot } from './get-root.js';
4
- /**
5
- * Returns object containing package type and list of its internal (scoped) dependencies.
6
- */
7
- export const getPackageDependencies = async ({ directory, scopes, workspacePackage }) => {
8
- const { dependencies = {}, devDependencies = {}, type = 'module', } = JSON.parse(await readFile(join(getRoot(), directory, workspacePackage, 'package.json'), 'utf8'));
9
- return {
10
- type,
11
- dependencies: [...Object.keys(dependencies), ...Object.keys(devDependencies)].filter((dependency) => scopes.some((scope) => dependency.startsWith(scope))),
12
- };
13
- };
14
- //# sourceMappingURL=get-package-dependencies.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-package-dependencies.js","sourceRoot":"","sources":["../../../src/commands/sync-project-references/get-package-dependencies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIjC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAQxC;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,gBAAgB,EAA+B,EAAE,EAAE;IACnH,MAAM,EACJ,YAAY,GAAG,EAAE,EACjB,eAAe,GAAG,EAAE,EACpB,IAAI,GAAG,QAAQ,GAChB,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,gBAAgB,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAIlG,CAAC;IACF,OAAO;QACL,IAAI;QACJ,YAAY,EAAE,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,EAAE,CAClG,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CACrD;KACF,CAAC;AACJ,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- export declare const getRoot: () => string;
@@ -1,2 +0,0 @@
1
- export const getRoot = () => process.cwd();
2
- //# sourceMappingURL=get-root.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-root.js","sourceRoot":"","sources":["../../../src/commands/sync-project-references/get-root.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC"}