thomvaill / log4brains

✍️ Log and publish your architecture decisions (ADR)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Init fails on Mac OS

Nevon opened this issue Β· comments

Bug Report

Description

log4brains init fails with an error after completing the wizard in Mac OS - possibly due to differences in how sed works (unconfirmed).

$ npx log4brains init

πŸ‘‹ Welcome to Log4brains!

This interactive script will help you configure Log4brains for your project.
It will create the .log4brains.yml config file,
        copy the default ADR template,
        and create your first ADR for you!

Before going further, please check that you are running this command
from the root folder of your project's git repository:
/Users/tommy.brunn/workspace/log4brains-test

? Continue? Yes

πŸ‘ We will now ask you several questions to get you started:

? What is the name of your project? log4brains-test

? Which statement describes the best your project? Multi-package project

? In which directory do you plan to store your global ADRs? (will be automatically created) ./docs/adr

We will now define your packages...


  Package #1:

? Name? (short, lowercase, without special characters, nor spaces) foo

? Where is located the source code of this package? ./packages/foo

? In which directory do you plan to store the ADRs of this package? (will be automatically created) ./packages/foo/docs/adr

? We are done with package #1. Do you want to add another one? No
[==  ] Creating your first ADR... Error


 FATAL  Command failed with exit code 1: sed -i s/{DATE_YESTERDAY}/2021-01-18/g /Users/tommy.brunn/workspace/log4brains-test/docs/adr/20210119-use-log4brains-to-manage-the-adrs.md
sed: 1: "/Users/tommy.brunn/work ...": undefined label 'ommy.brunn/workspace/log4brains-test/docs/adr/20210119-use-log4brains-to-manage-the-adrs.md'

Steps to Reproduce

See the above steps. I literally just used the default options, except for choosing a multi-package project.

Expected Behavior

I'm not sure what the command is trying to do. Perhaps replacing {DATE_YESTERDAY} with the actual date.

Environment

  • Log4brains version: 1.0.0-beta.6
  • Node.js version: v14.15.1
  • OS and its version: Mac OS 10.15.7

Hi @Nevon !
Thank you for this report!

In fact I did not have the opportunity to test the project on macOS before.
I managed to borrow one, so I could debug your issue ;)

And yes, you were right, sed behaves differently on macOS.
Anyway, I implemented this part of the init very quickly and it was not clean at all to rely on an exec to replace something in a file!
So I just implemented it in native Node (see this PR: #18)

I also configured GitHub Actions to test on macOS, and fixed a build issue.

It should work fine now!
Please raise another issue if you find some other bugs ;)
Thanks a lot! πŸ™

PS: pay attention to this issue if you try again: #20
I had to remove manually this folder to make it work after the upgrade: /usr/local/lib/node_modules/log4brains/@log4brains/init/node_modules/.cache/esm

I will try to fix this asap.