Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README #440

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,19 @@ danger-swift command --danger-js-path path/to/danger-js

#### Current working directory

Many people prefers using the SPM Danger configuration, because is more performing.
But having a `Package.swift` on your root folder can be annoying, especially now that Xcode (from 11) doesn't put on the recents list an `xcproj` (or `xcworkspace`) when there is a `Package.swift` in the same folder.
Many people prefer using the SPM Danger configuration because is more performant.
But having a `Package.swift` in your root folder can be annoying, especially now that Xcode (from 11) doesn't put an `xcproj` (or `xcworkspace`) on the recents list when there is a `Package.swift` in the same folder.
With the `--cwd` parameter you can specify a working directory.
This allows you to have your `Package.swift` in another directory and still run danger-swift as it was executed from your project root directory.
This allows you to have your `Package.swift` in another directory and still run danger-swift as it was executed from your project root directory. Since you no longer have a `Package.swift` in your root directory, you'll also have to specify that package path to `swift run`.

```swift
swift run danger-swift command --cwd path/to/working-directory
swift run --package-path path/to/working-directory danger-swift command --cwd path/to/working-directory
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--package-path and --cwd do almost the same thing, but in different ways (so you shouldn't need --cwd if you have --package-path), but --package-path doesn't work in all the cases, it has still some corner cases that needs to be handled, and this is why it is not suggested yet, once it fully supported cwd should be deprecated.

The correct command should be cd path && swift run danger ci --cwd rootFolder

```

Keep in mind that Danger will automatically search for your Dangerfile in a `danger` directory placed at the root of your project. So if you put your `Dangerfile.swift` and `Package.swift` in a `danger` directory you can leave off the `--cwd` parameter (though, you still have to specify your package path to `swift run`)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use the --dangerfile parameter to specify the Dangerfile you want to run, there is no need to use cwd in that case I think, you can use --package-path and --dangerfile

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO, there is no information about --dangerfile parameter in any reference or documents, and should be written in the README🤔.


```swift
swift run --package-path danger danger-swift command
```

#### Dev
Expand Down