sv-arcgis 1.0.0 → 1.0.1-next.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.
@@ -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 (mapComponents.MAP_COMPONENTS === true && calcite.CALCITE === true) {
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
- // Install just mapComponents?
364
- if (mapComponents.MAP_COMPONENTS === true) {
365
- console.log("📦 Installing ArcGIS Core and Map Components...");
366
- initPromises.push(
367
- new Promise((resolve, reject) => {
368
- exec(\`\${packageManager} install @arcgis/core@4.31.6 @arcgis/map-components@4.31.6\`, (error, stdout, stderr) => {
369
- if (error) {
370
- console.log('error:', chalk.white.bgRed(error.message));
371
- reject(error);
372
- } else {
373
- resolve();
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("✅ Package installation completed!");
366
+ console.log("✅ Packages installation completed");
404
367
  } catch (error) {
405
368
  console.log("");
406
369
  console.log("❌ Package installation failed:", error.message);
@@ -484,8 +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";
488
- @import "@esri/calcite-components/dist/calcite/calcite.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";' : ''}
489
451
 
490
452
  :global(body:has(.e-demo)) {
491
453
  margin: 0;
@@ -623,7 +585,6 @@ const config = {
623
585
  ...webmapId,
624
586
  ...appId,
625
587
  ...securityClassification,
626
- ...mapComponents,
627
588
  ...calcite
628
589
  }
629
590
 
@@ -713,26 +674,31 @@ packageJson.scripts.config = 'SUPPRESS_NO_CONFIG_WARNING=true node ./.config/ini
713
674
  // Write back to package.json
714
675
  fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
715
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
+
716
694
  console.log("✅ Added config script to package.json");
717
695
  console.log("");
718
696
 
719
- console.log("1️⃣ Please install required dependencies:");
697
+ console.log("🚀 Now run:");
720
698
  if (packageManager === 'pnpm') {
721
- console.log(" pnpm add chalk cross-env prompts");
722
- console.log("");
723
-
724
- console.log("2️⃣ Then run:");
725
- console.log(" pnpm run config");
699
+ console.log(" `pnpm run config`");
726
700
  } else if (packageManager === 'yarn') {
727
- console.log(" yarn add chalk cross-env prompts");
728
- console.log("");
729
-
730
- console.log("2️⃣ Then run:");
731
- console.log(" yarn run config");
701
+ console.log(" `yarn run config`");
732
702
  } else {
733
- console.log(" npm install --save chalk cross-env prompts");
734
- console.log("");
735
-
736
- console.log("2️⃣ Then run:");
737
- console.log(" npm run config");
703
+ console.log(" `npm run config`");
738
704
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sv-arcgis",
3
- "version": "1.0.0",
3
+ "version": "1.0.1-next.2",
4
4
  "main": "index.js",
5
5
  "bin": {
6
6
  "sv-arcgis": "./bin/sv-arcgis-setup.js"