@vercel/build-utils 4.2.1 → 5.0.1
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/fs/run-user-scripts.d.ts +1 -1
- package/dist/fs/run-user-scripts.js +28 -7
- package/dist/index.d.ts +0 -14
- package/dist/index.js +36 -7552
- package/package.json +2 -3
- package/dist/detect-builders.d.ts +0 -37
- package/dist/detect-builders.js +0 -841
- package/dist/detect-file-system-api.d.ts +0 -34
- package/dist/detect-file-system-api.js +0 -173
- package/dist/detect-framework.d.ts +0 -12
- package/dist/detect-framework.js +0 -60
- package/dist/detectors/filesystem.d.ts +0 -54
- package/dist/detectors/filesystem.js +0 -78
- package/dist/fs/get-glob-fs.d.ts +0 -6
- package/dist/fs/get-glob-fs.js +0 -71
- package/dist/get-project-paths.d.ts +0 -9
- package/dist/get-project-paths.js +0 -39
- package/dist/monorepos/monorepo-managers.d.ts +0 -16
- package/dist/monorepos/monorepo-managers.js +0 -34
- package/dist/workspaces/get-workspace-package-paths.d.ts +0 -11
- package/dist/workspaces/get-workspace-package-paths.js +0 -62
- package/dist/workspaces/get-workspaces.d.ts +0 -12
- package/dist/workspaces/get-workspaces.js +0 -35
- package/dist/workspaces/workspace-managers.d.ts +0 -16
- package/dist/workspaces/workspace-managers.js +0 -60
@@ -1,12 +0,0 @@
|
|
1
|
-
import { DetectorFilesystem } from '../detectors/filesystem';
|
2
|
-
export interface GetWorkspaceOptions {
|
3
|
-
fs: DetectorFilesystem;
|
4
|
-
depth?: number;
|
5
|
-
cwd?: string;
|
6
|
-
}
|
7
|
-
export declare type WorkspaceType = 'yarn' | 'pnpm' | 'npm';
|
8
|
-
export declare type Workspace = {
|
9
|
-
type: WorkspaceType;
|
10
|
-
rootPath: string;
|
11
|
-
};
|
12
|
-
export declare function getWorkspaces({ fs, depth, cwd, }: GetWorkspaceOptions): Promise<Workspace[]>;
|
@@ -1,35 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.getWorkspaces = void 0;
|
7
|
-
const path_1 = __importDefault(require("path"));
|
8
|
-
const workspace_managers_1 = require("./workspace-managers");
|
9
|
-
const detect_framework_1 = require("../detect-framework");
|
10
|
-
const MAX_DEPTH_TRAVERSE = 3;
|
11
|
-
const posixPath = path_1.default.posix;
|
12
|
-
async function getWorkspaces({ fs, depth = MAX_DEPTH_TRAVERSE, cwd = '/', }) {
|
13
|
-
if (depth === 0)
|
14
|
-
return [];
|
15
|
-
const workspaceType = await detect_framework_1.detectFramework({
|
16
|
-
fs,
|
17
|
-
frameworkList: workspace_managers_1.workspaceManagers,
|
18
|
-
});
|
19
|
-
if (workspaceType === null) {
|
20
|
-
const directoryContents = await fs.readdir('./');
|
21
|
-
const childDirectories = directoryContents.filter(stat => stat.type === 'dir');
|
22
|
-
return (await Promise.all(childDirectories.map(childDirectory => getWorkspaces({
|
23
|
-
fs: fs.chdir(childDirectory.path),
|
24
|
-
depth: depth - 1,
|
25
|
-
cwd: posixPath.join(cwd, childDirectory.path),
|
26
|
-
})))).flat();
|
27
|
-
}
|
28
|
-
return [
|
29
|
-
{
|
30
|
-
type: workspaceType,
|
31
|
-
rootPath: cwd,
|
32
|
-
},
|
33
|
-
];
|
34
|
-
}
|
35
|
-
exports.getWorkspaces = getWorkspaces;
|
@@ -1,16 +0,0 @@
|
|
1
|
-
import type { Framework } from '@vercel/frameworks';
|
2
|
-
/**
|
3
|
-
* The supported list of workspace managers.
|
4
|
-
*
|
5
|
-
* This list is designed to work with the @see {@link detectFramework} function.
|
6
|
-
*
|
7
|
-
* @example
|
8
|
-
* import { workspaceManagers as frameworkList } from '@vercel/build-utils'
|
9
|
-
* import { detectFramework } from '@vercel/build-utils'
|
10
|
-
*
|
11
|
-
* const fs = new GitDetectorFilesystem(...)
|
12
|
-
* detectFramwork({ fs, frameworkList }) // returns the 'slug' field if detected, otherwise null
|
13
|
-
*
|
14
|
-
*/
|
15
|
-
export declare const workspaceManagers: Array<Omit<Framework, 'description' | 'logo' | 'settings' | 'getOutputDirName'>>;
|
16
|
-
export default workspaceManagers;
|
@@ -1,60 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.workspaceManagers = void 0;
|
4
|
-
/**
|
5
|
-
* The supported list of workspace managers.
|
6
|
-
*
|
7
|
-
* This list is designed to work with the @see {@link detectFramework} function.
|
8
|
-
*
|
9
|
-
* @example
|
10
|
-
* import { workspaceManagers as frameworkList } from '@vercel/build-utils'
|
11
|
-
* import { detectFramework } from '@vercel/build-utils'
|
12
|
-
*
|
13
|
-
* const fs = new GitDetectorFilesystem(...)
|
14
|
-
* detectFramwork({ fs, frameworkList }) // returns the 'slug' field if detected, otherwise null
|
15
|
-
*
|
16
|
-
*/
|
17
|
-
exports.workspaceManagers = [
|
18
|
-
{
|
19
|
-
name: 'Yarn',
|
20
|
-
slug: 'yarn',
|
21
|
-
detectors: {
|
22
|
-
every: [
|
23
|
-
{
|
24
|
-
path: 'package.json',
|
25
|
-
matchContent: '"workspaces":\\s*(?:\\[[^\\]]*]|{[^}]*"packages":[^}]*})',
|
26
|
-
},
|
27
|
-
{
|
28
|
-
path: 'yarn.lock',
|
29
|
-
},
|
30
|
-
],
|
31
|
-
},
|
32
|
-
},
|
33
|
-
{
|
34
|
-
name: 'pnpm',
|
35
|
-
slug: 'pnpm',
|
36
|
-
detectors: {
|
37
|
-
every: [
|
38
|
-
{
|
39
|
-
path: 'pnpm-workspace.yaml',
|
40
|
-
},
|
41
|
-
],
|
42
|
-
},
|
43
|
-
},
|
44
|
-
{
|
45
|
-
name: 'npm',
|
46
|
-
slug: 'npm',
|
47
|
-
detectors: {
|
48
|
-
every: [
|
49
|
-
{
|
50
|
-
path: 'package.json',
|
51
|
-
matchContent: '"workspaces":\\s*(?:\\[[^\\]]*]|{[^}]*"packages":[^}]*})',
|
52
|
-
},
|
53
|
-
{
|
54
|
-
path: 'package-lock.json',
|
55
|
-
},
|
56
|
-
],
|
57
|
-
},
|
58
|
-
},
|
59
|
-
];
|
60
|
-
exports.default = exports.workspaceManagers;
|