* WIP tips * WIP first card stack * WIP use tips reducer to show things to try * single card deck similar to mask sequence * collapse option * Add zoom card * WIP tips * Reorganized to redux * Add zooming to the gifs * Blue cards + navigation * Add tips to new nav bar * Remove blue * Update design with icons * deck updates wip * Updated card decks * Add videos to libraries * Update initial card and clicker preview * Add backdrop to initial card step. * WIP use vimeo player instead * New simple spin deck * Spin around and say hello decks * Update button and sub-card styles * Fix "tips" button in menu bar * Use move cursor * Fix cursor * Use same image for deck preview and library * Fix cursor again * Update clicker game deck * Add videos as single-step decks * Change tips in menu bar to ? icon * Change “tips” to “how-tos” in library * Add help icon to cards * Update deck library images * Add drag cover for youtube video to prevent catching mouseup * add a step to spin deck for clicking control * Blue bar style updates * Add step pips * Update clicker game name to run away * Fix image padding * Add change color step to spin deck * Add start sound step to run away deck * Update say deck to start with adding a sprite * Remove package lock * Remove zooming functionality * Remove unnecassary prototype changes * Split up rendering of cards into smaller parts * Use FormattedMessage for all strings * Automatic lint fixes * Almost finished with lint errors! * Fix more lint errors * Clean up CSS * Fix webpack config
193 lines
6.1 KiB
JavaScript
193 lines
6.1 KiB
JavaScript
const defaultsDeep = require('lodash.defaultsdeep');
|
|
var path = require('path');
|
|
var webpack = require('webpack');
|
|
|
|
// Plugins
|
|
var CopyWebpackPlugin = require('copy-webpack-plugin');
|
|
var HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
|
|
// PostCss
|
|
var autoprefixer = require('autoprefixer');
|
|
var postcssVars = require('postcss-simple-vars');
|
|
var postcssImport = require('postcss-import');
|
|
|
|
const base = {
|
|
devtool: 'cheap-module-source-map',
|
|
devServer: {
|
|
contentBase: path.resolve(__dirname, 'build'),
|
|
host: '0.0.0.0',
|
|
port: process.env.PORT || 8601
|
|
},
|
|
output: {
|
|
library: 'GUI',
|
|
filename: '[name].js'
|
|
},
|
|
externals: {
|
|
React: 'react',
|
|
ReactDOM: 'react-dom'
|
|
},
|
|
module: {
|
|
rules: [{
|
|
test: /\.jsx?$/,
|
|
loader: 'babel-loader',
|
|
include: path.resolve(__dirname, 'src')
|
|
},
|
|
{
|
|
test: /\.css$/,
|
|
use: [{
|
|
loader: 'style-loader'
|
|
}, {
|
|
loader: 'css-loader',
|
|
options: {
|
|
modules: true,
|
|
importLoaders: 1,
|
|
localIdentName: '[name]_[local]_[hash:base64:5]',
|
|
camelCase: true
|
|
}
|
|
}, {
|
|
loader: 'postcss-loader',
|
|
options: {
|
|
ident: 'postcss',
|
|
plugins: function () {
|
|
return [
|
|
postcssImport,
|
|
postcssVars,
|
|
autoprefixer({
|
|
browsers: ['last 3 versions', 'Safari >= 8', 'iOS >= 8']
|
|
})
|
|
];
|
|
}
|
|
}
|
|
}]
|
|
}]
|
|
},
|
|
plugins: [].concat(process.env.NODE_ENV === 'production' ? [
|
|
new webpack.optimize.UglifyJsPlugin({
|
|
include: /\.min\.js$/,
|
|
minimize: true
|
|
})
|
|
] : [])
|
|
};
|
|
|
|
module.exports = [
|
|
// to run editor examples
|
|
defaultsDeep({}, base, {
|
|
entry: {
|
|
lib: ['react', 'react-dom'],
|
|
gui: './src/playground/index.jsx',
|
|
blocksonly: './src/playground/blocks-only.jsx',
|
|
compatibilitytesting: './src/playground/compatibility-testing.jsx',
|
|
player: './src/playground/player.jsx'
|
|
},
|
|
output: {
|
|
path: path.resolve(__dirname, 'build'),
|
|
filename: '[name].js'
|
|
},
|
|
externals: {
|
|
React: 'react',
|
|
ReactDOM: 'react-dom'
|
|
},
|
|
module: {
|
|
rules: base.module.rules.concat([
|
|
{
|
|
test: /\.(svg|png|wav|gif|jpg)$/,
|
|
loader: 'file-loader',
|
|
options: {
|
|
outputPath: 'static/assets/'
|
|
}
|
|
}
|
|
])
|
|
},
|
|
plugins: base.plugins.concat([
|
|
new webpack.DefinePlugin({
|
|
'process.env.NODE_ENV': '"' + process.env.NODE_ENV + '"',
|
|
'process.env.DEBUG': Boolean(process.env.DEBUG)
|
|
}),
|
|
new webpack.optimize.CommonsChunkPlugin({
|
|
name: 'lib',
|
|
filename: 'lib.min.js'
|
|
}),
|
|
new HtmlWebpackPlugin({
|
|
chunks: ['lib', 'gui'],
|
|
template: 'src/playground/index.ejs',
|
|
title: 'Scratch 3.0 GUI'
|
|
}),
|
|
new HtmlWebpackPlugin({
|
|
chunks: ['lib', 'blocksonly'],
|
|
template: 'src/playground/index.ejs',
|
|
filename: 'blocks-only.html',
|
|
title: 'Scratch 3.0 GUI: Blocks Only Example'
|
|
}),
|
|
new HtmlWebpackPlugin({
|
|
chunks: ['lib', 'compatibilitytesting'],
|
|
template: 'src/playground/index.ejs',
|
|
filename: 'compatibility-testing.html',
|
|
title: 'Scratch 3.0 GUI: Compatibility Testing'
|
|
}),
|
|
new HtmlWebpackPlugin({
|
|
chunks: ['lib', 'player'],
|
|
template: 'src/playground/index.ejs',
|
|
filename: 'player.html',
|
|
title: 'Scratch 3.0 GUI: Player Example'
|
|
}),
|
|
new CopyWebpackPlugin([{
|
|
from: 'static',
|
|
to: 'static'
|
|
}]),
|
|
new CopyWebpackPlugin([{
|
|
from: 'node_modules/scratch-blocks/media',
|
|
to: 'static/blocks-media'
|
|
}]),
|
|
new CopyWebpackPlugin([{
|
|
from: 'extensions/**',
|
|
to: 'static',
|
|
context: 'src/examples'
|
|
}]),
|
|
new CopyWebpackPlugin([{
|
|
from: 'extension-worker.{js,js.map}',
|
|
context: 'node_modules/scratch-vm/dist/web'
|
|
}])
|
|
])
|
|
})
|
|
].concat(
|
|
process.env.NODE_ENV === 'production' ? (
|
|
// export as library
|
|
defaultsDeep({}, base, {
|
|
target: 'web',
|
|
entry: {
|
|
'scratch-gui': './src/containers/gui.jsx'
|
|
},
|
|
output: {
|
|
libraryTarget: 'umd',
|
|
path: path.resolve('dist')
|
|
},
|
|
externals: {
|
|
React: 'react',
|
|
ReactDOM: 'react-dom'
|
|
},
|
|
module: {
|
|
rules: base.module.rules.concat([
|
|
{
|
|
|
|
test: /\.(svg|png|wav|gif|jpg)$/,
|
|
loader: 'file-loader',
|
|
options: {
|
|
outputPath: 'static/assets/',
|
|
publicPath: '/static/assets/'
|
|
}
|
|
}
|
|
])
|
|
},
|
|
plugins: base.plugins.concat([
|
|
new CopyWebpackPlugin([{
|
|
from: 'node_modules/scratch-blocks/media',
|
|
to: 'static/blocks-media'
|
|
}]),
|
|
new CopyWebpackPlugin([{
|
|
from: 'extension-worker.{js,js.map}',
|
|
context: 'node_modules/scratch-vm/dist/web'
|
|
}])
|
|
])
|
|
})) : []
|
|
);
|