swudo v0.2.8
Swudo

A light weight Runtime and Parser Library for Typescript.
Why swudo?
- Swudo is built-with-almost no Dependency other than typescript
- Swudo provides a runtime so that you don't have to call typescript to transcompile your code
- Swudo Compiles and Transpiles your code into Javascript Code at runtime produce the result. It heavily depends on the Typescript Compiler API.
- Fast and Lightweight ⚡
How it works
Swudo compiles Typescript code into Javascript Code on runtime even if it is a script or a module file. It outputs a Javascript File on runtime if you are using a setTimeOut in your code you can inspect that file.
Installation
Npm
npm i -g swudoYarn
yarn add -D swudoUsing Git
git clone https://github.com/swudots/swudo
cd swudo
yarn install
yarn build
yarn cli // specify commands to swudo hereUsage
Via Cli
usage:
Compiling and Running a Typescript Program - swudo <file> ?--out<file>
info : Getting information about the process,
eg: swudo info test/main.ts // this is a process to compile the program
--extract, -e <file> <identifiers[]>, -e <file> <identifiers[]> : Extract parts from code by specifying identifiers.
--extract-o, -eo : Just like extract command expects and output files as an argument *swudo -eo <ouput> <target> [identifiers]*
--transpile, -t <file> ?--out <resultFile>?: Transpile Typescript and get the Compiled result in the console
--docs, -d <file> ?--out <resultFile>?: Returns the documentation of the classes and funcions inside that file
--bundle-d [...args] Bundle Declaration Files into a single types.d.ts file
The ...args expect Declaration files as arguments
--out?, -o: Filename or path to append the output
--help, -h: Get All Available Commands
--version, -v: get version of the packageExecution
npx swudo [..args]
or
// if globally installed
swudo [...args]Utilities
- Bundling Declaration : swudo comes with a feature to bundle your typescript declarations. using the flag
--bundle-dand specifying your declaration files. By default it outputs a file namedtypes.d.tsin to your current working directory.You can also use the*to read declarations from a directory.But, keep in mind that never specify a non-directory value because it gonna overwrite directory stuffeg:
swudo --bundle-d *DirectoryBundl myTypes.d.tsthe argument with*at first is a value with dir.
- Transpilation: swudo can transpile your Typescript code into a Javascript.The moduleType used in the output will be the default module used in your
package.json.To use it, you need to specify the flag--transpileor-t.It accepts only one file as the argument.You can output the file using--outor-oand specifying a filename or path to output the result.eg:
swudo --transpile main.ts --out main.js
- Generate Documentation: At the early versions of swudo it only supported exported classes.But, now it support functions too! This feature can generate a simple documentation about your code.The result would in JSON Format.
eg:
swudo --docs program.ts --out documentation.jsonor you can specify the shorthand-d
- Extraction: Extraction is useful to extract Identifiers from your code.You only need to specify the identifiers and swudo will give you the results. You can output the result using
--outor-obefore using the--extractflag and giving your output file a name.Note that this is experimental- eg:
swudo --extract main.ts myFunction myClass myInterface myTypeor you can specify the shorthand-e
- eg:
TroubleShooting
We reccomend using extract at last while using cli
swudo --transpile main.ts --extract test.ts [identifiers]But if you specify it like this
swudo --extract test.ts [identifiers] --transpile main.tsYou are gonna get some runtime errors or additonal logs or unwanted bugs
Contributing
Feel free to open a pull request or an issue.
If you just wanna add a new feature just open a issue before you open a PR
Cloning this repo:
git clone https://github.com/swudots/swudo.git
cd swudo
yarn installRead the contributing guidlines: Read
Haven't read the Code of Conduct. Read
License
swudo is licensed under Apache License 2.0.
Open
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago