@newt-app/templates 0.13.2 → 0.14.1

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.
package/dist/index.d.ts CHANGED
@@ -45,7 +45,6 @@ declare const templates: {
45
45
  deploymentStandalone: Module;
46
46
  deploymentCustomServer: Module;
47
47
  deploymentSpa: Module;
48
- deploymentVercel: Module;
49
48
  nestDiOnly: Module;
50
49
  apiControllers: Module;
51
50
  };
package/dist/index.js CHANGED
@@ -8904,177 +8904,8 @@ var singleProcessStaticExport = {
8904
8904
  };
8905
8905
  var single_process_static_export_default = singleProcessStaticExport;
8906
8906
 
8907
- // src/single-process-pages/templates/api-package-json.ts
8908
- var api_package_json_default3 = {
8909
- filename: "apps/api/package.json",
8910
- template: `{
8911
- "name": "@<%= projectName %>/api",
8912
- "version": "0.0.1",
8913
- "description": "",
8914
- "author": "",
8915
- "private": true,
8916
- "license": "UNLICENSED",
8917
- "exports": {
8918
- ".": "./src/index.ts"
8919
- },
8920
- "scripts": {
8921
- "build": "nest build",
8922
- "start": "nest start",
8923
- "dev": "nest start --watch",
8924
- "start:dev": "nest start --watch",
8925
- "start:debug": "nest start --debug --watch",
8926
- "start:prod": "node dist/main",
8927
- "lint": "eslint \\"{src,apps,libs,test}/**/*.ts\\" --fix",
8928
- "lint:check": "eslint \\"{src,apps,libs,test}/**/*.ts\\""
8929
- },
8930
- "dependencies": {
8931
- "@nestjs/common": "^11.0.1",
8932
- "@nestjs/core": "^11.0.1",
8933
- "@nestjs/platform-express": "^11.0.1",
8934
- "@<%= projectName %>/auth": "workspace:*",
8935
- "@thallesp/nestjs-better-auth": "^2.5.1",
8936
- "dotenv": "^17.3.1",
8937
- "reflect-metadata": "^0.2.2",
8938
- "rxjs": "^7.8.1"
8939
- },
8940
- "devDependencies": {
8941
- "@eslint/eslintrc": "^3.2.0",
8942
- "@eslint/js": "^9.18.0",
8943
- "@nestjs/cli": "^11.0.0",
8944
- "@nestjs/schematics": "^11.0.0",
8945
- "@nestjs/testing": "^11.0.1",
8946
- "@types/express": "^5.0.0",
8947
- "@types/node": "^22.10.7",
8948
- "@types/supertest": "^6.0.2",
8949
- "eslint": "^9.18.0",
8950
- "eslint-config-prettier": "^10.0.1",
8951
- "globals": "^16.0.0",
8952
- "supertest": "^7.0.0",
8953
- "ts-node": "^10.9.2",
8954
- "tsconfig-paths": "^4.2.0",
8955
- "typescript": "6.0.2",
8956
- "typescript-eslint": "^8.20.0"
8957
- }
8958
- }`
8959
- };
8960
-
8961
- // src/single-process-pages/templates/api-src-index.ts
8962
- var api_src_index_default2 = {
8963
- filename: "apps/api/src/index.ts",
8964
- template: `export { AppModule } from './app.module';`
8965
- };
8966
-
8967
- // src/single-process-pages/templates/web-api-catchall.ts
8968
- var web_api_catchall_default = {
8969
- filename: "apps/web/pages/api/[...path].ts",
8970
- template: `import 'reflect-metadata';
8971
- import type { NextApiRequest, NextApiResponse } from 'next';
8972
- import type { INestApplication } from '@nestjs/common';
8973
-
8974
- export const config = {
8975
- api: {
8976
- bodyParser: false,
8977
- externalResolver: true,
8978
- },
8979
- };
8980
-
8981
- let app: INestApplication | null = null;
8982
-
8983
- async function getApp(): Promise<INestApplication> {
8984
- if (!app) {
8985
- const { NestFactory } = await import('@nestjs/core');
8986
- const { AppModule } = await import('@<%= projectName %>/api');
8987
- app = await NestFactory.create(AppModule, { bodyParser: false });
8988
- app.setGlobalPrefix('api');
8989
- await app.init();
8990
- }
8991
- return app;
8992
- }
8993
-
8994
- export default async function handler(req: NextApiRequest, res: NextApiResponse) {
8995
- const nestApp = await getApp();
8996
- const express = nestApp.getHttpAdapter().getInstance() as (
8997
- req: NextApiRequest,
8998
- res: NextApiResponse
8999
- ) => void;
9000
- express(req, res);
9001
- }`
9002
- };
9003
-
9004
- // src/single-process-pages/templates/web-package-json.ts
9005
- var web_package_json_default2 = {
9006
- filename: "apps/web/package.json",
9007
- template: `{
9008
- "name": "web",
9009
- "version": "0.1.0",
9010
- "type": "module",
9011
- "private": true,
9012
- "scripts": {
9013
- "dev": "next dev --port 3000",
9014
- "build": "next build",
9015
- "start": "next start",
9016
- "lint": "eslint --fix && next typegen && tsc --noEmit",
9017
- "lint:check": "eslint --max-warnings 0 && next typegen && tsc --noEmit",
9018
- "db:migrate": "better-auth migrate"
9019
- },
9020
- "dependencies": {
9021
- "@<%= projectName %>/api": "workspace:*",
9022
- "@<%= projectName %>/auth": "workspace:*",
9023
- "@<%= projectName %>/ui": "workspace:*",
9024
- "@tailwindcss/postcss": "^4.2.1",
9025
- "dotenv": "^17.3.1",
9026
- "@tanstack/react-form": "^1.28.5",
9027
- "@tanstack/react-query": "^5.90.21",
9028
- "better-auth": "^1.2.8",
9029
- "next": "16.2.1",
9030
- "react": "^19.2.4",
9031
- "react-dom": "^19.2.4",
9032
- "tailwindcss": "^4.2.1"
9033
- },
9034
- "devDependencies": {
9035
- "@<%= projectName %>/eslint-config": "workspace:*",
9036
- "@<%= projectName %>/typescript-config": "workspace:*",
9037
- "@types/node": "^22.15.3",
9038
- "@types/react": "19.2.14",
9039
- "@types/react-dom": "19.2.3",
9040
- "eslint": "^9.39.1",
9041
- "typescript": "6.0.2"
9042
- }
9043
- }`
9044
- };
9045
-
9046
- // src/single-process-pages/templates/web-next-config.ts
9047
- var web_next_config_default3 = {
9048
- filename: "apps/web/next.config.js",
9049
- template: `import dotenv from 'dotenv';
9050
- import { resolve } from 'path';
9051
-
9052
- // Load root .env first, then local .env (local takes precedence)
9053
- dotenv.config({ path: resolve(process.cwd(), '../../.env') });
9054
- dotenv.config({ path: resolve(process.cwd(), '.env') });
9055
-
9056
- /** @type {import('next').NextConfig} */
9057
- const nextConfig = {
9058
- output: "standalone",
9059
- };
9060
-
9061
- export default nextConfig;`
9062
- };
9063
-
9064
- // src/single-process-pages/index.ts
9065
- var singleProcessPages = {
9066
- templates: [
9067
- api_package_json_default3,
9068
- api_src_index_default2,
9069
- web_api_catchall_default,
9070
- web_package_json_default2,
9071
- web_next_config_default3
9072
- ]
9073
- };
9074
- var single_process_pages_default = singleProcessPages;
9075
-
9076
8907
  // src/nest-di-only/templates/api-package-json.ts
9077
- var api_package_json_default4 = {
8908
+ var api_package_json_default3 = {
9078
8909
  filename: "apps/api/package.json",
9079
8910
  template: `{
9080
8911
  "name": "@<%= projectName %>/api",
@@ -9165,7 +8996,7 @@ var web_nest_context_default = {
9165
8996
  template: `import 'reflect-metadata';
9166
8997
  import { NestFactory } from '@nestjs/core';
9167
8998
  import { AppModule } from '@<%= projectName %>/api';
9168
- import type { INestApplicationContext } from '@nestjs/common';
8999
+ import type { INestApplicationContext, Type, Abstract } from '@nestjs/common';
9169
9000
 
9170
9001
  let context: INestApplicationContext | null = null;
9171
9002
 
@@ -9176,6 +9007,11 @@ export async function getContext(): Promise<INestApplicationContext> {
9176
9007
  });
9177
9008
  }
9178
9009
  return context;
9010
+ }
9011
+
9012
+ export async function inject<T>(token: Type<T> | Abstract<T> | string | symbol): Promise<T> {
9013
+ const ctx = await getContext();
9014
+ return ctx.get<T>(token);
9179
9015
  }`
9180
9016
  };
9181
9017
 
@@ -9232,7 +9068,7 @@ export async function PATCH(_req: Request, { params }: { params: Promise<{ id: s
9232
9068
  };
9233
9069
 
9234
9070
  // src/nest-di-only/templates/web-package-json.ts
9235
- var web_package_json_default3 = {
9071
+ var web_package_json_default2 = {
9236
9072
  filename: "apps/web/package.json",
9237
9073
  template: `{
9238
9074
  "name": "web",
@@ -9277,7 +9113,7 @@ var web_package_json_default3 = {
9277
9113
  };
9278
9114
 
9279
9115
  // src/nest-di-only/templates/web-next-config.ts
9280
- var web_next_config_default4 = {
9116
+ var web_next_config_default3 = {
9281
9117
  filename: "apps/web/next.config.js",
9282
9118
  template: `import dotenv from 'dotenv';
9283
9119
  import { resolve } from 'path';
@@ -9348,7 +9184,7 @@ export async function GET() {
9348
9184
  // src/nest-di-only/index.ts
9349
9185
  var nestDiOnly = {
9350
9186
  templates: [
9351
- api_package_json_default4,
9187
+ api_package_json_default3,
9352
9188
  api_tsconfig_default,
9353
9189
  api_index_default,
9354
9190
  web_nest_context_default,
@@ -9356,8 +9192,8 @@ var nestDiOnly = {
9356
9192
  web_todos_route_default,
9357
9193
  web_todos_id_route_default,
9358
9194
  web_todos_toggle_route_default,
9359
- web_package_json_default3,
9360
- web_next_config_default4,
9195
+ web_package_json_default2,
9196
+ web_next_config_default3,
9361
9197
  web_tsconfig_default
9362
9198
  ]
9363
9199
  };
@@ -9544,7 +9380,6 @@ var templates = {
9544
9380
  deploymentStandalone: deployment_standalone_default,
9545
9381
  deploymentCustomServer: single_process_custom_server_default,
9546
9382
  deploymentSpa: single_process_static_export_default,
9547
- deploymentVercel: single_process_pages_default,
9548
9383
  nestDiOnly: nest_di_only_default,
9549
9384
  apiControllers: api_controllers_default
9550
9385
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newt-app/templates",
3
- "version": "0.13.2",
3
+ "version": "0.14.1",
4
4
  "private": false,
5
5
  "description": "Templates for newt-app",
6
6
  "type": "module",