1.0.4 • Published 12 months ago

typesilly v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

TypeSilly

TypeSilly transforms your TypeScript code in fun and unexpected ways, making coding more entertaining. Whether you're looking to rename all variables to something amusing, insert random comments, or any other zany transformation, TypeSilly has you covered.

Installation

To install TypeSilly, you need to have Node.js and npm installed on your machine. You can then install TypeSilly via npm:

npm install typesilly

Usage

To use TypeSilly in your project, follow these steps:

  1. Create a TypeScript project if you don't already have one.
mkdir my-typescript-project
cd my-typescript-project
npm init -y
npm install typescript @types/node --save-dev
  1. Install TypeSilly.
npm install typesilly
  1. Create a TypeScript configuration file (tsconfig.json).
{
  "compilerOptions": {
    "target": "ES5",
    "module": "commonjs",
    "outDir": "./dist",
    "strict": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true
  },
  "include": ["src/**/*.ts", "compile.ts"]
}
  1. Set up your TypeSilly transformer. Create a compile.ts file in your project root:
import * as ts from 'typescript';
import transformer from 'type-silly';

const fileNames = process.argv.slice(2);

const program = ts.createProgram(fileNames, {
  outDir: './dist',
  module: ts.ModuleKind.CommonJS,
  target: ts.ScriptTarget.ES5,
});

program.emit(undefined, undefined, undefined, undefined, {
  before: [transformer],
});
  1. Create an example TypeScript file to transform. Create a file examples/test.ts:
const myVariable = true;
const anotherVariable = 42;
function greet() {
  const localVar = "Hello!";
  console.log(localVar);
}
greet();
  1. Compile your TypeScript code using TypeSilly. Compile your code with the TypeSilly transformer:
npx tsc
node dist/compile.js examples/test.ts

Contributing

We welcome contributions! If you have any silly transformation ideas or improvements, feel free to open an issue or submit a pull request.

License

This project is licensed under the MIT License.

1.0.4

12 months ago

1.0.3

12 months ago

1.0.2

12 months ago

1.0.1

12 months ago

1.0.0

12 months ago