-
Notifications
You must be signed in to change notification settings - Fork 63
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
17 changed files
with
536 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
version: 0.2 | ||
env: | ||
shell: bash | ||
git-credential-helper: yes | ||
phases: | ||
build: | ||
commands: | ||
- source ./shared-scripts.sh && _deprecate |
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,14 @@ | ||
version: 0.2 | ||
env: | ||
shell: bash | ||
compute-type: BUILD_GENERAL1_SMALL | ||
|
||
batch: | ||
fast-fail: false | ||
build-graph: | ||
- identifier: install_linux | ||
buildspec: .codebuild/install_linux.yml | ||
- identifier: deprecate | ||
buildspec: .codebuild/deprecate.yml | ||
depend-on: | ||
- install_linux |
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,10 @@ | ||
version: 0.2 | ||
env: | ||
shell: bash | ||
phases: | ||
build: | ||
commands: | ||
- source ./shared-scripts.sh && _installLinux | ||
artifacts: | ||
files: | ||
- 'shared-scripts.sh' |
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,7 +1,7 @@ | ||
#!/bin/bash | ||
|
||
custom_registry_url=http://localhost:4873 | ||
default_verdaccio_package=verdaccio@4.5.1 | ||
[email protected].2 | ||
|
||
function startLocalRegistry { | ||
# Start local 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
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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { EOL } from 'os'; | ||
import { NpmClient } from './npm_client.js'; | ||
import { releaseTagToNameAndVersion } from './release_tag_to_name_and_version'; | ||
|
||
type DistTagMoveAction = { | ||
/** | ||
* An NPM dist-tag | ||
*/ | ||
distTag: string; | ||
/** | ||
* This is a string of the form <packageName>@<version> | ||
*/ | ||
releaseTag: string; | ||
}; | ||
|
||
/** | ||
* Handles moving npm dist-tags from one package version to another | ||
*/ | ||
export class DistTagMover { | ||
/** | ||
* Initialize with an npmClient | ||
*/ | ||
constructor(private readonly npmClient: NpmClient) {} | ||
|
||
/** | ||
* Given a list of sourceReleaseTags and destReleaseTags, | ||
* any npm dist-tags that are pointing to a sourceReleaseTag will be moved to point to the corresponding destReleaseTag | ||
*/ | ||
moveDistTags = async (sourceReleaseTags: string[], destReleaseTags: string[]) => { | ||
const moveActions: DistTagMoveAction[] = []; | ||
|
||
for (const sourceReleaseTag of sourceReleaseTags) { | ||
const { packageName, version: sourceVersion } = releaseTagToNameAndVersion(sourceReleaseTag); | ||
|
||
const { 'dist-tags': distTags } = await this.npmClient.getPackageInfo(sourceReleaseTag); | ||
|
||
Object.entries(distTags).forEach(([tagName, versionAtTag]) => { | ||
if (versionAtTag !== sourceVersion) { | ||
return; | ||
} | ||
const destReleaseTag = destReleaseTags.find(releaseTag => releaseTag.includes(packageName)); | ||
if (!destReleaseTag) { | ||
console.warn(`No corresponding destination release tag found for ${sourceReleaseTag}. latest tag not moved.`); | ||
} else { | ||
moveActions.push({ | ||
releaseTag: destReleaseTag, | ||
distTag: tagName, | ||
}); | ||
} | ||
}); | ||
} | ||
|
||
for (const { distTag, releaseTag } of moveActions) { | ||
console.log(`Moving dist tag "${distTag}" to release tag ${releaseTag}`); | ||
await this.npmClient.setDistTag(releaseTag, distTag); | ||
console.log(`Done!${EOL}`); | ||
} | ||
}; | ||
} |
Oops, something went wrong.