@geolonia/embed 4.3.0 → 5.0.2
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/build.yml +99 -36
- package/.nvmrc +1 -1
- package/.prettierrc.json +4 -0
- package/.tool-versions +1 -1
- package/README.md +7 -1
- package/dist/e2e/basic.spec.d.ts +8 -0
- package/dist/e2e/helper.d.ts +4 -0
- package/dist/embed +2 -1
- package/dist/embed-chunks/2489af4328c51b71e92d.js +2 -0
- package/dist/embed-chunks/6e05bbf5f391fda5b858.js +1 -0
- package/dist/embed.js +2 -1
- package/dist/embed.js.LICENSE.txt +4 -0
- package/dist/playwright.config.d.ts +9 -0
- package/dist/{embed.d.ts → src/embed.d.ts} +3 -1
- package/dist/{lib → src/lib}/geolonia-map.d.ts +10 -2
- package/dist/{lib → src/lib}/geolonia-marker.d.ts +1 -2
- package/dist/{lib → src/lib}/maplibre-util.d.ts +1 -3
- package/dist/{lib → src/lib}/util.d.ts +6 -3
- package/dist/src/lib/util.test.d.ts +1 -0
- package/dist/src/testability.test.d.ts +1 -0
- package/dist/src/version.d.ts +1 -0
- package/e2e/basic.spec.ts +52 -0
- package/e2e/helper.ts +12 -0
- package/e2e/map.spec.ts +69 -0
- package/eslint.config.js +232 -0
- package/package.json +25 -12
- package/playwright.config.ts +79 -0
- package/src/embed.ts +13 -7
- package/src/lib/CustomAttributionControl.ts +52 -29
- package/src/lib/geolonia-map.ts +144 -38
- package/src/lib/geolonia-marker.ts +9 -6
- package/src/lib/keyring.test.ts +18 -0
- package/src/lib/keyring.ts +11 -13
- package/src/lib/maplibre-util.ts +31 -19
- package/src/lib/parse-atts.test.ts +2 -1
- package/src/lib/render.ts +18 -7
- package/src/lib/simplestyle-vector.ts +42 -13
- package/src/lib/simplestyle.test.ts +80 -69
- package/src/lib/simplestyle.ts +61 -43
- package/src/lib/util.test.ts +108 -21
- package/src/lib/util.ts +115 -32
- package/src/testability.test.ts +46 -0
- package/tsconfig.json +3 -1
- package/webpack.config.js +10 -1
- package/.eslintignore +0 -3
- package/.eslintrc.js +0 -14
- package/.prettierrc.js +0 -1
- package/dist/embed-chunks/b52b89229e47dc93c64b.js +0 -2
- package/dist/embed-chunks/d0f087405f7ae2fcf1c1.js +0 -1
- package/dist/version.d.ts +0 -1
- /package/dist/{lib/keyring.test.d.ts → e2e/map.spec.d.ts} +0 -0
- /package/dist/embed-chunks/{b52b89229e47dc93c64b.js.LICENSE.txt → 2489af4328c51b71e92d.js.LICENSE.txt} +0 -0
- /package/dist/{lib → src/lib}/CustomAttributionControl.d.ts +0 -0
- /package/dist/{lib → src/lib}/controls/geolonia-control.d.ts +0 -0
- /package/dist/{lib → src/lib}/keyring.d.ts +0 -0
- /package/dist/{lib/parse-atts.test.d.ts → src/lib/keyring.test.d.ts} +0 -0
- /package/dist/{lib → src/lib}/parse-atts.d.ts +0 -0
- /package/dist/{lib/simplestyle.test.d.ts → src/lib/parse-atts.test.d.ts} +0 -0
- /package/dist/{lib → src/lib}/render.d.ts +0 -0
- /package/dist/{lib → src/lib}/simplestyle-vector.d.ts +0 -0
- /package/dist/{lib → src/lib}/simplestyle.d.ts +0 -0
- /package/dist/{lib/util.test.d.ts → src/lib/simplestyle.test.d.ts} +0 -0
- /package/dist/{types-internal.d.ts → src/types-internal.d.ts} +0 -0
|
@@ -11,28 +11,40 @@ on:
|
|
|
11
11
|
branches: [master]
|
|
12
12
|
|
|
13
13
|
jobs:
|
|
14
|
+
act-test:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- name: Block obsolete job execution
|
|
18
|
+
run: |
|
|
19
|
+
if [ -n "$ACT" ]; then
|
|
20
|
+
echo "Running in act, some jobs are skipped"
|
|
21
|
+
exit 1
|
|
22
|
+
else
|
|
23
|
+
exit 0
|
|
24
|
+
fi
|
|
25
|
+
continue-on-error: true
|
|
14
26
|
build:
|
|
15
27
|
runs-on: ubuntu-latest
|
|
16
28
|
strategy:
|
|
17
29
|
matrix:
|
|
18
|
-
node-version: ['
|
|
30
|
+
node-version: ['22.x']
|
|
19
31
|
steps:
|
|
20
|
-
- uses: actions/checkout@
|
|
32
|
+
- uses: actions/checkout@v4
|
|
21
33
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
22
|
-
uses: actions/setup-node@
|
|
34
|
+
uses: actions/setup-node@v4
|
|
23
35
|
with:
|
|
24
36
|
node-version: ${{ matrix.node-version }}
|
|
25
37
|
- name: Cache node_modules
|
|
26
|
-
uses: actions/cache@
|
|
38
|
+
uses: actions/cache@v4
|
|
27
39
|
with:
|
|
28
40
|
path: node_modules
|
|
29
|
-
key: modules-cache-v1-${{ runner.os }}-${{ hashFiles('
|
|
30
|
-
- run:
|
|
31
|
-
- run:
|
|
32
|
-
- run:
|
|
33
|
-
- run:
|
|
41
|
+
key: modules-cache-v1-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
|
|
42
|
+
- run: npm install
|
|
43
|
+
- run: npm run lint
|
|
44
|
+
- run: npm run test
|
|
45
|
+
- run: npm run build
|
|
34
46
|
- name: save the built
|
|
35
|
-
uses: actions/upload-artifact@
|
|
47
|
+
uses: actions/upload-artifact@v4
|
|
36
48
|
if: "!failure()"
|
|
37
49
|
with:
|
|
38
50
|
retention-days: 1
|
|
@@ -46,18 +58,19 @@ jobs:
|
|
|
46
58
|
runs-on: ubuntu-latest
|
|
47
59
|
needs:
|
|
48
60
|
- build
|
|
61
|
+
- act-test
|
|
49
62
|
if: ${{ github.ref == 'refs/heads/master' }}
|
|
50
63
|
steps:
|
|
51
|
-
- uses: actions/checkout@
|
|
52
|
-
- uses: actions/setup-node@
|
|
64
|
+
- uses: actions/checkout@v4
|
|
65
|
+
- uses: actions/setup-node@v4
|
|
53
66
|
with:
|
|
54
|
-
node-version: '
|
|
67
|
+
node-version: '22.x'
|
|
55
68
|
- name: Clean repo
|
|
56
69
|
run: |
|
|
57
70
|
git checkout --orphan gh-pages
|
|
58
71
|
git rm -rf . > /dev/null 2>&1
|
|
59
72
|
- name: load the built
|
|
60
|
-
uses: actions/download-artifact@
|
|
73
|
+
uses: actions/download-artifact@v4
|
|
61
74
|
with:
|
|
62
75
|
name: the-built
|
|
63
76
|
- name: Setup and deploy Github Pages
|
|
@@ -75,17 +88,18 @@ jobs:
|
|
|
75
88
|
runs-on: ubuntu-latest
|
|
76
89
|
needs:
|
|
77
90
|
- build
|
|
91
|
+
- act-test
|
|
78
92
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
79
93
|
steps:
|
|
80
|
-
- uses: actions/checkout@
|
|
81
|
-
- uses: actions/setup-node@
|
|
94
|
+
- uses: actions/checkout@v4
|
|
95
|
+
- uses: actions/setup-node@v4
|
|
82
96
|
with:
|
|
83
97
|
tag_name: 'v%s'
|
|
84
|
-
node-version: '
|
|
98
|
+
node-version: '22.x'
|
|
85
99
|
registry-url: 'https://registry.npmjs.org'
|
|
86
100
|
scope: '@geolonia'
|
|
87
101
|
- name: load the built
|
|
88
|
-
uses: actions/download-artifact@
|
|
102
|
+
uses: actions/download-artifact@v4
|
|
89
103
|
with:
|
|
90
104
|
name: the-built
|
|
91
105
|
- name: 'Publish to NPM (latest)'
|
|
@@ -98,23 +112,72 @@ jobs:
|
|
|
98
112
|
run: npm publish --access=public --tag=next
|
|
99
113
|
env:
|
|
100
114
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
101
|
-
|
|
102
|
-
|
|
115
|
+
deploy:
|
|
116
|
+
needs: build
|
|
117
|
+
runs-on: ubuntu-latest
|
|
118
|
+
if: startsWith(github.ref, 'refs/tags/v')
|
|
119
|
+
|
|
120
|
+
# These permissions are needed to interact with GitHub's OIDC Token endpoint.
|
|
121
|
+
permissions:
|
|
122
|
+
id-token: write
|
|
123
|
+
contents: read
|
|
124
|
+
|
|
125
|
+
steps:
|
|
126
|
+
- uses: actions/checkout@v4
|
|
103
127
|
with:
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
128
|
+
fetch-depth: 0
|
|
129
|
+
|
|
130
|
+
- uses: actions/download-artifact@v4
|
|
131
|
+
with: { name: the-built, path: ./ }
|
|
132
|
+
|
|
133
|
+
- name: Read version
|
|
134
|
+
id: version
|
|
135
|
+
run: |
|
|
136
|
+
TAG=${GITHUB_REF#refs/tags/}
|
|
137
|
+
VERSION=${TAG#v}
|
|
138
|
+
MAJOR=$(echo $VERSION | cut -d. -f1)
|
|
139
|
+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
|
140
|
+
echo "major_version=$MAJOR" >> "$GITHUB_OUTPUT"
|
|
141
|
+
|
|
142
|
+
- name: Restore timestamps
|
|
143
|
+
uses: chetan/git-restore-mtime-action@v1
|
|
144
|
+
|
|
145
|
+
- name: Configure AWS Credentials for test
|
|
146
|
+
if: ${{ env.ACT }}
|
|
147
|
+
uses: aws-actions/configure-aws-credentials@v1
|
|
112
148
|
with:
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
149
|
+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
150
|
+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
151
|
+
aws-region: ${{ env.AWS_REGION }}
|
|
152
|
+
|
|
153
|
+
- name: Configure AWS Credentials for deploy
|
|
154
|
+
if: ${{ !env.ACT }}
|
|
155
|
+
uses: aws-actions/configure-aws-credentials@v1
|
|
156
|
+
with:
|
|
157
|
+
aws-region: ap-northeast-1
|
|
158
|
+
role-to-assume: ${{ secrets.AWS_DEPLOY_ROLE }}
|
|
159
|
+
|
|
160
|
+
- name: Deploy to S3
|
|
161
|
+
run: |
|
|
162
|
+
# Note: The default max-age is set at 3600 seconds or 1 hour. After 1 hour,
|
|
163
|
+
# the client will mark the resource as stale, and require a refresh.
|
|
164
|
+
# In most cases, this will result in a if-modified-since conditional request.
|
|
165
|
+
|
|
166
|
+
# For resources that are immutable (for example, embed-chunks), the max-age is set to immutable.
|
|
167
|
+
# For resources that will be manually invalidated, an addition s-maxage so CloudFront keeps the file in its cache as long as possible.
|
|
168
|
+
|
|
169
|
+
# Deploy embed chunks -- because they have fingerprints in the filename, they're immutable
|
|
170
|
+
aws s3 sync ./dist/embed-chunks s3://${{ secrets.CDN_BUCKET }}/embed/v${{ steps.version.outputs.major_version }}/embed-chunks --cache-control "public,max-age=31536000,immutable"
|
|
171
|
+
aws s3 sync ./dist/embed-chunks s3://${{ secrets.CDN_BUCKET }}/embed/v${{ steps.version.outputs.version }}/embed-chunks --cache-control "public,max-age=31536000,immutable"
|
|
172
|
+
|
|
173
|
+
# Deploy main embed entrypoint
|
|
174
|
+
# I used to use s-maxage here, but after testing decided to revert back to only using max-age.
|
|
175
|
+
# If you use s-maxage that is much longer than max-age, the age header will be longer than
|
|
176
|
+
# max-age, and the browser will think that the file is expired. Using max-age will make
|
|
177
|
+
# CloudFront fetch a new file every 3600 seconds, resetting the Age header
|
|
178
|
+
aws s3 cp ./dist/embed s3://${{ secrets.CDN_BUCKET }}/embed/v${{ steps.version.outputs.major_version }}/embed --cache-control "public,max-age=3600" --content-type "application/javascript; charset=UTF-8"
|
|
179
|
+
aws s3 cp ./dist/embed.js.LICENSE.txt s3://${{ secrets.CDN_BUCKET }}/embed/v${{ steps.version.outputs.major_version }}/embed.js.LICENSE.txt --cache-control "public,max-age=3600" --content-type "text/plain; charset=UTF-8"
|
|
180
|
+
aws s3 cp ./dist/embed s3://${{ secrets.CDN_BUCKET }}/embed/v${{ steps.version.outputs.version }}/embed --cache-control "public,max-age=3600" --content-type "application/javascript; charset=UTF-8"
|
|
181
|
+
aws s3 cp ./dist/embed.js.LICENSE.txt s3://${{ secrets.CDN_BUCKET }}/embed/v${{ steps.version.outputs.version }}/embed.js.LICENSE.txt --cache-control "public,max-age=3600" --content-type "text/plain; charset=UTF-8"
|
|
182
|
+
|
|
183
|
+
aws cloudfront create-invalidation --distribution-id "${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID }}" --paths "/embed/v${{ steps.version.outputs.major_version }}/embed" "/embed/v${{ steps.version.outputs.version }}/embed"
|
package/.nvmrc
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
v22
|
package/.prettierrc.json
ADDED
package/.tool-versions
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
nodejs
|
|
1
|
+
nodejs 22.21.0
|
package/README.md
CHANGED
|
@@ -46,10 +46,16 @@ You can see more examples at [https://geolonia.github.io/embed/](https://geoloni
|
|
|
46
46
|
|
|
47
47
|
## Development
|
|
48
48
|
|
|
49
|
+
### Requirements
|
|
50
|
+
|
|
51
|
+
- node.js >= 22.18
|
|
52
|
+
|
|
53
|
+
### How to build
|
|
54
|
+
|
|
49
55
|
```shell
|
|
50
56
|
$ git clone git@github.com:geolonia/embed.git
|
|
51
57
|
$ cd embed
|
|
52
|
-
$
|
|
58
|
+
$ npm install
|
|
53
59
|
$ npm start # run dev server
|
|
54
60
|
$ npm test # run tests
|
|
55
61
|
$ npm run build # build production bundle
|