Skip to content
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,7 @@ dist

# Log4brains
.log4brains

# IntelliJ
*.iml
.idea
23 changes: 12 additions & 11 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,20 @@ Thank you so much! :clap:
## Development

```bash
# First, uninstall any global version and install dependencies
npm uninstall -g log4brains
yarn install
yarn link-cli

# Build all packages
yarn build

yarn dev
# ... if it does not work, you may have to add this line to your ~/.bashrc (or similar):
# export PATH="$PATH:$(yarn global bin)"
# Link the CLI for local development (only the global-cli package supports linking)
cd packages/global-cli && yarn link && cd ../..

# You can now develop
# `yarn dev` re-builds the changed packages live
# Start development mode (watches and rebuilds packages on changes)
yarn dev

# You can test the different packages directly on the Log4brains project
# You can now develop and test the CLI directly on the Log4brains project
log4brains adr new
log4brains preview
log4brains build
Expand All @@ -40,7 +41,7 @@ cd $(mktemp -d -t l4b-test-XXXX)
log4brains init
```

When you are done, run `yarn unlink-cli && npm install -g log4brains` to use the official version again.
When you are done, run `cd packages/global-cli && yarn unlink && cd ../.. && npm install -g log4brains` to use the official version again.

## Coding standards

Expand Down Expand Up @@ -75,13 +76,13 @@ Log4brains follows a **simplified Git Flow** model. Here’s how the process wor

```bash
yarn lint # enforced automatically before every commit with husky+lint-staged
yarn format:fix # enforced automatically before every commit with husky+lint-staged
yarn format --write # format code (format:fix script may not work correctly)
yarn typescript # enforced automatically before every commit with husky
yarn test:changed # (or `yarn test` to run all the tests)
yarn test # run all tests (test:changed may have issues)

# Simulate the execution on a fresh install:
yarn link-cli
yarn build
cd packages/global-cli && yarn link && cd ../..
rm -rf node_modules
yarn install --production --no-lockfile
yarn e2e
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-react": "^7.20.6",
"eslint-plugin-react-hooks": "^4.1.2",
"eslint-plugin-sonarjs": "^0.5.0",
"eslint-plugin-sonarjs": "^0.25.1",
"husky": "^4.3.5",
"jest": "^26.4.2",
"jest-mock-extended": "^1.0.10",
Expand Down Expand Up @@ -74,5 +74,6 @@
"commitizen": {
"path": "cz-conventional-changelog"
}
}
},
"dependencies": {}
}
2 changes: 1 addition & 1 deletion packages/cli/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const templateExampleUrl =
let l4bInstance: Log4brains;
function getL4bInstance(): Log4brains {
if (!l4bInstance) {
l4bInstance = Log4brains.createFromCwd(process.env.LOG4BRAINS_CWD || ".");
l4bInstance = Log4brains.create(process.env.LOG4BRAINS_CWD);
}
return l4bInstance;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/web/cli/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import path from "path";
let l4bInstance: Log4brains;
export function getL4bInstance(): Log4brains {
if (!l4bInstance) {
l4bInstance = Log4brains.createFromCwd(process.env.LOG4BRAINS_CWD || ".");
l4bInstance = Log4brains.create(process.env.LOG4BRAINS_CWD);
}
return l4bInstance;
}
Expand Down
6 changes: 3 additions & 3 deletions packages/web/nextjs/src/lib/core-api/instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ export function getLog4brainsInstance(): Log4brains {
if (!instance) {
if (process.env.LOG4BRAINS_PHASE === "initial-build") {
// Noop instance during "next build" phase
instance = Log4brains.createFromCwd(
instance = Log4brains.create(
path.join(
getConfig().serverRuntimeConfig.PROJECT_ROOT,
"lib/core-api/noop"
"src/lib/core-api/noop"
)
);
} else {
instance = Log4brains.createFromCwd(process.env.LOG4BRAINS_CWD || ".");
instance = Log4brains.create(process.env.LOG4BRAINS_CWD);
}
}
return instance;
Expand Down
2 changes: 1 addition & 1 deletion packages/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"build:cli": "microbundle --no-compress --format es,cjs --tsconfig tsconfig.build.json --target node",
"clean:cli": "rimraf ./dist",
"dev:nextjs": "cd nextjs && cross-env LOG4BRAINS_CWD=../.. NODE_OPTIONS=--openssl-legacy-provider next",
"build:nextjs": "yarn clean:nextjs && cd nextjs && cross-env LOG4BRAINS_PHASE=initial-build NODE_OPTIONS=--openssl-legacy-provider next build",
"build:nextjs": "yarn clean:nextjs && cd nextjs && cross-env LOG4BRAINS_CWD=../.. LOG4BRAINS_PHASE=initial-build NODE_OPTIONS=--openssl-legacy-provider next build",
"clean:nextjs": "rimraf ./nextjs/.next ./nextjs/.next-export",
"serve": "serve .log4brains/out",
"typescript": "tsc --noEmit && cd nextjs && tsc",
Expand Down
14 changes: 7 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5856,9 +5856,9 @@ caniuse-api@^3.0.0:
lodash.uniq "^4.5.0"

caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001125, caniuse-lite@^1.0.30001202, caniuse-lite@^1.0.30001214, caniuse-lite@^1.0.30001219, caniuse-lite@^1.0.30001228:
version "1.0.30001687"
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001687.tgz"
integrity sha512-0S/FDhf4ZiqrTUiQ39dKeUjYRjkv7lOZU1Dgif2rIqrTzX/1wV2hfKu9TOm1IHkdSijfLswxTFzl/cvir+SLSQ==
version "1.0.30001727"
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001727.tgz"
integrity sha512-pB68nIHmbN6L/4C6MH1DokyR3bYqFwjaSs/sWDHGj4CTcFtQUQMuJftVwWkXq7mNWOybD3KhUv3oWHoGxgP14Q==

capture-exit@^2.0.0:
version "2.0.0"
Expand Down Expand Up @@ -8235,10 +8235,10 @@ eslint-plugin-react@^7.20.6:
resolve "^2.0.0-next.3"
string.prototype.matchall "^4.0.4"

eslint-plugin-sonarjs@^0.5.0:
version "0.5.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-sonarjs/-/eslint-plugin-sonarjs-0.5.0.tgz#ce17b2daba65a874c2862213a9e38e8986ad7d7d"
integrity sha512-XW5MnzlRjhXpIdbULC/qAdJYHWw3rRLws/DyawdlPU/IdVr9AmRK1r2LaCvabwKOAW2XYYSo3kDX58E4MrB7PQ==
eslint-plugin-sonarjs@^0.25.1:
version "0.25.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-sonarjs/-/eslint-plugin-sonarjs-0.25.1.tgz#0619798dbc27b04fd0a8e6d0fb6adf7fa2cb5041"
integrity sha512-5IOKvj/GMBNqjxBdItfotfRHo7w48496GOu1hxdeXuD0mB1JBlDCViiLHETDTfA8pDAVSBimBEQoetRXYceQEw==

eslint-scope@^3.7.1:
version "3.7.3"
Expand Down