scratchfoundation / scratch-parser

Validation and parsing for Scratch projects
BSD 3-Clause "New" or "Revised" License
61 stars 64 forks source link

scratch-parser

Parser for Scratch projects

CircleCI

Overview

The Scratch Parser is a Node.js module that parses and validates Scratch projects.

API

Installation

npm install scratch-parser

Basic Use

var fs = require('fs');
var parser = require('scratch-parser');

var buffer = fs.readFileSync('/path/to/project.sb2');
parser(buffer, false, function (err, project) {
    if (err) // handle the error
    // do something interesting
});

"Info"

In addition to the _meta data described above, Scratch projects include an attribute called info that may include the following:

Key Description
flashVersion Installed version of Adobe Flash
swfVersion Version of the Scratch editor used to create the project
userAgent User agent used to create the project
savedExtensions Array of Scratch Extensions used in the project

Testing

Running the Test Suite

npm test

Code Coverage Report

make coverage

Performance Benchmarks / Stress Testing

make benchmark

Committing

This project uses semantic release to ensure version bumps follow semver so that projects using the config don't break unexpectedly.

In order to automatically determine the type of version bump necessary, semantic release expects commit messages to be formatted following conventional-changelog.

<type>(<scope>): <subject>
<BLANK LINE>
<body>
<BLANK LINE>
<footer>

subject and body are your familiar commit subject and body. footer is where you would include BREAKING CHANGE and ISSUES FIXED sections if applicable.

type is one of:

Use the commitizen CLI to make commits formatted in this way:

npm install -g commitizen
npm install

Now you're ready to make commits using git cz.

Breaking changes

If you're committing a change that will require changes to existing code, ensure your commit specifies a breaking change. In your commit body, prefix the changes with "BREAKING CHANGE: " This will cause a major version bump so downstream projects must choose to upgrade the config and will not break the build unexpectedly.