@reldens/skills 0.58.0 → 0.59.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/.github/workflows/npm-publish.yml +12 -7
- package/.github/workflows/tests.yml +36 -0
- package/lib/types/physical-attack.js +1 -1
- package/lib/types/physical-effect.js +1 -1
- package/package.json +2 -2
- package/tests/unit/types/test-physical-attack.js +7 -0
- package/tests/unit/types/test-physical-effect.js +11 -0
|
@@ -123,13 +123,18 @@ jobs:
|
|
|
123
123
|
- name: Confirm the published version
|
|
124
124
|
if: github.event.inputs.dry_run != 'true'
|
|
125
125
|
run: |
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
126
|
+
PKG_NAME="${{ steps.meta.outputs.name }}"
|
|
127
|
+
PKG_VERSION="${{ steps.meta.outputs.version }}"
|
|
128
|
+
DIST_TAG="${{ steps.disttag.outputs.value }}"
|
|
129
|
+
for ATTEMPT in 1 2 3 4 5 6 7 8 9 10; do
|
|
130
|
+
FOUND=$(npm view "$PKG_NAME@$PKG_VERSION" version --registry=https://registry.npmjs.org/ --prefer-online --loglevel=error 2>/dev/null || true)
|
|
131
|
+
TAGGED=$(npm view "$PKG_NAME" "dist-tags.$DIST_TAG" --registry=https://registry.npmjs.org/ --prefer-online --loglevel=error 2>/dev/null || true)
|
|
132
|
+
if [ "$FOUND" = "$PKG_VERSION" ] && [ "$TAGGED" = "$PKG_VERSION" ]; then
|
|
133
|
+
echo "Confirmed on the registry: $PKG_NAME@$PKG_VERSION with dist-tag $DIST_TAG."
|
|
130
134
|
exit 0
|
|
131
135
|
fi
|
|
132
|
-
echo "
|
|
133
|
-
sleep
|
|
136
|
+
echo "Attempt $ATTEMPT: $PKG_NAME@$PKG_VERSION is not on the registry yet, the dist-tag $DIST_TAG points to [${TAGGED:-none}]. Retry in 60s."
|
|
137
|
+
sleep 60
|
|
134
138
|
done
|
|
135
|
-
echo "::
|
|
139
|
+
echo "::error::$PKG_NAME@$PKG_VERSION with dist-tag $DIST_TAG was not confirmed on the registry after 10 minutes. Check https://www.npmjs.com/package/$PKG_NAME before releasing again, published versions are immutable."
|
|
140
|
+
exit 1
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
name: Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
push:
|
|
6
|
+
branches: [develop, master]
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
concurrency:
|
|
12
|
+
group: tests-${{ github.ref }}
|
|
13
|
+
cancel-in-progress: true
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
tests:
|
|
17
|
+
name: tests
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
timeout-minutes: 20
|
|
20
|
+
steps:
|
|
21
|
+
- name: Checkout the source
|
|
22
|
+
uses: actions/checkout@v4
|
|
23
|
+
|
|
24
|
+
- name: Set up Node.js
|
|
25
|
+
uses: actions/setup-node@v4
|
|
26
|
+
with:
|
|
27
|
+
node-version: '24'
|
|
28
|
+
cache: npm
|
|
29
|
+
|
|
30
|
+
- name: Install dependencies
|
|
31
|
+
run: npm ci
|
|
32
|
+
|
|
33
|
+
- name: Run tests
|
|
34
|
+
env:
|
|
35
|
+
RELDENS_LOG_LEVEL: '9'
|
|
36
|
+
run: npm test
|
|
@@ -21,7 +21,7 @@ class PhysicalAttack extends Attack
|
|
|
21
21
|
super(props);
|
|
22
22
|
this.type = SkillsConst.SKILL.TYPE.PHYSICAL_ATTACK;
|
|
23
23
|
this.parentType = SkillsConst.SKILL.TYPE.ATTACK;
|
|
24
|
-
this.isReady = PhysicalPropertiesValidator.validate(props);
|
|
24
|
+
this.isReady = this.isReady && PhysicalPropertiesValidator.validate(props);
|
|
25
25
|
this.magnitude = props.magnitude;
|
|
26
26
|
this.objectWidth = props.objectWidth;
|
|
27
27
|
this.objectHeight = props.objectHeight;
|
|
@@ -21,7 +21,7 @@ class PhysicalEffect extends Effect
|
|
|
21
21
|
super(props);
|
|
22
22
|
this.type = SkillsConst.SKILL.TYPE.PHYSICAL_EFFECT;
|
|
23
23
|
this.parentType = SkillsConst.SKILL.TYPE.EFFECT;
|
|
24
|
-
this.isReady = PhysicalPropertiesValidator.validate(props);
|
|
24
|
+
this.isReady = this.isReady && PhysicalPropertiesValidator.validate(props);
|
|
25
25
|
this.magnitude = props.magnitude;
|
|
26
26
|
this.objectWidth = props.objectWidth;
|
|
27
27
|
this.objectHeight = props.objectHeight;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reldens/skills",
|
|
3
3
|
"scope": "@reldens",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.59.0",
|
|
5
5
|
"description": "Reldens - Skills",
|
|
6
6
|
"author": "Damian A. Pastorini",
|
|
7
7
|
"license": "MIT",
|
|
@@ -47,6 +47,6 @@
|
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@reldens/modifiers": "^0.43.0",
|
|
50
|
-
"@reldens/utils": "^0.
|
|
50
|
+
"@reldens/utils": "^0.66.0"
|
|
51
51
|
}
|
|
52
52
|
}
|
|
@@ -76,6 +76,13 @@ describe('PhysicalAttack', () => {
|
|
|
76
76
|
assert.strictEqual(skill.isReady, false);
|
|
77
77
|
});
|
|
78
78
|
|
|
79
|
+
it('should keep isReady false when the attack affectedProperty is missing', async () => {
|
|
80
|
+
let skillData = {...BaseSkillsFixtures.physicalAttackSkill, owner: mockOwner};
|
|
81
|
+
delete skillData.affectedProperty;
|
|
82
|
+
let skill = new PhysicalAttack(skillData);
|
|
83
|
+
assert.deepStrictEqual([skill.isReady, await skill.execute(mockTarget)], [false, false]);
|
|
84
|
+
});
|
|
85
|
+
|
|
79
86
|
it('should set magnitude property', () => {
|
|
80
87
|
let skillData = {...BaseSkillsFixtures.physicalAttackSkill, owner: mockOwner};
|
|
81
88
|
let skill = new PhysicalAttack(skillData);
|
|
@@ -119,6 +119,17 @@ describe('PhysicalEffect', () => {
|
|
|
119
119
|
assert.strictEqual(skill.isReady, false);
|
|
120
120
|
});
|
|
121
121
|
|
|
122
|
+
it('should keep isReady false when the effect targetEffects are missing', async () => {
|
|
123
|
+
let skill = new PhysicalEffect({
|
|
124
|
+
key: 'test-physical-effect',
|
|
125
|
+
owner: mockOwner,
|
|
126
|
+
magnitude: 100,
|
|
127
|
+
objectWidth: 10,
|
|
128
|
+
objectHeight: 10
|
|
129
|
+
});
|
|
130
|
+
assert.deepStrictEqual([skill.isReady, await skill.execute(mockTarget)], [false, false]);
|
|
131
|
+
});
|
|
132
|
+
|
|
122
133
|
it('should set magnitude property', () => {
|
|
123
134
|
let skillData = {
|
|
124
135
|
key: 'test-physical-effect',
|