Skip to content

Commit 6dc6c6f

Browse files
committed
try to build with docker
1 parent 2d65e47 commit 6dc6c6f

4 files changed

Lines changed: 63 additions & 32 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 5 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -18,44 +18,17 @@ jobs:
1818
runs-on: ubuntu-latest
1919
steps:
2020
- uses: actions/checkout@v4
21-
# use python 2.7 to build node-gyp
22-
- uses: actions/setup-python@v5
23-
with:
24-
python-version: '2.7'
25-
# use node 6 to build, as v3 is an old version
26-
- uses: actions/setup-node@v4
27-
with:
28-
node-version: '6'
29-
registry-url: 'https://registry.npmjs.org'
30-
- uses: actions/cache@v4
31-
with:
32-
path: ~/.npm
33-
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
34-
restore-keys: ${{ runner.OS }}-node-
35-
- run: npm install
36-
21+
# use node:6 docker image to build, as v3 is an old version requiring node-gyp with python 2.7
22+
- name: Build with Node 6 (via Docker)
23+
run: docker run --rm -v $(pwd):/app -w /app node:6 sh -c "npm install && npm run build"
24+
3725
# use node 20 to publish
3826
- uses: actions/setup-node@v4
3927
with:
4028
node-version: '20'
4129
registry-url: 'https://registry.npmjs.org'
42-
- uses: actions/cache@v4
43-
with:
44-
path: ~/.npm
45-
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
46-
restore-keys: ${{ runner.OS }}-node-
47-
- run: npm run build
4830

4931
# Ensure npm 11.5.1 or later is installed
5032
- name: Update npm
5133
run: npm install -g npm@latest
52-
- name: 'Determine NPM tag: latest or next depending if we are on a prerelease or not (version with hyphen should be a prerelease)'
53-
id: npm_tag
54-
run: |
55-
VERSION=$(node -p "require('./package.json').version")
56-
if [[ $VERSION == *-* ]]; then
57-
echo "TAG=next" >> "$GITHUB_OUTPUT"
58-
else
59-
echo "TAG=latest" >> "$GITHUB_OUTPUT"
60-
fi
61-
- run: cd npm && npm publish --tag ${{ steps.npm_tag.outputs.TAG }}
34+
- run: npm publish --tag version-4

‎.vscode/settings.json‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"typescript.tsdk": "node_modules/typescript/lib",
3+
"i18n-ally.localesPaths": []
4+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { List, Map } from 'immutable';
2+
import { describe, expect, it } from '@jest/globals';
3+
import { IS_ORDERED_SYMBOL } from '../src/predicates/isOrdered';
4+
import { hashCollection } from '../src/utils/hashCollection';
5+
6+
const EMPTY_SEQ_HASH_MAP = -15128758;
7+
const EMPTY_SEQ_HASH_ORDERED_MAP = -943827830;
8+
9+
describe('hashCollection', () => {
10+
it('computes hash for collection with undefined size', () => {
11+
expect(hashCollection({ size: undefined, __iterate: () => {} })).toBe(
12+
EMPTY_SEQ_HASH_MAP
13+
);
14+
15+
expect(
16+
hashCollection({
17+
size: undefined,
18+
[IS_ORDERED_SYMBOL]: true,
19+
__iterate: () => {},
20+
})
21+
).toBe(EMPTY_SEQ_HASH_ORDERED_MAP);
22+
});
23+
24+
it('computes hash for collection with infinite size', () => {
25+
expect(hashCollection({ size: Infinity, __iterate: () => {} })).toBe(0);
26+
});
27+
28+
it('computes hash for collection with empty sequence', () => {
29+
expect(List().hashCode()).toBe(EMPTY_SEQ_HASH_ORDERED_MAP);
30+
expect(Map().hashCode()).toBe(EMPTY_SEQ_HASH_MAP);
31+
});
32+
33+
it('computes hash for collection with non-empty sequence', () => {
34+
expect(List(['a']).hashCode()).toBe(873615215);
35+
expect(Map({ a: 1 }).hashCode()).toBe(-356504055);
36+
});
37+
});

‎test.js‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
class A {
2+
toB() {
3+
return new B();
4+
}
5+
}
6+
7+
class B extends A {
8+
toA() {
9+
return new A();
10+
}
11+
}
12+
13+
const a = new A();
14+
const b = a.toB();
15+
const a2 = b.toA();
16+
17+
console.log(a2);

0 commit comments

Comments
 (0)