Skip to content

Commit

Permalink
chore: fix upgrade-dependencies task (#247)
Browse files Browse the repository at this point in the history
We do not use the `exclude` keyword and likely will not for the
foreseeable future. Just dropping it for now. We will have to
re-implement that if we need it but I don't see why we would -- this
decision was also made in projen:
https://github.com/projen/projen/pull/2845/files. This continues work
started because projen had breaking changes.


---

By submitting this pull request, I confirm that my contribution is made
under the terms of the [Apache 2.0 license].

[Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0

---------

Signed-off-by: github-actions <github-actions@github.com>
Signed-off-by: Kaizen Conroy <36202692+kaizencc@users.noreply.github.com>
Co-authored-by: github-actions <github-actions@github.com>
  • Loading branch information
kaizencc and github-actions authored Aug 16, 2023
1 parent f3d8c1d commit d95d54f
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions projenrc/upgrade-dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,6 @@ const PATCH_CREATED_OUTPUT = 'patch_created';
* Options for `UpgradeDependencies`.
*/
export interface UpgradeDependenciesOptions {
/**
* List of package names to exclude during the upgrade.
*
* @default - Nothing is excluded.
*/
readonly exclude?: string[];

/**
* List of package names to include during the upgrade.
*
Expand Down Expand Up @@ -154,8 +147,6 @@ export class UpgradeDependencies extends Component {
}

private renderTaskSteps(): TaskStep[] {
const exclude = this.options.exclude ?? [];

// exclude depedencies that has already version pinned (fully or with patch version) by Projen with ncu (but not package manager upgrade)
// Getting only unique values through set
const ncuExcludes = [
Expand All @@ -166,8 +157,7 @@ export class UpgradeDependencies extends Component {
dep.name === 'typescript' ||
(dep.version && dep.version[0] !== '^' && dep.type !== DependencyType.OVERRIDE),
)
.map((dep) => dep.name)
.concat(exclude),
.map((dep) => dep.name),
),
];
// TypeScript is minor-pinned in this project...
Expand Down Expand Up @@ -214,7 +204,7 @@ export class UpgradeDependencies extends Component {

// run upgrade command to upgrade transitive deps as well
steps.push({
exec: this._project.package.renderUpgradePackagesCommand(exclude, this.options.include),
exec: this.renderUpgradePackagesCommand(this.options.include),
});

// run "projen" to give projen a chance to update dependencies (it will also run "yarn install")
Expand Down Expand Up @@ -335,10 +325,10 @@ export class UpgradeDependencies extends Component {
/**
* Render a package manager specific command to upgrade all requested dependencies.
*/
private renderUpgradePackagesCommand(include: string[]): string {
private renderUpgradePackagesCommand(include?: string[]): string {
function upgradePackages(command: string) {
return () => {
return `${command} ${include.join(' ')}`;
return `${command} ${(include ?? []).join(' ')}`.trim();
};
}

Expand Down

0 comments on commit d95d54f

Please sign in to comment.