Skip to content

Instantly share code, notes, and snippets.

@joscha
Last active November 7, 2024 10:54
Show Gist options
  • Save joscha/bd630f90adaa0cb1ce2f9c4714ba3d7a to your computer and use it in GitHub Desktop.
Save joscha/bd630f90adaa0cb1ce2f9c4714ba3d7a to your computer and use it in GitHub Desktop.
Pipedream Typescript Action with parcel
node_modules
.parcel-cache
dist
{
"ignoreSubmoduleImports": true
}
{
"extends": "@parcel/config-default",
"optimizers": {
"*.{js,mjs}": [
"...",
"@planet-a/parcel-optimizer-versioned-imports"
]
}
}
import { defineAction } from "@pipedream/types";
import assert from "node:assert";
export default defineAction({
name: "My Action",
version: "0.0.1",
key: "my-key",
description: "Example",
props: {},
type: "action",
methods: {},
async run(options) {
assert(options);
const { $ } = options;
$.export("$summary", ":tada:");
$.export("hello", "world");
},
});
{
"name": "@your/package",
"version": "1.0.0",
"source": "index.ts",
"main": "dist/main.js",
"types": "dist/main.d.ts",
"private": true,
"type": "module",
"scripts": {
"watch": "parcel watch",
"prebuild": "rimraf dist .parcel-cache",
"build": "parcel build --log-level=verbose"
},
"dependencies": {
"@pipedream/types": "^0.3.0"
},
"devDependencies": {
"@parcel/packager-ts": "2.12.0",
"@parcel/transformer-typescript-types": "2.12.0",
"@planet-a/parcel-optimizer-versioned-imports": "^0.0.3",
"@types/node": "^22.9.0",
"parcel": "^2.12.0",
"rimraf": "^6.0.1",
"typescript": "^5.4.5"
}
}
{
"compilerOptions": {
"composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
"target": "ES2020", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
"lib": ["ES2020"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
"module": "ES2020", /* Specify what module code is generated. */
"moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
"outDir": "dist", /* Specify an output folder for all emitted files. */
"isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
"allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
"strict": true, /* Enable all strict type-checking options. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment