1.0.1 β€’ Published 7 months ago

ts-emoji v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
7 months ago

πŸš€ ts-emoji πŸš€

Impeccable TypeScript for the Expressive Developer

πŸŽ‰ Revel in the Renaissance of Commenting πŸŽ‰

Behold! The monumental ts-emoji, an artisanal TypeScript preprocessor destined to intertwine the charm of emojis with the sturdiness of TypeScript directives.

The craftsmanship embedded within ts-emoji enables developers to adorn their codebase with an ensemble of playful and succinct emojis, which, behind the curtains, transmutes into genuine TypeScript directives during the compilation.

Imagine, dear reader, a world where your TypeScript artifacts not merely serve as the backbone of your logical operations but also cascade through the repository, whispering the subtle nuances of your code’s intentions via the gentle emotive embrace of emojis. A symphony of symbols and logic entwined together in a beautiful tapestry of code!

✨ Overview of Our Enchanting Journey ✨

Consider, for a moment, the mesmerizing dance of emojis and TypeScript, seamlessly intertwining to portray the esoteric intentions hidden beneath the code’s austere surface, unfolding thus:

// πŸ™‰
const x: any = 'The magic is invisible here';

// πŸ™ˆ
// This enchanting block shall not summon TypeScript’s scrutiny
const y: string = 123;

// πŸ“ Ah, a future refinement awaits herein!
function add(a: number, b: number): number {
  return a + b;
}

// πŸ‘€ Unveil TypeScript’s gaze!
// πŸ™Š Anticipate an enchanting error below
const z: number = 'A number? Nay, a string!';

πŸ“˜ Tome of Installation πŸ“˜

To commence, integrate this artisanal toolkit into your mystical codebase by invoking the following incantation within your terminal:

npm install ts-emoji --save-dev

πŸ—οΈ Unveiling the Enchantments: Usage πŸ—οΈ

Preprocessing Your Script

Employ ts-emoji to gently caress your TypeScript, replacing the enchanting emojis with rigorous TypeScript directives:

import { preprocessFile } from 'ts-emoji';

preprocessFile('./path-to-your/enchanting-script.ts');

Enabling the Enchantments: Configuration

Include a preprocessor in your TypeScript or JavaScript workflow to summon ts-emoji prior to the traditional transpilation.

Example Configuration with Webpack

Using the ts-loader and its getCustomTransformers option, whisper ts-emoji into your build process:

const { preprocessTs } = require('ts-emoji');

// webpack.config.js
module.exports = {
  // Your configurations dwell herein...
  module: {
    rules: [
      {
        test: /\.ts$/,
        loader: 'ts-loader',
        options: {
          getCustomTransformers: program => ({
            before: [preprocessTs(program)]
          })
        }
      }
    ]
  }
};

🌍 Universal Emojis to TypeScript Directives 🌍

Behold the default mappings, bridging the whimsical world of emojis and the steadfast reliability of TypeScript directives:

{
  "πŸ™‰": "@ts-ignore",
  "πŸ™ˆ": "@ts-nocheck",
  "πŸ™Š": "@ts-expect-error",
  "πŸ‘€": "@ts-check",
  // ...more of the enchanting mappings...
}

You may peruse emojis.json within the library’s confines for the exhaustive list of mappings.

πŸ› οΈ Contribution & Enhancement πŸ› οΈ

Kindred spirits desiring to weave their own enchantments into ts-emoji are most welcome. Submit your pull requests and embroil yourself in the creation of an ever more enchanting toolkit for all!

Running Tests

To ensure your magicks do not disturb the existing enchantments, invoke the test suite with:

npm test

πŸ“œ License πŸ“œ

Released under the MIT License.

Embellish your TypeScript with the joys of emojis and embark upon a coding journey where logic and emotion dance together in a symphony of symbiotic harmony!

πŸš€ Happy Coding, Enchanting Developer! πŸš€

1.0.1

7 months ago

1.0.0

7 months ago