cdklabs / construct-hub

AWS CDK construct library that can be used to deploy instances of the Construct Hub in any AWS Account.
https://constructs.dev
Apache License 2.0
201 stars 26 forks source link

Library deprecation support #343

Open Chriscbr opened 2 years ago

Chriscbr commented 2 years ago

Deprecation is an important part of the open source software lifecycle. Construct library vendors should have a way to mark a library as deprecated on the Construct Hub.

On NPM, authors can specifically mark their packages as deprecated, in a process which allows them to include a deprecation reason. See https://docs.npmjs.com/deprecating-and-undeprecating-packages-or-package-versions

Requiring authors to specify some kind of extra metadata in their package.json isn't really appropriate here because after an author has deprecated a library, it's likely they do not want to publish a new version (with the updated package.json).

A more appropriate solution here is to check against externally to see if the package has been deprecated. It's possible to check if the package has been deprecated on npm from the output of npm view <package> --json. (We could also (optionally) check if the package's repository is on GitHub, in which case if the repository has been archived then we could assume it has been deleted.)

If a package is deprecated, we still want to show it and its API reference, but we probably don't want to show it in search results (?) and we should clearly indicate that it is deprecated on the package's detail page

github-actions[bot] commented 2 years ago

This issue is now marked as stale because it hasn't seen activity for a while. Add a comment or it will be closed soon.

github-actions[bot] commented 2 years ago

This issue is now marked as stale because it hasn't seen activity for a while. Add a comment or it will be closed soon.

mrgrain commented 2 years ago

In addition authors can mark specific versions of a package as deprecated. By default they are hidden on npmjs.com and viewing a deprecate version does prominently display a deprecation notice.

xiehan commented 2 years ago

Upvoting this on behalf of HashiCorp -- we have a prebuilt provider that we decided to no longer maintain: https://github.com/hashicorp/cdktf-provider-yandex and archived the GitHub repo, but it is still appearing as though it is actively being supported in Construct Hub: https://constructs.dev/packages/@cdktf/provider-yandex/v/2.0.32?lang=typescript which is quite problematic for us.

cfuerst commented 1 year ago

Shortly checked the situation, roughly 100 packages listed which are either deprecated or gone from npm registry

#/bin/bash
# needs jq and npm install -g check-is-deprecated
echo '["'$(check-is-deprecated $(curl -s "https://constructs.dev/catalog.json"| jq -c '.packages[] | .name' | sort -u | jq -scr ' join(" ")') | tr '\n' '--')'"]' \
  | jq '.[0] | split("--")[] | split(":") | {package: .[0], verdict: (if .[1] == "-✖ npm" then "deprecared" else "gone" end)}' \
  | jq -s 'group_by(.verdict)[] | {(.[0].verdict): [.[] | .package]}' | jq -s
[
  {
    "deprecared": [
      "@aws-cdk/app-delivery",
      "@aws-cdk/assets-docker",
      "@aws-cdk/aws-dynamodb-global",
      "@aws-cdk/aws-eks-legacy",
      "@aws-cdk/aws-quickstarts",
      "@aws-cdk/cdk",
      "@aws-cdk/cdk-assets-schema",
      "@aws-cdk/runtime-values",
      "@aws-cdk/yaml-cfn",
      "@cdk-cloudformation/alexa-ask-skill",
      "@cdk-cloudformation/registry-test-resource1-module",
      "@moia-dev/bastion-host-forward",
      "@moia-dev/bastion-host-rds-forward",
      "@pepperize-testing/cdk-autoscaling-gitlab-runner",
      "@pepperize/cdk-serverless-cluster-from-snapshot",
      "@quirion/cdk-constructs",
      "@stackspot/cdk-core",
      "@stackspot/cdk-event-bridge",
      "@stackspot/cdk-sns",
      "@stefanfreitag/aws-budget-notifier",
      "cdk-automated-waf",
      "cdk-cloudfront-deploy",
      "cdk-datalake-constructs",
      "cdk-lambda-token-authorizer-jwt",
      "cdk-secrets",
      "cdk-ssm-document",
      "cdk-ssm-documents",
      "cdk-triggers",
      "hiii-construct-utils",
      "monocdk-experiment",
      "monocdk-nag",
      "monocdk-serverless-clamscan",
      "pgstac-cdk-construct",
      "udondan-test-package"
    ]
  },
  {
    "gone": [
      "@cloudxs/cdk-iot-lorawan",
      "@jayhuss/npm-zip-lambda",
      "@jayhuss/serverless-nextjs",
      "@jhuss/code-zip",
      "@kikoda/constructs",
      "@pepperize-testing/cdk-ses-smtp-credentials",
      "@renovosolutions/cdk-managed-instance-role",
      "@richicoder/cdk-ecs-s3-files",
      "@rocktemplates/aws-cdk-templates",
      "@stackspot/cdk-api-gateway",
      "@stackspot/cdk-app-task-definition",
      "@stackspot/cdk-ecs",
      "@stackspot/cdk-env-container",
      "@stackspot/cdk-env-eventbridge",
      "@stackspot/cdk-env-load-balancer",
      "@stackspot/cdk-env-sns",
      "@stackspot/cdk-env-vpc",
      "@stackspot/cdk-load-balancer",
      "@stackspot/cdk-vpc",
      "cdk-chime-phone-numbers",
      "cdk-ec2-imagebuilder",
      "cdk-ecs-service-extensions",
      "cdk-ez-vpc",
      "cdk-k0s-cluster",
      "cdk-monitoring",
      "cdk-rstudio-sagemaker",
      "cdk-rstudio-workflow",
      "cdk-vue3",
      "cdkfoldingathome",
      "cdktf-dbt-snowflake",
      "cdktf-metaflow",
      "cdktf-snowflake",
      "cloudadder-cdk-constructs",
      "custom-cloud9-ssm",
      "django-cdk",
      "dynamodb-dashboard-example",
      "dynamodb-projen",
      "easy-cerver",
      "jacobitegboje",
      "my-dummy-construct",
      "my-second-projen-construct",
      "s3-bucket-alpha",
      "s3-bucket-open",
      "s3-bucket-tt",
      "schadem-cdk-construct-csv-to-aurora",
      "schadem-cdk-construct-sfn-comprehend-classifier",
      "schadem-cdk-construct-sfn-generate-csv",
      "schadem-cdk-construct-sfn-idp-decider",
      "schadem-cdk-construct-sfn-test",
      "schadem-cdk-construct-sfn-textract-classifiction-configurator",
      "schadem-cdk-construct-sfn-textract-output-config-to-json",
      "schadem-cdk-construct-sfn-token-bucket",
      "schadem-cdk-construct-test",
      "schadem-cdk-construct-test1",
      "schadem-cdk-construct-textract-generic-async",
      "schadem-cdk-construct-textract-generic-sync",
      "serverless-spy2",
      "sns-app-jsii-component",
      "test-cdk-construct",
      "test-cdk-constructs-v2",
      "test1-cdk-constructs",
      "test1-cdk-constructs-v2",
      "test3-cdk-constructs-v2",
      "test5-cdk-constructs",
      "test6-cdk-constructs-v2",
      "user-pool-identity-provider-github"
    ]
  }
]

https://gist.github.com/cfuerst/8b9853dbd9072b16cf6f2a31fe75ff5f