Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Ray Schamp committed Sep 15, 2016
0 parents commit a173405
Show file tree
Hide file tree
Showing 16 changed files with 256 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_size = 4
trim_trailing_whitespace = true

[*.{js,html}]
indent_style = space
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/*
build/*
25 changes: 25 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"parser": "babel-eslint",
"rules": {
"curly": [2, "multi-line"],
"eol-last": [2],
"indent": [2, 4],
"linebreak-style": [2, "unix"],
"max-len": [2, 120, 4],
"no-trailing-spaces": [2, { "skipBlankLines": true }],
"no-unused-vars": [2, {"args": "after-used", "varsIgnorePattern": "^_"}],
"quotes": [2, "single"],
"semi": [2, "always"],
"space-before-function-paren": [2, "always"],
"strict": [2, "never"]
},
"env": {
"browser": true,
"es6": true,
"node": true
},
"plugins": [
"react"
],
"extends": ["eslint:recommended", "plugin:react/recommended"]
}
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Mac OS
.DS_Store

# NPM
/node_modules
npm-*

# Testing
/.nyc_output
/coverage
12 changes: 12 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Copyright (c) 2016, Massachusetts Institute of Technology
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 changes: 26 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
ESLINT=./node_modules/.bin/eslint
NODE=node
WEBPACK=./node_modules/.bin/webpack --progress --colors
WEBPACK_DEV_SERVER=./node_modules/.bin/webpack-dev-server

# ------------------------------------------------------------------------------

build:
$(WEBPACK)

watch:
$(WEBPACK) --watch

serve:
$(WEBPACK_DEV_SERVER) --port 8601 --config playground.config.js

# ------------------------------------------------------------------------------

lint:
$(ESLINT) . --ext .js,.jsx

test:
@make lint
@make build

.PHONY: build watch serve lint
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# scratch-gui
#### Scratch GUI is a set of React components that comprise the interface for creating and running Scratch 3.0 projects

## Installation
This requires you to have Git and Node.js installed.

In your own node environment/application:
```bash
npm install https://github.com/LLK/scratch-gui.git
```
If you want to edit/play yourself:
```bash
git clone git@github.com:LLK/scratch-gui.git
cd scratch-gui
npm install
```

## Playground
This requires Node.js to be installed.

## Running the Playground
Open a Command Prompt or Terminal in the repository and run:
```bash
npm start
```
Then go to [http://localhost:8601/](http://localhost:8601/) - the playground outputs the default GUI component

## Testing
```bash
make test
```

## Donate
We provide [Scratch](https://scratch.mit.edu) free of charge, and want to keep it that way! Please consider making a [donation](https://secure.donationpay.org/scratchfoundation/) to support our continued engineering, design, community, and resource development efforts. Donations of any size are appreciated. Thank you!
7 changes: 7 additions & 0 deletions TRADEMARK
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
The Scratch trademarks, including the Scratch name, logo, the Scratch Cat, Gobo, Pico, Nano, Tera and Giga graphics (the "Marks"), are property of the Massachusetts Institute of Technology (MIT), and the use of the Marks is governed by this policy.

You may use the Marks to refer to Scratch in Substantially Unmodified form.

"Substantially Unmodified" means the source code provided by MIT, possibly with minor modifications including but not limited to: bug fixes (including security), changing the locations of files for better integration with the host operating system, adding documentation, and changes to the dynamic linking of libraries.

A version is not "Substantially Unmodified" if it incorporates features not present in a release of Scratch by MIT. If you do make a substantial modification, to avoid confusion with versions of Scratch produced by MIT you must remove all Marks from your version of the software and refrain from using any of the Marks to refer to your version.
11 changes: 11 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Scratch GUI Playground</title>
</head>
<body>
<div id="app"></div>
<script type="text/javascript" src="playground.js"></script>
</body>
</html>
35 changes: 35 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "scratch-gui",
"version": "0.1.0",
"description": "GraphicaL User Interface for creating and running Scratch 3.0 projects",
"main": "./src/index.js",
"scripts": {
"start": "make serve"
},
"author": "Massachusetts Institute of Technology",
"license": "BSD-3-Clause",
"homepage": "https://github.com/LLK/scratch-gui#readme",
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/LLK/scratch-gui.git"
},
"devDependencies": {
"babel-core": "6.14.0",
"babel-eslint": "6.1.2",
"babel-loader": "6.2.5",
"babel-preset-es2015": "6.14.0",
"babel-preset-react": "6.11.1",
"eslint": "3.5.0",
"eslint-plugin-react": "6.2.1",
"exports-loader": "0.6.3",
"imports-loader": "0.6.5",
"json-loader": "0.5.4",
"react": "15.3.1",
"react-dom": "15.3.1",
"scratch-blocks": "github:llk/scratch-blocks#develop",
"scratch-render": "github:llk/scratch-render#develop",
"scratch-vm": "github:llk/scratch-vm#develop",
"webpack": "1.13.2",
"webpack-dev-server": "1.15.2"
}
}
6 changes: 6 additions & 0 deletions playground.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
var config = require('./webpack.config');
module.exports = Object.assign({}, config, {
entry: {
playground: './src/playground.jsx'
},
});
15 changes: 15 additions & 0 deletions src/components/blocks.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from 'react';
import ScratchBlocks from 'scratch-blocks/blocks_compressed_vertical';

export default class Blocks extends React.Component {
mountBlocks (component) {
ScratchBlocks.inject(component, {});
}
render () {
return (
<div
className="scratch-blocks"
ref={this.mountBlocks} />
);
}
}
17 changes: 17 additions & 0 deletions src/components/gui.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react';
import VM from 'scratch-vm';
import Blocks from './blocks.jsx';

export default class GUI extends React.Component {
render () {
return (
<div className="scratch-gui">
<Blocks />
</div>
);
}
}

GUI.defaultProps = {
vm: new VM()
};
5 changes: 5 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import GUIComponent from './components/gui.jsx';
import BlocksComponent from './components/blocks.jsx';

export const GUI = GUIComponent;
export const Blocks = BlocksComponent;
7 changes: 7 additions & 0 deletions src/playground.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import React from 'react';
import ReactDOM from 'react-dom';
import {GUI} from '.';

ReactDOM.render(
<GUI />,
document.getElementById('app'));
33 changes: 33 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
var path = require('path');
module.exports = {
entry: {
gui: './src/index.js'
},
output: {
library: 'ScratchGUI',
path: __dirname,
filename: '[name].js'
},
module: {
loaders: [{
test: /\.jsx?$/,
loader: 'babel-loader',
include: path.resolve(__dirname, 'src'),
query: {
presets: ['es2015', 'react']
}
}, {
test: /\.json$/,
loader: 'json-loader'
}, {
test: require.resolve('scratch-blocks/blockly_compressed_vertical'),
loader: 'exports?Blockly'
}, {
test: require.resolve('scratch-blocks/blocks_compressed'),
loader: 'imports?Blockly=scratch-blocks/blockly_compressed_vertical!exports?Blockly'
}, {
test: require.resolve('scratch-blocks/blocks_compressed_vertical'),
loader: 'imports?Blockly=scratch-blocks/blocks_compressed!exports?Blockly'
}]
}
};

0 comments on commit a173405

Please sign in to comment.