-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
97390b8
commit 11f2bab
Showing
12 changed files
with
223 additions
and
24 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
export * from "./createPat.js"; | ||
export * from "./createUserNpmrc.js"; | ||
export * from "./makeParsedProjectNpmrc.js"; | ||
export * from "./parseProjectNpmrc.js"; | ||
export * from "./types.js"; | ||
export * from "./writeNpmrc.js"; |
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,50 @@ | ||
import { describe, expect, it } from "vitest"; | ||
|
||
import { makeParsedProjectNpmrc } from "./makeParsedProjectNpmrc.js"; | ||
|
||
describe("makeParsedProjectNpmrc", () => { | ||
it("given no project it constructs an organisation feed ParsedProjectNpmrc", () => { | ||
const result = makeParsedProjectNpmrc({ | ||
organization: "johnnyreilly", | ||
feed: "npmrc-script-organization", | ||
}); | ||
expect(result).toEqual({ | ||
organization: "johnnyreilly", | ||
urlWithoutRegistryAtEnd: | ||
"//pkgs.dev.azure.com/johnnyreilly/_packaging/npmrc-script-organization/npm/", | ||
urlWithoutRegistryAtStart: | ||
"//pkgs.dev.azure.com/johnnyreilly/_packaging/npmrc-script-organization/npm/registry/", | ||
}); | ||
}); | ||
|
||
it("given a project it constructs a project feed ParsedProjectNpmrc", () => { | ||
const result = makeParsedProjectNpmrc({ | ||
organization: "johnnyreilly", | ||
project: "azure-static-web-apps", | ||
feed: "npmrc-script-demo", | ||
}); | ||
expect(result).toEqual({ | ||
organization: "johnnyreilly", | ||
urlWithoutRegistryAtEnd: | ||
"//pkgs.dev.azure.com/johnnyreilly/azure-static-web-apps/_packaging/npmrc-script-demo/npm/", | ||
urlWithoutRegistryAtStart: | ||
"//pkgs.dev.azure.com/johnnyreilly/azure-static-web-apps/_packaging/npmrc-script-demo/npm/registry/", | ||
}); | ||
}); | ||
}); | ||
/* | ||
registry=https://pkgs.dev.azure.com/investec/_packaging/investec-npm-packages/npm/registry | ||
always-auth=true | ||
registry=https://pkgs.dev.azure.com/johnnyreilly/ _packaging/npmrc-script-organization/npm/registry/ | ||
always-auth=true | ||
registry=https://pkgs.dev.azure.com/johnnyreilly/azure-static-web-apps/_packaging/npmrc-script-demo/npm/registry/ | ||
always-auth=true | ||
registry=https://pkgs.dev.azure.com/[ORGANIZATION]/[PROJECT]/_packaging/[FEED_NAME]/npm/registry/ | ||
*/ |
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,38 @@ | ||
import type { ParsedProjectNpmrc } from "./types.js"; | ||
|
||
import { fallbackLogger, type Logger } from "./shared/cli/logger.js"; | ||
|
||
/** | ||
* Construct a ParsedProjectNpmrc object using the provided parameters | ||
*/ | ||
export function makeParsedProjectNpmrc({ | ||
organization, | ||
project, | ||
feed, | ||
logger = fallbackLogger, | ||
}: { | ||
organization: string; | ||
project?: string | undefined; | ||
feed: string; | ||
logger?: Logger; | ||
}): ParsedProjectNpmrc { | ||
const urlWithoutRegistryAtEnd = project | ||
? `//pkgs.dev.azure.com/${organization}/${project}/_packaging/${feed}/npm/` | ||
: `//pkgs.dev.azure.com/${organization}/_packaging/${feed}/npm/`; | ||
|
||
const urlWithoutRegistryAtStart = project | ||
? `//pkgs.dev.azure.com/${organization}/${project}/_packaging/${feed}/npm/registry/` | ||
: `//pkgs.dev.azure.com/${organization}/_packaging/${feed}/npm/registry/`; | ||
|
||
// eg | ||
// organization: "johnnyreilly", | ||
// urlWithoutRegistryAtEnd: "//pkgs.dev.azure.com/johnnyreilly/_packaging/npmrc-script-organization/npm/", | ||
// urlWithoutRegistryAtStart: "//pkgs.dev.azure.com/johnnyreilly/_packaging/npmrc-script-organization/npm/registry/", | ||
|
||
logger.info(`Made: | ||
- organization: ${organization} | ||
- urlWithoutRegistryAtStart: ${urlWithoutRegistryAtStart} | ||
- urlWithoutRegistryAtEnd: ${urlWithoutRegistryAtEnd}`); | ||
|
||
return { urlWithoutRegistryAtStart, urlWithoutRegistryAtEnd, organization }; | ||
} |
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
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