From af65405e38cf2100340d816cf0f9dcd3df6d71fd Mon Sep 17 00:00:00 2001 From: Resi Respati Date: Mon, 18 Dec 2017 13:02:52 +0700 Subject: [PATCH] Docs updates [2017-12-18] --- docs/SUMMARY.md | 1 + docs/getting-started/deploying.md | 4 ++-- docs/getting-started/installation.md | 2 +- .../cookbook/environment-variables.md | 8 ++++++-- docs/in-depth/cookbook/one-line-powershell.md | 19 +++++++++++++++++++ 5 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 docs/in-depth/cookbook/one-line-powershell.md diff --git a/docs/SUMMARY.md b/docs/SUMMARY.md index f622004..b71ef47 100644 --- a/docs/SUMMARY.md +++ b/docs/SUMMARY.md @@ -16,6 +16,7 @@ * [TypeScript](./in-depth/typescript.md) * [Cookbook](./in-depth/cookbook.md) * [Environment variables](./in-depth/cookbook/environment-variables.md) + * [One-line PowerShell setup](./in-depth/cookbook/one-line-powershell.md) --- diff --git a/docs/getting-started/deploying.md b/docs/getting-started/deploying.md index 8f2a5bb..941a6b8 100644 --- a/docs/getting-started/deploying.md +++ b/docs/getting-started/deploying.md @@ -16,7 +16,7 @@ The `screeps.json` file is a JSON configuration file separated into multiple env > **Note:** You don't have to manually create the target branch in your Screeps client if it doesn't exist yet. `rollup-plugin-screeps` will do it for you. -## Running Your First Deploy +## Running your first deploy Once you're done, run the following command: @@ -28,4 +28,4 @@ You're done! Now go to your Screeps client and make sure your code is deployed p ![deploying-2](img/deploying-2.png) -Ready for something extra? Read on. +Ready for something extra? [Read on.](../in-depth/module-bundling.md) diff --git a/docs/getting-started/installation.md b/docs/getting-started/installation.md index 084167b..4575607 100644 --- a/docs/getting-started/installation.md +++ b/docs/getting-started/installation.md @@ -22,4 +22,4 @@ Or if you're running `yarn`: yarn ``` -Next up, we'll configure our environment and run our first code deploy. +Next up, we'll configure our environment and [run our first code deploy](./deploying.md). diff --git a/docs/in-depth/cookbook/environment-variables.md b/docs/in-depth/cookbook/environment-variables.md index 30b9b66..8f69515 100644 --- a/docs/in-depth/cookbook/environment-variables.md +++ b/docs/in-depth/cookbook/environment-variables.md @@ -78,10 +78,12 @@ Then configure your `rollup.config.js` to include your desired variables. import replace from 'rollup-plugin-replace'; export default { - // ... plugins: [ replace({ + // returns 'true' if code is bundled in prod mode PRODUCTION: JSON.stringify(isProduction), + // you can also use this to include deploy-related data, such as + // date + time of build, as well as latest commit ID from git __BUILD_TIME__: JSON.stringify(Date.now()), __REVISION__: JSON.stringify(require('git-rev-sync').short()), }) @@ -89,7 +91,9 @@ export default { }; ``` -> **Note:** Generally, you need to ensure that `rollup-plugin-replace` goes *before* other plugins, so that those plugins can apply any optimisations like dead code elimination. +> **Note:** Generally, you need to ensure that `rollup-plugin-replace` goes *before* other plugins, so we can be sure Rollup replaces these variables correctly and the remaining plugins can apply any optimisations (e.g. dead code elimination) correctly. + +> **Note:** Because these values are evaluated once as a string (for the find-and-replace), and once as an expression, they need to be wrapped in `JSON.stringify`. Variables set by this plugin will be replaced in the actual output JS code. When compiling your code, Rollup will replace the variable names with the output of the supplied expression or value. diff --git a/docs/in-depth/cookbook/one-line-powershell.md b/docs/in-depth/cookbook/one-line-powershell.md new file mode 100644 index 0000000..26de760 --- /dev/null +++ b/docs/in-depth/cookbook/one-line-powershell.md @@ -0,0 +1,19 @@ +# One-line PowerShell setup + +> **TODO:** Make sure this works with v3.0. + +[@ChrisTaylorRocks](https://github.com/ChrisTaylorRocks) has made a PowerShell script to get the starter kit up and running with a single command. Go check it out [here](https://github.com/ChrisTaylorRocks/screeps-typescript-starter-setup)! + +## Usage + +PowerShell < 5.0: + +``` +PS> (new-object Net.WebClient).DownloadString('http://bit.ly/2z2QDJI') | iex; New-ScreepsTypeScriptSetup +``` + +PowerShell 5.0+: + +``` +PS> curl http://bit.ly/2z2QDJI | iex; New-ScreepsTypeScriptSetup +```