-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
42 changed files
with
215 additions
and
204 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/helpers/generate-npm-lockfile.ts → ...lockfile/helpers/generate-npm-lockfile.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./process-lockfile"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 4 additions & 7 deletions
11
src/helpers/adapt-target-package-manifest.ts → ...manifest/adapt-target-package-manifest.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...lpers/adapt-internal-package-manifests.ts → ...lpers/adapt-internal-package-manifests.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 2 additions & 5 deletions
7
src/helpers/adapt-manifest-internal-deps.ts → ...t/helpers/adapt-manifest-internal-deps.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export * from "./adapt-internal-package-manifests"; | ||
export * from "./adapt-manifest-internal-deps"; | ||
export * from "./patch-internal-entries"; |
4 changes: 2 additions & 2 deletions
4
src/helpers/patch-internal-entries.ts → ...anifest/helpers/patch-internal-entries.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export * from "./adapt-target-package-manifest"; | ||
export * from "./helpers"; | ||
export * from "./import-manifest"; |
5 changes: 3 additions & 2 deletions
5
src/helpers/get-build-output-dir.ts → src/lib/output/get-build-output-dir.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export * from "./get-build-output-dir"; | ||
export * from "./pack-dependencies"; | ||
export * from "./process-build-output-files"; | ||
export * from "./unpack-dependencies"; |
9 changes: 5 additions & 4 deletions
9
src/helpers/pack-dependencies.ts → src/lib/output/pack-dependencies.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
src/helpers/process-build-output-files.ts → src/lib/output/process-build-output-files.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
src/helpers/unpack-dependencies.ts → src/lib/output/unpack-dependencies.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import fs from "fs-extra"; | ||
import { execSync } from "node:child_process"; | ||
import path from "node:path"; | ||
import type { PackageManager, PackageManagerName } from "../names"; | ||
import { getLockfileFileName, supportedPackageManagerNames } from "../names"; | ||
|
||
export function inferFromFiles(workspaceRoot: string): PackageManager { | ||
for (const name of supportedPackageManagerNames) { | ||
const lockfileName = getLockfileFileName(name); | ||
|
||
if (fs.existsSync(path.join(workspaceRoot, lockfileName))) { | ||
return { name, version: getVersion(name) }; | ||
} | ||
} | ||
|
||
/** If no lockfile was found, it could be that there is an npm shrinkwrap file. */ | ||
if (fs.existsSync(path.join(workspaceRoot, "npm-shrinkwrap.json"))) { | ||
return { name: "npm", version: getVersion("npm") }; | ||
} | ||
|
||
throw new Error(`Failed to detect package manager`); | ||
} | ||
function getVersion(packageManagerName: PackageManagerName): string { | ||
const buffer = execSync(`${packageManagerName} --version`); | ||
return buffer.toString().trim(); | ||
} |
Oops, something went wrong.