Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collect improvements and restore tests #5

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Build & Test

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x, 20.x, 22.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run build --if-present
- run: npm test
35 changes: 30 additions & 5 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,43 @@ export default {

plugins: [
...
screeps({configFile: "./screeps.json"})
screeps()
]
}

```

### Config File
### Yaml Config File

rollup-plugin-screeps needs your screeps username/password and the server to upload to.
rollup-plugin-screeps now uses the [screeps unified credentials file](https://github.com/screepers/screepers-standards/blob/master/SS3-Unified_Credentials_File.md), as used by [screeps-api](https://github.com/screepers/node-screeps-api).

Example `.screeps.yaml` config file:

```
servers:
main:
host: screeps.com
secure: true
token: '00000000-0a0a-0a00-000a-a0000a0000a0'
private:
host: 127.0.0.1
port: 21025
secure: false
username: bob
password: password123
```

Target server default to `main`, it can be selected with `screeps({ server: 'my-server' })` or the environment variable `$SCREEPS_SERVER`.

Branch *(aka the destination folder on screeps server)* default to `auto`, it can be select with `screeps({ branch: 'my-branch' })` or the environment variable `$SCREEPS_BRANCH`.

### JS Config File

rollup-plugin-screeps still support the json config file.

```json
{
"email": "[email protected]",
"password": "pass",
"token": "abcdef12345",
"protocol": "https",
"hostname": "screeps.com",
"port": 443,
Expand All @@ -45,4 +68,6 @@ rollup-plugin-screeps needs your screeps username/password and the server to upl

```

It change be loaded from a file with `screeps({ configFile: './screeps.json' })` or direct as value with `screeps({ config: my_config })`.

If `branch` is set to `"auto"` rollup-plugin-screeps will use your current git branch as the name of the branch on screeps, if you set it to anything else that string will be used as the name of the branch.
9 changes: 9 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/** @type {import('ts-jest').JestConfigWithTsJest} **/
export default {
testEnvironment: "node",
transform: {
"^.+\.tsx?$": ["ts-jest", { useESM: true }],
},
setupFilesAfterEnv: ["jest-extended/all"],
extensionsToTreatAsEsm: [".ts"],
};
Loading