sv-arcgis 1.3.0-next.1 → 1.3.0-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.
- package/bin/sv-arcgis-setup.js +32 -22
- package/package.json +1 -1
package/bin/sv-arcgis-setup.js
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const fs = require(
|
|
3
|
-
const path = require(
|
|
4
|
-
const { execSync } = require(
|
|
2
|
+
const fs = require("fs");
|
|
3
|
+
const path = require("path");
|
|
4
|
+
const { execSync } = require("child_process");
|
|
5
5
|
|
|
6
|
-
const packageJsonPath = path.join(process.cwd(),
|
|
6
|
+
const packageJsonPath = path.join(process.cwd(), "package.json");
|
|
7
7
|
|
|
8
8
|
if (!fs.existsSync(packageJsonPath)) {
|
|
9
|
-
console.error(
|
|
9
|
+
console.error("No package.json found in current directory");
|
|
10
10
|
process.exit(1);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath,
|
|
13
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
|
|
14
14
|
|
|
15
15
|
// Detect package manager
|
|
16
|
-
const hasPnpmLock = fs.existsSync(path.join(process.cwd(),
|
|
17
|
-
const hasYarnLock = fs.existsSync(path.join(process.cwd(),
|
|
16
|
+
const hasPnpmLock = fs.existsSync(path.join(process.cwd(), "pnpm-lock.yaml"));
|
|
17
|
+
const hasYarnLock = fs.existsSync(path.join(process.cwd(), "yarn.lock"));
|
|
18
18
|
|
|
19
|
-
let packageManager =
|
|
19
|
+
let packageManager = "npm";
|
|
20
20
|
if (hasPnpmLock) {
|
|
21
|
-
packageManager =
|
|
21
|
+
packageManager = "pnpm";
|
|
22
22
|
} else if (hasYarnLock) {
|
|
23
|
-
packageManager =
|
|
23
|
+
packageManager = "yarn";
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
// Create config directory
|
|
27
|
-
const configDirectory = path.join(process.cwd(),
|
|
27
|
+
const configDirectory = path.join(process.cwd(), ".config");
|
|
28
28
|
if (!fs.existsSync(configDirectory)) {
|
|
29
29
|
fs.mkdirSync(configDirectory, { recursive: true });
|
|
30
30
|
// console.log("✅ Created .config directory");
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
// Create init-sv-arcgis.js file
|
|
34
|
-
const initConfigPath = path.join(configDirectory,
|
|
34
|
+
const initConfigPath = path.join(configDirectory, "init-sv-arcgis.js");
|
|
35
35
|
const initConfigContent = `#!/usr/bin/env node
|
|
36
36
|
|
|
37
37
|
import fs from 'fs';
|
|
@@ -368,6 +368,8 @@ if (initPromises.length > 0) {
|
|
|
368
368
|
} catch (error) {
|
|
369
369
|
console.log("");
|
|
370
370
|
console.log("❌ Package installation failed:", error.message);
|
|
371
|
+
console.log("");
|
|
372
|
+
console.log("❓ Do you already have one of these installed @arcgis/core, @arcgis/map-components, or @esri/calcite-components? This may be the issue. If you're comfortable with it, uninstall them, delete the node_modules folder, package-lock.json, and run this tool again.");
|
|
371
373
|
}
|
|
372
374
|
}
|
|
373
375
|
|
|
@@ -749,7 +751,7 @@ if (demo.DEMO === true) {
|
|
|
749
751
|
|
|
750
752
|
fs.writeFileSync(demoPagePath, demoPageContent);
|
|
751
753
|
if (isSvelte) {
|
|
752
|
-
console.log(\`✅ Created demo page at ./src/
|
|
754
|
+
console.log(\`✅ Created demo page at ./src/lib/arcgis/ArcGIS.svelte\`);
|
|
753
755
|
} else {
|
|
754
756
|
console.log(\`✅ Created demo page at ./src/routes/arcgis/+page.svelte\`);
|
|
755
757
|
}
|
|
@@ -878,7 +880,8 @@ console.log("✅ Created .config/init-sv-arcgis.js");
|
|
|
878
880
|
|
|
879
881
|
// Add script
|
|
880
882
|
if (!packageJson.scripts) packageJson.scripts = {};
|
|
881
|
-
packageJson.scripts.config =
|
|
883
|
+
packageJson.scripts.config =
|
|
884
|
+
"SUPPRESS_NO_CONFIG_WARNING=true node ./.config/init-sv-arcgis.js";
|
|
882
885
|
|
|
883
886
|
// Write back to package.json
|
|
884
887
|
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
|
|
@@ -887,12 +890,19 @@ fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
|
|
|
887
890
|
console.log("📦 Installing required dependencies...");
|
|
888
891
|
|
|
889
892
|
try {
|
|
890
|
-
if (packageManager ===
|
|
891
|
-
execSync(
|
|
892
|
-
|
|
893
|
-
|
|
893
|
+
if (packageManager === "pnpm") {
|
|
894
|
+
execSync("pnpm add -D chalk@5.4.1 prompts@2.4.2 cross-env@10.0.0", {
|
|
895
|
+
stdio: "inherit",
|
|
896
|
+
});
|
|
897
|
+
} else if (packageManager === "yarn") {
|
|
898
|
+
execSync("yarn add -D chalk@5.4.1 prompts@2.4.2 cross-env@10.0.0", {
|
|
899
|
+
stdio: "inherit",
|
|
900
|
+
});
|
|
894
901
|
} else {
|
|
895
|
-
execSync(
|
|
902
|
+
execSync(
|
|
903
|
+
"npm install --save-dev chalk@5.4.1 prompts@2.4.2 cross-env@10.0.0",
|
|
904
|
+
{ stdio: "inherit" }
|
|
905
|
+
);
|
|
896
906
|
}
|
|
897
907
|
console.log("✅ Dependencies installed successfully");
|
|
898
908
|
} catch (error) {
|
|
@@ -904,9 +914,9 @@ console.log("✅ Added config script to package.json");
|
|
|
904
914
|
console.log("");
|
|
905
915
|
|
|
906
916
|
console.log("🚀 Now run:");
|
|
907
|
-
if (packageManager ===
|
|
917
|
+
if (packageManager === "pnpm") {
|
|
908
918
|
console.log(" `pnpm run config`");
|
|
909
|
-
} else if (packageManager ===
|
|
919
|
+
} else if (packageManager === "yarn") {
|
|
910
920
|
console.log(" `yarn run config`");
|
|
911
921
|
} else {
|
|
912
922
|
console.log(" `npm run config`");
|