@kispace-io/gs-lib 1.0.28 → 1.0.30
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/map-builder.js +6 -2
- package/lib/node-map-builder.ts +17 -4
- package/package.json +1 -1
package/bin/map-builder.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import { fileURLToPath } from 'url'
|
|
4
|
-
import { dirname as pathDirname, resolve, basename } from 'path'
|
|
4
|
+
import { dirname as pathDirname, resolve, basename, isAbsolute } from 'path'
|
|
5
5
|
import { readFileSync } from 'fs'
|
|
6
6
|
|
|
7
7
|
const __filename = fileURLToPath(import.meta.url)
|
|
@@ -79,7 +79,11 @@ const mapFileName = basename(resolvedMapFile)
|
|
|
79
79
|
let env = {}
|
|
80
80
|
if (options.envFile) {
|
|
81
81
|
try {
|
|
82
|
-
|
|
82
|
+
// If env file path is already absolute, use it as-is
|
|
83
|
+
// Otherwise, resolve it relative to projectRoot (the .geospace file's directory)
|
|
84
|
+
const envPath = isAbsolute(options.envFile)
|
|
85
|
+
? options.envFile
|
|
86
|
+
: resolve(projectRoot, options.envFile)
|
|
83
87
|
const envContent = readFileSync(envPath, 'utf-8')
|
|
84
88
|
envContent.split('\n').forEach(line => {
|
|
85
89
|
const trimmed = line.trim()
|
package/lib/node-map-builder.ts
CHANGED
|
@@ -4,8 +4,7 @@ import {
|
|
|
4
4
|
FileSystem,
|
|
5
5
|
ProgressCallback,
|
|
6
6
|
buildMap,
|
|
7
|
-
calculateTotalSteps
|
|
8
|
-
createCopyAssetsFunction
|
|
7
|
+
calculateTotalSteps
|
|
9
8
|
} from '../src/base-map-builder'
|
|
10
9
|
import {GsMap} from '../src/gs-model'
|
|
11
10
|
|
|
@@ -169,8 +168,22 @@ export async function buildProject(
|
|
|
169
168
|
|
|
170
169
|
const buildTitle = title || path.basename(mapFile, '.geospace')
|
|
171
170
|
|
|
172
|
-
//
|
|
173
|
-
const copyAssets =
|
|
171
|
+
// Create Node.js-specific copyAssets function using native fs.cp()
|
|
172
|
+
const copyAssets = async (fileSys: FileSystem, outputDir: string) => {
|
|
173
|
+
const assetsSrc = path.resolve(projectRoot, 'assets')
|
|
174
|
+
const assetsDest = path.resolve(projectRoot, outputDir, 'assets')
|
|
175
|
+
|
|
176
|
+
// Check if assets directory exists
|
|
177
|
+
try {
|
|
178
|
+
await nodeFs.access(assetsSrc)
|
|
179
|
+
} catch {
|
|
180
|
+
// Assets directory doesn't exist, skip copying
|
|
181
|
+
return
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// Use Node.js native fs.cp() for recursive directory copy (available since v16.7.0)
|
|
185
|
+
await nodeFs.cp(assetsSrc, assetsDest, { recursive: true })
|
|
186
|
+
}
|
|
174
187
|
|
|
175
188
|
// Build using unified function
|
|
176
189
|
// Dynamic import to avoid bundling esbuild in browser builds
|