feat: check plugins
This commit is contained in:
parent
0bea6c900c
commit
d3a5c97c0e
|
|
@ -54,4 +54,4 @@ Thumbs.db
|
|||
*.tsbuildinfo
|
||||
|
||||
# ignore Secrets folder
|
||||
.secrets/
|
||||
.secrets/
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
[submodule "libraries/plugins/src/list/--force"]
|
||||
path = libraries/plugins/src/list/--force
|
||||
url = git@notifire:gitroomhq/public-api.git
|
||||
[submodule "libraries/plugins/src/list/public-api"]
|
||||
path = libraries/plugins/src/list/public-api
|
||||
url = git@notifire:gitroomhq/public-api.git
|
||||
|
|
@ -1,21 +1,24 @@
|
|||
import {Global, Module} from '@nestjs/common';
|
||||
import { Global, Module } from '@nestjs/common';
|
||||
|
||||
import {DatabaseModule} from "@gitroom/nestjs-libraries/database/prisma/database.module";
|
||||
import {ApiModule} from "@gitroom/backend/api/api.module";
|
||||
import {APP_GUARD} from "@nestjs/core";
|
||||
import {PoliciesGuard} from "@gitroom/backend/services/auth/permissions/permissions.guard";
|
||||
import { DatabaseModule } from '@gitroom/nestjs-libraries/database/prisma/database.module';
|
||||
import { ApiModule } from '@gitroom/backend/api/api.module';
|
||||
import { APP_GUARD } from '@nestjs/core';
|
||||
import { PoliciesGuard } from '@gitroom/backend/services/auth/permissions/permissions.guard';
|
||||
import { BullMqModule } from '@gitroom/nestjs-libraries/bull-mq-transport-new/bull.mq.module';
|
||||
import { PluginModule } from '@gitroom/plugins/plugin.module';
|
||||
|
||||
@Global()
|
||||
@Module({
|
||||
imports: [BullMqModule, DatabaseModule, ApiModule],
|
||||
imports: [BullMqModule, DatabaseModule, ApiModule, PluginModule],
|
||||
controllers: [],
|
||||
providers: [{
|
||||
provide: APP_GUARD,
|
||||
useClass: PoliciesGuard
|
||||
}],
|
||||
providers: [
|
||||
{
|
||||
provide: APP_GUARD,
|
||||
useClass: PoliciesGuard,
|
||||
},
|
||||
],
|
||||
get exports() {
|
||||
return [...this.imports];
|
||||
}
|
||||
},
|
||||
})
|
||||
export class AppModule {}
|
||||
|
|
|
|||
|
|
@ -2,4 +2,4 @@
|
|||
/// <reference types="next/image-types/global" />
|
||||
|
||||
// NOTE: This file should not be edited
|
||||
// see https://nextjs.org/docs/basic-features/typescript for more information.
|
||||
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,77 @@
|
|||
const { readdirSync, statSync, writeFileSync } = require('fs');
|
||||
const { join } = require('path');
|
||||
|
||||
function isNonEmptyFolder(folderPath) {
|
||||
const items = readdirSync(folderPath);
|
||||
// Check if there are any items in the folder
|
||||
return items.some((item) => {
|
||||
const fullPath = join(folderPath, item);
|
||||
// Check if the item is a file or a non-empty directory
|
||||
const stats = statSync(fullPath);
|
||||
if (stats.isDirectory()) {
|
||||
return isNonEmptyFolder(fullPath); // Recursively check subfolders
|
||||
}
|
||||
return true; // It's a file
|
||||
});
|
||||
}
|
||||
|
||||
// Function to get all non-empty folders
|
||||
function getNonEmptyFolders(rootFolder) {
|
||||
const result = [];
|
||||
const items = readdirSync(rootFolder);
|
||||
|
||||
items.forEach((item) => {
|
||||
const fullPath = join(rootFolder, item);
|
||||
const stats = statSync(fullPath);
|
||||
if (stats.isDirectory() && isNonEmptyFolder(fullPath)) {
|
||||
result.push(item);
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
const abc = [
|
||||
'a',
|
||||
'b',
|
||||
'c',
|
||||
'd',
|
||||
'e',
|
||||
'f',
|
||||
'g',
|
||||
'h',
|
||||
'i',
|
||||
'j',
|
||||
'k',
|
||||
'l',
|
||||
'm',
|
||||
'n',
|
||||
'o',
|
||||
'p',
|
||||
'q',
|
||||
'r',
|
||||
's',
|
||||
't',
|
||||
'u',
|
||||
'v',
|
||||
'w',
|
||||
'x',
|
||||
'y',
|
||||
'z',
|
||||
];
|
||||
const list = getNonEmptyFolders('./libraries/plugins/src/list');
|
||||
const fileContent = `${list
|
||||
.map((p, index) => {
|
||||
return `import Module${abc[
|
||||
index
|
||||
].toUpperCase()} from '@gitroom/plugins/list/${p}/backend/module';`;
|
||||
})
|
||||
.join('\n')}
|
||||
|
||||
export default [${list
|
||||
.map((p, index) => {
|
||||
return `Module${abc[index].toUpperCase()}`;
|
||||
})
|
||||
.join(', ')}];
|
||||
`;
|
||||
|
||||
writeFileSync('./libraries/plugins/src/plugins.ts', fileContent);
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"extends": ["../../.eslintrc.json"],
|
||||
"ignorePatterns": ["!**/*"],
|
||||
"overrides": [
|
||||
{
|
||||
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
|
||||
"rules": {}
|
||||
},
|
||||
{
|
||||
"files": ["*.ts", "*.tsx"],
|
||||
"rules": {}
|
||||
},
|
||||
{
|
||||
"files": ["*.js", "*.jsx"],
|
||||
"rules": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
# plugins
|
||||
|
||||
This library was generated with [Nx](https://nx.dev).
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"name": "plugins",
|
||||
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
||||
"sourceRoot": "libraries/plugins/src",
|
||||
"projectType": "library",
|
||||
"targets": {
|
||||
"lint": {
|
||||
"executor": "@nx/eslint:lint",
|
||||
"outputs": ["{options.outputFile}"]
|
||||
}
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
Subproject commit ebdb67cc66976b00b74d6717d6c012d94a7644c3
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
import {Global, Module} from '@nestjs/common';
|
||||
import module from './plugins';
|
||||
|
||||
@Global()
|
||||
@Module({
|
||||
imports: [...module],
|
||||
controllers: [],
|
||||
providers: [],
|
||||
get exports() {
|
||||
return [...this.imports];
|
||||
}
|
||||
})
|
||||
export class PluginModule {}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
|
||||
|
||||
export default [];
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strict": true,
|
||||
"noImplicitOverride": true,
|
||||
"noImplicitReturns": true,
|
||||
"noFallthroughCasesInSwitch": true
|
||||
},
|
||||
"files": [],
|
||||
"include": [],
|
||||
"references": [
|
||||
{
|
||||
"path": "./tsconfig.lib.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../dist/out-tsc",
|
||||
"declaration": true,
|
||||
"types": ["node"]
|
||||
},
|
||||
"include": ["src/**/*.ts"],
|
||||
"exclude": ["src/**/*.spec.ts", "src/**/*.test.ts"]
|
||||
}
|
||||
|
|
@ -12,6 +12,7 @@
|
|||
"build:frontend": "npx nx run frontend:build:production",
|
||||
"dev:frontend": "npx nx run frontend:serve:development",
|
||||
"dev:backend": "npx nx run backend:serve:development",
|
||||
"update-plugins": "node ./build.plugins.js",
|
||||
"dev:workers": "npx nx run workers:serve:development",
|
||||
"dev:cron": "npx nx run cron:serve:development",
|
||||
"dev:docker": "docker compose -f ./docker-compose.dev.yaml up -d",
|
||||
|
|
@ -27,7 +28,7 @@
|
|||
"prisma-reset": "cd ./libraries/nestjs-libraries/src/database/prisma && npx prisma db push --force-reset && npx prisma db push",
|
||||
"docker-build": "./var/docker/docker-build.sh",
|
||||
"docker-create": "./var/docker/docker-create.sh",
|
||||
"postinstall": "npm run prisma-generate"
|
||||
"postinstall": "npm run update-plugins && npm run prisma-generate"
|
||||
},
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,8 @@
|
|||
"@gitroom/helpers/*": ["libraries/helpers/src/*"],
|
||||
"@gitroom/nestjs-libraries/*": ["libraries/nestjs-libraries/src/*"],
|
||||
"@gitroom/react/*": ["libraries/react-shared-libraries/src/*"],
|
||||
"@gitroom/workers/*": ["apps/workers/src/*"]
|
||||
"@gitroom/plugins/*": ["libraries/plugins/src/*"],
|
||||
"@gitroom/workers/*": ["apps/workers/src/*"],
|
||||
}
|
||||
},
|
||||
"exclude": ["node_modules", "tmp"]
|
||||
|
|
|
|||
Loading…
Reference in New Issue