# How to turn a .ts file into a GitHub extension

**URL:** <https://forum.makecode.com/t/how-to-turn-a-ts-file-into-a-github-extension/5362>\
**Category:** Help\
**Created:** [January 5, 2021, 6:57pm UTC](https://forum.makecode.com/t/how-to-turn-a-ts-file-into-a-github-extension/5362 "2021-01-05T18:57:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![UnsignedArduino](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/unsignedarduino/32/592_2.png) [@UnsignedArduino](https://forum.makecode.com/u/UnsignedArduino)\
**Post date:** [January 5, 2021, 6:57pm UTC](https://forum.makecode.com/t/how-to-turn-a-ts-file-into-a-github-extension/5362/1 "2021-01-05T18:57:39Z")

</div>

I have a `.ts` file here (Thanks @richard):

```typescript
//% blockNamespace=Random color="#FF8000"
class FastRandomBlocks {
    _rng: Math.FastRandom

    constructor(seed: number) {
        this._rng = new Math.FastRandom(seed)
    }

    /**
     * Return the next number between 1 and 65535
     */
    //% block="$this get next number"
    //% this.defl=rng
    //% blockId="fastrandomblocks_nextnumber"
    nextNumber() {
        return this._rng.next()
    }

    /**
     * Returns a random number between two numbers
     * @param minimum The minimum number, ex: 1
     * @param maximum The maximum number, ex: 10
     */
    //% block="$this get a random number between $minimum| and $maximum"
    //% inlineInputMode=inline
    //% this.defl=rng
    //% blockId="fastrandomblocks_randomrange"
    randomRange(minimum: number, maximum: number) {
        return this._rng.randomRange(minimum, maximum)
    }

    /**
     * Returns a boolean based on the percent passed in
     * @param percent The percentage of the time the boolean returned will be true.
     */
    //% block="$this get a random boolean with %percent| percent chance"
    //% this.defl=rng
    //% blockId="fastrandomblocks_percentchance"
    percentChance(percent: number) {
        return this._rng.percentChance(percent)
    }

    /**
     * Returns a boolean with a 50% chance of being true
     */
    //% block="$this 50/50 chance"
    //% this.defl=rng
    //% blockId="fastrandomblocks_randomboolean"
    randomBoolean() {
        return this._rng.randomBool()
    }

    /**
     * Pick a random element from the array passed in
     * @param elements The array to choose from, ex: ["apples", "oranges", "pears"]
     */
    //% block="$this choose a random element from %elements"
    //% elements.shadow="lists_create_with"
    //% this.defl=rng
    //% blockId="fastrandomblocks_randomelement"
    randomElement(elements: any[]) {
        return this._rng.pickRandom(elements)
    }

    /**
     * Reset the RNG
     */
    //% block="Reset $this"
    //% this.defl=rng
    //% blockId="fastrandomblocks_resetrng"
    resetRNG() {
        this._rng.reset()
    }
}

//% color="#FF8000"
namespace Random {
    /**
     * Create a RNG object
     * @param seed The seed for the RNG, ex: 1234. Using 0 as the seed may have unexpected results!!!
     */
    //% block="create RNG || with seed $seed"
    //% blockSetVariable=rng
    //% expandableArgumentMode="toggle"
    //% blockId="random_createrng"
    export function createRNG(seed: number = null): FastRandomBlocks {
        return new FastRandomBlocks(seed);
    }
}

```

How can I turn it into a GitHub extension so that people can just import my extension with the GitHub URL?

---

<div class="post-metadata">

**Author:** ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)\
**Post date:** [January 5, 2021, 7:06pm UTC](https://forum.makecode.com/t/how-to-turn-a-ts-file-into-a-github-extension/5362/2 "2021-01-05T19:06:32Z")

</div>

Just create a project with this code then press the github button at the bottom of the editor. It should create a repo for you that people can import. There’s also a test button in the github page to try it out.

---

<div class="post-metadata">

**Author:** ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)\
**Post date:** [January 5, 2021, 7:08pm UTC](https://forum.makecode.com/t/how-to-turn-a-ts-file-into-a-github-extension/5362/3 "2021-01-05T19:08:05Z")

</div>

More info: [https://arcade.makecode.com/github/getting-started](https://arcade.makecode.com/github/getting-started)

---

<div class="post-metadata">

**Author:** ![UnsignedArduino](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/unsignedarduino/32/592_2.png) [@UnsignedArduino](https://forum.makecode.com/u/UnsignedArduino)\
**Post date:** [January 5, 2021, 8:09pm UTC](https://forum.makecode.com/t/how-to-turn-a-ts-file-into-a-github-extension/5362/4 "2021-01-05T20:09:01Z")

</div>

Thanks! I did not know it was that easy!

Here is the repo if anyone is interested:

> **[UnsignedArduino/Fast-Random-Blocks](https://github.com/UnsignedArduino/Fast-Random-Blocks)**
>
> Blocks for FastRandom. Contribute to UnsignedArduino/Fast-Random-Blocks development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)\
**Post date:** [January 5, 2021, 8:09pm UTC](https://forum.makecode.com/t/how-to-turn-a-ts-file-into-a-github-extension/5362/5 "2021-01-05T20:09:36Z")

</div>

@UnsignedArduino if you make a new post with the extension and how to use it, I’ll add the extension tag to it!
