create-aerobuilt 0.2.9 → 0.3.0

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 (4) hide show
  1. package/README.md +2 -0
  2. package/index.js +11 -2
  3. package/lib.js +5 -4
  4. package/package.json +2 -2
package/README.md CHANGED
@@ -49,6 +49,8 @@ my-app/
49
49
  └── tsconfig.json # Path aliases
50
50
  ```
51
51
 
52
+ If you change `dirs.client` (or other dirs) in `vite.config.ts` or `aero.config.ts`, update your `tsconfig.json` `paths` so they match (e.g. `@pages` → `"<client>/pages"`). The dev server will warn when custom dirs are used and a tsconfig is present.
53
+
52
54
  ## Links
53
55
 
54
56
  - [GitHub](https://github.com/aerobuilt/aero)
package/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { cpSync, mkdirSync, existsSync, statSync, readdirSync, lstatSync } from 'fs'
3
+ import { cpSync, mkdirSync, existsSync, statSync, readdirSync, readFileSync } from 'fs'
4
4
  import { dirname, join, basename } from 'path'
5
5
  import { fileURLToPath } from 'url'
6
6
  import { spawnSync } from 'child_process'
@@ -138,9 +138,18 @@ function main() {
138
138
  }
139
139
 
140
140
  const templatePath = resolveTemplatePath(template)
141
+ let aerobuiltVersion = null
142
+ if (!inMonorepo) {
143
+ try {
144
+ const cliPkg = JSON.parse(readFileSync(join(startPkgDir, 'package.json'), 'utf8'))
145
+ aerobuiltVersion = cliPkg.version || null
146
+ } catch {
147
+ // ignore; lib will fall back to *
148
+ }
149
+ }
141
150
  console.log(`Creating Aero app in ${target} from template "${template}"...`)
142
151
  copyTemplate(templatePath, targetDir)
143
- rewritePackageJson(templatePath, targetDir, target, inMonorepo)
152
+ rewritePackageJson(templatePath, targetDir, target, inMonorepo, aerobuiltVersion)
144
153
  writeReadme(targetDir, target, template)
145
154
  console.log('Installing dependencies...')
146
155
  if (inMonorepo) {
package/lib.js CHANGED
@@ -31,9 +31,10 @@ const PACKAGE_TEMPLATE = 'package-template.json'
31
31
  * @param {string} templatePath - Path to the template directory (e.g. packages/templates/minimal)
32
32
  * @param {string} targetDir - Path to the scaffolded project directory
33
33
  * @param {string} projectName - Project name for package.json "name"
34
- * @param {boolean} inMonorepo - If true, use workspace:* for aerobuilt; otherwise *
34
+ * @param {boolean} inMonorepo - If true, use workspace:* for aerobuilt; otherwise use aerobuiltVersion
35
+ * @param {string} [aerobuiltVersion] - When !inMonorepo, version range for aerobuilt (e.g. ^0.2.9). Omit to use '*'.
35
36
  */
36
- export function rewritePackageJson(templatePath, targetDir, projectName, inMonorepo) {
37
+ export function rewritePackageJson(templatePath, targetDir, projectName, inMonorepo, aerobuiltVersion) {
37
38
  const templatePkgPath = join(templatePath, PACKAGE_TEMPLATE)
38
39
  if (!existsSync(templatePkgPath)) {
39
40
  console.error(
@@ -43,9 +44,9 @@ export function rewritePackageJson(templatePath, targetDir, projectName, inMonor
43
44
  }
44
45
  const pkg = JSON.parse(readFileSync(templatePkgPath, 'utf8'))
45
46
  pkg.name = projectName
46
- const aerobuiltVersion = inMonorepo ? 'workspace:*' : '*'
47
+ const depVersion = inMonorepo ? 'workspace:*' : (aerobuiltVersion ? `^${aerobuiltVersion}` : '*')
47
48
  if (pkg.dependencies && pkg.dependencies.aerobuilt !== undefined) {
48
- pkg.dependencies.aerobuilt = aerobuiltVersion
49
+ pkg.dependencies.aerobuilt = depVersion
49
50
  }
50
51
  writeFileSync(join(targetDir, 'package.json'), JSON.stringify(pkg, null, 2) + '\n')
51
52
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-aerobuilt",
3
- "version": "0.2.9",
3
+ "version": "0.3.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Jamie Wilson",
@@ -19,7 +19,7 @@
19
19
  "create-aerobuilt": "index.js"
20
20
  },
21
21
  "dependencies": {
22
- "@aerobuilt/template-minimal": "0.2.9"
22
+ "@aerobuilt/template-minimal": "0.3.0"
23
23
  },
24
24
  "scripts": {
25
25
  "create": "node .",