Skip to content

Commit

Permalink
feat(cli): ignore hidden files in "cdk8s init" (#99)
Browse files Browse the repository at this point in the history
* ignore hidden files in empty directory check

* create hidden files for integration tests
  • Loading branch information
brennerm committed Apr 10, 2020
1 parent a7902d9 commit 5681e14
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/cdk8s-cli/bin/cmds/init.ts
Expand Up @@ -20,7 +20,7 @@ class Command implements yargs.CommandModule {
.choices('TYPE', availableTemplates);

public async handler(argv: any) {
if (fs.readdirSync('.').length > 0) {
if (fs.readdirSync('.').filter(f => !f.startsWith('.')).length > 0) {
console.error(`Cannot initialize a project in a non-empty directory`);
process.exit(1);
}
Expand Down
4 changes: 4 additions & 0 deletions test/test-python-app/test.sh
Expand Up @@ -4,6 +4,10 @@ scriptdir=$(cd $(dirname $0) && pwd)
cd $(mktemp -d)
mkdir test && cd test

# hidden files should be ignored
touch .foo
mkdir .bar

# initialize an empty project
cdk8s init python-app

Expand Down
4 changes: 4 additions & 0 deletions test/test-typescript-app/test.sh
Expand Up @@ -5,6 +5,10 @@ scriptdir=$(cd $(dirname $0) && pwd)
cd $(mktemp -d)
mkdir test && cd test

# hidden files should be ignored
touch .foo
mkdir .bar

# initialize an empty project
cdk8s init typescript-app

Expand Down

0 comments on commit 5681e14

Please sign in to comment.