Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
{
"allowSingleLine": true
}
]
],
"no-undef-init": "off"
}
}
}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,6 @@ dist
/.dccache

/examples/*/dist

# IDEs
.idea
4 changes: 2 additions & 2 deletions examples/apollo/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import http from 'http';
import { ApolloServer } from '@apollo/server';
import { expressMiddleware } from '@apollo/server/express4';
import { ApolloServerPluginDrainHttpServer } from '@apollo/server/plugin/drainHttpServer';
import express from 'express';
import express, { type Express } from 'express';
import cors from 'cors';
import bodyParser from 'body-parser';

Expand Down Expand Up @@ -63,4 +63,4 @@ async function bootstrap() {
return app;
}
const app = bootstrap();
export const viteNodeApp = app;
export const viteNodeApp: Promise<Express> = app;
10 changes: 7 additions & 3 deletions examples/apollo/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "apollo-example",
"version": "1.0.0",
"main": "index.js",
"type": "module",
"license": "MIT",
"scripts": {
"dev": "vite",
Expand All @@ -12,11 +12,15 @@
"dependencies": {
"@apollo/server": "^4.3.0",
"cors": "^2.8.5",
"graphql": "^16.6.0"
"graphql": "^16.6.0",
"body-parser": "^1.20.3",
"express": "^4.17.1"
},
"devDependencies": {
"@types/body-parser": "^1.19.5",
"@types/cors": "^2.8.13",
"vite": "^4.0.4",
"@types/express": "^4.17.13",
"vite": "^5.0.0",
"vite-plugin-node": "workspace:*"
}
}
6 changes: 3 additions & 3 deletions examples/cloudfunction/app.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import express from 'express';
import express, { type Express, type RequestHandler } from 'express';

async function makeApp() {
const app = express();
Expand All @@ -12,8 +12,8 @@ async function makeApp() {

const appPromise = makeApp();

export const viteNodeApp = appPromise;
export const main = async (req, res) => {
export const viteNodeApp: Promise<Awaited<Express>> = appPromise;
export const main: RequestHandler = async (req, res) => {
const app = await appPromise;

app(req, res);
Expand Down
5 changes: 3 additions & 2 deletions examples/cloudfunction/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "express-example",
"version": "1.0.0",
"main": "index.js",
"type": "module",
"license": "MIT",
"scripts": {
"dev": "vite",
Expand All @@ -14,7 +14,8 @@
},
"devDependencies": {
"@swc/core": "^1.2.155",
"vite": "^4.0.4",
"@types/express": "^4.17.13",
"vite": "^5.0.0",
"vite-plugin-node": "workspace:*"
}
}
4 changes: 2 additions & 2 deletions examples/express/app.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import express from 'express';
import express, { type Express } from 'express';

const app = express();

Expand All @@ -17,4 +17,4 @@ if (import.meta.env.PROD) {
console.log('listening on http://localhost:3000/');
}

export const viteNodeApp = app;
export const viteNodeApp: Express = app;
6 changes: 4 additions & 2 deletions examples/express/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "express-example",
"version": "1.0.0",
"main": "index.js",
"type": "module",
"license": "MIT",
"scripts": {
"dev": "vite",
Expand All @@ -13,7 +13,9 @@
"express": "^4.17.1"
},
"devDependencies": {
"vite": "^4.0.4",
"@types/express": "^4.17.13",
"@types/node": "^18.0.0",
"vite": "^5.0.0",
"vite-plugin-node": "workspace:*"
}
}
3 changes: 0 additions & 3 deletions examples/express/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ import { defineConfig } from 'vite';
import { VitePluginNode } from 'vite-plugin-node';

export default defineConfig({
ssr: {
format: 'cjs',
},
server: {
port: 3699,
},
Expand Down
2 changes: 1 addition & 1 deletion examples/fastify/app.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import fastify from 'fastify';
import { fastify } from 'fastify';

const app = async () => {
const app = fastify();
Expand Down
4 changes: 2 additions & 2 deletions examples/fastify/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "fastify-example",
"version": "1.0.0",
"main": "index.js",
"type": "module",
"license": "MIT",
"scripts": {
"dev": "vite",
Expand All @@ -11,7 +11,7 @@
"fastify": "^3.27.1"
},
"devDependencies": {
"vite": "^4.0.4",
"vite": "^5.0.0",
"vite-plugin-node": "workspace:*"
}
}
4 changes: 2 additions & 2 deletions examples/initAppOnBoot/app.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import express from 'express';
import express, { type Express } from 'express';

const app = express();

Expand All @@ -19,4 +19,4 @@ if (import.meta.env.PROD) {

console.log('app is loaded');

export const viteNodeApp = app;
export const viteNodeApp: Express = app;
7 changes: 4 additions & 3 deletions examples/initAppOnBoot/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "init-app-on-boot-example",
"version": "1.0.0",
"main": "index.js",
"type": "module",
"license": "MIT",
"scripts": {
"dev": "vite",
Expand All @@ -13,7 +13,8 @@
"express": "^4.17.1"
},
"devDependencies": {
"vite": "^4.5.0",
"@types/express": "^4.17.13",
"vite": "^5.0.0",
"vite-plugin-node": "workspace:*"
}
}
}
3 changes: 0 additions & 3 deletions examples/initAppOnBoot/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ import { defineConfig } from 'vite';
import { VitePluginNode } from 'vite-plugin-node';

export default defineConfig({
ssr: {
format: 'cjs',
},
server: {
port: 3699,
},
Expand Down
5 changes: 3 additions & 2 deletions examples/koa/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "koa-example",
"version": "1.0.0",
"main": "index.js",
"type": "module",
"license": "MIT",
"scripts": {
"dev": "vite",
Expand All @@ -11,7 +11,8 @@
"koa": "^2.13.3"
},
"devDependencies": {
"vite": "^4.0.4",
"@types/koa": "^2.13.4",
"vite": "^5.0.0",
"vite-plugin-node": "workspace:*"
}
}
5 changes: 2 additions & 3 deletions examples/marble/app.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as T from 'fp-ts/lib/Task';
import { pipe } from 'fp-ts/lib/function';
import * as T from 'fp-ts/Task';
import { pipe } from 'fp-ts/function';
import { createServer, httpListener } from '@marblejs/http';
import { isTestEnv, getPortEnv } from '@marblejs/core/dist/+internal/utils';
import { logger$ } from '@marblejs/middleware-logger';
import { bodyParser$ } from '@marblejs/middleware-body';
import { r } from '@marblejs/http';
Expand Down
6 changes: 3 additions & 3 deletions examples/marble/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "marble-example",
"version": "1.0.0",
"description": "Marble.js test",
"main": "index.js",
"type": "module",
"license": "MIT",
"scripts": {
"dev": "vite",
Expand All @@ -24,8 +24,8 @@
"typescript": "^4.3.2"
},
"devDependencies": {
"@types/node": "14",
"vite": "^4.0.4",
"@types/node": "^18.0.0",
"vite": "^5.0.0",
"vite-plugin-node": "workspace:*"
}
}
6 changes: 0 additions & 6 deletions examples/marble/tsconfig.json

This file was deleted.

50 changes: 16 additions & 34 deletions examples/nest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"author": "",
"private": true,
"license": "UNLICENSED",
"type": "module",
"scripts": {
"dev": "vite",
"prebuild": "rimraf dist",
Expand All @@ -15,58 +16,39 @@
"start:debug": "nest start --debug --watch",
"start:prod": "node dist/main",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"test": "jest",
"test:watch": "jest --watch",
"test:cov": "jest --coverage",
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
"test:e2e": "jest --config ./test/jest-e2e.json"
"test": "vitest",
"test:watch": "vitest --watch",
"test:cov": "vitest --coverage",
"test:e2e": "vitest ./test/"
},
"dependencies": {
"@nestjs/common": "^8.0.0",
"@nestjs/core": "^8.0.0",
"@nestjs/platform-express": "^8.0.0",
"@nestjs/common": "^10.0.0",
"@nestjs/core": "^10.0.0",
"@nestjs/platform-express": "^10.0.0",
"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.2",
"rxjs": "^7.2.0"
},
"devDependencies": {
"@nestjs/cli": "^8.0.0",
"@nestjs/schematics": "^8.0.0",
"@nestjs/testing": "^8.0.0",
"@nestjs/cli": "^10.0.0",
"@nestjs/schematics": "^10.0.0",
"@nestjs/testing": "^10.0.0",
"@swc/core": "^1.2.155",
"@types/express": "^4.17.13",
"@types/jest": "^26.0.24",
"@types/node": "^16.0.0",
"@types/node": "^18.0.0",
"@types/supertest": "^2.0.11",
"@typescript-eslint/eslint-plugin": "^5.23.0",
"@typescript-eslint/parser": "^5.23.0",
"eslint": "^7.30.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^3.4.0",
"jest": "27.0.6",
"prettier": "^2.3.2",
"supertest": "^6.1.3",
"ts-node": "^10.0.0",
"tsconfig-paths": "^3.10.1",
"typescript": "^4.3.5",
"vite": "^4.0.4",
"vite-plugin-node": "workspace:*"
},
"jest": {
"moduleFileExtensions": [
"js",
"json",
"ts"
],
"rootDir": "src",
"testRegex": ".*\\.spec\\.ts$",
"transform": {
"^.+\\.(t|j)s$": "ts-jest"
},
"collectCoverageFrom": [
"**/*.(t|j)s"
],
"coverageDirectory": "../coverage",
"testEnvironment": "node"
"typescript": "^5.6.0",
"vite": "^5.0.0",
"vite-plugin-node": "workspace:*",
"vitest": "^2.1.1"
}
}
7 changes: 4 additions & 3 deletions examples/nest/src/app.controller.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Test, TestingModule } from '@nestjs/testing';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { AppController } from './app.controller.js';
import { AppService } from './app.service.js';
import { describe, beforeEach, it, expect } from 'vitest';

describe('AppController', () => {
let appController: AppController;
Expand All @@ -16,7 +17,7 @@ describe('AppController', () => {

describe('root', () => {
it('should return "Hello World!"', () => {
expect(appController.getHello()).toBe('Hello World!');
expect(appController.getHello()).toBe('change me to see updates! str from a new file,..');
});
});
});
2 changes: 1 addition & 1 deletion examples/nest/src/app.controller.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Controller, Get } from '@nestjs/common';
import { AppService } from './app.service';
import { AppService } from './app.service.js';

@Controller()
export class AppController {
Expand Down
4 changes: 2 additions & 2 deletions examples/nest/src/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { AppController } from './app.controller.js';
import { AppService } from './app.service.js';

@Module({
imports: [],
Expand Down
2 changes: 1 addition & 1 deletion examples/nest/src/app.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Injectable } from '@nestjs/common';
import { str } from './str';
import { str } from './str.js';

@Injectable()
export class AppService {
Expand Down
5 changes: 3 additions & 2 deletions examples/nest/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/// <reference types="vite/client" />
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { AppModule } from './app.module.js';

if (import.meta.env.PROD) {
if (import.meta.env?.PROD) {
async function bootstrap() {
const app = await NestFactory.create(AppModule);
await app.listen(3000);
Expand Down
Loading