npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

dequalify

v1.0.1

Published

Take a fully qualified lambda ARN and output it without the version.

Downloads

5

Readme

This is a super simple utility script

Input a string with many colons : and knock off anything after the last one. I use it to de-qualify fully qualified ARNs of lambdas.

npm install -g dequalify.

or npm install -g from within where you clone this if you roll that way.

use

This is expected to be installed to your $PATH, and used as a single use parser in larger scripts via |.

Pass in a fully qualified ARN, Get an unqualified ARN back.

echo "arn:aws:lambda:region:account-id:function:function-name:version" | dequalify

for example would return

arn:aws:lambda:region:account-id:function:function-name

You can add -q to instead return what qualifies: echo "arn:aws:lambda:region:account-id:function:function-name:version" | dequalify -q for example would return version.

If you'd like to find a use for this script in your day to day CI/CD: Here's how we use it. Local environments use Apex, and each function within a project has it's own git repo. There are thoughts on project level repos #WIP. When a change is ready to go into the CI/CD pipeline, commit to the develop branch. Build server picks up the changes and runs something like:

# clean up after yourself
rm -rf lambda.zip
rm -f ARN
rm -f log
rm -f .gitignore
rm -rf .git

# Generate code to send to AWS
zip -r lambda.zip .
# send it to AWS and save a log
aws lambda update-function-code --function-name YourLambdaFunctionHere --publish --zip-file fileb://./lambda.zip > log
# parse that log to grab the full ARN to an artifact that can be used to deploy arbitrarily later
cat ./log
cat ./log | grep FunctionArn | cut -d '"' -f4 > ARN
cat ARN

That build generates an ARN that you can use to deploy to different environments using aliases. Hence this script that literally everybody* will have use for. Give the aws lambda update-alias --function-name $(cat ARN | dequalify) --name YourEnvironmentHere --function-version $(cat ARN | dequalify -q) script an alias that your environment points to. Boom. CD.

PS. Dear Amazon. Lambdas are awesome. Please let me choose the version number when publishing one. I'd like to have that control back. Sincerely, @excenter