Skip to content

Commit d44778e

Browse files
committed
refactor: folder structure
1 parent efa3a9b commit d44778e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+26
-63
lines changed

.gitignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ dist
131131

132132
# custom directory
133133
custom/resources/*
134-
!custom/src/node/modules/hello/*
135-
!custom/test/node/hello/*
134+
!custom/src/modules/hello/*
135+
!custom/test/hello/*
136136
uploads
137137

File renamed without changes.

package-lock.json

+12-49
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
File renamed without changes.

src/lib/setup-app.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
import express from 'express';
44
import dotenv from 'dotenv';
5-
import { run as nodeRun } from '../node/start.js';
5+
import { run as nodeRun } from '../start.js';
66
import { resolve, join } from 'path';
77
import { logger, httpLogger } from './logger.js';
88
import { request } from './http-request.js';
99
import { rmSync, mkdirSync, existsSync, readFileSync, writeFileSync } from 'fs';
1010
import path from 'path';
11-
import packageJson from '../../package.json' with { type: "json" };
11+
import packageJson from '../../package.json' assert { type: 'json' };
1212

1313
dotenv.config();
1414

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.

src/node/start.js src/start.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,20 @@ import Joi from 'joi';
77
import { validateRoute, validateSchema } from './lib/validation.js';
88
import joiToSwagger from 'joi-to-swagger';
99
import { handleSingleUploadFile } from './lib/upload.js';
10-
import { logger } from '../lib/logger.js';
11-
import packageJson from '../../package.json' with { type: "json" };
10+
import { logger } from './lib/logger.js';
11+
import packageJson from '../package.json' assert { type: 'json' };
1212
import { url } from 'inspector';
1313

14-
const CUSTOM_MODULES_DIR = './custom/src/node/modules';
15-
const SYSTEM_MODULES_DIR = './src/node/modules';
14+
const CUSTOM_MODULES_DIR = './custom/src/modules';
15+
const SYSTEM_MODULES_DIR = './src/modules';
1616

1717
let swaggerDefinition = {
1818
openapi: '3.0.0',
1919
info: {
2020
title: 'Onify Functions',
21-
description: '[https://github.com/onify/functions](https://github.com/onify/functions)',
22-
version: packageJson.version
21+
description:
22+
'[https://github.com/onify/functions](https://github.com/onify/functions)',
23+
version: packageJson.version,
2324
},
2425
};
2526

@@ -56,9 +57,8 @@ const loadModules = async (baseDir) => {
5657
const modules = modulePaths.map(async (modulePath) => {
5758
return {
5859
path: modulePath,
59-
module: (
60-
await await import(new URL(`../../${modulePath}`, import.meta.url))
61-
).module,
60+
module: (await await import(new URL(`../${modulePath}`, import.meta.url)))
61+
.module,
6262
};
6363
});
6464

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.

vitest.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { defineConfig } from 'vitest/config';
33
export default defineConfig({
44
test: {
55
root: '.',
6-
include: ['./test/node/**/*.js', './custom/test/node/**/*.js'],
6+
include: ['./test/**/*.js', './custom/test/**/*.js'],
77
testTimeout: 20000,
88
},
99
});

0 commit comments

Comments
 (0)