Initial structure

This commit is contained in:
Christopher Willis-Ford 2016-10-21 18:27:47 -07:00
parent 07726bd06d
commit 8184fb9b14
10 changed files with 126 additions and 19 deletions

View file

@ -7,8 +7,9 @@ charset = utf-8
indent_size = 4
trim_trailing_whitespace = true
[*.{js,jsx,html}]
[*.json]
indent_style = space
indent_size = 2
[*.{frag,vert}]
indent_style = tab
[*.{js}]
indent_style = space

2
.eslintignore Normal file
View file

@ -0,0 +1,2 @@
dist/*
node_modules/*

View file

@ -1,18 +1,3 @@
{
"rules": {
"curly": [2, "multi-line"],
"eol-last": [2],
"indent": [2, 4],
"quotes": [2, "single"],
"linebreak-style": [2, "unix"],
"max-len": [2, 80, 4],
"semi": [2, "always"],
"strict": [2, "never"],
"no-console": [2, {"allow": ["log", "warn", "error"]}]
},
"env": {
"node": true,
"browser": true
},
"extends": "eslint:recommended"
"extends": "eslint-config-scratch"
}

3
.gitignore vendored
View file

@ -11,3 +11,6 @@ npm-*
# IDEA
/.idea
# Build
/dist

2
README.md Normal file
View file

@ -0,0 +1,2 @@
## scratch-storage
#### Scratch Storage is a library for loading and storing project and asset files for Scratch 3.0

36
package.json Normal file
View file

@ -0,0 +1,36 @@
{
"name": "scratch-storage",
"version": "0.0.1",
"description": "Load and store project and asset files for Scratch 3.0",
"license": "BSD-3-Clause",
"homepage": "https://github.com/LLK/scratch-storage#readme",
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/LLK/scratch-storage.git"
},
"main": "./dist.js",
"scripts": {
"build": "./node_modules/.bin/webpack --progress --colors --bail",
"coverage": "./node_modules/.bin/tap ./test/{unit,integration}/*.js --coverage --coverage-report=lcov",
"lint": "./node_modules/.bin/eslint .",
"prepublish": "npm run build",
"prepublish-watch": "npm run watch",
"start": "./node_modules/.bin/webpack-dev-server",
"tap-integration": "./node_modules/.bin/tap ./test/integration/*.js",
"tap-unit": "./node_modules/.bin/tap ./test/unit/*.js",
"test": "npm run lint && npm run tap-unit && npm run tap-integration",
"version": "./node_modules/.bin/json -f package.json -I -e \"this.repository.sha = '$(git log -n1 --pretty=format:%H)'\"",
"watch": "./node_modules/.bin/webpack --progress --colors --watch-poll"
},
"devDependencies": {
"babel-core": "^6.17.0",
"babel-eslint": "^7.0.0",
"babel-loader": "^6.2.5",
"babel-polyfill": "^6.16.0",
"babel-preset-es2015": "^6.16.0",
"debug": "^2.2.0",
"eslint": "^3.8.1",
"eslint-plugin-react": "^6.4.1",
"webpack": "^1.13.2"
}
}

5
src/ScratchStorage.js Normal file
View file

@ -0,0 +1,5 @@
class ScratchStorage {
}
module.exports = ScratchStorage;

7
src/index-web.js Normal file
View file

@ -0,0 +1,7 @@
require('babel-polyfill');
/**
* Export for use on a web page.
* @type {ScratchStorage}
*/
window.ScratchStorage = require('./index');

7
src/index.js Normal file
View file

@ -0,0 +1,7 @@
const ScratchStorage = require('./ScratchStorage');
/**
* Export for use with NPM & Node.js.
* @type {ScratchStorage}
*/
module.exports = ScratchStorage;

59
webpack.config.js Normal file
View file

@ -0,0 +1,59 @@
const path = require('path');
const webpack = require('webpack');
const base = {
module: {
loaders: [
{
include: [
path.resolve(__dirname, 'src')
],
test: /\.js$/,
loader: 'babel-loader',
query: {
presets: ['es2015']
}
},
{
test: /\.json$/,
loader: 'json-loader'
}
]
},
plugins: [
new webpack.optimize.UglifyJsPlugin({
include: /\.min\.js$/,
minimize: true,
compress: {
warnings: false
}
})
]
};
module.exports = [
// Web-compatible
Object.assign({}, base, {
entry: {
'scratch-storage': './src/index-web.js',
'scratch-storage.min': './src/index-web.js'
},
output: {
path: __dirname,
filename: 'dist/web/[name].js'
}
}),
// Webpack-compatible
Object.assign({}, base, {
entry: {
'scratch-storage': './src/index.js'
},
output: {
library: 'ScratchStorage',
libraryTarget: 'commonjs2',
path: __dirname,
filename: 'dist/node/[name].js'
}
})
];