Skip to content

Commit

Permalink
fix : clean repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ccamensuli committed Jan 22, 2024
1 parent f038c13 commit 6097e60
Show file tree
Hide file tree
Showing 97 changed files with 4,493 additions and 12,615 deletions.
11 changes: 0 additions & 11 deletions app/index.js

This file was deleted.

14 changes: 14 additions & 0 deletions app/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Kernel, Module } from "nodefony";
import http from "@nodefony/http";
import security from "@nodefony/security";
import config from "./src/nodefony/config/config";

class App extends Module {
constructor(kernel: Kernel) {
super("app", kernel, config);
kernel.use(http);
kernel.use(security);
}
}

export default App;
11 changes: 8 additions & 3 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@
"version": "1.0.0",
"description": "app nodefony entry point",
"author": "admin <[email protected]>",
"main": "index.js",
"main": "dist/index.js",
"type": "module",
"types": "types.d.ts",
"scripts": {},
"types": "dist/types/index.d.ts",
"scripts": {
"build": "rimraf dist && npm run rollup",
"rollup": "rollup --config rollup.config.ts --configPlugin typescript",
"dev": "rimraf dist && npm run rollup -- --watch",
"test": "node -e \"console.log('test')\""
},
"private": true,
"keywords": [
"nodefony",
Expand Down
87 changes: 87 additions & 0 deletions app/rollup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
// rollup.config.ts
import path from "node:path";
import { defineConfig, Plugin, RollupOptions } from "rollup";
import nodeResolve from "@rollup/plugin-node-resolve";
import typescript from "@rollup/plugin-typescript";
import commonjs from "@rollup/plugin-commonjs";
import json from "@rollup/plugin-json";
import copy from "rollup-plugin-copy";

const external: string[] = ["nodefony", "@nodefony/http", "@nodefony/security"];

const sharedNodeOptions = defineConfig({
treeshake: {
moduleSideEffects: "no-external",
propertyReadSideEffects: false,
tryCatchDeoptimization: false,
},
output: {
dir: "./dist",
entryFileNames: `[name].js`,
//chunkFileNames: "node/chunks/dep-[hash].js",
exports: "auto",
format: "esm",
externalLiveBindings: false,
freeze: false,
},
onwarn(warning, warn) {
if (warning.message.includes("Circular dependency")) {
return;
}
warn(warning);
},
});

function createNodePlugins(
isProduction: boolean,
sourceMap: boolean,
declarationDir: string | false
): Plugin[] {
const tab = [
nodeResolve({ preferBuiltins: true }),
typescript({
tsconfig: path.resolve("tsconfig.json"),
sourceMap,
declaration: declarationDir !== false,
declarationDir: declarationDir !== false ? declarationDir : undefined,
}),
commonjs({
extensions: [".js"],
//ignoreDynamicRequires: true
dynamicRequireTargets: [],
}),
json(),
copy({
targets: [],
}),
];
if (isProduction) {
//tab.push(terser());
}
return tab;
}

function createNodeConfig(isProduction: boolean): RollupOptions {
return defineConfig({
//input,
input: "index.ts",
...sharedNodeOptions,
output: {
...sharedNodeOptions.output,
sourcemap: !isProduction,
//preserveModules: true,
//preserveModulesRoot: "src",
},
external,
plugins: [...createNodePlugins(isProduction, true, "dist/types")],
});
}

export default (commandLineArgs: any): RollupOptions[] => {
const isDev = commandLineArgs.watch;
const isProduction = !isDev;
return defineConfig([
//envConfig,
createNodeConfig(isProduction),
]);
};
1 change: 1 addition & 0 deletions app/src/nodefony/config/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default {};
16 changes: 16 additions & 0 deletions app/tsconfig.base.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"stripInternal": true,
"declaration": true,
"declarationDir": "./dist/types",
"outDir": "./dist"
},
}
16 changes: 16 additions & 0 deletions app/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"rootDir": "./",
"outDir": "./dist",
},
"include": [
"index.ts",
"rollup.config.ts",
"src/**/*.ts"
],
"exclude": [
"node_modules",
"dist"
]
}
59 changes: 18 additions & 41 deletions config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,25 +67,27 @@ switch (kernel.appEnvironment) {
}

export default {
domain: "0.0.0.0",
domain: "0.0.0.0", // "0.0.0.0" "selectAuto"
domainAlias: ["^127.0.0.1$", "^localhost$"],
httpPort: 5151,
httpsPort: 5152,
domainCheck,
locale: "en_en",
servers: {
statics,
http: {
port: 5151,
protocol: "2.0", // 2.0 || 1.1
},
https: {
port: 5152,
protocol: "2.0", // 2.0 || 1.1
},
ws: {},
wss: {},
},
certificats,
// httpPort: 5151,
// httpsPort: 5152,

/**
* BUNDLES CORE
*/
security: true,
realtime: true,
monitoring,
mail: true,
documentation,
unitTest,
redis: false,
mongo: false,
elastic: false,
locale: "en_en",

/**
* SERVERS
Expand All @@ -112,31 +114,6 @@ export default {
websocket: true,
},

/**
* BUNDLES LOCAL REGISTRATION
*
* bundles:{
* "hello-bundle" : "file:src/bundles/hello-bundle"
* "test-bundle" : path.resolve("src", "bundles", "test-bundle")
* }
*/
bundles: {
"test-bundle": path.resolve("src", "bundles", "test-bundle"),
"users-bundle": path.resolve(
"src",
"nodefony",
"cli",
"builder",
"bundles",
"users-bundle"
),
// "demo-bundle": "file:src/bundles/demo-bundle",
// "webAssembly-bundle": "file:src/bundles/webAssembly-bundle",
"ia-bundle": "file:src/bundles/ia-bundle",
// "vault-bundle": "file:src/bundles/vault-bundle"
// "keycloak-bundle": "file:src/bundles/keycloak-bundle"
},

/**
* SYSLOG NODEFONY
*/
Expand Down
Loading

0 comments on commit 6097e60

Please sign in to comment.