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

Improve publishing speed for Typescript apps #3145

Merged
merged 2 commits into from
Sep 9, 2022
Merged

Improve publishing speed for Typescript apps #3145

merged 2 commits into from
Sep 9, 2022

Conversation

wwestrop
Copy link
Contributor

@wwestrop wwestrop commented Sep 7, 2022

The default template for a Typescript function app (created using func init --language typescript --worker-runtime node) will install development tooling into node_modules when you run npm install.

Publishing this simple app using func azure functionapp publish myappname includes all this, and is therefore very slow.

This PR reduces the amount deployed to Azure by about 181 MB (on Windows) so it is substantially faster to publish.

Pull request checklist

  • My changes do not require documentation changes
    • Otherwise: Documentation issue linked to PR
  • My changes do not need to be backported to a previous version
    • Otherwise: Backport tracked by issue/PR #issue_or_pr
  • I have added all required tests (Unit tests, E2E tests)

src/Azure.Functions.Cli/StaticResources/funcignore Outdated Show resolved Hide resolved
src/Azure.Functions.Cli/StaticResources/funcignore Outdated Show resolved Hide resolved
node_modules/.bin/
node_modules/@azure/
node_modules/@types/
node_modules/azure-functions-core-tools/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is the most impactful line, and I think it makes total sense to add it. Thank you!!!

Fwiw, adding to the funcignore will help with one-off deployments from core tools. However, if you deploy through a CI/CD pipeline I would recommend adding npm prune --production before deploying, which will more consistently get rid of all dev dependencies.

Another fwiw, VS Code will run npm prune --production by default if you deploy through there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

npm prune is a good shout, I was just trying to do a quick-n-dirty functionapp in this case 😉

@wwestrop
Copy link
Contributor Author

wwestrop commented Sep 8, 2022

I've made the changes requested - typescript and azure-functions-core-tools between them account for almost the entire payload so it's still a very good saving if you forget to prune 👍

Copy link
Contributor

@ejizba ejizba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@ejizba ejizba merged commit ed8f04c into Azure:v4.x Sep 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants