-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23332 from mshima/skip_ci-cleanup
Cleanup more todo methods
- Loading branch information
Showing
22 changed files
with
103 additions
and
89 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
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
File renamed without changes.
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
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
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,15 @@ | ||
import _ from 'lodash'; | ||
|
||
const { camelCase } = _; | ||
|
||
/** | ||
* get the frontend application name. | ||
*/ | ||
export const getFrontendAppName = ({ baseName }: { baseName: string }) => { | ||
const name = camelCase(baseName) + (baseName.endsWith('App') ? '' : 'App'); | ||
return name.match(/^\d/) ? 'App' : name; | ||
}; | ||
|
||
export const getMicroserviceAppName = ({ microserviceName }: { microserviceName: string }) => { | ||
return camelCase(microserviceName) + (microserviceName.endsWith('App') ? '' : 'App'); | ||
}; |
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,22 @@ | ||
import { expect, describe, it } from 'esmocha'; | ||
import { getFrontendAppName } from './basename.mjs'; | ||
|
||
describe('generator > base', () => { | ||
describe('getFrontendAppName', () => { | ||
describe('when called with name having App', () => { | ||
it('returns the frontend app name', () => { | ||
expect(getFrontendAppName({ baseName: 'myAmazingApp' })).toBe('myAmazingApp'); | ||
}); | ||
}); | ||
describe('when called with name', () => { | ||
it('returns the frontend app name with the App suffix added', () => { | ||
expect(getFrontendAppName({ baseName: 'myAwesomeProject' })).toBe('myAwesomeProjectApp'); | ||
}); | ||
}); | ||
describe('when called with name starting with a digit', () => { | ||
it('returns the default frontend app name - App', () => { | ||
expect(getFrontendAppName({ baseName: '1derful' })).toBe('App'); | ||
}); | ||
}); | ||
}); | ||
}); |
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
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
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
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,14 @@ | ||
import _ from 'lodash'; | ||
import { getMicroserviceAppName } from '../../base/support/index.mjs'; | ||
|
||
const { upperFirst } = _; | ||
|
||
/** | ||
* get the java main class name. | ||
*/ | ||
export const getMainClassName = ({ baseName }: { baseName: string }) => { | ||
const main = upperFirst(getMicroserviceAppName({ microserviceName: baseName })); | ||
const acceptableForJava = new RegExp('^[A-Z][a-zA-Z0-9_]*$'); | ||
|
||
return acceptableForJava.test(main) ? main : 'Application'; | ||
}; |
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,22 @@ | ||
import { describe, expect, it } from 'esmocha'; | ||
import { getMainClassName } from './util.mjs'; | ||
|
||
describe('generator > java', () => { | ||
describe('getMainClassName', () => { | ||
describe('when called with name', () => { | ||
it('return the app name', () => { | ||
expect(getMainClassName({ baseName: 'myTest' })).toBe('MyTestApp'); | ||
}); | ||
}); | ||
describe('when called with name having App', () => { | ||
it('return the app name', () => { | ||
expect(getMainClassName({ baseName: 'myApp' })).toBe('MyApp'); | ||
}); | ||
}); | ||
describe('when called with name having invalid java chars', () => { | ||
it('return the default app name', () => { | ||
expect(getMainClassName({ baseName: '9myApp' })).toBe('Application'); | ||
}); | ||
}); | ||
}); | ||
}); |
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
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 |
---|---|---|
|
@@ -3,6 +3,6 @@ | |
"exclude": [], | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"types": ["mocha"] | ||
"types": [] | ||
} | ||
} |