All Projects → PullJosh → sb-edit

PullJosh / sb-edit

Licence: MIT license
Javascript library for manipulating Scratch project files

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to sb-edit

Blocklike
Bridging the gap between block programming and JavaScript.
Stars: ✭ 177 (+436.36%)
Mutual labels:  scratch
Pyonkee
Pyonkee is a visual-programming environment for iPad. It is based on Scratch from the MIT Media Lab.
Stars: ✭ 80 (+142.42%)
Mutual labels:  scratch
scratch-LN
https://scratch4d.github.io/scratch-LN/
Stars: ✭ 19 (-42.42%)
Mutual labels:  scratch
web-app-from-scratch
Supporting material for my blog post series on writing a web application from scratch in Python.
Stars: ✭ 128 (+287.88%)
Mutual labels:  scratch
codes-scratch-zookeeper-netty
zk + netty 实现集群节点文件同步服务
Stars: ✭ 29 (-12.12%)
Mutual labels:  scratch
Gratch
Block-style programming environment for tackling graph structure and graph algorithm, based on MIT Scratch.
Stars: ✭ 15 (-54.55%)
Mutual labels:  scratch
Scratchaddons
All-in-one browser extension for Scratch.
Stars: ✭ 133 (+303.03%)
Mutual labels:  scratch
ScratchRadio
Educational software for use with the LimeSDR platform
Stars: ✭ 64 (+93.94%)
Mutual labels:  scratch
scratux
A simple project that aims to provide Free/Libre Open Source Linux binaries of Scratch Desktop
Stars: ✭ 88 (+166.67%)
Mutual labels:  scratch
coro-scratch
A Scratch to Python transpiler that makes extensive use of coroutines
Stars: ✭ 22 (-33.33%)
Mutual labels:  scratch
cod4-docker
Runs a Call of duty 4 Modern Warfare (cod4x) dedicated server in a Docker container.
Stars: ✭ 44 (+33.33%)
Mutual labels:  scratch
apostilas
Apostilas sobre diversos assuntos: PHP, PDO, MySQL, PHPOO, MVC, mobile, scratch, git, github, docker, vps, alpine linux, segurança na wev, servidores, etc
Stars: ✭ 49 (+48.48%)
Mutual labels:  scratch
LiteGui
Immediate Mode GUI From Scratch
Stars: ✭ 15 (-54.55%)
Mutual labels:  scratch
Phosphorus
JavaScript compiler for Scratch projects.
Stars: ✭ 250 (+657.58%)
Mutual labels:  scratch
go-docker
Sample code and dockerfiles accompanying the blog post The Ultimate Guide to Writing Dockerfiles for Go Web-apps
Stars: ✭ 89 (+169.7%)
Mutual labels:  scratch
Express Mongodb Rest Api Boilerplate
A boilerplate for Node.js apps / Rest API / Authentication from scratch - express, mongodb (mongoose).
Stars: ✭ 153 (+363.64%)
Mutual labels:  scratch
Meower-Vanilla
Official source code for the Scratch-based Meower client.
Stars: ✭ 24 (-27.27%)
Mutual labels:  scratch
scratching-forth
A compiler from Forth to Scratch
Stars: ✭ 19 (-42.42%)
Mutual labels:  scratch
openblock-desktop
Graphic programming software for hardware like: arduino, microbit, esp32, esp8266...
Stars: ✭ 161 (+387.88%)
Mutual labels:  scratch
Lang-app
Add a multi lang configuration to your WEB APP 'from scratch' [ANY FRAMEWORK, ANY PLUGIN, ANY API]
Stars: ✭ 15 (-54.55%)
Mutual labels:  scratch

sb-edit

sb-edit is a javascript library for manipulating Scratch project files.

🚧 Warning!

sb-edit is still a work-in-progress. Not everything will work, and the API will probably change drastically. Don't get too comfortable the way things are. ;)

Importing and exporting

sb-edit allows importing and exporting a variety of Scratch project file types:

File Format Import Export
Scratch 3.0 (.sb3) Yes Yes
Scratch 2.0 (.sb2) 🕒 Planned 🕒 Planned
Leopard No Yes
scratchblocks 👻 Maybe! 🚧 In progress

Editing

sb-edit can also be used to modify Scratch projects. A few things you can/will be able to do with sb-edit:

Add Edit Delete
Sprites 🕒 Planned Yes Yes
Stage No Yes No
Scripts 🕒 Planned 🕒 Planned 🕒 Planned
Costumes and sounds 🕒 Planned 🕒 Planned 🕒 Planned

Development

If you want to help develop the sb-edit package, you'll need to follow these steps:

Step 1: Download sb-edit and prepare to use

> git clone https://github.com/PullJosh/sb-edit.git
> cd sb-edit
> npm link # Allow using sb-edit in another local project

Step 2: Add sb-edit as dependency in another project

> cd my-cool-project
> npm init # This should be a node project
> npm link sb-edit # Similar to `npm install` but uses local version

Step 3: Modify sb-edit

If you make any changes to the sb-edit source code, you'll have to rebuild the package. Here's how:

> cd sb-edit # Cloned from Github and then edited
> npm run build # Build the new version!
> npm run watch # Watch files and rebuild automatically when code is changed

You can also run the Jest tests to make sure you didn't break anything:

> cd sb-edit # You're probably already here ;)
> npm test # Run Jest tests
> npm run lint # Check code for style problems

And finally, make sure everything is pretty:

> cd sb-edit
> npm run format # Format code to look nice with Prettier

Code Examples

Import an .sb3 file in Node

const { Project } = require("sb-edit");
const fs = require("fs");
const path = require("path");

const file = fs.readFileSync(path.join(__dirname, "myProject.sb3"));
const project = await Project.fromSb3(file);

console.log(project);

Export an .sb3 file in Node

const { Project } = require("sb-edit");
const fs = require("fs");
const path = require("path");

const project = /* Get yourself a `Project`... */;

const saveLocation = path.join(__dirname, "myProject.sb3");
fs.writeFileSync(saveLocation, Buffer.from(await project.toSb3()));

// `project` is now saved at ./myProject.sb3

Get Leopard code for project

const project = /* Get yourself a `Project`... */;

console.log(project.toLeopard({ printWidth: 100 })); // Optionally pass a Prettier config object!
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].