-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1bf54ec
commit c2c1438
Showing
20 changed files
with
2,687 additions
and
2,254 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2019 pixeldublu <[email protected]> | ||
Copyright (c) 2020 pixeldublu <[email protected]> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,36 @@ | ||
npm install and then npm link and then you can use yo ngx-rocket-module-generator | ||
# generator-ngx-rocket-list-edit-module [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url] | ||
> Generates ngx rocket style module with list and manage edit view | ||
## Installation | ||
|
||
First, install [Yeoman](http://yeoman.io) and generator-ngx-rocket-list-edit-module using [npm](https://www.npmjs.com/) (we assume you have pre-installed [node.js](https://nodejs.org/)). | ||
|
||
```bash | ||
npm install -g yo | ||
npm install -g generator-ngx-rocket-list-edit-module | ||
``` | ||
|
||
Then generate your new project: | ||
|
||
```bash | ||
yo ngx-rocket-list-edit-module | ||
``` | ||
|
||
## Getting To Know Yeoman | ||
|
||
* Yeoman has a heart of gold. | ||
* Yeoman is a person with feelings and opinions, but is very easy to work with. | ||
* Yeoman can be too opinionated at times but is easily convinced not to be. | ||
* Feel free to [learn more about Yeoman](http://yeoman.io/). | ||
|
||
## License | ||
|
||
MIT © [pixeldublu]() | ||
|
||
|
||
[npm-image]: https://badge.fury.io/js/generator-ngx-rocket-list-edit-module.svg | ||
[npm-url]: https://npmjs.org/package/generator-ngx-rocket-list-edit-module | ||
[travis-image]: https://travis-ci.com/pixeldublu/generator-ngx-rocket-list-edit-module.svg?branch=master | ||
[travis-url]: https://travis-ci.com/pixeldublu/generator-ngx-rocket-list-edit-module | ||
[daviddm-image]: https://david-dm.org/pixeldublu/generator-ngx-rocket-list-edit-module.svg?theme=shields.io | ||
[daviddm-url]: https://david-dm.org/pixeldublu/generator-ngx-rocket-list-edit-module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
'use strict'; | ||
const path = require('path'); | ||
const assert = require('yeoman-assert'); | ||
const helpers = require('yeoman-test'); | ||
|
||
describe('generator-ngx-rocket-list-edit-module:app', () => { | ||
beforeAll(() => { | ||
return helpers | ||
.run(path.join(__dirname, '../generators/app')) | ||
.withPrompts({ someAnswer: true }); | ||
}); | ||
|
||
it('creates files', () => { | ||
assert.file(['dummyfile.txt']); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
export interface ConfigurationParameters { | ||
apiKeys?: { [key: string]: string }; | ||
username?: string; | ||
password?: string; | ||
accessToken?: string | (() => string); | ||
basePath?: string; | ||
withCredentials?: boolean; | ||
} | ||
|
||
export class Configuration { | ||
apiKeys?: { [key: string]: string }; | ||
username?: string; | ||
password?: string; | ||
accessToken?: string | (() => string); | ||
basePath?: string; | ||
withCredentials?: boolean; | ||
|
||
constructor(configurationParameters: ConfigurationParameters = {}) { | ||
this.apiKeys = configurationParameters.apiKeys; | ||
this.username = configurationParameters.username; | ||
this.password = configurationParameters.password; | ||
this.accessToken = configurationParameters.accessToken; | ||
this.basePath = configurationParameters.basePath; | ||
this.withCredentials = configurationParameters.withCredentials; | ||
} | ||
|
||
/** | ||
* Select the correct content-type to use for a request. | ||
* Uses {@link Configuration#isJsonMime} to determine the correct content-type. | ||
* If no content type is found return the first found type if the contentTypes is not empty | ||
* @param contentTypes - the array of content types that are available for selection | ||
* @returns the selected content-type or <code>undefined</code> if no selection could be made. | ||
*/ | ||
public selectHeaderContentType(contentTypes: string[]): string | undefined { | ||
if (contentTypes.length == 0) { | ||
return undefined; | ||
} | ||
|
||
let type = contentTypes.find(x => this.isJsonMime(x)); | ||
if (type === undefined) { | ||
return contentTypes[0]; | ||
} | ||
return type; | ||
} | ||
|
||
/** | ||
* Select the correct accept content-type to use for a request. | ||
* Uses {@link Configuration#isJsonMime} to determine the correct accept content-type. | ||
* If no content type is found return the first found type if the contentTypes is not empty | ||
* @param accepts - the array of content types that are available for selection. | ||
* @returns the selected content-type or <code>undefined</code> if no selection could be made. | ||
*/ | ||
public selectHeaderAccept(accepts: string[]): string | undefined { | ||
if (accepts.length == 0) { | ||
return undefined; | ||
} | ||
|
||
let type = accepts.find(x => this.isJsonMime(x)); | ||
if (type === undefined) { | ||
return accepts[0]; | ||
} | ||
return type; | ||
} | ||
|
||
/** | ||
* Check if the given MIME is a JSON MIME. | ||
* JSON MIME examples: | ||
* application/json | ||
* application/json; charset=UTF8 | ||
* APPLICATION/JSON | ||
* application/vnd.company+json | ||
* @param mime - MIME (Multipurpose Internet Mail Extensions) | ||
* @return True if the given MIME is JSON, false otherwise. | ||
*/ | ||
public isJsonMime(mime: string): boolean { | ||
const jsonMime: RegExp = new RegExp('^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i'); | ||
return mime != null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
* | ||
* OpenAPI spec version: 0.0.1 | ||
* | ||
* | ||
* NOTE: This class is auto generated by the swagger code generator program. | ||
* https://github.com/swagger-api/swagger-codegen.git | ||
*/ | ||
|
||
export interface <%= mainModel %> { | ||
id?: number; | ||
name?: string; | ||
} |
Oops, something went wrong.