@reldens/skills 0.54.0 → 0.58.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 +135 -0
- package/CLAUDE.md +619 -619
- package/README.md +353 -353
- package/index.js +19 -19
- package/lib/class-path.js +143 -143
- package/lib/client/receiver.js +86 -86
- package/lib/constants.js +67 -67
- package/lib/level.js +31 -31
- package/lib/levels-set.js +276 -276
- package/lib/server/sender.js +180 -180
- package/lib/server.js +53 -53
- package/lib/skill.js +345 -345
- package/lib/skills-events.js +45 -45
- package/lib/types/attack.js +202 -202
- package/lib/types/effect.js +52 -52
- package/lib/types/physical-attack.js +46 -46
- package/lib/types/physical-effect.js +46 -46
- package/lib/types/physical-properties-validator.js +35 -35
- package/lib/types/physical-skill-runner.js +41 -41
- package/package.json +52 -52
- package/tests/unit/test-class-path.js +4 -3
- package/tests/unit/test-levels-set.js +4 -3
- package/tests/unit/test-skill.js +4 -3
- package/tests/unit/types/test-attack.js +4 -3
- package/tests/unit/types/test-effect.js +4 -3
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
name: Publish to npm
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
inputs:
|
|
8
|
+
ref:
|
|
9
|
+
description: 'Tag, branch or commit to publish'
|
|
10
|
+
required: true
|
|
11
|
+
default: 'master'
|
|
12
|
+
dist_tag:
|
|
13
|
+
description: 'npm dist-tag (latest for stable, next for prereleases)'
|
|
14
|
+
required: false
|
|
15
|
+
default: ''
|
|
16
|
+
dry_run:
|
|
17
|
+
description: 'Validate and pack only, do not publish'
|
|
18
|
+
type: boolean
|
|
19
|
+
required: false
|
|
20
|
+
default: false
|
|
21
|
+
|
|
22
|
+
permissions:
|
|
23
|
+
contents: read
|
|
24
|
+
id-token: write
|
|
25
|
+
|
|
26
|
+
concurrency:
|
|
27
|
+
group: npm-publish-${{ github.repository }}
|
|
28
|
+
cancel-in-progress: false
|
|
29
|
+
|
|
30
|
+
jobs:
|
|
31
|
+
publish:
|
|
32
|
+
name: Validate, test and publish
|
|
33
|
+
runs-on: ubuntu-latest
|
|
34
|
+
timeout-minutes: 20
|
|
35
|
+
steps:
|
|
36
|
+
- name: Checkout the released source
|
|
37
|
+
uses: actions/checkout@v4
|
|
38
|
+
with:
|
|
39
|
+
ref: ${{ github.event.inputs.ref || github.ref }}
|
|
40
|
+
|
|
41
|
+
- name: Set up Node.js
|
|
42
|
+
uses: actions/setup-node@v4
|
|
43
|
+
with:
|
|
44
|
+
node-version: '24'
|
|
45
|
+
registry-url: 'https://registry.npmjs.org'
|
|
46
|
+
|
|
47
|
+
- name: Ensure an npm version with trusted publishing support
|
|
48
|
+
run: |
|
|
49
|
+
NPM_VERSION=$(npm --version)
|
|
50
|
+
echo "Runner has npm $NPM_VERSION on node $(node --version)"
|
|
51
|
+
NPM_MAJOR=${NPM_VERSION%%.*}
|
|
52
|
+
if [ "$NPM_MAJOR" -lt 11 ]; then
|
|
53
|
+
npm install -g npm@11
|
|
54
|
+
echo "Upgraded to npm $(npm --version)"
|
|
55
|
+
fi
|
|
56
|
+
|
|
57
|
+
- name: Read package metadata
|
|
58
|
+
id: meta
|
|
59
|
+
run: |
|
|
60
|
+
PKG_NAME=$(node -p "require('./package.json').name")
|
|
61
|
+
PKG_VERSION=$(node -p "require('./package.json').version")
|
|
62
|
+
PKG_PRIVATE=$(node -p "String(require('./package.json').private === true)")
|
|
63
|
+
echo "name=$PKG_NAME" >> "$GITHUB_OUTPUT"
|
|
64
|
+
echo "version=$PKG_VERSION" >> "$GITHUB_OUTPUT"
|
|
65
|
+
echo "private=$PKG_PRIVATE" >> "$GITHUB_OUTPUT"
|
|
66
|
+
echo "Publishing candidate: $PKG_NAME@$PKG_VERSION"
|
|
67
|
+
|
|
68
|
+
- name: Reject private packages
|
|
69
|
+
if: steps.meta.outputs.private == 'true'
|
|
70
|
+
run: |
|
|
71
|
+
echo "::error::${{ steps.meta.outputs.name }} is marked private and must not be published."
|
|
72
|
+
exit 1
|
|
73
|
+
|
|
74
|
+
- name: Check the release tag matches the package version
|
|
75
|
+
if: github.event_name == 'release'
|
|
76
|
+
run: |
|
|
77
|
+
TAG_VERSION="${{ github.event.release.tag_name }}"
|
|
78
|
+
TAG_VERSION="${TAG_VERSION#v}"
|
|
79
|
+
if [ "$TAG_VERSION" != "${{ steps.meta.outputs.version }}" ]; then
|
|
80
|
+
echo "::error::Release tag $TAG_VERSION does not match package.json version ${{ steps.meta.outputs.version }}."
|
|
81
|
+
exit 1
|
|
82
|
+
fi
|
|
83
|
+
|
|
84
|
+
- name: Check the version is not published yet
|
|
85
|
+
run: |
|
|
86
|
+
PUBLISHED=$(npm view "${{ steps.meta.outputs.name }}@${{ steps.meta.outputs.version }}" version --registry=https://registry.npmjs.org/ --prefer-online 2>/dev/null || true)
|
|
87
|
+
if [ -n "$PUBLISHED" ]; then
|
|
88
|
+
echo "::error::${{ steps.meta.outputs.name }}@${{ steps.meta.outputs.version }} already exists on npm. Bump the version, published versions are immutable."
|
|
89
|
+
exit 1
|
|
90
|
+
fi
|
|
91
|
+
|
|
92
|
+
- name: Resolve the dist-tag
|
|
93
|
+
id: disttag
|
|
94
|
+
run: |
|
|
95
|
+
DIST_TAG="${{ github.event.inputs.dist_tag }}"
|
|
96
|
+
if [ -z "$DIST_TAG" ]; then
|
|
97
|
+
DIST_TAG="latest"
|
|
98
|
+
case "${{ steps.meta.outputs.version }}" in
|
|
99
|
+
*-*) DIST_TAG="next" ;;
|
|
100
|
+
esac
|
|
101
|
+
fi
|
|
102
|
+
echo "value=$DIST_TAG" >> "$GITHUB_OUTPUT"
|
|
103
|
+
echo "Using dist-tag: $DIST_TAG"
|
|
104
|
+
|
|
105
|
+
- name: Install dependencies
|
|
106
|
+
run: npm ci
|
|
107
|
+
|
|
108
|
+
- name: Run tests
|
|
109
|
+
env:
|
|
110
|
+
RELDENS_LOG_LEVEL: '9'
|
|
111
|
+
run: npm test --if-present
|
|
112
|
+
|
|
113
|
+
- name: Pack only (dry run)
|
|
114
|
+
if: github.event.inputs.dry_run == 'true'
|
|
115
|
+
run: |
|
|
116
|
+
npm publish --dry-run --access public --tag "${{ steps.disttag.outputs.value }}"
|
|
117
|
+
echo "Dry run finished, nothing was published."
|
|
118
|
+
|
|
119
|
+
- name: Publish to npm with trusted publishing
|
|
120
|
+
if: github.event.inputs.dry_run != 'true'
|
|
121
|
+
run: npm publish --access public --tag "${{ steps.disttag.outputs.value }}"
|
|
122
|
+
|
|
123
|
+
- name: Confirm the published version
|
|
124
|
+
if: github.event.inputs.dry_run != 'true'
|
|
125
|
+
run: |
|
|
126
|
+
for ATTEMPT in 1 2 3 4 5 6; do
|
|
127
|
+
FOUND=$(npm view "${{ steps.meta.outputs.name }}@${{ steps.meta.outputs.version }}" version --registry=https://registry.npmjs.org/ --prefer-online 2>/dev/null || true)
|
|
128
|
+
if [ -n "$FOUND" ]; then
|
|
129
|
+
echo "Confirmed on the registry: ${{ steps.meta.outputs.name }}@$FOUND (dist-tag ${{ steps.disttag.outputs.value }})"
|
|
130
|
+
exit 0
|
|
131
|
+
fi
|
|
132
|
+
echo "Not visible yet, retry $ATTEMPT after $((ATTEMPT * 10))s of registry propagation."
|
|
133
|
+
sleep $((ATTEMPT * 10))
|
|
134
|
+
done
|
|
135
|
+
echo "::warning::Publish reported success but the version is not visible yet. Do NOT republish, it is propagation lag."
|