@projectinvicta/nails 3.0.6 → 3.0.7

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/index.js ADDED
@@ -0,0 +1,9 @@
1
+ import Nails from './dist/Nails.js';
2
+ import ControllerInternal from './dist/Controller.js';
3
+
4
+ export { DataTypes, Model } from 'sequelize';
5
+
6
+ export default Nails;
7
+
8
+ export const Controller = ControllerInternal;
9
+ export * from './dist/config.js';
package/lib/Nails.ts CHANGED
@@ -6,11 +6,11 @@ import {type Server as HttpServer} from 'node:http';
6
6
 
7
7
  import { type Application } from 'express-ws';
8
8
  import { type InitOptions, Model, Sequelize, type ModelAttributes, type ModelStatic } from 'sequelize';
9
- import expressApp from './application.ts';
10
- import Router from './Router.ts';
9
+ import expressApp from './application.js';
10
+ import Router from './Router.js';
11
11
 
12
12
  import { type Config } from './config.ts';
13
- import Controller from './Controller.ts';
13
+ import Controller from './Controller.js';
14
14
 
15
15
  export default class Nails {
16
16
  static Controller = Controller;
package/lib/Router.ts CHANGED
@@ -2,8 +2,8 @@ import { EventEmitter } from 'node:events';
2
2
  import {type WebSocket} from "ws";
3
3
  import express, {type NextFunction, type Request, type Response} from 'express';
4
4
  import expressWs, {type Router as WsRouter, type Application as WsApplication, type WebsocketRequestHandler} from 'express-ws';
5
- import app, {expressRouter, ExpressRouter, expressStatic} from './application.ts';
6
- import { type RouteDefinition, type RouteOptions } from './config.ts';
5
+ import app, {expressRouter, ExpressRouter, expressStatic} from './application.js';
6
+ import { type RouteDefinition, type RouteOptions } from './config.js';
7
7
 
8
8
  interface ExpressWsType {
9
9
  app: any;
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@projectinvicta/nails",
3
- "version": "3.0.6",
3
+ "version": "3.0.7",
4
4
  "description": "A node.js webserver scaffold",
5
5
  "type": "module",
6
- "main": "index.ts",
6
+ "main": "index.js",
7
7
  "engines": {
8
8
  "node": ">=24.0.0"
9
9
  },
@@ -14,7 +14,8 @@
14
14
  "copyreadme": "node bin/convertreadmetohtml.js",
15
15
  "test": "vitest run ./tests",
16
16
  "debug": "vitest --inspect-brk run ./tests",
17
- "test_init": "bash bin/test/test_init.sh"
17
+ "test_init": "bash bin/test/test_init.sh",
18
+ "build": "tsc"
18
19
  },
19
20
  "repository": {
20
21
  "type": "git",
@@ -49,13 +50,12 @@
49
50
  "@types/express-ws": "*",
50
51
  "@types/node": "*",
51
52
  "chai-http": "*",
53
+ "typescript": "^6.0.2",
52
54
  "vite": "^8.0.1",
53
55
  "vitest": "^4.1.0"
54
56
  },
55
- "config": {
56
- "mongodbMemoryServer": {
57
- "version": "latest"
58
- }
57
+ "imports": {
58
+ "#nails": "./dist/nails.js"
59
59
  },
60
60
  "author": "Stanton W. Jones",
61
61
  "license": "MIT"
@@ -1,4 +1,4 @@
1
- import nails, {Controller} from "../../../../../index.ts";
1
+ import {Controller} from "../../../../../index.js";
2
2
  // require("../../../../../index.js").Controller;
3
3
  export default class ClassbasedController extends Controller {
4
4
  routes = [
@@ -1,4 +1,4 @@
1
- import { Controller } from "../../../../../index.ts";
1
+ import { Controller } from "../../../../../index.js";
2
2
  import Dog from "../models/dog.js";
3
3
  import Owner from "../models/owner.js";
4
4
 
@@ -1,4 +1,4 @@
1
- import nails, {Controller} from "../../../../../index.ts";
1
+ import {Controller} from "../../../../../index.js";
2
2
 
3
3
  export default class ErrorController extends Controller {
4
4
  // DO NOT OVERRIDE CONSTRUCTOR
@@ -1,4 +1,4 @@
1
- import { Controller } from "../../../../../index.ts";
1
+ import { Controller } from "../../../../../index.js";
2
2
 
3
3
  export default class HomeController extends Controller {
4
4
  index(params, request, response) {
@@ -1,4 +1,4 @@
1
- import {Controller} from "../../../../../index.ts";
1
+ import {Controller} from "../../../../../index.js";
2
2
 
3
3
  export default class JsonController extends Controller {
4
4
  testparams(params, request, response) {
@@ -1,4 +1,4 @@
1
- import {Controller} from "../../../../../index.ts";
1
+ import {Controller} from "../../../../../index.js";
2
2
  export default class ManualRenderAsyncController extends Controller {
3
3
  testmanualrenderasync(params, request, response) {
4
4
  return new Promise((resolve, reject) => {
@@ -1,4 +1,4 @@
1
- import {Controller} from "../../../../../index.ts";
1
+ import {Controller} from "../../../../../index.js";
2
2
  export default class MjsController extends Controller {
3
3
  // DO NOT OVERRIDE CONSTRUCTOR
4
4
  index(params, request, response) {
@@ -1,7 +1,7 @@
1
- import nails from "../../../../../index.ts";
1
+ import {Controller} from "../../../../../index.js";
2
2
  import Dog from "../models/dog.js";
3
3
 
4
- export default class ModeltestController extends nails.Controller {
4
+ export default class ModeltestController extends Controller {
5
5
  async createdog(params, request, response) {
6
6
  let dog = await Dog.create({good: true, name: params.name});
7
7
  console.log("CREATED DOG ID:", dog.id);
@@ -1,6 +1,6 @@
1
- import nails from "../../../../../index.ts";
1
+ import Nails from "../../../../../index.js";
2
2
 
3
- export default class WebsocketController extends nails.Controller {
3
+ export default class WebsocketController extends Nails.Controller {
4
4
  index(params, ws, request) {
5
5
  ws.send("It worked");
6
6
  ws.close();
@@ -1,4 +1,4 @@
1
- import {Model, DataTypes} from '../../../../../index.ts';
1
+ import {Model, DataTypes} from '../../../../../index.js';
2
2
  import Owner from './owner.js';
3
3
 
4
4
  export const schema = {
@@ -1,4 +1,4 @@
1
- import {Model} from '../../../../../index.ts';
1
+ import {Model} from '../../../../../index.js';
2
2
  import { DataTypes } from 'sequelize';
3
3
  import Dog from './dog.js';
4
4
 
@@ -1,4 +1,4 @@
1
- import Nails from '../../../index.ts';
1
+ import Nails from '../../../index.js';
2
2
  import service_config from './config/service.js';
3
3
 
4
4
  // See self-documented config files
package/tsconfig.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "compilerOptions": {
3
+ /* Base Options */
4
+ "target": "ES2022", // High target to keep modern syntax (async/await, etc.)
5
+ "module": "NodeNext", // Best for modern Node.js ESM/CJS compatibility
6
+ "moduleResolution": "NodeNext",
7
+ "lib": ["ES2022"],
8
+
9
+ /* Output */
10
+ "outDir": "./dist", // Where the JS goes
11
+ "rootDir": "./lib", // Where your TS lives
12
+ "declaration": true, // Generates .d.ts files (essential for libraries)
13
+ "sourceMap": true, // Helps with debugging the original TS
14
+ "removeComments": false, // Keeping comments is usually better for library users
15
+
16
+ /* Strictness & Safety */
17
+ "strict": true, // Recommended to ensure your types are actually valid
18
+ "esModuleInterop": true, // Ensures compatibility with older packages
19
+ "skipLibCheck": true, // Speeds up build by not checking node_modules
20
+ "forceConsistentCasingInFileNames": true,
21
+
22
+ /* Emit Behavior */
23
+ "emitDeclarationOnly": false, // We want both JS and type definitions
24
+ "isolatedModules": true // Ensures each file can be safely transpiled independently
25
+ },
26
+ "include": ["lib/*"],
27
+ "exclude": ["node_modules", "**/*.test.ts"]
28
+ }
package/vite.config.ts CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  // import react from '@vitejs/plugin-react'
4
4
  import { defineConfig } from 'vite'
5
+ import { builtinModules } from 'node:module';
5
6
  import path from 'path'
6
7
 
7
8
  // https://vitejs.dev/config/
package/index.ts DELETED
@@ -1,9 +0,0 @@
1
- import Nails from './lib/Nails.ts';
2
- import ControllerInternal from './lib/Controller.ts';
3
-
4
- export { DataTypes, Model } from 'sequelize';
5
-
6
- export default Nails;
7
-
8
- export const Controller = ControllerInternal;
9
- export * from './lib/config.ts';