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

azure-functions-deploy

v0.0.7

Published

Pack and deploy azure functions with webpack,and Azure Kudu API

Downloads

11

Readme

Azure Functions Pack

This is a tool to make it easy to package, and deploy your Azure Functions Node.js Functions for optimal performance on Azure Functions. This is inspired by the original azure-functions-pack, and serverless-azure-function code. They're all great tools, however are all not 100% fit to my requirements.

The problem addressed

Whenever an Azure Function App is recreated on demand (a so called "cold start") the node'js module cache for each Function will be empty. The current Functions file system is sluggish in dealing with many small file accesses so there is a significant delay as node reads all the module files. Fortunately, node caches the modules in memory so subsequent accesses are fast.

The azure-funciton-pack tool packs the JS module with webpack to address the issue above. Howeever it manipulates the original funciton.json file directly, which is not good for me.

I'd like to separate the pack output to a separate folder, and generate the funciton.json file with right entry point points to the js bundle file. This way the output folder contains the minimal files, and is ready for deploy to azure. The source code keeps untouched, so there's no requirement of unpack command anymore.

Another missing part of the azure-funciton-pack is that the user will need use Azure CLI to publish the function to Azure. It works great, but need user manages the resource group, storage accout, and etc.

The servless-azure-functions manages the whole lifecycle of the serverless functions quit well, but its webpack plugins is not perfect for azure.

I combied the webpack feature, and the serveless function app deploy feature together in this tool, so that the user can pack the code, and deploy it with just one tool.

The solution

With the pack command, webpack is used to place all the modules in a single file to the output folder, 'dist' by default.

The Function folder structures, and the functions.json files are also generated in the output folder.

With the publish command, the output folder is zipped, and published to the azure cloud via kudu api.

With the deploy command, it run both of the above 2 steps.

:construction: This project is experimental; use with caution and be prepared for breaking changes. :construction:

NOde: This is a different version of the original azure's code.

How to run

In the Function App directory:

npm install -g azure-functions-deploy

funcdeploy pack ./
funcdeploy publish unique-function-name
funcdeploy deploy unique-function-name

Example

npm install -g azure-functions-deploy
git clone https://github.com/qs-wang/azure-functions-deploy.git
cd azure-functions-deploy/sample
npm install
funcdeploy pack ./
funcdeploy publish mysamplefunction456

Node: you need have a valid azure subscription to run the publish command. For non-interactive login, you need install the Azure CLI and run the az login command beforehand.

API

Usage: main [options] [command]


  Commands:

    pack [options] <path>    Will pack the specified path or the current directory if none is specified

    publish [options] <name>    Will publish the bundle code to azure with given name.

    deploy [options] <name>  run pack, and publish sequentially.

  Options:

    -h, --help     output usage information
    -V, --version  output the version number

Note: the uglify feature only supports some small amount of es6, so I recommend that if you get errors either don't uglify or drop your code down to es5.

pack

Usage: pack [options] <path>

  Will pack the specified path or the current directory if none is specified

  Options:

    -h, --help           output usage information
    -u, --uglify         Uglify the project when webpacking
    -o, --output <path>  Path for output directory

publish

Usage: publish [options] <name>

  Will publish the bundle folder to the azure with the given name.

  Options:

    -h, --help           output usage information
    -u, --uglify         Uglify the project when webpacking
    -d, --dir <path>     Path for bundle directory
    -l, --location <location> the host location,e.g. westus, australiaeast, and etc. Default value is westus.

deploy

Usage: deploy [options] <name>

  Will pack, and deploy the project to the azure with the given name.

  Options:

    -h, --help           output usage information
    -u, --uglify         Uglify the project when webpacking
    -o, --output <path>  Path for output directory

git clone

License

MIT