sv-arcgis 1.0.1-next.1 → 1.0.1
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/bin/sv-arcgis-setup.js +38 -71
- package/package.json +1 -1
package/bin/sv-arcgis-setup.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
const fs = require('fs');
|
|
3
3
|
const path = require('path');
|
|
4
|
+
const { execSync } = require('child_process');
|
|
4
5
|
|
|
5
6
|
const packageJsonPath = path.join(process.cwd(), 'package.json');
|
|
6
7
|
|
|
@@ -57,7 +58,6 @@ let envExamplePath;
|
|
|
57
58
|
// BASE
|
|
58
59
|
// APP_NAME
|
|
59
60
|
// SECURITY_CLASSIFICATION
|
|
60
|
-
// MAP_COMPONENTS
|
|
61
61
|
// CALCITE
|
|
62
62
|
// API_KEY
|
|
63
63
|
// CLIENT_ID
|
|
@@ -279,23 +279,6 @@ const securityClassification = await prompts([
|
|
|
279
279
|
], { onCancel });
|
|
280
280
|
console.log("");
|
|
281
281
|
|
|
282
|
-
const mapComponents = await prompts([
|
|
283
|
-
{
|
|
284
|
-
type: 'select',
|
|
285
|
-
name: 'MAP_COMPONENTS',
|
|
286
|
-
message: 'Do you want to use Map Components?',
|
|
287
|
-
choices: [
|
|
288
|
-
{ title: 'Yes', value: true },
|
|
289
|
-
{ title: 'No', value: false }
|
|
290
|
-
],
|
|
291
|
-
validate: value => {
|
|
292
|
-
global.mapComponentsIsNull = value.length === 0;
|
|
293
|
-
return true;
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
], { onCancel });
|
|
297
|
-
console.log("");
|
|
298
|
-
|
|
299
282
|
const calcite = await prompts([
|
|
300
283
|
{
|
|
301
284
|
type: 'select',
|
|
@@ -345,7 +328,7 @@ if (hasPnpmLock) {
|
|
|
345
328
|
// Install packages with loader
|
|
346
329
|
const initPromises = [];
|
|
347
330
|
|
|
348
|
-
if (
|
|
331
|
+
if (calcite.CALCITE === true) {
|
|
349
332
|
console.log("📦 Installing ArcGIS Core, Map Components, and Calcite Components...");
|
|
350
333
|
initPromises.push(
|
|
351
334
|
new Promise((resolve, reject) => {
|
|
@@ -360,39 +343,19 @@ if (mapComponents.MAP_COMPONENTS === true && calcite.CALCITE === true) {
|
|
|
360
343
|
})
|
|
361
344
|
);
|
|
362
345
|
} else {
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
})
|
|
377
|
-
);
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
// Install just Calcite?
|
|
381
|
-
if (calcite.CALCITE === true) {
|
|
382
|
-
console.log("📦 Installing Calcite Components...");
|
|
383
|
-
initPromises.push(
|
|
384
|
-
new Promise((resolve, reject) => {
|
|
385
|
-
exec(\`\${packageManager} install @esri/calcite-components@2.13.0\`, (error, stdout, stderr) => {
|
|
386
|
-
if (error) {
|
|
387
|
-
console.log('error:', chalk.white.bgRed(error.message));
|
|
388
|
-
reject(error);
|
|
389
|
-
} else {
|
|
390
|
-
resolve();
|
|
391
|
-
}
|
|
392
|
-
});
|
|
393
|
-
})
|
|
394
|
-
);
|
|
395
|
-
}
|
|
346
|
+
console.log("📦 Installing ArcGIS Core and Map Components...");
|
|
347
|
+
initPromises.push(
|
|
348
|
+
new Promise((resolve, reject) => {
|
|
349
|
+
exec(\`\${packageManager} install @arcgis/core@4.31.6 @arcgis/map-components@4.31.6\`, (error, stdout, stderr) => {
|
|
350
|
+
if (error) {
|
|
351
|
+
console.log('error:', chalk.white.bgRed(error.message));
|
|
352
|
+
reject(error);
|
|
353
|
+
} else {
|
|
354
|
+
resolve();
|
|
355
|
+
}
|
|
356
|
+
});
|
|
357
|
+
})
|
|
358
|
+
);
|
|
396
359
|
}
|
|
397
360
|
|
|
398
361
|
// Wait for all installations to complete
|
|
@@ -400,7 +363,7 @@ if (initPromises.length > 0) {
|
|
|
400
363
|
try {
|
|
401
364
|
await Promise.all(initPromises);
|
|
402
365
|
console.log("");
|
|
403
|
-
console.log("✅
|
|
366
|
+
console.log("✅ Packages installation completed");
|
|
404
367
|
} catch (error) {
|
|
405
368
|
console.log("");
|
|
406
369
|
console.log("❌ Package installation failed:", error.message);
|
|
@@ -484,7 +447,7 @@ if (demo.DEMO === true) {
|
|
|
484
447
|
</main>
|
|
485
448
|
|
|
486
449
|
<style>
|
|
487
|
-
@import "https://js.arcgis.com/4.31/@arcgis/core/assets/esri/themes/dark/main.css"
|
|
450
|
+
@import "https://js.arcgis.com/4.31/@arcgis/core/assets/esri/themes/dark/main.css";\${calcite.CALCITE ? '\\n @import "@esri/calcite-components/dist/calcite/calcite.css";' : ''}
|
|
488
451
|
|
|
489
452
|
:global(body:has(.e-demo)) {
|
|
490
453
|
margin: 0;
|
|
@@ -622,7 +585,6 @@ const config = {
|
|
|
622
585
|
...webmapId,
|
|
623
586
|
...appId,
|
|
624
587
|
...securityClassification,
|
|
625
|
-
...mapComponents,
|
|
626
588
|
...calcite
|
|
627
589
|
}
|
|
628
590
|
|
|
@@ -712,26 +674,31 @@ packageJson.scripts.config = 'SUPPRESS_NO_CONFIG_WARNING=true node ./.config/ini
|
|
|
712
674
|
// Write back to package.json
|
|
713
675
|
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
|
|
714
676
|
|
|
677
|
+
// Install required dependencies for the config script
|
|
678
|
+
console.log("📦 Installing required dependencies...");
|
|
679
|
+
|
|
680
|
+
try {
|
|
681
|
+
if (packageManager === 'pnpm') {
|
|
682
|
+
execSync('pnpm add -D chalk@5.4.1 prompts@2.4.2 cross-env@10.0.0', { stdio: 'inherit' });
|
|
683
|
+
} else if (packageManager === 'yarn') {
|
|
684
|
+
execSync('yarn add -D chalk@5.4.1 prompts@2.4.2 cross-env@10.0.0', { stdio: 'inherit' });
|
|
685
|
+
} else {
|
|
686
|
+
execSync('npm install --save-dev chalk@5.4.1 prompts@2.4.2 cross-env@10.0.0', { stdio: 'inherit' });
|
|
687
|
+
}
|
|
688
|
+
console.log("✅ Dependencies installed successfully");
|
|
689
|
+
} catch (error) {
|
|
690
|
+
console.error("❌ Failed to install dependencies:", error.message);
|
|
691
|
+
process.exit(1);
|
|
692
|
+
}
|
|
693
|
+
|
|
715
694
|
console.log("✅ Added config script to package.json");
|
|
716
695
|
console.log("");
|
|
717
696
|
|
|
718
|
-
console.log("
|
|
697
|
+
console.log("🚀 Now run:");
|
|
719
698
|
if (packageManager === 'pnpm') {
|
|
720
|
-
console.log(" pnpm
|
|
721
|
-
console.log("");
|
|
722
|
-
|
|
723
|
-
console.log("2️⃣ Then run:");
|
|
724
|
-
console.log(" pnpm run config");
|
|
699
|
+
console.log(" `pnpm run config`");
|
|
725
700
|
} else if (packageManager === 'yarn') {
|
|
726
|
-
console.log(" yarn
|
|
727
|
-
console.log("");
|
|
728
|
-
|
|
729
|
-
console.log("2️⃣ Then run:");
|
|
730
|
-
console.log(" yarn run config");
|
|
701
|
+
console.log(" `yarn run config`");
|
|
731
702
|
} else {
|
|
732
|
-
console.log(" npm
|
|
733
|
-
console.log("");
|
|
734
|
-
|
|
735
|
-
console.log("2️⃣ Then run:");
|
|
736
|
-
console.log(" npm run config");
|
|
703
|
+
console.log(" `npm run config`");
|
|
737
704
|
}
|