@civ-clone/base-terrain-feature-furs 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitattributes +2 -0
- package/.github/workflows/build-on-push.yml +39 -0
- package/.prettierrc +4 -0
- package/Furs.d.ts +3 -0
- package/Furs.js +9 -0
- package/Furs.js.map +1 -0
- package/Furs.ts +5 -0
- package/LICENSE +21 -0
- package/README.md +16 -2
- package/package.json +33 -4
- package/tests/Furs.test.ts +18 -0
- package/tsconfig.json +16 -0
package/.gitattributes
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: Build and test application on push to remote
|
|
2
|
+
|
|
3
|
+
on: [push]
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
build:
|
|
7
|
+
runs-on: ubuntu-latest
|
|
8
|
+
steps:
|
|
9
|
+
- uses: actions/checkout@v4
|
|
10
|
+
- uses: pnpm/action-setup@v4
|
|
11
|
+
with:
|
|
12
|
+
version: 11
|
|
13
|
+
- uses: actions/setup-node@v4
|
|
14
|
+
with:
|
|
15
|
+
node-version: 22
|
|
16
|
+
# No lock file, so this tests what a consumer resolves. The settings match
|
|
17
|
+
# web-renderer's pnpm-workspace.yaml: several @civ-clone packages depend on
|
|
18
|
+
# each other as `github:` URLs, this project's own releases are often only
|
|
19
|
+
# minutes old, and nothing here needs a dependency's build script.
|
|
20
|
+
- run: >-
|
|
21
|
+
pnpm install --no-frozen-lockfile
|
|
22
|
+
--config.block-exotic-subdeps=false
|
|
23
|
+
--config.minimum-release-age=0
|
|
24
|
+
--config.strict-dep-builds=false
|
|
25
|
+
- run: npm run --if-present prettier:check
|
|
26
|
+
# The tests load the committed `.js`, so compile to prove the source
|
|
27
|
+
# type-checks, and fail if the committed output is stale. `--force`
|
|
28
|
+
# because a fresh checkout's timestamps can make `tsc --build` treat the
|
|
29
|
+
# committed output as up to date and skip the compile entirely.
|
|
30
|
+
- run: npm run --if-present ts:compile -- --force
|
|
31
|
+
- run: npm run --if-present prettier:format
|
|
32
|
+
# Stale *or never committed* output fails: `git diff` alone misses a new
|
|
33
|
+
# module whose `.js` was never added, which the published package would
|
|
34
|
+
# then omit. Only the compiled extensions, so the lock file the install
|
|
35
|
+
# writes cannot fail it; `node_modules` is ignored, so it stays out.
|
|
36
|
+
- run: |
|
|
37
|
+
git status --short --untracked-files=all -- '*.js' '*.d.ts' '*.js.map'
|
|
38
|
+
test -z "$(git status --porcelain --untracked-files=all -- '*.js' '*.d.ts' '*.js.map')"
|
|
39
|
+
- run: npm run --if-present test
|
package/.prettierrc
ADDED
package/Furs.d.ts
ADDED
package/Furs.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Furs = void 0;
|
|
4
|
+
const TerrainFeature_1 = require("@civ-clone/core-terrain-feature/TerrainFeature");
|
|
5
|
+
class Furs extends TerrainFeature_1.default {
|
|
6
|
+
}
|
|
7
|
+
exports.Furs = Furs;
|
|
8
|
+
exports.default = Furs;
|
|
9
|
+
//# sourceMappingURL=Furs.js.map
|
package/Furs.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Furs.js","sourceRoot":"","sources":["Furs.ts"],"names":[],"mappings":";;;AAAA,mFAA4E;AAE5E,MAAa,IAAK,SAAQ,wBAAc;CAAG;AAA3C,oBAA2C;AAE3C,kBAAe,IAAI,CAAC"}
|
package/Furs.ts
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 Dom Hastings
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
-
#
|
|
1
|
+
# base-terrain-feature-furs
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The `Furs` terrain feature: a special resource a square can hold.
|
|
4
|
+
|
|
5
|
+
For example: Civ2's Furs, found on Tundra.
|
|
6
|
+
|
|
7
|
+
This package only declares the class: it has no `main` and registers nothing, so installing it changes no game.
|
|
8
|
+
A game's rules register it and give it its yields.
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
import Furs from '@civ-clone/base-terrain-feature-furs/Furs';
|
|
12
|
+
import { instance as availableTerrainFeatureRegistryInstance } from '@civ-clone/core-terrain-feature/AvailableTerrainFeatureRegistry';
|
|
13
|
+
|
|
14
|
+
availableTerrainFeatureRegistryInstance.register(Furs);
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Part of the Civ2 work (civ-clone/web-renderer#1008).
|
package/package.json
CHANGED
|
@@ -1,6 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@civ-clone/base-terrain-feature-furs",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "The Furs terrain feature class.",
|
|
5
|
+
"repository": "git@github.com:civ-clone/base-terrain-feature-furs.git",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"typescript",
|
|
8
|
+
"civilization"
|
|
9
|
+
],
|
|
10
|
+
"author": "dom111 <dom111@users.noreply.github.com>",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"private": false,
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "npm run ts:compile && npm run prettier:format",
|
|
15
|
+
"prettier:check": "prettier --config .prettierrc --check '**/*.ts'",
|
|
16
|
+
"prettier:format": "prettier --config .prettierrc '**/*.ts' --write",
|
|
17
|
+
"test": "ts-mocha ./tests/*.test.ts",
|
|
18
|
+
"ts:compile": "tsc --build tsconfig.json"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@civ-clone/core-rule": "^0.1.9",
|
|
22
|
+
"@civ-clone/core-terrain": "^0.1.4",
|
|
23
|
+
"@types/chai": "^4.0.0",
|
|
24
|
+
"@types/mocha": "^8.0.0",
|
|
25
|
+
"@types/node": "^14.18.63",
|
|
26
|
+
"chai": "^4.0.0",
|
|
27
|
+
"mocha": "^9.0.0",
|
|
28
|
+
"prettier": "^2.8.8",
|
|
29
|
+
"ts-mocha": "^9.0.0",
|
|
30
|
+
"typescript": "^4.9.5"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@civ-clone/core-terrain-feature": "^0.1.5"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import Furs from '../Furs';
|
|
2
|
+
import { Land } from '@civ-clone/core-terrain/Types';
|
|
3
|
+
import RuleRegistry from '@civ-clone/core-rule/RuleRegistry';
|
|
4
|
+
import TerrainFeature from '@civ-clone/core-terrain-feature/TerrainFeature';
|
|
5
|
+
import { expect } from 'chai';
|
|
6
|
+
|
|
7
|
+
class Ground extends Land {}
|
|
8
|
+
|
|
9
|
+
describe('Furs', (): void => {
|
|
10
|
+
it('should be a terrain feature of its terrain', (): void => {
|
|
11
|
+
const terrain = new Ground(new RuleRegistry()),
|
|
12
|
+
feature = new Furs(terrain);
|
|
13
|
+
|
|
14
|
+
expect(feature).to.be.instanceOf(TerrainFeature);
|
|
15
|
+
expect(feature.terrain()).to.equal(terrain);
|
|
16
|
+
expect(feature.clone()).to.be.instanceOf(Furs);
|
|
17
|
+
});
|
|
18
|
+
});
|
package/tsconfig.json
ADDED