emmanuelnk / github-actions-workflow-ts

Write Github Actions workflow files in TypeScript (compiles to YAML)
MIT License
104 stars 3 forks source link

[Feature Request] zero-dependency library version #15

Open mrgrain opened 1 year ago

mrgrain commented 1 year ago

This looks awesome! I really like the API surface.

I think the current setup is great as a standalone tool, but not ideal for use in other packages. For example in https://github.com/projen/projen we already have everything set up to generate YAML files from a JS object. A zero-dependency library version of this package would make it easier to include in other tools.

Current Behavior

The package is a CLI and library all-in-one tool.

As far as I can tell all its dependencies are used for the CLI only:

    "fast-glob": "^3.2.11",
    "js-yaml": "^4.1.0",
    "ts-node": "^10.8.1",
    "yargs": "^17.4.0"

Expected Behavior

Publish a zero-dependency library version of this package that can be included in other projects.

Everything would work as before, but no files are created. Calling Workflow.asObject() will return the Workflow as an object that can than be manipulated further, and passed to any YAML tool and/or written to disk as desired.

 const exampleWorkflow = new Workflow('example-filename', { /***/ })
 exampleWorkflow.asObject();
emmanuelnk commented 1 year ago

Hi @mrgrain Sure let me look into it. I have been running some tests with projen so I guess this would fit in nicely as well. I'll try to knock it out on the weekend.

Thanks for the feedback.

kingpower2542 commented 1 year ago

Tigo Service @mrgrain