Compare commits
5 Commits
9cd181c5b8
...
c9378e6cae
Author | SHA1 | Date | |
---|---|---|---|
c9378e6cae | |||
62c7f26540 | |||
18e3ef9a79 | |||
395b0101a8 | |||
84a0bd2cd9 |
44
.drone.yml
44
.drone.yml
@ -37,11 +37,22 @@ steps:
|
||||
tags:
|
||||
- dev
|
||||
registry: registry.odit.services
|
||||
when:
|
||||
branch:
|
||||
- dev
|
||||
event:
|
||||
- push
|
||||
- name: run full license export
|
||||
image: node:alpine
|
||||
depends_on: [clone]
|
||||
commands:
|
||||
- yarn
|
||||
- yarn licenses:full
|
||||
- name: push new licenses file to repo
|
||||
image: appleboy/drone-git-push
|
||||
settings:
|
||||
branch: dev
|
||||
commit: true
|
||||
commit_message: new license file version [CI SKIP]
|
||||
author_email: bot@odit.services
|
||||
remote: git@git.odit.services:lfk/backend.git
|
||||
ssh_key:
|
||||
from_secret: GITLAB_SSHKEY
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
@ -107,3 +118,26 @@ steps:
|
||||
trigger:
|
||||
event:
|
||||
- tag
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: export:licenses
|
||||
|
||||
steps:
|
||||
- name: run full license export
|
||||
image: node:alpine
|
||||
depends_on: [clone]
|
||||
commands:
|
||||
- yarn
|
||||
- yarn licenses:full
|
||||
- name: push new licenses file to repo
|
||||
image: appleboy/drone-git-push
|
||||
settings:
|
||||
branch: dev
|
||||
commit: true
|
||||
commit_message: new license file version [CI SKIP]
|
||||
author_email: bot@odit.services
|
||||
remote: git@git.odit.services:lfk/backend.git
|
||||
ssh_key:
|
||||
from_secret: GITLAB_SSHKEY
|
||||
|
@ -59,6 +59,7 @@
|
||||
"cp-cli": "^2.0.0",
|
||||
"jest": "^26.6.3",
|
||||
"nodemon": "^2.0.6",
|
||||
"license-checker": "^25.0.1",
|
||||
"rimraf": "^2.7.1",
|
||||
"start-server-and-test": "^1.11.6",
|
||||
"ts-jest": "^26.4.4",
|
||||
@ -74,7 +75,9 @@
|
||||
"test:watch": "jest --watchAll",
|
||||
"test:ci": "start-server-and-test dev http://localhost:4010/api/docs/openapi.json test",
|
||||
"seed": "ts-node ./node_modules/typeorm/cli.js schema:sync && ts-node ./node_modules/typeorm-seeding/dist/cli.js seed",
|
||||
"openapi:export": "ts-node src/openapi_export.ts"
|
||||
"openapi:export": "node scripts/openapi_export.js",
|
||||
"licenses:export": "node scripts/license_exporter.js",
|
||||
"licenses:full": "node scripts/license_exporter.js --full"
|
||||
},
|
||||
"nodemonConfig": {
|
||||
"ignore": [
|
||||
|
58
scripts/license_exporter.js
Normal file
58
scripts/license_exporter.js
Normal file
@ -0,0 +1,58 @@
|
||||
var checker = require('license-checker');
|
||||
var consola = require('consola');
|
||||
var fs = require('fs');
|
||||
|
||||
var args = process.argv.slice(2);
|
||||
|
||||
checker.init({
|
||||
start: './',
|
||||
relativeLicensePath: true,
|
||||
customFormat: {
|
||||
licenseText: "",
|
||||
licenseFile: "",
|
||||
description: "",
|
||||
version: "",
|
||||
}
|
||||
}, function (err, packages) {
|
||||
if (err) {
|
||||
consola.error("Couldn't load the licenses.")
|
||||
} else {
|
||||
let licenses = new Array();
|
||||
if (args.includes("--full")) {
|
||||
Object.keys(packages).forEach(function (key) {
|
||||
licenses.push({
|
||||
"name": packages[key].name,
|
||||
"licenses": packages[key].licenses,
|
||||
"repository": packages[key].repository || null,
|
||||
"publisher": packages[key].publisher || null,
|
||||
"email": packages[key].email || null,
|
||||
"version": packages[key].version || null,
|
||||
"description": packages[key].description || null,
|
||||
"copyright": packages[key].copyright || null,
|
||||
"text": packages[key].licenseText || null,
|
||||
"license_path": packages[key].licenseFile || null,
|
||||
});
|
||||
});
|
||||
}
|
||||
else {
|
||||
Object.keys(packages).forEach(function (key) {
|
||||
licenses.push({
|
||||
"name": packages[key].name,
|
||||
"licenses": packages[key].licenses,
|
||||
"repository": packages[key].repository || null,
|
||||
"publisher": packages[key].publisher || null,
|
||||
"email": packages[key].email || null,
|
||||
"version": packages[key].version || null,
|
||||
"description": packages[key].description || null,
|
||||
"copyright": packages[key].copyright || null,
|
||||
});
|
||||
});
|
||||
}
|
||||
try {
|
||||
fs.writeFileSync("./licenses.json", JSON.stringify(licenses), { encoding: "utf-8" });
|
||||
consola.success("Exported licenses to ./licenses.json");
|
||||
} catch (error) {
|
||||
consola.error("Couldn't export the licenses");
|
||||
}
|
||||
}
|
||||
});
|
@ -4,9 +4,9 @@ import fs from "fs";
|
||||
import "reflect-metadata";
|
||||
import { createExpressServer, getMetadataArgsStorage } from "routing-controllers";
|
||||
import { routingControllersToSpec } from 'routing-controllers-openapi';
|
||||
import { config } from './config';
|
||||
import authchecker from "./middlewares/authchecker";
|
||||
import { ErrorHandler } from './middlewares/ErrorHandler';
|
||||
import { config } from '../src/config';
|
||||
import authchecker from "../src/middlewares/authchecker";
|
||||
import { ErrorHandler } from '../src/middlewares/ErrorHandler';
|
||||
|
||||
const CONTROLLERS_FILE_EXTENSION = process.env.NODE_ENV === 'production' ? 'js' : 'ts';
|
||||
createExpressServer({
|
Loading…
x
Reference in New Issue
Block a user