@jakubmazanec/carson 0.2.0 → 0.3.0-next.1b2cc9c
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 +11 -11
- package/dist/constants.d.ts +2 -1
- package/dist/constants.js +2 -1
- package/dist/constants.js.map +1 -1
- package/dist/template/applyTemplateRenders.d.ts +3 -2
- package/dist/template/applyTemplateRenders.js +5 -6
- package/dist/template/applyTemplateRenders.js.map +1 -1
- package/dist/template/internals/createUsingTemplateRender.js +49 -4
- package/dist/template/internals/createUsingTemplateRender.js.map +1 -1
- package/dist/template/internals/mergeUsingTemplateRender.js +26 -14
- package/dist/template/internals/mergeUsingTemplateRender.js.map +1 -1
- package/dist/workspace/Project.js +19 -14
- package/dist/workspace/Project.js.map +1 -1
- package/dist/workspace/Workspace.d.ts +3 -0
- package/dist/workspace/Workspace.js +29 -19
- package/dist/workspace/Workspace.js.map +1 -1
- package/dist/workspace/internals/containsProject.js +9 -4
- package/dist/workspace/internals/containsProject.js.map +1 -1
- package/dist/workspace/internals/containsWorkspace.d.ts +1 -0
- package/dist/workspace/internals/containsWorkspace.js +14 -0
- package/dist/workspace/internals/containsWorkspace.js.map +1 -0
- package/dist/workspace/internals.d.ts +1 -0
- package/dist/workspace/internals.js +1 -0
- package/dist/workspace/internals.js.map +1 -1
- package/package.json +2 -2
- package/src/constants.ts +2 -1
- package/src/template/applyTemplateRenders.ts +8 -12
- package/src/template/internals/createUsingTemplateRender.ts +42 -2
- package/src/template/internals/mergeUsingTemplateRender.ts +17 -9
- package/src/workspace/Project.ts +21 -12
- package/src/workspace/Workspace.ts +39 -22
- package/src/workspace/internals/containsProject.ts +19 -4
- package/src/workspace/internals/containsWorkspace.ts +24 -0
- package/src/workspace/internals.ts +1 -0
|
@@ -1,14 +1,29 @@
|
|
|
1
|
+
import {type PackageJson} from '@jakubmazanec/zod-utils';
|
|
1
2
|
import fs from 'fs-extra';
|
|
2
3
|
import path from 'node:path';
|
|
3
4
|
|
|
4
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
CARSON_CONFIG_DIRECTORY,
|
|
7
|
+
PACKAGE_JSON_FILENAME,
|
|
8
|
+
PROJECT_CONFIG_FILENAME,
|
|
9
|
+
} from '../../constants.js';
|
|
5
10
|
|
|
6
11
|
export async function containsProject(directoryPath: string): Promise<boolean> {
|
|
7
|
-
|
|
8
|
-
|
|
12
|
+
let packageJsonPath = path.join(directoryPath, PACKAGE_JSON_FILENAME);
|
|
13
|
+
|
|
14
|
+
if (await fs.pathExists(packageJsonPath)) {
|
|
15
|
+
let packageJson = (await fs.readJson(packageJsonPath)) as PackageJson | undefined;
|
|
16
|
+
|
|
17
|
+
if (packageJson?.name) {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return false;
|
|
9
22
|
}
|
|
10
23
|
|
|
11
|
-
if (
|
|
24
|
+
if (
|
|
25
|
+
await fs.pathExists(path.join(directoryPath, CARSON_CONFIG_DIRECTORY, PROJECT_CONFIG_FILENAME))
|
|
26
|
+
) {
|
|
12
27
|
return true;
|
|
13
28
|
}
|
|
14
29
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import fs from 'fs-extra';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
CARSON_CONFIG_DIRECTORY,
|
|
6
|
+
PACKAGE_JSON_FILENAME,
|
|
7
|
+
WORKSPACE_CONFIG_FILENAME,
|
|
8
|
+
} from '../../constants.js';
|
|
9
|
+
|
|
10
|
+
export async function containsWorkspace(directoryPath: string): Promise<boolean> {
|
|
11
|
+
if (await fs.pathExists(path.join(directoryPath, PACKAGE_JSON_FILENAME))) {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (
|
|
16
|
+
await fs.pathExists(
|
|
17
|
+
path.join(directoryPath, CARSON_CONFIG_DIRECTORY, WORKSPACE_CONFIG_FILENAME),
|
|
18
|
+
)
|
|
19
|
+
) {
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
@@ -2,6 +2,7 @@ export * from './internals/compareProjectPath.js';
|
|
|
2
2
|
export * from './internals/compareSemver.js';
|
|
3
3
|
export * from './internals/compareWorkspaceDependencyProjectName.js';
|
|
4
4
|
export * from './internals/containsProject.js';
|
|
5
|
+
export * from './internals/containsWorkspace.js';
|
|
5
6
|
export * from './internals/getPackageJsonWorkspaces.js';
|
|
6
7
|
export * from './internals/getRepositoryBranches.js';
|
|
7
8
|
export * from './internals/getRepositoryUrl.js';
|