Skip to content

Commit 986b58f

Browse files
committed
Add config option "wrapFolder"
1 parent 995c105 commit 986b58f

5 files changed

Lines changed: 9 additions & 1 deletion

File tree

src/config/default.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"styles": "scss",
33
"typescript": false,
44
"jsxExt": true,
5+
"wrapFolder": true,
56
"fileNameCase": "pascal",
67
"path": "src/components"
78
}

src/core/FileService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { CONFIG, EXT, APP_ROOT } from '../constants';
55
import { Logger } from './Logger';
66

77
export class FileService {
8-
private dirPath = path.resolve(CONFIG.path, this.fileName);
8+
private dirPath = path.resolve(CONFIG.path, CONFIG.wrapFolder ? this.fileName : '');
99

1010
constructor(private fileName: string) {}
1111

src/init/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export async function initConfigFile() {
2525
jsxExt: answers.jsxExt,
2626
fileNameCase: answers.fileNameCase,
2727
path: answers.path,
28+
wrapFolder: answers.wrapFolder,
2829
};
2930

3031
const content = JSON.stringify(config, null, 2);

src/init/questions.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ export const question = [
2626
message: 'Use JSX format',
2727
when: values => !values.typescript,
2828
},
29+
{
30+
type: 'confirm',
31+
name: 'wrapFolder',
32+
message: 'Should create a wrap folder?',
33+
},
2934
{
3035
type: 'list',
3136
name: 'fileNameCase',

src/types/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export interface IConfig {
99
jsxExt: boolean;
1010
fileNameCase: FileNameCase;
1111
path: string;
12+
wrapFolder: boolean;
1213
}
1314

1415
interface IBaseVariables {

0 commit comments

Comments
 (0)