Skip to content

Commit 58ef794

Browse files
committed
feat: updates after advice
- improved how core is loaded - css tweaks - removed appId in favor of clientId - slots insteads position attribute
1 parent dca6ab7 commit 58ef794

File tree

2 files changed

+46
-48
lines changed

2 files changed

+46
-48
lines changed

README.md

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,12 @@ Here are the prompts that are asked when running the tool (all are optional):
1111
- Enter your baseUrl (e.g. /)
1212
- Enter your Portal URL
1313
- Enter your webmapId
14-
- Enter your appId
1514

1615
**(env)**
1716

18-
- Enter your ArcGIS API key
19-
- Enter your ArcGIS Client ID
20-
- Enter your ArcGIS Client Secret
17+
- Enter your ArcGIS API key (private)
18+
- Enter your ArcGIS Client ID (private)
19+
- Enter your ArcGIS Client Secret (public)
2120

2221
**(ui)**
2322

@@ -42,19 +41,32 @@ Here are the prompts that are asked when running the tool (all are optional):
4241

4342
## 📕 Notes
4443

45-
- Using this will install _@arcgis/core@4.31.6_ and _@arcgis/map-components@4.31.6_. (Testing has not been done on later versions)
46-
- If you choose 'Yes' to Calcite, _@esri/calcite-components@2.13.0_ will be installed. (Testing has not been done on later versions)
44+
- Using this will install _@arcgis/core@4.34.8_ and _@arcgis/map-components@4.34.9_. (Testing has not been done on later versions)
45+
- If you choose 'Yes' to Calcite, _@esri/calcite-components@3.3.3_ will be installed. (Testing has not been done on later versions)
4746
- Using this will install the following devDepenencies: _chalk_, _prompts_ and _cross-env_
4847

4948
## 🗺️ Roadmap
5049

50+
### q3 2026
51+
52+
- [ ] Bun support
5153
- [ ] Option for / intergrate OAuth2 https://developers.arcgis.com/documentation/security-and-authentication/user-authentication/arcgis-apis/
54+
55+
### q1 2027
56+
57+
- [ ] i18n support
5258
- [ ] Add prompt for ArcGIS Charts / Code components?
53-
- [ ] Toggle for calcite-mode-light/dark?
59+
60+
### q3 2027
61+
5462
- [ ] Create CI / CD (w/ tests)
5563
- [ ] Create tests (see https://www.youtube.com/watch?v=Xk8yaN9_PZA)
56-
- [ ] When selecting demo for Svelte (vite) currently we're only importing the component. Update the script to drop `<ArcGIS />` something in the html
64+
65+
### q1 2026
66+
67+
- [x] Toggle for calcite-mode-light/dark?
5768
- [x] Update to work Svelte / Vite app (not just Kit)? (Demo would need to be different)
69+
- [x] When selecting demo for Svelte (vite) currently we're only importing the component. Update the script to drop `<ArcGIS />` something in the html
5870

5971
## 🙏 Help
6072

bin/sv-arcgis-setup.js

Lines changed: 26 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ let envExamplePath;
5252
// Write to ./src/lib/config/index.js
5353
// Prompts user for:
5454
// portalUrl
55-
// appId
5655
// webmapId
5756
// base
5857
// appName
@@ -150,7 +149,7 @@ const base = await prompts([
150149
{
151150
type: 'text',
152151
name: 'base',
153-
message: 'Enter your baseUrl (e.g. /)',
152+
message: 'Enter your base URL (e.g. /)',
154153
validate: value => {
155154
global.baseIsNull = value.length === 0;
156155
return true;
@@ -160,7 +159,7 @@ const base = await prompts([
160159
{
161160
type: () => global.baseIsNull ? 'text' : null,
162161
name: 'base',
163-
message: 'base_URL is required. It will default to "/"',
162+
message: 'Base URL is required. Otherwise, it defaults to "/"',
164163
initial: '/',
165164
format: value => value.startsWith('/') ? value : \`/\${value}\`
166165
}
@@ -178,23 +177,10 @@ const portalUrl = await prompts([
178177
}
179178
},
180179
{
181-
// type: () => global.portalUrlIsNull ? 'text' : null,
182-
// name: 'portalUrl',
183-
// message: 'portalUrl is required. If proceeding it\'ll be set to: ',
184-
// initial: 'https://prof-services.maps.arcgis.com/',
185-
}
186-
], { onCancel });
187-
console.log("");
188-
189-
const appId = await prompts([
190-
{
191-
type: 'text',
192-
name: 'appId',
193-
message: 'Enter your appId',
194-
validate: value => {
195-
global.appIdIsNull = value.length === 0;
196-
return true;
197-
}
180+
type: () => global.portalUrlIsNull ? 'text' : null,
181+
name: 'portalUrl',
182+
message: 'Portal URL is required. Otherwise, it defaults to "arcgis.com"',
183+
initial: 'https://www.arcgis.com',
198184
}
199185
], { onCancel });
200186
console.log("");
@@ -417,9 +403,7 @@ if (demo.DEMO === true) {
417403
if (browser) {
418404
import("@arcgis/map-components/dist/loader").then(
419405
({ defineCustomElements }) => {
420-
defineCustomElements(window, {
421-
resourcesUrl: "https://js.arcgis.com/map-components/4.34.8/assets",
422-
});
406+
defineCustomElements(window);
423407
}
424408
);
425409
}
@@ -439,11 +423,15 @@ if (demo.DEMO === true) {
439423
{/if}
440424
<div class="e-demo-container">
441425
<div class="e-demo-header">
442-
<h1>🗺️ SV + ArcGIS Demo</h1>
426+
{#if config.appName}
427+
{config.appName}
428+
{:else}
429+
<h1>🗺️ SV-ArcGIS Demo</h1>
430+
{/if}
443431
</div>
444432
<div class="e-demo-map-wrap">
445-
<arcgis-map bind:this={mapView} item-id="05e015c5f0314db9a487a9b46cb37eca">
446-
<arcgis-zoom position="top-left"></arcgis-zoom>
433+
<arcgis-map bind:this={mapView} item-id={config.portal.webmapId ? config.portal.webmapId : "05e015c5f0314db9a487a9b46cb37eca"}>
434+
<arcgis-zoom slot="top-left"></arcgis-zoom>
447435
</arcgis-map>
448436
{#if config.calcite}
449437
<calcite-button appearance="solid" scale="m" type="button" onclick={() => {document.body.classList.toggle('calcite-mode-dark')}}>
@@ -491,7 +479,7 @@ if (demo.DEMO === true) {
491479
492480
.e-demo-header {
493481
padding: 1rem;
494-
color: #f1f1f1;
482+
color: #212121;
495483
496484
translate: 0 0;
497485
transition: translate 1s ease-out;
@@ -534,7 +522,7 @@ if (demo.DEMO === true) {
534522
align-items: center;
535523
justify-content: center;
536524
inset-block-start: 0;
537-
height: 22px;
525+
height: 24px;
538526
background-color: #000;
539527
color: #fff;
540528
margin: 0;
@@ -596,9 +584,7 @@ if (demo.DEMO === true) {
596584
597585
import("@arcgis/map-components/dist/loader").then(
598586
({ defineCustomElements }) => {
599-
defineCustomElements(window, {
600-
resourcesUrl: "https://js.arcgis.com/map-components/4.34.8/assets",
601-
});
587+
defineCustomElements(window);
602588
}
603589
);
604590
</script>
@@ -617,11 +603,15 @@ if (demo.DEMO === true) {
617603
{/if}
618604
<div class="e-demo-container">
619605
<div class="e-demo-header">
620-
<h1>🗺️ SV + ArcGIS Demo</h1>
606+
{#if config.appName}
607+
{config.appName}
608+
{:else}
609+
<h1>🗺️ SV-ArcGIS Demo</h1>
610+
{/if}
621611
</div>
622612
<div class="e-demo-map-wrap">
623-
<arcgis-map bind:this={mapView} item-id="05e015c5f0314db9a487a9b46cb37eca">
624-
<arcgis-zoom position="top-left"></arcgis-zoom>
613+
<arcgis-map bind:this={mapView} item-id={config.portal.webmapId ? config.portal.webmapId : "05e015c5f0314db9a487a9b46cb37eca"}>
614+
<arcgis-zoom slot="top-left"></arcgis-zoom>
625615
</arcgis-map>
626616
{#if config.calcite}
627617
<calcite-button appearance="solid" scale="m" type="button" onclick={() => {document.body.classList.toggle('calcite-mode-dark')}}>
@@ -669,7 +659,7 @@ if (demo.DEMO === true) {
669659
670660
.e-demo-header {
671661
padding: 1rem;
672-
color: #f1f1f1;
662+
color: #212121;
673663
674664
translate: 0 0;
675665
transition: translate 1s ease-out;
@@ -712,7 +702,7 @@ if (demo.DEMO === true) {
712702
align-items: center;
713703
justify-content: center;
714704
inset-block-start: 0;
715-
height: 22px;
705+
height: 24px;
716706
background-color: #000;
717707
color: #fff;
718708
margin: 0;
@@ -812,7 +802,6 @@ const config = {
812802
...appName,
813803
...base,
814804
portal: {
815-
appId: appId.appId,
816805
webmapId: webmapId.webmapId,
817806
url: portalUrl.portalUrl
818807
},
@@ -858,7 +847,6 @@ generateConfig()
858847
859848
// Create and write to config file
860849
const configFileText = usesTypeScript ? \`interface PortalConfiguration {
861-
appId: string;
862850
webmapId: string;
863851
url: string;
864852
}
@@ -879,7 +867,6 @@ export const config: StaticConfiguration = {
879867
appName: "\${data.config.appName}",
880868
base: "\${data.config.base}",
881869
portal: {
882-
appId: "\${data.config.portal.appId}",
883870
webmapId: "\${data.config.portal.webmapId}",
884871
url: "\${data.config.portal.url}",
885872
},
@@ -893,7 +880,6 @@ export default config;\` : \`export const config = {
893880
appName: "\${data.config.appName}",
894881
base: "\${data.config.base}",
895882
portal: {
896-
appId: "\${data.config.portal.appId}",
897883
webmapId: "\${data.config.portal.webmapId}",
898884
url: "\${data.config.portal.url}",
899885
},

0 commit comments

Comments
 (0)