sv-arcgis 1.3.3 → 1.4.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/README.md +2 -0
- package/bin/sv-arcgis-setup.js +171 -110
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,6 +6,7 @@ Here are the prompts that are asked when running the tool (all are optional):
|
|
|
6
6
|
|
|
7
7
|
**(config)**
|
|
8
8
|
|
|
9
|
+
- Enter your environment
|
|
9
10
|
- Enter your appName
|
|
10
11
|
- Enter your baseUrl (e.g. /)
|
|
11
12
|
- Enter your Portal URL
|
|
@@ -49,6 +50,7 @@ Here are the prompts that are asked when running the tool (all are optional):
|
|
|
49
50
|
|
|
50
51
|
- [ ] Option for / intergrate OAuth2 https://developers.arcgis.com/documentation/security-and-authentication/user-authentication/arcgis-apis/
|
|
51
52
|
- [ ] Add prompt for ArcGIS Charts / Code components?
|
|
53
|
+
- [ ] Toggle for calcite-mode-light/dark?
|
|
52
54
|
- [ ] Create CI / CD (w/ tests)
|
|
53
55
|
- [ ] Create tests (see https://www.youtube.com/watch?v=Xk8yaN9_PZA)
|
|
54
56
|
- [ ] When selecting demo for Svelte (vite) currently we're only importing the component. Update the script to drop `<ArcGIS />` something in the html
|
package/bin/sv-arcgis-setup.js
CHANGED
|
@@ -24,14 +24,14 @@ if (hasPnpmLock) {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
// Create config directory
|
|
27
|
-
const configDirectory = path.join(process.cwd(), ".
|
|
27
|
+
const configDirectory = path.join(process.cwd(), ".sv-arcgis");
|
|
28
28
|
if (!fs.existsSync(configDirectory)) {
|
|
29
29
|
fs.mkdirSync(configDirectory, { recursive: true });
|
|
30
|
-
// console.log("✅ Created .
|
|
30
|
+
// console.log("✅ Created .sv-arcgis directory");
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
// Create
|
|
34
|
-
const initConfigPath = path.join(configDirectory, "
|
|
33
|
+
// Create sv-arcgis.js file
|
|
34
|
+
const initConfigPath = path.join(configDirectory, "sv-arcgis.js");
|
|
35
35
|
const initConfigContent = `#!/usr/bin/env node
|
|
36
36
|
|
|
37
37
|
import fs from 'fs';
|
|
@@ -49,16 +49,15 @@ let configPath;
|
|
|
49
49
|
let envPath;
|
|
50
50
|
let envExamplePath;
|
|
51
51
|
|
|
52
|
-
|
|
53
52
|
// Write to ./src/lib/config/index.js
|
|
54
53
|
// Prompts user for:
|
|
55
|
-
//
|
|
56
|
-
//
|
|
57
|
-
//
|
|
58
|
-
//
|
|
59
|
-
//
|
|
60
|
-
//
|
|
61
|
-
//
|
|
54
|
+
// portalUrl
|
|
55
|
+
// appId
|
|
56
|
+
// webmapId
|
|
57
|
+
// base
|
|
58
|
+
// appName
|
|
59
|
+
// securityClassification
|
|
60
|
+
// calcite
|
|
62
61
|
// API_KEY
|
|
63
62
|
// CLIENT_ID
|
|
64
63
|
// CLIENT_SECRET
|
|
@@ -80,51 +79,30 @@ async function generateConfig() {
|
|
|
80
79
|
process.exit(1);
|
|
81
80
|
}
|
|
82
81
|
|
|
83
|
-
//
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
// message: 'What environment do you want to setup?',
|
|
88
|
-
// choices: [
|
|
89
|
-
// { title: 'development', value: 'development' },
|
|
90
|
-
// { title: 'staging', value: 'staging' },
|
|
91
|
-
// { title: 'production', value: 'production' },
|
|
92
|
-
// ],
|
|
93
|
-
// validate: value => {
|
|
94
|
-
// global.environment = value;
|
|
95
|
-
// return true;
|
|
96
|
-
// }
|
|
97
|
-
// }
|
|
98
|
-
// ], { onCancel });
|
|
99
|
-
// console.log("");
|
|
82
|
+
// Check if env specific config file already exists
|
|
83
|
+
configPath = path.join(process.cwd(), usesTypeScript ? './src/lib/config/index.ts' : './src/lib/config/index.js');
|
|
84
|
+
envPath = path.join(process.cwd(), \`.env\`);
|
|
85
|
+
envExamplePath = path.join(process.cwd(), \`.env.example\`);
|
|
100
86
|
|
|
101
|
-
//
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
initial: false
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
// Show cancelled msg
|
|
123
|
-
if (!overwrite) {
|
|
124
|
-
console.log("Setup canceled. Existing configuration preserved.");
|
|
125
|
-
return;
|
|
87
|
+
// Warn if exists
|
|
88
|
+
if (fs.existsSync(configPath) || fs.existsSync(envPath)) {
|
|
89
|
+
|
|
90
|
+
console.log("⚠️ Warning");
|
|
91
|
+
console.log("");
|
|
92
|
+
|
|
93
|
+
const { overwrite } = await prompts({
|
|
94
|
+
type: 'confirm',
|
|
95
|
+
name: 'overwrite',
|
|
96
|
+
message: 'Config and / or .env file already exist. Overwrite?',
|
|
97
|
+
initial: false
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
// Show cancelled msg
|
|
101
|
+
if (!overwrite) {
|
|
102
|
+
console.log("Setup canceled. Existing configuration preserved.");
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
126
105
|
}
|
|
127
|
-
}
|
|
128
106
|
|
|
129
107
|
// Start config!
|
|
130
108
|
console.log("");
|
|
@@ -134,10 +112,31 @@ console.log("");
|
|
|
134
112
|
// Use package.json version, else...
|
|
135
113
|
const VERSION = { version } ? version : '0.1.0';
|
|
136
114
|
|
|
115
|
+
const environment = await prompts([
|
|
116
|
+
{
|
|
117
|
+
type: 'select',
|
|
118
|
+
name: 'environment',
|
|
119
|
+
message: 'What environment do you want to setup?',
|
|
120
|
+
choices: [
|
|
121
|
+
{ title: 'development', value: 'development' },
|
|
122
|
+
{ title: 'staging', value: 'staging' },
|
|
123
|
+
{ title: 'production', value: 'production' },
|
|
124
|
+
],
|
|
125
|
+
validate: value => {
|
|
126
|
+
global.environment = \`/process.env.NODE_ENV || \${value}\`;
|
|
127
|
+
return true;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
], { onCancel });
|
|
131
|
+
console.log("");
|
|
132
|
+
|
|
133
|
+
// Set env
|
|
134
|
+
global.env = environment.environment;
|
|
135
|
+
|
|
137
136
|
const appName = await prompts([
|
|
138
137
|
{
|
|
139
138
|
type: 'text',
|
|
140
|
-
name: '
|
|
139
|
+
name: 'appName',
|
|
141
140
|
message: 'Enter your appName',
|
|
142
141
|
validate: value => {
|
|
143
142
|
global.appNameIsNull = value.length === 0;
|
|
@@ -150,7 +149,7 @@ console.log("");
|
|
|
150
149
|
const base = await prompts([
|
|
151
150
|
{
|
|
152
151
|
type: 'text',
|
|
153
|
-
name: '
|
|
152
|
+
name: 'base',
|
|
154
153
|
message: 'Enter your baseUrl (e.g. /)',
|
|
155
154
|
validate: value => {
|
|
156
155
|
global.baseIsNull = value.length === 0;
|
|
@@ -160,8 +159,8 @@ const base = await prompts([
|
|
|
160
159
|
},
|
|
161
160
|
{
|
|
162
161
|
type: () => global.baseIsNull ? 'text' : null,
|
|
163
|
-
name: '
|
|
164
|
-
message: '
|
|
162
|
+
name: 'base',
|
|
163
|
+
message: 'base_URL is required. It will default to "/"',
|
|
165
164
|
initial: '/',
|
|
166
165
|
format: value => value.startsWith('/') ? value : \`/\${value}\`
|
|
167
166
|
}
|
|
@@ -171,7 +170,7 @@ console.log("");
|
|
|
171
170
|
const portalUrl = await prompts([
|
|
172
171
|
{
|
|
173
172
|
type: 'text',
|
|
174
|
-
name: '
|
|
173
|
+
name: 'portalUrl',
|
|
175
174
|
message: 'Enter your Portal URL',
|
|
176
175
|
validate: value => {
|
|
177
176
|
global.portalUrlIsNull = value.length === 0;
|
|
@@ -180,33 +179,33 @@ const portalUrl = await prompts([
|
|
|
180
179
|
},
|
|
181
180
|
{
|
|
182
181
|
// type: () => global.portalUrlIsNull ? 'text' : null,
|
|
183
|
-
// name: '
|
|
182
|
+
// name: 'portalUrl',
|
|
184
183
|
// message: 'portalUrl is required. If proceeding it\'ll be set to: ',
|
|
185
184
|
// initial: 'https://prof-services.maps.arcgis.com/',
|
|
186
185
|
}
|
|
187
186
|
], { onCancel });
|
|
188
187
|
console.log("");
|
|
189
188
|
|
|
190
|
-
const
|
|
189
|
+
const appId = await prompts([
|
|
191
190
|
{
|
|
192
191
|
type: 'text',
|
|
193
|
-
name: '
|
|
194
|
-
message: 'Enter your
|
|
192
|
+
name: 'appId',
|
|
193
|
+
message: 'Enter your appId',
|
|
195
194
|
validate: value => {
|
|
196
|
-
global.
|
|
195
|
+
global.appIdIsNull = value.length === 0;
|
|
197
196
|
return true;
|
|
198
197
|
}
|
|
199
198
|
}
|
|
200
199
|
], { onCancel });
|
|
201
200
|
console.log("");
|
|
202
201
|
|
|
203
|
-
const
|
|
202
|
+
const webmapId = await prompts([
|
|
204
203
|
{
|
|
205
204
|
type: 'text',
|
|
206
|
-
name: '
|
|
207
|
-
message: 'Enter your
|
|
205
|
+
name: 'webmapId',
|
|
206
|
+
message: 'Enter your webmapId',
|
|
208
207
|
validate: value => {
|
|
209
|
-
global.
|
|
208
|
+
global.webmapIdIsNull = value.length === 0;
|
|
210
209
|
return true;
|
|
211
210
|
}
|
|
212
211
|
}
|
|
@@ -255,7 +254,7 @@ console.log("");
|
|
|
255
254
|
const securityClassification = await prompts([
|
|
256
255
|
{
|
|
257
256
|
type: 'select',
|
|
258
|
-
name: '
|
|
257
|
+
name: 'securityClassification',
|
|
259
258
|
message: 'Do you need the Security Classification bars above and below on the UI?',
|
|
260
259
|
choices: [
|
|
261
260
|
{ title: 'None', value: false },
|
|
@@ -274,7 +273,7 @@ const securityClassification = await prompts([
|
|
|
274
273
|
},
|
|
275
274
|
{
|
|
276
275
|
type: () => global.securityClassificationIsNull ? 'text' : null,
|
|
277
|
-
name: '
|
|
276
|
+
name: 'securityClassification',
|
|
278
277
|
initial: false,
|
|
279
278
|
}
|
|
280
279
|
], { onCancel });
|
|
@@ -283,7 +282,7 @@ console.log("");
|
|
|
283
282
|
const calcite = await prompts([
|
|
284
283
|
{
|
|
285
284
|
type: 'select',
|
|
286
|
-
name: '
|
|
285
|
+
name: 'calcite',
|
|
287
286
|
message: 'Do you want to use Calcite Components?',
|
|
288
287
|
choices: [
|
|
289
288
|
{ title: 'Yes', value: true },
|
|
@@ -329,11 +328,11 @@ if (hasPnpmLock) {
|
|
|
329
328
|
// Install packages with loader
|
|
330
329
|
const initPromises = [];
|
|
331
330
|
|
|
332
|
-
if (calcite.
|
|
331
|
+
if (calcite.calcite === true) {
|
|
333
332
|
console.log("📦 Installing ArcGIS Core, Map Components, and Calcite Components...");
|
|
334
333
|
initPromises.push(
|
|
335
334
|
new Promise((resolve, reject) => {
|
|
336
|
-
exec(\`\${packageManager} install @arcgis/core@4.
|
|
335
|
+
exec(\`\${packageManager} install @arcgis/core@4.34.8 @arcgis/map-components@4.34.9 @esri/calcite-components@3.3.3\`, (error, stdout, stderr) => {
|
|
337
336
|
if (error) {
|
|
338
337
|
console.log('error:', chalk.white.bgRed(error.message));
|
|
339
338
|
reject(error);
|
|
@@ -347,7 +346,7 @@ if (calcite.CALCITE === true) {
|
|
|
347
346
|
console.log("📦 Installing ArcGIS Core and Map Components...");
|
|
348
347
|
initPromises.push(
|
|
349
348
|
new Promise((resolve, reject) => {
|
|
350
|
-
exec(\`\${packageManager} install @arcgis/core@4.
|
|
349
|
+
exec(\`\${packageManager} install @arcgis/core@4.34.8 @arcgis/map-components@4.34.9\`, (error, stdout, stderr) => {
|
|
351
350
|
if (error) {
|
|
352
351
|
console.log('error:', chalk.white.bgRed(error.message));
|
|
353
352
|
reject(error);
|
|
@@ -419,7 +418,7 @@ if (demo.DEMO === true) {
|
|
|
419
418
|
import("@arcgis/map-components/dist/loader").then(
|
|
420
419
|
({ defineCustomElements }) => {
|
|
421
420
|
defineCustomElements(window, {
|
|
422
|
-
resourcesUrl: "https://js.arcgis.com/map-components/4.
|
|
421
|
+
resourcesUrl: "https://js.arcgis.com/map-components/4.34.8/assets",
|
|
423
422
|
});
|
|
424
423
|
}
|
|
425
424
|
);
|
|
@@ -431,11 +430,11 @@ if (demo.DEMO === true) {
|
|
|
431
430
|
</svelte:head>
|
|
432
431
|
|
|
433
432
|
<main class="e-demo">
|
|
434
|
-
{#if config.
|
|
433
|
+
{#if config.securityClassification}
|
|
435
434
|
<div
|
|
436
|
-
class="e-demo-security-bar e-demo-security-bar--{config.
|
|
435
|
+
class="e-demo-security-bar e-demo-security-bar--{config.securityClassification}"
|
|
437
436
|
>
|
|
438
|
-
Security Classification: {config.
|
|
437
|
+
Security Classification: {config.securityClassification.toUpperCase()}
|
|
439
438
|
</div>
|
|
440
439
|
{/if}
|
|
441
440
|
<div class="e-demo-container">
|
|
@@ -446,30 +445,31 @@ if (demo.DEMO === true) {
|
|
|
446
445
|
<arcgis-map item-id="05e015c5f0314db9a487a9b46cb37eca">
|
|
447
446
|
<arcgis-zoom position="top-left"></arcgis-zoom>
|
|
448
447
|
</arcgis-map>
|
|
449
|
-
{#if config.
|
|
450
|
-
<calcite-button
|
|
451
|
-
|
|
448
|
+
{#if config.calcite}
|
|
449
|
+
<calcite-button appearance="solid" scale="m" type="button" onclick={() => {document.body.classList.toggle('calcite-mode-dark')}}>
|
|
450
|
+
Toggle Theme
|
|
452
451
|
</calcite-button>
|
|
453
452
|
{/if}
|
|
454
453
|
</div>
|
|
455
454
|
</div>
|
|
456
|
-
{#if config.
|
|
455
|
+
{#if config.securityClassification}
|
|
457
456
|
<div
|
|
458
|
-
class="e-demo-security-bar e-demo-security-bar--{config.
|
|
457
|
+
class="e-demo-security-bar e-demo-security-bar--{config.securityClassification}"
|
|
459
458
|
>
|
|
460
|
-
Security Classification: {config.
|
|
459
|
+
Security Classification: {config.securityClassification.toUpperCase()}
|
|
461
460
|
</div>
|
|
462
461
|
{/if}
|
|
463
462
|
</main>
|
|
464
463
|
|
|
465
464
|
<style>
|
|
466
|
-
@import "https://js.arcgis.com/4.33/@arcgis/core/assets/esri/themes/dark/main.css";\${calcite.CALCITE ? '\\n @import "@esri/calcite-components/dist/calcite/calcite.css";' : ''}
|
|
467
|
-
|
|
468
465
|
:global(body:has(.e-demo)) {
|
|
469
466
|
margin: 0;
|
|
470
467
|
padding: 0;
|
|
471
468
|
height: 100%;
|
|
472
469
|
width: 100%;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
:global(body.calcite-mode-dark) {
|
|
473
473
|
background: #212121;
|
|
474
474
|
}
|
|
475
475
|
|
|
@@ -593,7 +593,7 @@ if (demo.DEMO === true) {
|
|
|
593
593
|
import("@arcgis/map-components/dist/loader").then(
|
|
594
594
|
({ defineCustomElements }) => {
|
|
595
595
|
defineCustomElements(window, {
|
|
596
|
-
resourcesUrl: "https://js.arcgis.com/map-components/4.
|
|
596
|
+
resourcesUrl: "https://js.arcgis.com/map-components/4.34.8/assets",
|
|
597
597
|
});
|
|
598
598
|
}
|
|
599
599
|
);
|
|
@@ -604,11 +604,11 @@ if (demo.DEMO === true) {
|
|
|
604
604
|
</svelte:head>
|
|
605
605
|
|
|
606
606
|
<main class="e-demo">
|
|
607
|
-
{#if config.
|
|
607
|
+
{#if config.securityClassification}
|
|
608
608
|
<div
|
|
609
|
-
class="e-demo-security-bar e-demo-security-bar--{config.
|
|
609
|
+
class="e-demo-security-bar e-demo-security-bar--{config.securityClassification}"
|
|
610
610
|
>
|
|
611
|
-
Security Classification: {config.
|
|
611
|
+
Security Classification: {config.securityClassification.toUpperCase()}
|
|
612
612
|
</div>
|
|
613
613
|
{/if}
|
|
614
614
|
<div class="e-demo-container">
|
|
@@ -619,30 +619,32 @@ if (demo.DEMO === true) {
|
|
|
619
619
|
<arcgis-map item-id="05e015c5f0314db9a487a9b46cb37eca">
|
|
620
620
|
<arcgis-zoom position="top-left"></arcgis-zoom>
|
|
621
621
|
</arcgis-map>
|
|
622
|
-
{#if config.
|
|
623
|
-
<calcite-button
|
|
624
|
-
|
|
622
|
+
{#if config.calcite}
|
|
623
|
+
<calcite-button appearance="solid" scale="m" type="button" onclick={() => {document.body.classList.toggle('calcite-mode-dark')}}>
|
|
624
|
+
Toggle Theme
|
|
625
625
|
</calcite-button>
|
|
626
626
|
{/if}
|
|
627
627
|
</div>
|
|
628
628
|
</div>
|
|
629
|
-
{#if config.
|
|
629
|
+
{#if config.securityClassification}
|
|
630
630
|
<div
|
|
631
|
-
class="e-demo-security-bar e-demo-security-bar--{config.
|
|
631
|
+
class="e-demo-security-bar e-demo-security-bar--{config.securityClassification}"
|
|
632
632
|
>
|
|
633
|
-
Security Classification: {config.
|
|
633
|
+
Security Classification: {config.securityClassification.toUpperCase()}
|
|
634
634
|
</div>
|
|
635
635
|
{/if}
|
|
636
636
|
</main>
|
|
637
637
|
|
|
638
638
|
<style>
|
|
639
|
-
|
|
640
|
-
|
|
639
|
+
|
|
641
640
|
:global(body:has(.e-demo)) {
|
|
642
641
|
margin: 0;
|
|
643
642
|
padding: 0;
|
|
644
643
|
height: 100%;
|
|
645
644
|
width: 100%;
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
:global(body.calcite-mode-dark) {
|
|
646
648
|
background: #212121;
|
|
647
649
|
}
|
|
648
650
|
|
|
@@ -772,27 +774,41 @@ if (demo.DEMO === true) {
|
|
|
772
774
|
if (fs.existsSync(rootPagePath) && isSvelte) {
|
|
773
775
|
const existingContent = fs.readFileSync(rootPagePath, 'utf8');
|
|
774
776
|
if (!existingContent.includes('ArcGIS.svelte')) {
|
|
777
|
+
// First, add the import statement inside the <script> tag
|
|
775
778
|
const scriptTagRegex = /(<script[^>]*>)/;
|
|
776
779
|
const match = existingContent.match(scriptTagRegex);
|
|
780
|
+
let updatedContent = existingContent;
|
|
781
|
+
|
|
777
782
|
if (match) {
|
|
778
783
|
const insertionPoint = match.index + match[0].length;
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
784
|
+
updatedContent = existingContent.slice(0, insertionPoint) + rootPageUpdate + existingContent.slice(insertionPoint);
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
// Then, insert <ArcGIS /> component just after the closing </script> tag
|
|
788
|
+
const closingScriptTagRegex = /(<\\/script>)/;
|
|
789
|
+
const closingMatch = updatedContent.match(closingScriptTagRegex);
|
|
790
|
+
|
|
791
|
+
if (closingMatch) {
|
|
792
|
+
const componentInsertionPoint = closingMatch.index + closingMatch[0].length;
|
|
793
|
+
updatedContent = updatedContent.slice(0, componentInsertionPoint) + \`\n\n<ArcGIS />\` + updatedContent.slice(componentInsertionPoint);
|
|
782
794
|
}
|
|
783
795
|
|
|
784
|
-
|
|
796
|
+
fs.writeFileSync(rootPagePath, updatedContent);
|
|
797
|
+
console.log(\`✅ Updated App.svelte with ArcGIS component\`);
|
|
785
798
|
}
|
|
786
799
|
}
|
|
787
800
|
}
|
|
788
801
|
|
|
789
802
|
const config = {
|
|
790
|
-
VERSION,
|
|
803
|
+
version: VERSION,
|
|
804
|
+
environment: environment.environment,
|
|
791
805
|
...appName,
|
|
792
806
|
...base,
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
807
|
+
portal: {
|
|
808
|
+
appId: appId.appId,
|
|
809
|
+
webmapId: webmapId.webmapId,
|
|
810
|
+
url: portalUrl.portalUrl
|
|
811
|
+
},
|
|
796
812
|
...securityClassification,
|
|
797
813
|
...calcite
|
|
798
814
|
}
|
|
@@ -834,7 +850,52 @@ generateConfig()
|
|
|
834
850
|
const configFilePath = usesTypeScript ? './src/lib/config/index.ts' : './src/lib/config/index.js';
|
|
835
851
|
|
|
836
852
|
// Create and write to config file
|
|
837
|
-
const configFileText = \`
|
|
853
|
+
const configFileText = usesTypeScript ? \`interface PortalConfiguration {
|
|
854
|
+
appId: string;
|
|
855
|
+
webmapId: string;
|
|
856
|
+
url: string;
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
interface StaticConfiguration {
|
|
860
|
+
version: string;
|
|
861
|
+
environment: string;
|
|
862
|
+
appName: string;
|
|
863
|
+
base: string;
|
|
864
|
+
portal: PortalConfiguration;
|
|
865
|
+
securityClassification: boolean | string;
|
|
866
|
+
calcite: boolean;
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
export const config: StaticConfiguration = {
|
|
870
|
+
version: "\${data.config.version}",
|
|
871
|
+
environment: process.env.NODE_ENV || "\${data.config.environment}",
|
|
872
|
+
appName: "\${data.config.appName}",
|
|
873
|
+
base: "\${data.config.base}",
|
|
874
|
+
portal: {
|
|
875
|
+
appId: "\${data.config.portal.appId}",
|
|
876
|
+
webmapId: "\${data.config.portal.webmapId}",
|
|
877
|
+
url: "\${data.config.portal.url}",
|
|
878
|
+
},
|
|
879
|
+
securityClassification: \${typeof data.config.securityClassification === 'string' ? \`"\${data.config.securityClassification}"\` : data.config.securityClassification},
|
|
880
|
+
calcite: \${data.config.calcite},
|
|
881
|
+
};
|
|
882
|
+
|
|
883
|
+
export default config;\` : \`export const config = {
|
|
884
|
+
version: "\${data.config.version}",
|
|
885
|
+
environment: process.env.NODE_ENV || "\${data.config.environment}",
|
|
886
|
+
appName: "\${data.config.appName}",
|
|
887
|
+
base: "\${data.config.base}",
|
|
888
|
+
portal: {
|
|
889
|
+
appId: "\${data.config.portal.appId}",
|
|
890
|
+
webmapId: "\${data.config.portal.webmapId}",
|
|
891
|
+
url: "\${data.config.portal.url}",
|
|
892
|
+
},
|
|
893
|
+
securityClassification: \${typeof data.config.securityClassification === 'string' ? \`"\${data.config.securityClassification}"\` : data.config.securityClassification},
|
|
894
|
+
calcite: \${data.config.calcite},
|
|
895
|
+
};
|
|
896
|
+
|
|
897
|
+
export default config;\`;
|
|
898
|
+
|
|
838
899
|
fs.writeFileSync(configFilePath, configFileText, { encoding: 'utf8', flag: 'w' });
|
|
839
900
|
|
|
840
901
|
// Show that config was written
|
|
@@ -874,12 +935,12 @@ generateConfig()
|
|
|
874
935
|
`;
|
|
875
936
|
|
|
876
937
|
fs.writeFileSync(initConfigPath, initConfigContent);
|
|
877
|
-
console.log("✅ Created .
|
|
938
|
+
console.log("✅ Created .sv-arcgis/sv-arcgis.js");
|
|
878
939
|
|
|
879
940
|
// Add script
|
|
880
941
|
if (!packageJson.scripts) packageJson.scripts = {};
|
|
881
942
|
packageJson.scripts.config =
|
|
882
|
-
"SUPPRESS_NO_CONFIG_WARNING=true node ./.
|
|
943
|
+
"SUPPRESS_NO_CONFIG_WARNING=true node ./.sv-arcgis/sv-arcgis.js";
|
|
883
944
|
|
|
884
945
|
// Write back to package.json
|
|
885
946
|
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
|