Skip to content

Commit 53c423d

Browse files
committed
chore: move and rename some files
1 parent f3297ac commit 53c423d

File tree

10 files changed

+14
-13
lines changed

10 files changed

+14
-13
lines changed

src/__tests__/comment-parser.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { parseComment } from '../utils/comment-parser';
1+
import { parseComment } from '../lib/comment-parser';
22

33
const template = `/*
44
* @vuepress

src/__tests__/file-structure.test.ts renamed to src/__tests__/list-folder.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { fs, vol } from 'memfs';
22

3-
import { getFileStructure } from '../utils/file-structure';
3+
import { listFolder } from '../lib/list-folder';
44

55
jest.mock('fs');
66
jest.mock('fs/promises', () => fs.promises);
@@ -21,7 +21,7 @@ describe('test file-structure', () => {
2121
'./src'
2222
);
2323

24-
expect(await getFileStructure('./src', [])).toEqual([
24+
expect(await listFolder('./src', [])).toEqual([
2525
{ ext: '.js', folder: 'src/', isDir: false, name: 'file1', path: 'src/file1.js' },
2626
{ ext: '.ts', folder: 'src/', isDir: false, name: 'file2', path: 'src/file2.ts' },
2727
{ ext: '.vue', folder: 'src/lib/', isDir: false, name: 'file3', path: 'src/lib/file3.vue' },

src/__tests__/sidebar.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { generateVueSidebar } from '../utils/vue-sidebar';
1+
import { generateVueSidebar } from '../lib/vue-sidebar';
22

33
describe('test sidebar', () => {
44
test('generateVueSidebar should return valid vue config', () => {

src/__tests__/utils.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { checkExtension, getExtension, getFilename, asyncForEach } from '../utils';
1+
import { checkExtension, getExtension, getFilename, asyncForEach } from '../lib/utils';
22

33
describe('test utils', () => {
44
test('getExtension should return true', () => {

src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import del from 'del';
22
import mkdirp from 'mkdirp';
33

4-
import { parseFile, parseVueFile, writeContentToFile } from './parser';
5-
import { getExtension } from './utils';
6-
import { getFileStructure } from './utils/file-structure';
4+
import { listFolder } from './lib/list-folder';
5+
import { parseFile, parseVueFile, writeContentToFile } from './lib/parser';
6+
import { getExtension } from './lib/utils';
77

88
const fileTree: any[] = [];
99
const statistics: Record<string, any> = {};
@@ -50,7 +50,7 @@ export const generate = async (argv: Record<string, string>) => {
5050
// remove docs folder, except README.md
5151
const deletedPaths = await del([`${docsFolder}/**/*`, `!${docsFolder}/README.md`, ...rmPattern]);
5252

53-
const filesAndFolder = await getFileStructure(srcFolder, exclude);
53+
const filesAndFolder = await listFolder(srcFolder, exclude);
5454

5555
await mkdirp(docsFolder);
5656

File renamed without changes.

src/utils/file-structure.ts renamed to src/lib/list-folder.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import path from 'path';
55

66
import { DirectoryFile } from '../interfaces';
77

8-
export const getFileStructure = async (srcPath: string, exclude: string[] = [], mainPath?: string) => {
8+
export const listFolder = async (srcPath: string, exclude: string[] = [], mainPath?: string) => {
99
const paths: DirectoryFile[] = [];
1010
const dirs = await fs.readdir(srcPath, {
1111
withFileTypes: true
@@ -19,7 +19,7 @@ export const getFileStructure = async (srcPath: string, exclude: string[] = [],
1919

2020
if (!mm.isMatch(path.join(srcPath.replace(mainPath || srcPath, ''), dirent.name), exclude)) {
2121
if (isDir) {
22-
paths.push(...(await getFileStructure(filePath, exclude, mainPath || srcPath)));
22+
paths.push(...(await listFolder(filePath, exclude, mainPath || srcPath)));
2323
}
2424

2525
if (name === 'index') {

src/parser.ts renamed to src/lib/parser.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ import path from 'path';
55
import compileTemplates from 'vue-docgen-cli/lib/compileTemplates';
66
import { extractConfig } from 'vue-docgen-cli/lib/docgen';
77

8-
import { DirectoryFile } from './interfaces';
9-
import { parseVuepressFileHeader } from './utils/comment-parser';
8+
import { DirectoryFile } from '../interfaces';
9+
10+
import { parseVuepressFileHeader } from './comment-parser';
1011

1112
interface ParseReturn {
1213
dest: string;
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)