Giter Club home page Giter Club logo

Comments (8)

kangzeroo avatar kangzeroo commented on May 14, 2024 4

For anyone looking to get Typescript support - you can get it by compiling your TS into a commonjs module, then uploading that to pipedream via cli. Something like this:

// myAction.ts
export default {
  name: "GBucket - Upload File",
  description: "Uploads a file to a GBucket route",
  key: "myGBucketUploader",
  version: "1.0.0",
  type: "action",
  props: {
    googleCloud: {         // passed in app object https://pipedream.com/docs/apps/all-apps/#apps
      type: "app",
      app: "google_cloud",
    },
    webhookTrigger: {    // passed in param https://pipedream.com/docs/workflows/steps/params/#entering-expressions
      type: "object",      
    },
  },
  async run() {

      // access your passed in variables, which can come from a previous code step
      const { myData } = (this as any).webhookTrigger.object;

     // access your auth passed in from apps
     const { Storage } = require("@google-cloud/storage");
     const key = JSON.parse((this as any).googleCloud.$auth.key_json);
    const storage = new Storage({
      projectId: key.project_id,
      credentials: {
        client_email: key.client_email,
        private_key: key.private_key,
      },
    });
    await storage.upload(myData)

  }
}
// rollup.config.js (or webpack.config.js)
const configAction = {
  input: "src/actions/myAction.ts",
  output: {
    file: "lib/actions/myAction.js",
    format: "cjs",
    sourcemap: true,
    exports: "default",
  },
  plugins: [
    commonjs(), // enable CommonJS modules
    nodePolyfills(), // enable NodeJS polyfills
    resolve({ preferBuiltins: true, browser: true }), // enable importing from node_modules
    typescript(), // enable TypeScript
    json(), // enable JSON
    globals(), // allows globals to be imported (process.env)
    builtins(), // allows builtins to be imported via require/import
  ],
};
echo "Deploying Pipedream..."
yarn build
NODE_ENV=production pd publish ./lib/actions/myAction.js

Which will end up looking like re-useable action this in the Pipedream UI.

image

from pipedream.

dylburger avatar dylburger commented on May 14, 2024 1

@hhimanshu this isn't on the immediate roadmap, but we hear you and plan to add support for other languages like TypeScript in the future!

from pipedream.

hhimanshu avatar hhimanshu commented on May 14, 2024

Likewise

from pipedream.

jverce avatar jverce commented on May 14, 2024

Bumping 😃

from pipedream.

hhimanshu avatar hhimanshu commented on May 14, 2024

Hello @todsac, any plans for getting this prioritized?

from pipedream.

seanparkross avatar seanparkross commented on May 14, 2024

Typescript. Yes please.

Powered by Deno and able to define the type that the code block will receive would be 🎉

from pipedream.

joscha avatar joscha commented on May 14, 2024

Is there any news on this? It's been almost a year and the only other resource I can find is https://pipedream.com/docs/components/typescript which is a start but there's not a lot of movement: https://github.com/PipedreamHQ/pipedream/commits/master/types/src/index.ts ?

from pipedream.

joscha avatar joscha commented on May 14, 2024

For anyone interested in using Parcel for their build, here is a sample configuration: https://gist.github.com/joscha/bd630f90adaa0cb1ce2f9c4714ba3d7a

from pipedream.

Related Issues (20)

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.