GithubHelp home page GithubHelp logo

Comments (3)

github-learning-lab avatar github-learning-lab commented on June 26, 2024

Getting rid of node_modules

We typically don't commit a node_modules folder in a repository. These can often grow to be huge if your project has many dependencies. Because of the way Node works this folder is a necessary evil, but there is a way to get rid of it!

First you need to install a tool called ncc. You'll want to install this tool globally so that you can use as if it's any other CLI tool on your machine.

What ncc does is take all the dependencies within your project and compile them into a single JavaScript file. This allows you to avoid committing the node_modules folder in your actions source code.

Install ncc
npm install -g @zeit/ncc

Using ncc
When you use ncc:

ncc build <input-file>

A new directory named dist will be created. Within that directory you will find a file named index.js. To tell GitHub Actions that this new index.js file is the one that should run when your action is used a small edit to the action.yml file needs to be made.

before:

runs:
  using: "node12"
  main: "index.js"

after:

runs:
  using: "node12"
  main: "dist/index.js"

Once you make this change you can delete the node_modules folder and commit those changes to the repository that contains your Actions source code.


πŸ“–Further help using ncc is in the GitHub Actions documentation.

from writing-javascript-actions.

github-learning-lab avatar github-learning-lab commented on June 26, 2024

Publishing your actions

Publishing your actions is a great way to help others in your team and across the GitHub community. Although actions do not need to be published to be consumed by adding them to the marketplace you make them easier to find.

Some notable actions you will find on the marketplace are:

And that just scratches the surface of the 1600+ and counting actions you will find on the marketplace πŸ˜„

πŸ“–Follow this guide to learn how to publish your actions to the GitHub Marketplace

from writing-javascript-actions.

github-learning-lab avatar github-learning-lab commented on June 26, 2024

The End 😭

It was so fun having you as a student while taking this course. I'll forever cherish our time together infinitEnigma

You can keep this repository forever to remember our time... I actually encourage you to do so! This has now become your central point for notes on writing JavaScript actions πŸ˜„

I really do think of everything!

Make sure to visit Learning Lab for more courses on GitHub Actions and other awesome tech content.

We would love to hear what you thought about this course, share your experience with us and others in the Community forum


To fully complete your course close this issue

from writing-javascript-actions.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.