create-newt-app 0.22.3 → 0.22.5

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 (3) hide show
  1. package/README.md +27 -0
  2. package/dist/index.js +38 -1
  3. package/package.json +2 -2
package/README.md ADDED
@@ -0,0 +1,27 @@
1
+ <div align="center">
2
+ <h1>newt-app</h1>
3
+ <p><strong>Scaffold a production-ready, full-stack TypeScript monorepo in one command.</strong></p>
4
+
5
+ <a href="https://www.npmjs.com/package/create-newt-app"><img alt="npm version" src="https://img.shields.io/npm/v/create-newt-app.svg?style=for-the-badge&labelColor=000000"></a>
6
+
7
+ </div>
8
+
9
+ ## Getting Started
10
+
11
+ ```sh
12
+ npm create newt-app
13
+ ```
14
+
15
+ Next.js and NestJS in one production-grade monorepo: a real backend, auth, and a database, curated so you're not deleting half of it on day one.
16
+
17
+ ## Documentation
18
+
19
+ Visit [newt-app.vercel.app](https://newt-app.vercel.app) to view the full documentation.
20
+
21
+ ## What's inside
22
+
23
+ - **Next.js** frontend and **NestJS** backend, with `/api` proxied server-side to Nest
24
+ - **Better Auth** shared across both apps
25
+ - **Kysely** persistence, on SQLite or Postgres
26
+ - **shadcn/ui** component library
27
+ - **Turborepo** + **pnpm** workspaces
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import chalk from "chalk";
7
7
  // package.json
8
8
  var package_default = {
9
9
  name: "create-newt-app",
10
- version: "0.22.3",
10
+ version: "0.22.5",
11
11
  private: false,
12
12
  type: "module",
13
13
  bin: {
@@ -131,6 +131,42 @@ async function renderTemplatesToDisk(basePackages, destDir, templateData) {
131
131
  }
132
132
  }, Promise.resolve());
133
133
  }
134
+ var DEP_FIELDS = [
135
+ "dependencies",
136
+ "devDependencies",
137
+ "peerDependencies",
138
+ "optionalDependencies"
139
+ ];
140
+ function sortByKey(obj) {
141
+ return Object.fromEntries(
142
+ Object.keys(obj).sort().map((key) => [key, obj[key]])
143
+ );
144
+ }
145
+ async function sortPackageJsons(destDir) {
146
+ const nested = await Promise.all(
147
+ ["apps", "packages"].map(async (base) => {
148
+ const dir = path.join(destDir, base);
149
+ try {
150
+ const entries = await promises.readdir(dir, { withFileTypes: true });
151
+ return entries.filter((entry) => entry.isDirectory()).map((entry) => path.join(dir, entry.name, "package.json"));
152
+ } catch {
153
+ return [];
154
+ }
155
+ })
156
+ );
157
+ const files = [path.join(destDir, "package.json")].concat(...nested);
158
+ await Promise.all(
159
+ files.map(async (file) => {
160
+ if (!existsSync(file)) return;
161
+ const pkg = JSON.parse(await promises.readFile(file, "utf8"));
162
+ if (pkg.scripts) pkg.scripts = sortByKey(pkg.scripts);
163
+ DEP_FIELDS.forEach((field) => {
164
+ if (pkg[field]) pkg[field] = sortByKey(pkg[field]);
165
+ });
166
+ await promises.writeFile(file, JSON.stringify(pkg, null, 2) + "\n");
167
+ })
168
+ );
169
+ }
134
170
  function validateProjectName(projectName) {
135
171
  if (!projectName) {
136
172
  return { valid: false, error: "Project name is required" };
@@ -180,6 +216,7 @@ async function scaffold(modules, options) {
180
216
  if (scripts.length > 0) {
181
217
  await updateScripts(options.name, scripts, templateData);
182
218
  }
219
+ await sortPackageJsons(options.name);
183
220
  }
184
221
  async function pnpmInstall(cwd) {
185
222
  return await execa("pnpm", ["install"], {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-newt-app",
3
- "version": "0.22.3",
3
+ "version": "0.22.5",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "bin": {
@@ -16,7 +16,7 @@
16
16
  "ejs": "^3.1.10",
17
17
  "execa": "^9.6.0",
18
18
  "zod": "^3.25.76",
19
- "@newt-app/templates": "0.22.3"
19
+ "@newt-app/templates": "0.22.5"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@types/ejs": "^3.1.5",