@civ-clone/library-unit 0.1.3 → 0.1.5

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.
@@ -6,9 +6,34 @@ jobs:
6
6
  build:
7
7
  runs-on: ubuntu-latest
8
8
  steps:
9
- - uses: actions/checkout@v1
10
- - uses: actions/setup-node@v1
9
+ - uses: actions/checkout@v4
10
+ - uses: pnpm/action-setup@v4
11
11
  with:
12
- node-version: 18
13
- - run: npm i
14
- - run: npm run prettier:check
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
@@ -0,0 +1,3 @@
1
+ import { JoinCity } from '@civ-clone/base-unit-action-join-city/JoinCity';
2
+ export { JoinCity } from '@civ-clone/base-unit-action-join-city/JoinCity';
3
+ export default JoinCity;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JoinCity = void 0;
4
+ const JoinCity_1 = require("@civ-clone/base-unit-action-join-city/JoinCity");
5
+ var JoinCity_2 = require("@civ-clone/base-unit-action-join-city/JoinCity");
6
+ Object.defineProperty(exports, "JoinCity", { enumerable: true, get: function () { return JoinCity_2.JoinCity; } });
7
+ exports.default = JoinCity_1.JoinCity;
8
+ //# sourceMappingURL=JoinCity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JoinCity.js","sourceRoot":"","sources":["JoinCity.ts"],"names":[],"mappings":";;;AAAA,6EAA0E;AAE1E,2EAA0E;AAAjE,oGAAA,QAAQ,OAAA;AAEjB,kBAAe,mBAAQ,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { JoinCity } from '@civ-clone/base-unit-action-join-city/JoinCity';
2
+
3
+ export { JoinCity } from '@civ-clone/base-unit-action-join-city/JoinCity';
4
+
5
+ export default JoinCity;
@@ -4,7 +4,7 @@ import Action from '@civ-clone/core-unit/Action';
4
4
  import Tile from '@civ-clone/core-world/Tile';
5
5
  import Unit from '@civ-clone/core-unit/Unit';
6
6
  export declare class SetHomeCity extends Action {
7
- #private;
7
+ private _cityRegistry;
8
8
  constructor(
9
9
  from: Tile,
10
10
  to: Tile,
@@ -1,16 +1,4 @@
1
1
  "use strict";
2
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
- if (kind === "m") throw new TypeError("Private method is not writable");
4
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
6
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
7
- };
8
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
- };
13
- var _SetHomeCity_cityRegistry;
14
2
  Object.defineProperty(exports, "__esModule", { value: true });
15
3
  exports.SetHomeCity = void 0;
16
4
  const CityRegistry_1 = require("@civ-clone/core-city/CityRegistry");
@@ -19,11 +7,10 @@ const Action_1 = require("@civ-clone/core-unit/Action");
19
7
  class SetHomeCity extends Action_1.default {
20
8
  constructor(from, to, unit, ruleRegistry = RuleRegistry_1.instance, cityRegistry = CityRegistry_1.instance) {
21
9
  super(from, to, unit, ruleRegistry);
22
- _SetHomeCity_cityRegistry.set(this, void 0);
23
- __classPrivateFieldSet(this, _SetHomeCity_cityRegistry, cityRegistry, "f");
10
+ this._cityRegistry = cityRegistry;
24
11
  }
25
12
  perform(...args) {
26
- const targetCity = __classPrivateFieldGet(this, _SetHomeCity_cityRegistry, "f").getByTile(this.from());
13
+ const targetCity = this._cityRegistry.getByTile(this.from());
27
14
  if (!targetCity) {
28
15
  return;
29
16
  }
@@ -31,6 +18,5 @@ class SetHomeCity extends Action_1.default {
31
18
  }
32
19
  }
33
20
  exports.SetHomeCity = SetHomeCity;
34
- _SetHomeCity_cityRegistry = new WeakMap();
35
21
  exports.default = SetHomeCity;
36
22
  //# sourceMappingURL=SetHomeCity.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SetHomeCity.js","sourceRoot":"","sources":["SetHomeCity.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,oEAG2C;AAC3C,oEAG2C;AAC3C,wDAAiD;AAIjD,MAAa,WAAY,SAAQ,gBAAM;IAGrC,YACE,IAAU,EACV,EAAQ,EACR,IAAU,EACV,eAA6B,uBAAoB,EACjD,eAA6B,uBAAoB;QAEjD,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;QATtC,4CAA4B;QAW1B,uBAAA,IAAI,6BAAiB,YAAY,MAAA,CAAC;IACpC,CAAC;IACD,OAAO,CAAC,GAAG,IAAW;QACpB,MAAM,UAAU,GAAG,uBAAA,IAAI,iCAAc,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QAE7D,IAAI,CAAC,UAAU,EAAE;YACf,OAAO;SACR;QAED,IAAI,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAClC,CAAC;CACF;AAvBD,kCAuBC;;AAED,kBAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"SetHomeCity.js","sourceRoot":"","sources":["SetHomeCity.ts"],"names":[],"mappings":";;;AAAA,oEAG2C;AAC3C,oEAG2C;AAC3C,wDAAiD;AAIjD,MAAa,WAAY,SAAQ,gBAAM;IAGrC,YACE,IAAU,EACV,EAAQ,EACR,IAAU,EACV,eAA6B,uBAAoB,EACjD,eAA6B,uBAAoB;QAEjD,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;QAEpC,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;IACpC,CAAC;IACD,OAAO,CAAC,GAAG,IAAW;QACpB,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QAE7D,IAAI,CAAC,UAAU,EAAE;YACf,OAAO;SACR;QAED,IAAI,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAClC,CAAC;CACF;AAvBD,kCAuBC;AAED,kBAAe,WAAW,CAAC"}
@@ -11,7 +11,7 @@ import Tile from '@civ-clone/core-world/Tile';
11
11
  import Unit from '@civ-clone/core-unit/Unit';
12
12
 
13
13
  export class SetHomeCity extends Action {
14
- #cityRegistry: CityRegistry;
14
+ private _cityRegistry: CityRegistry;
15
15
 
16
16
  constructor(
17
17
  from: Tile,
@@ -22,10 +22,10 @@ export class SetHomeCity extends Action {
22
22
  ) {
23
23
  super(from, to, unit, ruleRegistry);
24
24
 
25
- this.#cityRegistry = cityRegistry;
25
+ this._cityRegistry = cityRegistry;
26
26
  }
27
27
  perform(...args: any[]): void {
28
- const targetCity = this.#cityRegistry.getByTile(this.from());
28
+ const targetCity = this._cityRegistry.getByTile(this.from());
29
29
 
30
30
  if (!targetCity) {
31
31
  return;
@@ -5,7 +5,7 @@ import Player from '@civ-clone/core-player/Player';
5
5
  import Tile from '@civ-clone/core-world/Tile';
6
6
  import Unit from '@civ-clone/core-unit/Unit';
7
7
  export declare class SneakAttack extends Attack {
8
- #private;
8
+ private _enemy;
9
9
  constructor(
10
10
  from: Tile,
11
11
  to: Tile,
@@ -1,16 +1,4 @@
1
1
  "use strict";
2
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
- if (kind === "m") throw new TypeError("Private method is not writable");
4
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
6
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
7
- };
8
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
- };
13
- var _SneakAttack_enemy;
14
2
  Object.defineProperty(exports, "__esModule", { value: true });
15
3
  exports.SneakAttack = void 0;
16
4
  const RuleRegistry_1 = require("@civ-clone/core-rule/RuleRegistry");
@@ -19,15 +7,13 @@ const Actions_1 = require("../Actions");
19
7
  class SneakAttack extends Actions_1.Attack {
20
8
  constructor(from, to, unit, enemy, ruleRegistry = RuleRegistry_1.instance, unitRegistry = UnitRegistry_1.instance) {
21
9
  super(from, to, unit, ruleRegistry, unitRegistry);
22
- _SneakAttack_enemy.set(this, void 0);
23
- __classPrivateFieldSet(this, _SneakAttack_enemy, enemy, "f");
10
+ this._enemy = enemy;
24
11
  this.addKey('enemy');
25
12
  }
26
13
  enemy() {
27
- return __classPrivateFieldGet(this, _SneakAttack_enemy, "f");
14
+ return this._enemy;
28
15
  }
29
16
  }
30
17
  exports.SneakAttack = SneakAttack;
31
- _SneakAttack_enemy = new WeakMap();
32
18
  exports.default = SneakAttack;
33
19
  //# sourceMappingURL=SneakAttack.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SneakAttack.js","sourceRoot":"","sources":["SneakAttack.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,oEAG2C;AAC3C,oEAG2C;AAC3C,wCAAoC;AAKpC,MAAa,WAAY,SAAQ,gBAAM;IAGrC,YACE,IAAU,EACV,EAAQ,EACR,IAAU,EACV,KAAa,EACb,eAA6B,uBAAoB,EACjD,eAA6B,uBAAoB;QAEjD,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;QAVpD,qCAAe;QAYb,uBAAA,IAAI,sBAAU,KAAK,MAAA,CAAC;QAEpB,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACvB,CAAC;IAED,KAAK;QACH,OAAO,uBAAA,IAAI,0BAAO,CAAC;IACrB,CAAC;CACF;AArBD,kCAqBC;;AAED,kBAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"SneakAttack.js","sourceRoot":"","sources":["SneakAttack.ts"],"names":[],"mappings":";;;AAAA,oEAG2C;AAC3C,oEAG2C;AAC3C,wCAAoC;AAKpC,MAAa,WAAY,SAAQ,gBAAM;IAGrC,YACE,IAAU,EACV,EAAQ,EACR,IAAU,EACV,KAAa,EACb,eAA6B,uBAAoB,EACjD,eAA6B,uBAAoB;QAEjD,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;QAElD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QAEpB,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACvB,CAAC;IAED,KAAK;QACH,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF;AArBD,kCAqBC;AAED,kBAAe,WAAW,CAAC"}
@@ -12,7 +12,7 @@ import Tile from '@civ-clone/core-world/Tile';
12
12
  import Unit from '@civ-clone/core-unit/Unit';
13
13
 
14
14
  export class SneakAttack extends Attack {
15
- #enemy: Player;
15
+ private _enemy: Player;
16
16
 
17
17
  constructor(
18
18
  from: Tile,
@@ -24,13 +24,13 @@ export class SneakAttack extends Attack {
24
24
  ) {
25
25
  super(from, to, unit, ruleRegistry, unitRegistry);
26
26
 
27
- this.#enemy = enemy;
27
+ this._enemy = enemy;
28
28
 
29
29
  this.addKey('enemy');
30
30
  }
31
31
 
32
32
  enemy(): Player {
33
- return this.#enemy;
33
+ return this._enemy;
34
34
  }
35
35
  }
36
36
 
@@ -5,7 +5,7 @@ import Player from '@civ-clone/core-player/Player';
5
5
  import Tile from '@civ-clone/core-world/Tile';
6
6
  import Unit from '@civ-clone/core-unit/Unit';
7
7
  export declare class SneakCaptureCity extends CaptureCity {
8
- #private;
8
+ private _enemy;
9
9
  constructor(
10
10
  from: Tile,
11
11
  to: Tile,
@@ -1,16 +1,4 @@
1
1
  "use strict";
2
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
- if (kind === "m") throw new TypeError("Private method is not writable");
4
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
6
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
7
- };
8
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
- };
13
- var _SneakCaptureCity_enemy;
14
2
  Object.defineProperty(exports, "__esModule", { value: true });
15
3
  exports.SneakCaptureCity = void 0;
16
4
  const RuleRegistry_1 = require("@civ-clone/core-rule/RuleRegistry");
@@ -18,15 +6,13 @@ const Actions_1 = require("../Actions");
18
6
  class SneakCaptureCity extends Actions_1.CaptureCity {
19
7
  constructor(from, to, unit, city, enemy, ruleRegistry = RuleRegistry_1.instance) {
20
8
  super(from, to, unit, city, ruleRegistry);
21
- _SneakCaptureCity_enemy.set(this, void 0);
22
- __classPrivateFieldSet(this, _SneakCaptureCity_enemy, enemy, "f");
9
+ this._enemy = enemy;
23
10
  this.addKey('enemy');
24
11
  }
25
12
  enemy() {
26
- return __classPrivateFieldGet(this, _SneakCaptureCity_enemy, "f");
13
+ return this._enemy;
27
14
  }
28
15
  }
29
16
  exports.SneakCaptureCity = SneakCaptureCity;
30
- _SneakCaptureCity_enemy = new WeakMap();
31
17
  exports.default = SneakCaptureCity;
32
18
  //# sourceMappingURL=SneakCaptureCity.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SneakCaptureCity.js","sourceRoot":"","sources":["SneakCaptureCity.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,oEAG2C;AAC3C,wCAAyC;AAMzC,MAAa,gBAAiB,SAAQ,qBAAW;IAG/C,YACE,IAAU,EACV,EAAQ,EACR,IAAU,EACV,IAAU,EACV,KAAa,EACb,eAA6B,uBAAoB;QAEjD,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;QAV5C,0CAAe;QAYb,uBAAA,IAAI,2BAAU,KAAK,MAAA,CAAC;QAEpB,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACvB,CAAC;IAED,KAAK;QACH,OAAO,uBAAA,IAAI,+BAAO,CAAC;IACrB,CAAC;CACF;AArBD,4CAqBC;;AAED,kBAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"SneakCaptureCity.js","sourceRoot":"","sources":["SneakCaptureCity.ts"],"names":[],"mappings":";;;AAAA,oEAG2C;AAC3C,wCAAyC;AAMzC,MAAa,gBAAiB,SAAQ,qBAAW;IAG/C,YACE,IAAU,EACV,EAAQ,EACR,IAAU,EACV,IAAU,EACV,KAAa,EACb,eAA6B,uBAAoB;QAEjD,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;QAE1C,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QAEpB,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACvB,CAAC;IAED,KAAK;QACH,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF;AArBD,4CAqBC;AAED,kBAAe,gBAAgB,CAAC"}
@@ -9,7 +9,7 @@ import Tile from '@civ-clone/core-world/Tile';
9
9
  import Unit from '@civ-clone/core-unit/Unit';
10
10
 
11
11
  export class SneakCaptureCity extends CaptureCity {
12
- #enemy: Player;
12
+ private _enemy: Player;
13
13
 
14
14
  constructor(
15
15
  from: Tile,
@@ -21,13 +21,13 @@ export class SneakCaptureCity extends CaptureCity {
21
21
  ) {
22
22
  super(from, to, unit, city, ruleRegistry);
23
23
 
24
- this.#enemy = enemy;
24
+ this._enemy = enemy;
25
25
 
26
26
  this.addKey('enemy');
27
27
  }
28
28
 
29
29
  enemy(): Player {
30
- return this.#enemy;
30
+ return this._enemy;
31
31
  }
32
32
  }
33
33
 
package/Actions.d.ts CHANGED
@@ -13,6 +13,7 @@ export { Embark } from './Actions/Embark';
13
13
  export { Fortify } from './Actions/Fortify';
14
14
  export { FoundCity } from './Actions/FoundCity';
15
15
  export { GoTo } from './Actions/GoTo';
16
+ export { JoinCity } from './Actions/JoinCity';
16
17
  export { Move } from './Actions/Move';
17
18
  export { NoOrders } from './Actions/NoOrders';
18
19
  export { Pillage } from './Actions/Pillage';
package/Actions.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Unload = exports.SneakCaptureCity = exports.SneakAttack = exports.Sleep = exports.SetHomeCity = exports.PlantForest = exports.Pillage = exports.NoOrders = exports.Move = exports.GoTo = exports.FoundCity = exports.Fortify = exports.Embark = exports.Disembark = exports.Disband = exports.ClearSwamp = exports.ClearJungle = exports.ClearForest = exports.CaptureCity = exports.BuildRoad = exports.BuildRailroad = exports.BuildMine = exports.BuildIrrigation = exports.Attack = void 0;
3
+ exports.Unload = exports.SneakCaptureCity = exports.SneakAttack = exports.Sleep = exports.SetHomeCity = exports.PlantForest = exports.Pillage = exports.NoOrders = exports.Move = exports.JoinCity = exports.GoTo = exports.FoundCity = exports.Fortify = exports.Embark = exports.Disembark = exports.Disband = exports.ClearSwamp = exports.ClearJungle = exports.ClearForest = exports.CaptureCity = exports.BuildRoad = exports.BuildRailroad = exports.BuildMine = exports.BuildIrrigation = exports.Attack = void 0;
4
4
  var Attack_1 = require("./Actions/Attack");
5
5
  Object.defineProperty(exports, "Attack", { enumerable: true, get: function () { return Attack_1.Attack; } });
6
6
  var BuildIrrigation_1 = require("./Actions/BuildIrrigation");
@@ -31,6 +31,8 @@ var FoundCity_1 = require("./Actions/FoundCity");
31
31
  Object.defineProperty(exports, "FoundCity", { enumerable: true, get: function () { return FoundCity_1.FoundCity; } });
32
32
  var GoTo_1 = require("./Actions/GoTo");
33
33
  Object.defineProperty(exports, "GoTo", { enumerable: true, get: function () { return GoTo_1.GoTo; } });
34
+ var JoinCity_1 = require("./Actions/JoinCity");
35
+ Object.defineProperty(exports, "JoinCity", { enumerable: true, get: function () { return JoinCity_1.JoinCity; } });
34
36
  var Move_1 = require("./Actions/Move");
35
37
  Object.defineProperty(exports, "Move", { enumerable: true, get: function () { return Move_1.Move; } });
36
38
  var NoOrders_1 = require("./Actions/NoOrders");
package/Actions.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Actions.js","sourceRoot":"","sources":["Actions.ts"],"names":[],"mappings":";;;AAAA,2CAA0C;AAAjC,gGAAA,MAAM,OAAA;AACf,6DAA4D;AAAnD,kHAAA,eAAe,OAAA;AACxB,iDAAgD;AAAvC,sGAAA,SAAS,OAAA;AAClB,yDAAwD;AAA/C,8GAAA,aAAa,OAAA;AACtB,iDAAgD;AAAvC,sGAAA,SAAS,OAAA;AAClB,qDAAoD;AAA3C,0GAAA,WAAW,OAAA;AACpB,qDAAoD;AAA3C,0GAAA,WAAW,OAAA;AACpB,qDAAoD;AAA3C,0GAAA,WAAW,OAAA;AACpB,mDAAkD;AAAzC,wGAAA,UAAU,OAAA;AACnB,6CAA4C;AAAnC,kGAAA,OAAO,OAAA;AAChB,iDAAgD;AAAvC,sGAAA,SAAS,OAAA;AAClB,2CAA0C;AAAjC,gGAAA,MAAM,OAAA;AACf,6CAA4C;AAAnC,kGAAA,OAAO,OAAA;AAChB,iDAAgD;AAAvC,sGAAA,SAAS,OAAA;AAClB,uCAAsC;AAA7B,4FAAA,IAAI,OAAA;AACb,uCAAsC;AAA7B,4FAAA,IAAI,OAAA;AACb,+CAA8C;AAArC,oGAAA,QAAQ,OAAA;AACjB,6CAA4C;AAAnC,kGAAA,OAAO,OAAA;AAChB,qDAAoD;AAA3C,0GAAA,WAAW,OAAA;AACpB,qDAAoD;AAA3C,0GAAA,WAAW,OAAA;AACpB,yCAAwC;AAA/B,8FAAA,KAAK,OAAA;AACd,qDAAoD;AAA3C,0GAAA,WAAW,OAAA;AACpB,+DAA8D;AAArD,oHAAA,gBAAgB,OAAA;AACzB,2CAA0C;AAAjC,gGAAA,MAAM,OAAA"}
1
+ {"version":3,"file":"Actions.js","sourceRoot":"","sources":["Actions.ts"],"names":[],"mappings":";;;AAAA,2CAA0C;AAAjC,gGAAA,MAAM,OAAA;AACf,6DAA4D;AAAnD,kHAAA,eAAe,OAAA;AACxB,iDAAgD;AAAvC,sGAAA,SAAS,OAAA;AAClB,yDAAwD;AAA/C,8GAAA,aAAa,OAAA;AACtB,iDAAgD;AAAvC,sGAAA,SAAS,OAAA;AAClB,qDAAoD;AAA3C,0GAAA,WAAW,OAAA;AACpB,qDAAoD;AAA3C,0GAAA,WAAW,OAAA;AACpB,qDAAoD;AAA3C,0GAAA,WAAW,OAAA;AACpB,mDAAkD;AAAzC,wGAAA,UAAU,OAAA;AACnB,6CAA4C;AAAnC,kGAAA,OAAO,OAAA;AAChB,iDAAgD;AAAvC,sGAAA,SAAS,OAAA;AAClB,2CAA0C;AAAjC,gGAAA,MAAM,OAAA;AACf,6CAA4C;AAAnC,kGAAA,OAAO,OAAA;AAChB,iDAAgD;AAAvC,sGAAA,SAAS,OAAA;AAClB,uCAAsC;AAA7B,4FAAA,IAAI,OAAA;AACb,+CAA8C;AAArC,oGAAA,QAAQ,OAAA;AACjB,uCAAsC;AAA7B,4FAAA,IAAI,OAAA;AACb,+CAA8C;AAArC,oGAAA,QAAQ,OAAA;AACjB,6CAA4C;AAAnC,kGAAA,OAAO,OAAA;AAChB,qDAAoD;AAA3C,0GAAA,WAAW,OAAA;AACpB,qDAAoD;AAA3C,0GAAA,WAAW,OAAA;AACpB,yCAAwC;AAA/B,8FAAA,KAAK,OAAA;AACd,qDAAoD;AAA3C,0GAAA,WAAW,OAAA;AACpB,+DAA8D;AAArD,oHAAA,gBAAgB,OAAA;AACzB,2CAA0C;AAAjC,gGAAA,MAAM,OAAA"}
package/Actions.ts CHANGED
@@ -13,6 +13,7 @@ export { Embark } from './Actions/Embark';
13
13
  export { Fortify } from './Actions/Fortify';
14
14
  export { FoundCity } from './Actions/FoundCity';
15
15
  export { GoTo } from './Actions/GoTo';
16
+ export { JoinCity } from './Actions/JoinCity';
16
17
  export { Move } from './Actions/Move';
17
18
  export { NoOrders } from './Actions/NoOrders';
18
19
  export { Pillage } from './Actions/Pillage';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@civ-clone/library-unit",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "repository": "git@github.com:civ-clone/library-unit.git",
5
5
  "keywords": [
6
6
  "typescript",
@@ -10,13 +10,19 @@
10
10
  "license": "MIT",
11
11
  "scripts": {
12
12
  "build": "npm run ts:compile && npm run prettier:format",
13
- "prettier:check": "prettier --config .prettierrc '**/*.ts'",
13
+ "prettier:check": "prettier --config .prettierrc --check '**/*.ts'",
14
14
  "prettier:format": "prettier --config .prettierrc '**/*.ts' --write",
15
+ "test": "ts-mocha ./tests/*.test.ts",
15
16
  "ts:compile": "tsc --build tsconfig.json"
16
17
  },
17
18
  "devDependencies": {
19
+ "@types/chai": "^4.0",
20
+ "@types/mocha": "^9.0",
18
21
  "@types/node": "^14.0.0",
22
+ "chai": "^4.0",
23
+ "mocha": "^9.0",
19
24
  "prettier": "^2.0.0",
25
+ "ts-mocha": "^9.0",
20
26
  "typescript": "^4.0.0"
21
27
  },
22
28
  "dependencies": {
@@ -37,6 +43,7 @@
37
43
  "@civ-clone/base-unit-action-fortify": "^0.1.0",
38
44
  "@civ-clone/base-unit-action-found-city": "^0.1.0",
39
45
  "@civ-clone/base-unit-action-goto": "^0.1.0",
46
+ "@civ-clone/base-unit-action-join-city": "^0.1.0",
40
47
  "@civ-clone/base-unit-action-move": "^0.1.0",
41
48
  "@civ-clone/base-unit-action-no-orders": "^0.1.0",
42
49
  "@civ-clone/base-unit-action-pillage": "^0.1.0",
@@ -80,6 +87,8 @@
80
87
  "@civ-clone/base-unit-type-worker": "^0.1.0",
81
88
  "@civ-clone/base-unit-warrior": "^0.1.0",
82
89
  "@civ-clone/core-city": "^0.1.0",
90
+ "@civ-clone/core-player": "^0.1.0",
91
+ "@civ-clone/core-rule": "^0.1.0",
83
92
  "@civ-clone/core-unit": "^0.1.0",
84
93
  "@civ-clone/core-unit-transport": "^0.1.0",
85
94
  "@civ-clone/core-world": "^0.1.0"
@@ -0,0 +1,32 @@
1
+ import * as Actions from '../Actions';
2
+ import * as PlayerActions from '../PlayerActions';
3
+ import * as Types from '../Types';
4
+ import * as UnitImprovements from '../UnitImprovements';
5
+ import * as Units from '../Units';
6
+ import { expect } from 'chai';
7
+ import { JoinCity } from '@civ-clone/base-unit-action-join-city/JoinCity';
8
+
9
+ describe('library-unit', (): void => {
10
+ (
11
+ [
12
+ ['Actions', Actions],
13
+ ['PlayerActions', PlayerActions],
14
+ ['Types', Types],
15
+ ['UnitImprovements', UnitImprovements],
16
+ ['Units', Units],
17
+ ] as [string, { [key: string]: unknown }][]
18
+ ).forEach(([moduleName, exports]): void =>
19
+ it(`should export a class under its own name from \`${moduleName}\``, (): void => {
20
+ expect(Object.keys(exports)).not.empty;
21
+
22
+ Object.entries(exports).forEach(([name, value]): void => {
23
+ expect(value, name).to.be.a('function');
24
+ expect((value as Function).name, name).to.equal(name);
25
+ });
26
+ })
27
+ );
28
+
29
+ it('should re-export `JoinCity` from base-unit-action-join-city', (): void => {
30
+ expect(Actions.JoinCity).to.equal(JoinCity);
31
+ });
32
+ });