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

feat(global): Updated default folder to decisions #98

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ you make to a markdown file from your IDE is applied live.
To create a new ADR from your template, run this command:

```bash
log4brains adr new
log4brains decision new
```

Get all the available commands and options by running `log4brains --help`.
Expand Down Expand Up @@ -313,7 +313,7 @@ Log4brains supports both mono and multi packages projects. The `log4brains init`

In the case of a multi-package project, you have two options:

- Mono-repository: in this case, just install Log4brains in the root folder. It will manage "global ADRs", for example in `docs/adr` and "package-specific ADRs", for example in `packages/<package name>/docs/adr`.
- Mono-repository: in this case, just install Log4brains in the root folder. It will manage "global ADRs", for example in `docs/decisions` and "package-specific ADRs", for example in `packages/<package name>/docs/decisions`.
- One repository per package: in the future, Log4brains will handle this case with a central repository for the "global ADRs" while fetching "package-specifics ADRs" directly from each package repository. For the moment, all the ADRs have to be stored in a central repository.

Here is an example of a typical file structure for each case:
Expand Down Expand Up @@ -438,7 +438,7 @@ Here is an example with just the required fields:
project:
name: Foo Bar # The name that should be displayed in the UI
tz: Europe/Paris # The timezone that you use for the dates in your ADR files
adrFolder: ./docs/adr # The location of your ADR files
adrFolder: ./docs/decisions # The location of your ADR files
```

If you have multiple packages in your project, you may want to support package-specific ADRs by setting the optional `project.packages` field:
Expand All @@ -449,7 +449,7 @@ project:
packages:
- name: backend # The name (unique identifier) of the package
path: ./packages/backend # The location of its codebase
adrFolder: ./packages/backend/docs/adr # The location of its ADR files
adrFolder: ./packages/backend/docs/decisions # The location of its ADR files
# - ...
```

Expand Down
27 changes: 27 additions & 0 deletions docs/adr/20230119-use-the-term-decisions-instead-of-adr.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use the term decisions instead of adr

- Status: accepted
- Deciders: Tyler Hubert, Thomas Vaillant, Joel Parker Henderson

Technical Story: https://github.com/thomvaill/log4brains/issues/12

## Context and Problem Statement

The idea behind documenting any decision that gets made is becoming more popular. We should update the terminology in this library to reflect that any decision, not just architectural ones, should be documented and that this library can make that easier.

## Decision Drivers

- ADRs are starting to update their terminology to be Any Decision Records instead of Architectural, so using the more generic term decision is a simpler term that more people will understand.
Copy link
Contributor

Choose a reason for hiding this comment

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

Note that we intend to switch back to "architectural" to strengthen the importance of "architecture". See our CHANGELOG of the upcoming release at https://github.com/adr/madr/blob/develop/CHANGELOG.md

Any feedback welcome!


## Considered Options

- Leave it as ADR
- Change the default folder to docs/decisions

## Decision Outcome

Chose to update the default folder to docs/decisions along with adding an alias to the `log4brains adr new` to be `log4brains decision new`. This reflects the updated mindset that all decisions should be documented and not just architectural ones.

### Positive Consequences

- Hopefully more people will adopt this and document their decisions.
1 change: 1 addition & 0 deletions packages/cli/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export function createCli({ appConsole }: Deps): commander.Command {

const adr = program
.command("adr")
.alias("decision")
.description("Group of commands to manage your ADRs...");

adr
Expand Down
14 changes: 7 additions & 7 deletions packages/init/integration-tests/init.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,12 @@ describe("Init", () => {
await bindAnswers(run(cwd));

expect(fs.existsSync(path.join(cwd, ".log4brains.yml"))).toBeTruthy(); // TODO: test its content
expect(fs.existsSync(path.join(cwd, "docs/adr"))).toBeTruthy();
expect(fs.existsSync(path.join(cwd, "docs/decisions"))).toBeTruthy();
expect(
fs.existsSync(path.join(cwd, "docs/adr/template.md"))
fs.existsSync(path.join(cwd, "docs/decisions/template.md"))
).toBeTruthy();
expect(fs.existsSync(path.join(cwd, "docs/adr/index.md"))).toBeTruthy();
expect(fs.existsSync(path.join(cwd, "docs/adr/README.md"))).toBeTruthy();
expect(fs.existsSync(path.join(cwd, "docs/decisions/index.md"))).toBeTruthy();
expect(fs.existsSync(path.join(cwd, "docs/decisions/README.md"))).toBeTruthy();
});
});

Expand All @@ -150,13 +150,13 @@ describe("Init", () => {
await bindAnswers(run(cwd), {
name: "package1",
path: "packages/package1",
adrFolder: "packages/package1/docs/adr"
adrFolder: "packages/package1/docs/decisions"
});

expect(fs.existsSync(path.join(cwd, ".log4brains.yml"))).toBeTruthy(); // TODO: test its content
expect(fs.existsSync(path.join(cwd, "docs/adr"))).toBeTruthy();
expect(fs.existsSync(path.join(cwd, "docs/decisions"))).toBeTruthy();
expect(
fs.existsSync(path.join(cwd, "packages/package1/docs/adr"))
fs.existsSync(path.join(cwd, "packages/package1/docs/decisions"))
).toBeTruthy();
});
});
Expand Down
10 changes: 6 additions & 4 deletions packages/init/src/commands/InitCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,11 @@ export class InitCommand {
const usualPaths = [
"./docs/adr",
"./docs/adrs",
"./docs/decisions",
"./docs/architecture-decisions",
"./doc/adr",
"./doc/adrs",
"./doc/decisions",
"./doc/architecture-decisions",
"./adr",
"./adrs",
Expand Down Expand Up @@ -163,13 +165,13 @@ export class InitCommand {
}
if (!adrFolder) {
adrFolder = noInteraction
? "./docs/adr"
? "./docs/decisions"
: await this.console.askInputQuestionAndValidate(
`In which directory do you plan to store your ${
type === "multi" ? "global " : ""
}ADRs? (will be automatically created)`,
(answer) => !!answer.trim(),
"./docs/adr"
"./docs/decisions"
);
}
await mkdirp(path.join(cwd, adrFolder));
Expand Down Expand Up @@ -200,7 +202,7 @@ export class InitCommand {
const pkgAdrFolder = await this.console.askInputQuestionAndValidate(
`In which directory do you plan to store the ADRs of this package? (will be automatically created)`,
(answer) => !!answer.trim(),
`${pkgCodeFolder}/docs/adr`
`${pkgCodeFolder}/docs/decisions`
);
await mkdirp(path.join(cwd, pkgAdrFolder));
packages.push({
Expand Down Expand Up @@ -282,7 +284,7 @@ export class InitCommand {
this.console.success("Log4brains is configured! 🎉🎉🎉");
this.console.println();
this.console.println("You can now use the CLI to create a new ADR:");
this.console.println(` ${chalk.cyan(`log4brains adr new`)}`);
this.console.println(` ${chalk.cyan(`log4brains decision new`)}`);
this.console.println("");
this.console.println(
"And start the web UI to preview your architecture knowledge base:"
Expand Down