First start on extension packaging

This commit is contained in:
David Wendt 2019-08-20 00:29:53 -04:00
parent bac5ecfe8d
commit 0414e24ce2
4 changed files with 64 additions and 0 deletions

5
web/extension/js/bootstrap.js vendored Normal file
View File

@ -0,0 +1,5 @@
// A dependency graph that contains any wasm must all be imported
// asynchronously. This `bootstrap.js` file does the single async import, so
// that no one else needs to worry about it again.
import("./index.js")
.catch(e => console.error("Error importing `index.js`:", e));

View File

@ -0,0 +1,12 @@
{
"manifest_version": 2,
"name": "Ruffle",
"version": "0.1.0",
"description": "Puts Flash back on the web where it belongs.",
"content_scripts": [
{
"matches": ["*"],
"js": ["ruffle.js"]
}
]
}

View File

@ -0,0 +1,17 @@
{
"name": "ruffle-extension",
"version": "0.1.0",
"description": "Extension packaging for Ruffle Flash Emulator",
"scripts": {
"build": "webpack",
"serve": "webpack-dev-server"
},
"devDependencies": {
"@wasm-tool/wasm-pack-plugin": "0.2.1",
"clean-webpack-plugin": "^3.0.0",
"webpack": "^4.29.4",
"webpack-cli": "^3.1.1",
"webpack-dev-server": "^3.1.0"
}
}

View File

@ -0,0 +1,30 @@
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const WasmPackPlugin = require("@wasm-tool/wasm-pack-plugin");
const webpack = require('webpack');
const path = require('path');
module.exports = (env, argv) => {
let mode = "development";
if (argv && argv.mode) {
mode = argv.mode;
}
console.log(`Building ${mode}...`);
return {
entry: path.resolve(__dirname, "www/bootstrap.js"),
output: {
path: path.resolve(__dirname, "dist"),
filename: "index.js",
},
mode: mode,
plugins: [
new CleanWebpackPlugin(),
new WasmPackPlugin({
crateDirectory: path.resolve(__dirname, ".."),
extraArgs: "--out-name=ruffle",
forceMode: mode,
})
]
}
};