create-houdini 2.0.0-next.7 → 2.0.0-next.9

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.
Files changed (2) hide show
  1. package/bin.js +12 -1
  2. package/package.json +1 -1
package/bin.js CHANGED
@@ -16,6 +16,17 @@ let projectName = projectDir
16
16
  const { version } = JSON.parse(fs.readFileSync(new URL('package.json', import.meta.url), 'utf-8'))
17
17
  console.log(`${grey(`create-houdini version ${version}`)}\n`)
18
18
 
19
+ // derive the dist-tag from our own version, then resolve it to a real version from the registry
20
+ const distTag = version.includes('-') ? version.split('-')[1].split('.')[0] : 'latest'
21
+ let houdiniVersion = version
22
+ try {
23
+ const { execSync } = await import('node:child_process')
24
+ const resolved = execSync(`npm view houdini@${distTag} version`, { encoding: 'utf-8' }).trim()
25
+ if (resolved) houdiniVersion = resolved
26
+ } catch {
27
+ // offline or registry unavailable — fall back to create-houdini's own version
28
+ }
29
+
19
30
  // prepare options
20
31
  const templatesDir = sourcePath(`./templates`)
21
32
  const options = fs.readdirSync(templatesDir).map((templateDir) => {
@@ -171,7 +182,7 @@ copy(
171
182
  {
172
183
  API_URL: apiUrl,
173
184
  PROJECT_NAME: projectName,
174
- HOUDINI_VERSION: version,
185
+ HOUDINI_VERSION: houdiniVersion,
175
186
  ["'CLIENT_CONFIG'"]: clientConfig,
176
187
  ["'CONFIG_FILE'"]: configFile,
177
188
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-houdini",
3
- "version": "2.0.0-next.7",
3
+ "version": "2.0.0-next.9",
4
4
  "description": "A CLI for creating new Houdini projects",
5
5
  "repository": {
6
6
  "type": "git",