# How do you turn your code into a extension

**URL:** https://forum.makecode.com/t/how-do-you-turn-your-code-into-a-extension/6207
**Category:** Help
**Created:** [February 16, 2021, 6:35pm UTC](https://forum.makecode.com/t/how-do-you-turn-your-code-into-a-extension/6207 "2021-02-16T18:35:22Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Agent\_14](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/agent_14/32/17567_2.png) [@Agent\_14](https://forum.makecode.com/u/Agent_14)
#### Post date: [February 16, 2021, 6:35pm UTC](https://forum.makecode.com/t/how-do-you-turn-your-code-into-a-extension/6207/1 "2021-02-16T18:35:22Z")

</div>

EDIT: I later just copied an existing extension and replaced it’s block code  
SECOND EDIT: For some reason it generated the delted code and ignored mine, so I will try again…  
I already have the code for an extension (DISCLAIMER: The code is written by @richard, I only made it as extension code)  
Just how do you turn it into an extension where you can just add it to the editor?  
namespace Sprite {

```
    //% block

    export function arrayOfAllSprites() {

    const allSprites: Sprite[] = [];

    for (const key of Object.keys(game.currentScene().spritesByKind)) {

        for (const sprite of game.currentScene().spritesByKind[parseInt(key)].sprites()) {

            allSprites.push(sprite);

        }

    }

    return allSprites;

}
```

---

<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: [February 16, 2021, 6:57pm UTC](https://forum.makecode.com/t/how-do-you-turn-your-code-into-a-extension/6207/2 "2021-02-16T18:57:34Z")

</div>

If you have a GitHub account, then click the GitHub button at the bottom of the editor and create a repo. More information can be found [here](https://makecode.com/extensions/github-authoring).

If you don’t have a GitHub account, then you can just create a share link and use that! Fun fact: you can add a shared MakeCode project as an extension by pasting the share URL into the extension dialog (same place you paste github urls). The downside is you can’t update it later.

---

<div class="post-metadata">

### Author: ![Agent\_14](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/agent_14/32/17567_2.png) [@Agent\_14](https://forum.makecode.com/u/Agent_14)
#### Post date: [February 16, 2021, 6:59pm UTC](https://forum.makecode.com/t/how-do-you-turn-your-code-into-a-extension/6207/3 "2021-02-16T18:59:26Z")

</div>

Im trying on this:

> **[agent14bricks/array-of-all-sprites](https://github.com/agent14bricks/array-of-all-sprites)**
>
> Contribute to agent14bricks/array-of-all-sprites 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: [February 16, 2021, 7:01pm UTC](https://forum.makecode.com/t/how-do-you-turn-your-code-into-a-extension/6207/4 "2021-02-16T19:01:35Z")

</div>

Ah, looks like you forked @darzu’s minimap extension. It’ll be a lot easier if you create a repo straight from inside the MakeCode Arcade editor instead.

To do that:

1. Create a new project
2. Switch to JavaScript
3. Paste in your code
4. Click the GitHub button at the bottom of the editor (next to the save button)
5. Log in with your GitHub
6. Create a repo

---

<div class="post-metadata">

### Author: ![Agent\_14](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/agent_14/32/17567_2.png) [@Agent\_14](https://forum.makecode.com/u/Agent_14)
#### Post date: [February 16, 2021, 7:04pm UTC](https://forum.makecode.com/t/how-do-you-turn-your-code-into-a-extension/6207/5 "2021-02-16T19:04:16Z")

</div>

got it  
Thx
