Merge pull request #89 from ahmedcharles/master

Do some cleanup.
This commit is contained in:
Resi Respati
2018-05-15 11:13:30 +07:00
committed by GitHub
5 changed files with 14 additions and 12 deletions

View File

@@ -30,11 +30,11 @@ Screeps Typescript Starter uses rollup to compile your typescript and upload it
Move or copy `screeps.sample.json` to `screeps.json` and edit it, changing the credentials and optionally adding or removing some of the destinations. Move or copy `screeps.sample.json` to `screeps.json` and edit it, changing the credentials and optionally adding or removing some of the destinations.
Running `rollup -c` will compile your code and do a "dry run", preparing the code for upload but not actually pushing it. Running `rollup -c --dest main` will compile your code, and then upload it to a screeps server using the `main` config from `screeps.json`. Running `rollup -c` will compile your code and do a "dry run", preparing the code for upload but not actually pushing it. Running `rollup -c --environment DEST:main` will compile your code, and then upload it to a screeps server using the `main` config from `screeps.json`.
You can use `-cw` instead of `-c` to automatically re-run when your source code changes - for example, `rollup -cw --dest main` will automatically upload your code to the `main` configuration every time your code is changed. You can use `-cw` instead of `-c` to automatically re-run when your source code changes - for example, `rollup -cw --environment DEST:main` will automatically upload your code to the `main` configuration every time your code is changed.
Finally, there are also NPM scripts that serve as aliases for these commands in `package.json` for IDE integration. Running `npm run push-main` is equivalent to `rollup -c --dest main`, and `npm run watch-sim` is equivalent to `rollup -cw --dest sim`. Finally, there are also NPM scripts that serve as aliases for these commands in `package.json` for IDE integration. Running `npm run push-main` is equivalent to `rollup -c --environment DEST:main`, and `npm run watch-sim` is equivalent to `rollup -cw --dest sim`.
#### Important! To upload code to a private server, you must have [screepsmod-auth](https://github.com/ScreepsMods/screepsmod-auth) installed and configured! #### Important! To upload code to a private server, you must have [screepsmod-auth](https://github.com/ScreepsMods/screepsmod-auth) installed and configured!

View File

@@ -37,10 +37,10 @@ The `screeps.json` file is a JSON configuration file separated into multiple dep
} }
``` ```
You can make as many separate destinations as you want. Just make a copy of any config object and perform the necessary changes. Once you're done, use the `--dest` argument on the `rollup` command to specify which environment to upload to. You can make as many separate destinations as you want. Just make a copy of any config object and perform the necessary changes. Once you're done, use the `--environment DEST:<dest>` argument on the `rollup` command to specify which environment to upload to.
```bash ```bash
rollup -c --dest main rollup -c --environment DEST:main
``` ```
Omitting the `--dest` argument will perform a dry run, which can be used for local directories via symlinks. Omitting the destination will perform a dry run, which will compile and bundle the code without uploading it.

View File

@@ -5,7 +5,8 @@
"main": "index.js", "main": "index.js",
"//": "If you add or change the names of destinations in screeps.json, make sure you update these scripts to reflect the changes", "//": "If you add or change the names of destinations in screeps.json, make sure you update these scripts to reflect the changes",
"scripts": { "scripts": {
"lint": "tslint \"src/**/*.ts\"", "lint": "tslint -p tsconfig.json \"src/**/*.ts\"",
"build": "rollup -c",
"push-main": "rollup -c --environment DEST:main", "push-main": "rollup -c --environment DEST:main",
"push-pserver": "rollup -c --environment DEST:pserver", "push-pserver": "rollup -c --environment DEST:pserver",
"push-sim": "rollup -c --environment DEST:sim", "push-sim": "rollup -c --environment DEST:sim",
@@ -26,15 +27,15 @@
"homepage": "https://github.com/screepers/screeps-typescript-starter#readme", "homepage": "https://github.com/screepers/screeps-typescript-starter#readme",
"devDependencies": { "devDependencies": {
"@types/lodash": "^3.10.1", "@types/lodash": "^3.10.1",
"@types/screeps": "^2.2.1", "@types/screeps": "^2.3.0",
"rollup": "^0.57.1", "rollup": "^0.57.1",
"rollup-plugin-clean": "^1.0.0", "rollup-plugin-clear": "^2.0.7",
"rollup-plugin-commonjs": "^9.1.0", "rollup-plugin-commonjs": "^9.1.0",
"rollup-plugin-node-resolve": "^3.3.0", "rollup-plugin-node-resolve": "^3.3.0",
"rollup-plugin-screeps": "^0.1.2", "rollup-plugin-screeps": "^0.1.2",
"rollup-plugin-typescript2": "^0.12.0", "rollup-plugin-typescript2": "^0.12.0",
"tslint": "^5.9.1", "tslint": "^5.9.1",
"typescript": "^2.8.1" "typescript": "^2.8.3"
}, },
"dependencies": { "dependencies": {
"source-map": "~0.6.1" "source-map": "~0.6.1"

View File

@@ -1,6 +1,6 @@
"use strict"; "use strict";
import clean from "rollup-plugin-clean"; import clear from "rollup-plugin-clear";
import resolve from "rollup-plugin-node-resolve"; import resolve from "rollup-plugin-node-resolve";
import commonjs from "rollup-plugin-commonjs"; import commonjs from "rollup-plugin-commonjs";
import typescript from "rollup-plugin-typescript2"; import typescript from "rollup-plugin-typescript2";
@@ -23,7 +23,7 @@ export default {
}, },
plugins: [ plugins: [
clean(), clear({ targets: ["dist"] }),
resolve(), resolve(),
commonjs(), commonjs(),
typescript({tsconfig: "./tsconfig.json"}), typescript({tsconfig: "./tsconfig.json"}),

View File

@@ -2,6 +2,7 @@
"compilerOptions": { "compilerOptions": {
"module": "es2015", "module": "es2015",
"target": "es5", "target": "es5",
"moduleResolution": "Node",
"outDir": "dist", "outDir": "dist",
"baseUrl": "src/", "baseUrl": "src/",
"sourceMap": true, "sourceMap": true,