|
| 1 | +# create-atxp |
| 2 | + |
| 3 | +Developer documentation for the `create-atxp` wrapper package. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +The `create-atxp` package is a thin wrapper that enables the `npm create atxp` syntax by proxying calls to the main `atxp` package. This follows the convention used by other CLI tools like `create-react-app`, `create-next-app`, etc. |
| 8 | + |
| 9 | +## Architecture |
| 10 | + |
| 11 | +``` |
| 12 | +npm create atxp my-app --framework express |
| 13 | + ↓ |
| 14 | +create-atxp/index.js |
| 15 | + ↓ |
| 16 | +npx atxp create my-app --framework express |
| 17 | + ↓ |
| 18 | +packages/atxp/src/index.ts |
| 19 | +``` |
| 20 | + |
| 21 | +### How it works: |
| 22 | +1. User runs `npm create atxp <args>` |
| 23 | +2. npm automatically runs `npx create-atxp <args>` |
| 24 | +3. `create-atxp/index.js` transforms this into `npx atxp create <args>` |
| 25 | +4. The main `atxp` package handles the actual project creation |
| 26 | + |
| 27 | +## Development |
| 28 | + |
| 29 | +### Prerequisites |
| 30 | +- Node.js 18+ |
| 31 | +- The main `atxp` package built and available |
| 32 | + |
| 33 | +### Setup |
| 34 | +```bash |
| 35 | +cd packages/create-atxp |
| 36 | +npm install |
| 37 | +``` |
| 38 | + |
| 39 | +### Testing the Wrapper |
| 40 | + |
| 41 | +#### Test Basic Functionality |
| 42 | +```bash |
| 43 | +# From packages/create-atxp directory |
| 44 | +node index.js test-app |
| 45 | + |
| 46 | +# Should be equivalent to: |
| 47 | +# npx atxp create test-app |
| 48 | +``` |
| 49 | + |
| 50 | +#### Test with Flags |
| 51 | +```bash |
| 52 | +# Test framework flag |
| 53 | +node index.js test-app --framework express |
| 54 | + |
| 55 | +# Test git flags |
| 56 | +node index.js test-app --no-git |
| 57 | +node index.js test-app --git |
| 58 | + |
| 59 | +# Test help |
| 60 | +node index.js --help |
| 61 | +``` |
| 62 | + |
| 63 | +#### Test npm create Syntax |
| 64 | +```bash |
| 65 | +# From repo root, test the actual npm create flow |
| 66 | +npm create atxp test-app |
| 67 | +npm create atxp test-app --framework express --no-git |
| 68 | +``` |
| 69 | + |
| 70 | +### Debugging |
| 71 | + |
| 72 | +#### Enable Verbose Output |
| 73 | +```bash |
| 74 | +# See exactly what command is being executed |
| 75 | +node index.js test-app --verbose |
| 76 | +``` |
| 77 | + |
| 78 | +#### Check Dependencies |
| 79 | +```bash |
| 80 | +# Verify atxp package is available |
| 81 | +npx atxp --help |
| 82 | + |
| 83 | +# Check if create-atxp can find atxp |
| 84 | +npm ls atxp |
| 85 | +``` |
| 86 | + |
| 87 | +### Common Issues |
| 88 | + |
| 89 | +#### "Command not found" errors |
| 90 | +- Ensure `atxp` package is built: `cd ../atxp && npm run build` |
| 91 | +- Check that `atxp` is in dependencies: check `package.json` |
| 92 | + |
| 93 | +#### Arguments not passing through |
| 94 | +- Verify `process.argv.slice(2)` is correctly capturing all arguments |
| 95 | +- Test with `console.log(atxpArgs)` in `index.js` |
| 96 | + |
| 97 | +#### Version mismatches |
| 98 | +- Both packages should have the same version number |
| 99 | +- Check `atxp` dependency version in `package.json` |
| 100 | + |
| 101 | +## Version Management |
| 102 | + |
| 103 | +The `create-atxp` package version should always match the main `atxp` package: |
| 104 | + |
| 105 | +```bash |
| 106 | +# Check current versions |
| 107 | +cd packages/atxp && npm version |
| 108 | +cd ../create-atxp && npm version |
| 109 | + |
| 110 | +# Update versions (should be done together) |
| 111 | +npm version patch # in both packages |
| 112 | +``` |
| 113 | + |
| 114 | +## Testing Checklist |
| 115 | + |
| 116 | +Before releasing, verify: |
| 117 | + |
| 118 | +- [ ] `node index.js test-app` creates project successfully |
| 119 | +- [ ] `node index.js test-app --framework express` works |
| 120 | +- [ ] `node index.js test-app --no-git` skips git initialization |
| 121 | +- [ ] `node index.js test-app --git` forces git initialization |
| 122 | +- [ ] `node index.js --help` shows help information |
| 123 | +- [ ] `npm create atxp test-app` works from repo root |
| 124 | +- [ ] All arguments pass through correctly |
| 125 | +- [ ] Error messages are clear and helpful |
| 126 | +- [ ] Package.json versions match between both packages |
| 127 | + |
| 128 | +## File Structure |
| 129 | + |
| 130 | +``` |
| 131 | +packages/create-atxp/ |
| 132 | +├── README.md # This developer documentation |
| 133 | +├── package.json # Package configuration and dependencies |
| 134 | +├── index.js # Main wrapper script |
| 135 | +└── eslint.config.js # ESLint configuration |
| 136 | +``` |
| 137 | + |
| 138 | +## Dependencies |
| 139 | + |
| 140 | +- **`atxp`**: The main CLI package (exact version match) |
| 141 | +- **`eslint`**, **`globals`**: Development dependencies for linting |
| 142 | + |
| 143 | +## Publishing |
| 144 | + |
| 145 | +This package is published to npm as `create-atxp` and should be published alongside the main `atxp` package with matching versions. |
| 146 | + |
| 147 | +```bash |
| 148 | +# Build and test first |
| 149 | +npm run build |
| 150 | +npm test |
| 151 | + |
| 152 | +# Publish (from packages/create-atxp) |
| 153 | +npm publish |
| 154 | +``` |
| 155 | + |
| 156 | +## Contributing |
| 157 | + |
| 158 | +When modifying the wrapper: |
| 159 | +1. Test locally with `node index.js` |
| 160 | +2. Test with `npm create atxp` syntax |
| 161 | +3. Verify all flags and arguments pass through |
| 162 | +4. Update tests if needed |
| 163 | +5. Ensure version stays in sync with main package |
0 commit comments