Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/cli/src/commands/init/editTemplate.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import fs from 'fs';
import path from 'path';
import {logger} from '@react-native-community/cli-tools';
// @ts-ignore FIXME after converting walk to typescript
import walk from '../../tools/walk';

interface PlaceholderConfig {
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/tools/copyFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import fs from 'fs';
import path from 'path';
// @ts-ignore FIXME after converting walk to typescript
import walk from './walk';

type Options = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import chalk from 'chalk';
import path from 'path';
import copyAndReplace from '../copyAndReplace';
import promptInitializer from './promptSync';
// @ts-ignore FIXME: walk should be ts
import walk from '../walk';
import {logger} from '@react-native-community/cli-tools';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

import fs from 'fs';
import path from 'path';

function walk(current: string) {
function walk(current: string): string[] {
if (!fs.lstatSync(current).isDirectory()) {
return [current];
}

const files = fs
.readdirSync(current)
.map(child => walk(path.join(current, child)));
return [].concat.apply([current], files);
const result: string[] = [];
return result.concat.apply([current], files);
}

export default walk;