Skip to content

Commit

Permalink
devonfw#29 created workspaces for windows, linux and macos
Browse files Browse the repository at this point in the history
added prepare script to container project (builds all exectutables)
adjusted .gitignore and .npmignore
changed version to 1.2.0
  • Loading branch information
jan-vcapgemini committed Jan 22, 2021
1 parent c54d375 commit 28dcbbf
Show file tree
Hide file tree
Showing 82 changed files with 1,680 additions and 74 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
nestserver-*.exe
nestserver-*
.vscode
dist/
yarn-error.log
3 changes: 1 addition & 2 deletions cobigen-nest-server/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@
node_modules/
.vscode
dist/
nestserver-linux-1.0.7
nestserver-macos-1.0.7
nestserver-*
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
64 changes: 64 additions & 0 deletions cobigen-nest-server/linux/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"name": "@devonfw/cobigen-nestserver-linux",
"bin": "dist/main.js",
"version": "1.2.0",
"description": "Nestjs server to implement the input reader and merger for CobiGen",
"author": "CobiGen Team",
"license": "MIT",
"scripts":{
"build": "tsc -p tsconfig.build.json",
"format": "prettier --write \"src/**/*.ts\"",
"start": "ts-node -r tsconfig-paths/register src/main.ts",
"start:dev": "nodemon",
"start:debug": "nodemon --config nodemon-debug.json",
"prestart:prod": "rimraf dist && npm run build",
"start:prod": "node dist/main.js",
"lint": "tslint -p tsconfig.json -c tslint.json",
"test": "jest",
"test:watch": "jest --watch",
"test:cov": "jest --coverage",
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
"test:e2e": "jest --config ./test/jest-e2e.json"
},
"dependencies": {
"@devonfw/ts-merger": "^2.2.10",
"@nestjs/common": "^5.4.0",
"@nestjs/core": "^5.4.0",
"js-beautify": "^1.9.0",
"pkg": "^4.4.9",
"reflect-metadata": "^0.1.12",
"rimraf": "^2.6.2",
"rxjs": "^6.2.2",
"typescript": "^3.0.1"
},
"devDependencies": {
"@nestjs/testing": "^5.1.0",
"@types/express": "^4.16.0",
"@types/jest": "^23.3.1",
"@types/node": "^10.7.1",
"@types/supertest": "^2.0.5",
"jest": "^23.5.0",
"nodemon": "^1.18.3",
"prettier": "^1.14.2",
"supertest": "^3.1.0",
"ts-jest": "^23.1.3",
"ts-loader": "^4.4.2",
"ts-node": "^7.0.1",
"tsconfig-paths": "^3.5.0",
"tslint": "5.11.0"
},
"jest": {
"moduleFileExtensions": [
"js",
"json",
"ts"
],
"rootDir": "src",
"testRegex": ".spec.ts$",
"transform": {
"^.+\\.(t|j)s$": "ts-jest"
},
"coverageDirectory": "../coverage",
"testEnvironment": "node"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { ModelEto } from './../etos/model.eto';
import { InputFileEto } from '../etos/input-file.eto';
import * as tsm from '@devonfw/ts-merger';

export class InputReader {
readonly content;

public async getInputObjects(inputFile:InputFileEto, removeEmptyFields : boolean) {
const tsm = require('@devonfw/ts-merger');
const parsedFile = tsm.readFile(inputFile.content);

// Extending the model
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Controller, Get, Post, Body } from '@nestjs/common';
import { InputFileEto } from './etos/input-file.eto';
import { MergerEto } from './etos/merger.eto';
import { InputReader } from './inputreader/input-reader';
import * as tsm from '@devonfw/ts-merger';

const config = require('../../package.json');

Expand Down Expand Up @@ -39,7 +40,6 @@ export class ProcessmanagementController {
const baseContent: string = merger.baseContent.replace(/\\n/gm, '\n');
const patchOverrides: boolean = merger.patchOverrides;

const tsm = require('@devonfw/ts-merger');
const mergedCode: string = tsm.merge(
baseContent,
patchContent,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions cobigen-nest-server/macos/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"singleQuote": true,
"trailingComma": "all"
}
175 changes: 175 additions & 0 deletions cobigen-nest-server/macos/ExternalProcessContract.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
openapi: 3.0.0
servers:
- url: 'https://localhost:5000/'
description: nest server
info:
title: External process communication
description: Specification of communication between external process and CobiGen
version: 1.0.0
x-rootpackage: com.devonfw.poc

paths:
/processmanagement/tsplugin/isConnectionReady/:
get:
description: Needed for CobiGen to know that the server is ready to receive requests. Also we need it to differentiate plug-ins.
responses:
'200':
description: Returns server version
content:
text/plain:
schema:
type: string

/processmanagement/tsplugin/isValidInput/:
post:
description: Returns true or false whether it is a valid input for generation. It can be a simple file extension check or more complex logic.
requestBody:
$ref: '#/components/requestBodies/InputFile'
operationId: isValidInput
responses:
'200':
description: Returns true or false whether it is a valid input for generation
content:
text/plain:
schema:
type: boolean
'404':
description: Not found

/processmanagement/tsplugin/getInputModel/:
post:
description: Requesting a key-value model of the input file in JSON format.
requestBody:
$ref: '#/components/requestBodies/InputFile'
operationId: getInputObjects
responses:
'200':
description: Returns a model in JSON format
content:
application/json:
schema:
$ref: '#/components/schemas/Model'
'404':
description: Not found

/processmanagement/tsplugin/merge/:
post:
description: Merges two files and returns the result
requestBody:
$ref: '#/components/requestBodies/Merger'
operationId: merge
responses:
'200':
description: Returns merge file as a string
content:
text/plain:
schema:
type: string
'404':
description: Not found

components:
schemas:
Model:
x-component: processmanagement
description: Data model of the input file
type: object
properties:
path:
type: string
description: Input file path. It can also be just the file name.
uniqueItems: true
inputObject:
$ref: '#/components/schemas/InputObject'
InputObject:
x-component: processmanagement
description: Input object containing needed information for the templates
type: object
properties:
Fields:
$ref: '#/components/schemas/Fields'
Imports:
$ref: '#/components/schemas/Imports'
Fields:
x-component: processmanagement
description: Not really needed, just used as an example for the model.
type: array
items:
type: object
properties:
Field:
$ref: '#/components/schemas/Field'
Field:
x-component: processmanagement
description: Not really needed, just used as an example for the model.
type: object
properties:
fieldName:
type: string
fieldType:
type: string
Imports:
x-component: processmanagement
description: Not really needed, just used as an example for the model.
type: array
items:
type: object
properties:
Import:
$ref: '#/components/schemas/Import'
Import:
x-component: processmanagement
description: Not really needed, just used as an example for the model.
type: object
properties:
importValue:
type: string
InputFile:
x-component: processmanagement
description: Input file
type: object
properties:
filename:
type: string
content:
type: string
charset:
type: string
Merger:
x-component: processmanagement
description: Merger properties. baseContent is the current user's file. patchContent is CobiGen freshly generated file. patchOverrides is set to true when in case of conflict, we want to override using patch.
type: object
properties:
baseContent:
type: string
patchContent:
type: string
patchOverrides:
type: boolean


requestBodies:
Model:
description: Data model of the file in JSON format
content:
application/json:
schema:
$ref: '#/components/schemas/Model'
required: true

InputFile:
description: Input file for CobiGen to parse
content:
application/json:
schema:
$ref: '#/components/schemas/InputFile'
required: true

Merger:
description: baseContent is the current user's file. patchContent is CobiGen freshly generated file. patchOverrides is set to true when in case of conflict, we want to override using patch.
content:
application/json:
schema:
$ref: '#/components/schemas/Merger'
required: true

5 changes: 5 additions & 0 deletions cobigen-nest-server/macos/nest-cli.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"language": "ts",
"collection": "@nestjs/schematics",
"sourceRoot": "src"
}
6 changes: 6 additions & 0 deletions cobigen-nest-server/macos/nodemon-debug.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"watch": ["src"],
"ext": "ts",
"ignore": ["src/**/*.spec.ts"],
"exec": "node --inspect-brk -r ts-node/register -r tsconfig-paths/register src/main.ts"
}
6 changes: 6 additions & 0 deletions cobigen-nest-server/macos/nodemon.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"watch": ["src"],
"ext": "ts",
"ignore": ["src/**/*.spec.ts"],
"exec": "ts-node -r tsconfig-paths/register src/main.ts"
}
64 changes: 64 additions & 0 deletions cobigen-nest-server/macos/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"name": "@devonfw/cobigen-nestserver-macos",
"bin": "dist/main.js",
"version": "1.2.0",
"description": "Nestjs server to implement the input reader and merger for CobiGen",
"author": "CobiGen Team",
"license": "MIT",
"scripts":{
"build": "tsc -p tsconfig.build.json",
"format": "prettier --write \"src/**/*.ts\"",
"start": "ts-node -r tsconfig-paths/register src/main.ts",
"start:dev": "nodemon",
"start:debug": "nodemon --config nodemon-debug.json",
"prestart:prod": "rimraf dist && npm run build",
"start:prod": "node dist/main.js",
"lint": "tslint -p tsconfig.json -c tslint.json",
"test": "jest",
"test:watch": "jest --watch",
"test:cov": "jest --coverage",
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
"test:e2e": "jest --config ./test/jest-e2e.json"
},
"dependencies": {
"@devonfw/ts-merger": "^2.2.10",
"@nestjs/common": "^5.4.0",
"@nestjs/core": "^5.4.0",
"js-beautify": "^1.9.0",
"pkg": "^4.4.9",
"reflect-metadata": "^0.1.12",
"rimraf": "^2.6.2",
"rxjs": "^6.2.2",
"typescript": "^3.0.1"
},
"devDependencies": {
"@nestjs/testing": "^5.1.0",
"@types/express": "^4.16.0",
"@types/jest": "^23.3.1",
"@types/node": "^10.7.1",
"@types/supertest": "^2.0.5",
"jest": "^23.5.0",
"nodemon": "^1.18.3",
"prettier": "^1.14.2",
"supertest": "^3.1.0",
"ts-jest": "^23.1.3",
"ts-loader": "^4.4.2",
"ts-node": "^7.0.1",
"tsconfig-paths": "^3.5.0",
"tslint": "5.11.0"
},
"jest": {
"moduleFileExtensions": [
"js",
"json",
"ts"
],
"rootDir": "src",
"testRegex": ".spec.ts$",
"transform": {
"^.+\\.(t|j)s$": "ts-jest"
},
"coverageDirectory": "../coverage",
"testEnvironment": "node"
}
}
Loading

0 comments on commit 28dcbbf

Please sign in to comment.