Skip to content

Commit

Permalink
refactor: folder structure
Browse files Browse the repository at this point in the history
  • Loading branch information
rolu01 committed May 6, 2024
1 parent efa3a9b commit d44778e
Show file tree
Hide file tree
Showing 52 changed files with 26 additions and 63 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ dist

# custom directory
custom/resources/*
!custom/src/node/modules/hello/*
!custom/test/node/hello/*
!custom/src/modules/hello/*
!custom/test/hello/*
uploads

File renamed without changes.
File renamed without changes.
File renamed without changes.
61 changes: 12 additions & 49 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
4 changes: 2 additions & 2 deletions src/lib/setup-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

import express from 'express';
import dotenv from 'dotenv';
import { run as nodeRun } from '../node/start.js';
import { run as nodeRun } from '../start.js';
import { resolve, join } from 'path';
import { logger, httpLogger } from './logger.js';
import { request } from './http-request.js';
import { rmSync, mkdirSync, existsSync, readFileSync, writeFileSync } from 'fs';
import path from 'path';
import packageJson from '../../package.json' with { type: "json" };
import packageJson from '../../package.json' assert { type: 'json' };

dotenv.config();

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
18 changes: 9 additions & 9 deletions src/node/start.js → src/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,20 @@ import Joi from 'joi';
import { validateRoute, validateSchema } from './lib/validation.js';
import joiToSwagger from 'joi-to-swagger';
import { handleSingleUploadFile } from './lib/upload.js';
import { logger } from '../lib/logger.js';
import packageJson from '../../package.json' with { type: "json" };
import { logger } from './lib/logger.js';
import packageJson from '../package.json' assert { type: 'json' };
import { url } from 'inspector';

const CUSTOM_MODULES_DIR = './custom/src/node/modules';
const SYSTEM_MODULES_DIR = './src/node/modules';
const CUSTOM_MODULES_DIR = './custom/src/modules';
const SYSTEM_MODULES_DIR = './src/modules';

let swaggerDefinition = {
openapi: '3.0.0',
info: {
title: 'Onify Functions',
description: '[https://github.com/onify/functions](https://github.com/onify/functions)',
version: packageJson.version
description:
'[https://github.com/onify/functions](https://github.com/onify/functions)',
version: packageJson.version,
},
};

Expand Down Expand Up @@ -56,9 +57,8 @@ const loadModules = async (baseDir) => {
const modules = modulePaths.map(async (modulePath) => {
return {
path: modulePath,
module: (
await await import(new URL(`../../${modulePath}`, import.meta.url))
).module,
module: (await await import(new URL(`../${modulePath}`, import.meta.url)))
.module,
};
});

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion vitest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { defineConfig } from 'vitest/config';
export default defineConfig({
test: {
root: '.',
include: ['./test/node/**/*.js', './custom/test/node/**/*.js'],
include: ['./test/**/*.js', './custom/test/**/*.js'],
testTimeout: 20000,
},
});

0 comments on commit d44778e

Please sign in to comment.