Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: address problems uncovered when testing deprecating Hashicups #377

Merged
merged 1 commit into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/deprecate-packages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@ export class DeprecatePackages {
`// but these will not be compatible with newer versions of CDK for Terraform and are not eligible for commercial support.`,
`// You can continue to use the ${providerName} provider in your CDK for Terraform projects with newer versions of CDKTF,`,
`// but you will need to generate the bindings locally. See https://cdk.tf/imports for details.`,
].join("\n");
``,
].join("\\n");

const deprecationStep: JobStep = {
name: "Mark the Go module as deprecated",
run: `find '.repo/dist/go' -mindepth 2 -maxdepth 4 -type f -name 'go.mod' | xargs sed -i '1s|^|${deprecationMessageForGo} \n|'`,
run: `find '.repo/dist/go' -mindepth 2 -maxdepth 4 -type f -name 'go.mod' | xargs sed -i '1s|^|${deprecationMessageForGo}|'`,
continueOnError: true, // @TODO remove this once we confirm it to be working
};
if (isDeprecated) {
Expand Down Expand Up @@ -70,7 +71,10 @@ export class DeprecatePackages {
{
name: "Deprecate the package on NPM",
if: "steps.check_status.outputs.is_deprecated",
run: `npm deprecate ${packageInfo.npm.name} "${deprecationMessageForNPM}"`,
run: [
'npm set "//$NPM_REGISTRY/:_authToken=$NPM_TOKEN"',
`npm deprecate ${packageInfo.npm.name} "${deprecationMessageForNPM}"`,
].join("\n"),
env: {
NPM_REGISTRY: project.package.npmRegistry,
NPM_TOKEN:
Expand Down
17 changes: 1 addition & 16 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -392,10 +392,10 @@ export class CdktfProviderProject extends cdk.JsiiProject {
],
});

const releaseTask = this.tasks.tryFind("release")!;
if (!isDeprecated) {
new ShouldReleaseScriptFile(this, {});

const releaseTask = this.tasks.tryFind("release")!;
this.removeTask("release");
this.addTask("release", {
description: releaseTask.description,
Expand All @@ -420,21 +420,6 @@ export class CdktfProviderProject extends cdk.JsiiProject {
gitRemoteJob.name +=
" or cancel via faking a SHA if release was cancelled";
}
if (isDeprecated) {
// It's not clear to me why, but 'unbump' doesn't seem to have an effect and `npx projen release` fails
// This isn't a very elegant solution but I also don't feel like fighting Projen over an edge case
const releaseTaskSteps = releaseTask.steps;
releaseTaskSteps.splice(-1, 0, {
exec: "git checkout HEAD -- package.json",
});

this.removeTask("release");
this.addTask("release", {
description: releaseTask.description,
steps: releaseTaskSteps,
env: (releaseTask as any)._env,
});
}

// Submodule documentation generation
this.gitignore.exclude("API.md"); // ignore the old file, we now generate it in the docs folder
Expand Down
27 changes: 13 additions & 14 deletions test/__snapshots__/index.test.ts.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.