Bundle and push your AI to Screeps servers!
If you have registered on the official server via Steam or GitHub, please go to account management and make sure you have configured an email and password for your account to access your account on https://screeps.com and https://screeps.com/ptr.
On private servers, make sure you have authorization enabled and that the administrator has created your account.
npm install screeps-webpack-plugin
Add the plugin to your Webpack configuration.
Make sure you are using {target: 'node'}
, other environments aren't supported. You should have at least one chunk named main
in the output.
// webpack.config.js
import ScreepsWebpackPlugin from 'screeps-webpack-plugin'
module.exports = {
target: 'node',
entry: 'index.js',
output: {
path: 'dist',
filename: 'main',
libraryTarget: 'commonjs'
},
plugins: [new ScreepsWebpackPlugin(options)]
}
new ScreepsWebpackPlugin({
branch: '$activeWorld',
email: 'EMAIL',
password: 'PASSWORD',
token: 'TOKEN',
serverUrl: 'https://screeps.com',
serverPassword: 'SERVER_PASS',
gzip: false
})
If your server modules provide support, you can use tokens for authentication and send compressed bundles.
See screeps-modules#Usage for more information.
Asynchronously alter the modules which will be pushed to the server.
compilation.plugin(
'screeps-webpack-plugin-collect-modules', ({modules, plugin, compilation}, cb) => {
//...
cb(null, {modules, plugin, compilation})
}
)
Configure the client used for the request.
compilation.plugin(
'screeps-webpack-plugin-configure-client', (client, plugin) => {
//...
return client
}
)
Inspect request data.
compilation.plugin(
'screeps-webpack-plugin-before-commit', (branch, modules) => {
// ...
}
)
Inspect the response body of the commit.
compilation.plugin(
'screeps-webpack-plugin-after-commit', (body) => {
//..
}
)
The plugin only provides opaque access to the response body, so that it can be safely used in CI. To debug, run with DEBUG=* webpack $ARGS
.
Share your feedback, bugs and PRs on the issues tracker.