Get Started2 Understand the Project

Step 2 - Understand the Project

Check out the folder structure

Open up the lightyear-integrations project with your IDE and familiarize yourself with the key files in the directory structure.

  ...
  src/
    basicWebhook.js
    githubToSlack.js
    helloSlack.js
    helloWorld.js
    index.js
  ...

Control which integrations are deployed

If you take a look at src/index.js, you can see each of the files is referenced in an import statement, but most are commented out.

import "./helloWorld";
// import "./helloSlack";
// import "./basicWebhook";
// import "./githubToSlack";

Since helloWorld is the only one imported, it will be the only action deployed for now.

đź’ˇ

If you are seeing something very different from this, double-check to make sure you are looking at the index.js in the src directory.

Look at the helloWorld action

If you examine the code in src/helloWorld.js, you can see it simply prints out Hello World! to the console.

import { defineAction } from "@runlightyear/lightyear";
 
defineAction({
  name: "helloWorld",
  title: "Hello World",
  run: async () => {
    console.log("Hello World!");
  },
});

Not much of an integration, but it’s a start to help you understand the platform.

Update the message

For fun, let’s update the message to something new.

import { defineAction } from "@runlightyear/lightyear";
 
defineAction({
  name: "helloWorld",
  title: "Hello World",
  run: async () => {
    console.log("Hello World! Nice to meet you!");
  },
});