Docs updates [2017-12-18]
This commit is contained in:
@@ -16,6 +16,7 @@
|
|||||||
* [TypeScript](./in-depth/typescript.md)
|
* [TypeScript](./in-depth/typescript.md)
|
||||||
* [Cookbook](./in-depth/cookbook.md)
|
* [Cookbook](./in-depth/cookbook.md)
|
||||||
* [Environment variables](./in-depth/cookbook/environment-variables.md)
|
* [Environment variables](./in-depth/cookbook/environment-variables.md)
|
||||||
|
* [One-line PowerShell setup](./in-depth/cookbook/one-line-powershell.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.
|
> **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:
|
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
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
Ready for something extra? Read on.
|
Ready for something extra? [Read on.](../in-depth/module-bundling.md)
|
||||||
|
|||||||
@@ -22,4 +22,4 @@ Or if you're running `yarn`:
|
|||||||
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).
|
||||||
|
|||||||
@@ -78,10 +78,12 @@ Then configure your `rollup.config.js` to include your desired variables.
|
|||||||
import replace from 'rollup-plugin-replace';
|
import replace from 'rollup-plugin-replace';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
// ...
|
|
||||||
plugins: [
|
plugins: [
|
||||||
replace({
|
replace({
|
||||||
|
// returns 'true' if code is bundled in prod mode
|
||||||
PRODUCTION: JSON.stringify(isProduction),
|
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()),
|
__BUILD_TIME__: JSON.stringify(Date.now()),
|
||||||
__REVISION__: JSON.stringify(require('git-rev-sync').short()),
|
__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.
|
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.
|
||||||
|
|
||||||
|
|||||||
19
docs/in-depth/cookbook/one-line-powershell.md
Normal file
19
docs/in-depth/cookbook/one-line-powershell.md
Normal file
@@ -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
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user