@kispace-io/gs-lib 1.0.27 → 1.0.29

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,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { fileURLToPath } from 'url'
4
- import { dirname, resolve } from 'path'
4
+ import { dirname as pathDirname, resolve, basename } from 'path'
5
5
  import { readFileSync } from 'fs'
6
6
 
7
7
  const __filename = fileURLToPath(import.meta.url)
8
- const __dirname = dirname(__filename)
8
+ const __dirname = pathDirname(__filename)
9
9
 
10
10
  // Parse command line arguments
11
11
  const args = process.argv.slice(2)
@@ -68,9 +68,12 @@ for (let i = 1; i < args.length; i++) {
68
68
  }
69
69
  }
70
70
 
71
- // Resolve paths relative to current working directory
72
- const projectRoot = process.cwd()
73
- const resolvedMapFile = resolve(projectRoot, mapFile)
71
+ // Resolve the map file path (can be absolute or relative to cwd)
72
+ const resolvedMapFile = resolve(process.cwd(), mapFile)
73
+
74
+ // Use the directory of the .geospace file as the project root
75
+ const projectRoot = pathDirname(resolvedMapFile)
76
+ const mapFileName = basename(resolvedMapFile)
74
77
 
75
78
  // Load environment variables if env file is provided
76
79
  let env = {}
@@ -111,7 +114,8 @@ const progress = (step, message, totalSteps) => {
111
114
  const gsLibPath = resolve(__dirname, '..')
112
115
 
113
116
  // Build the project
114
- await buildProject(projectRoot, resolvedMapFile, {
117
+ // mapFile should be relative to projectRoot (just the filename)
118
+ await buildProject(projectRoot, mapFileName, {
115
119
  title: options.title,
116
120
  version: options.version || '1.0.0',
117
121
  env: env || {},
package/dist/index.js CHANGED
@@ -98782,7 +98782,7 @@ async function buildMap(options, fs2, resolvePlugin, esbuildInstance, config = {
98782
98782
  const entryPointContent = generateAppJs({
98783
98783
  gsMap: options.gsMap,
98784
98784
  gsLibPath: buildGsLibPath,
98785
- env: options.env
98785
+ env: { ...options.env, BUILD_TIME: /* @__PURE__ */ new Date() }
98786
98786
  });
98787
98787
  await fs2.writeFile(`${buildDir}/app.js`, entryPointContent);
98788
98788
  updateProgress("Generating HTML file...");