Skip to content

Commit

Permalink
Modernize Dependencies (#116)
Browse files Browse the repository at this point in the history
Co-authored-by: Petr Heinz <[email protected]>
  • Loading branch information
versecafe and PetrHeinz authored Aug 7, 2024
1 parent a4b4f0b commit ce3ed55
Show file tree
Hide file tree
Showing 51 changed files with 4,532 additions and 18,210 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/end-to-end.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches:
- master
schedule:
- cron: '20 5 * * *'
- cron: "20 5 * * *"
workflow_dispatch:

jobs:
Expand All @@ -14,14 +14,14 @@ jobs:

strategy:
matrix:
node-version: [16.x, 18.x, 20.x]
node-version: [16.x, 18.x, 20.x, 22.x]
fail-fast: false

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm
Expand Down Expand Up @@ -54,7 +54,7 @@ jobs:
fail-fast: false

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Bun ${{ matrix.bun-version }}
uses: oven-sh/setup-bun@v1
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 16.x
node-version: 20.x
cache: yarn
cache-dependency-path: |
yarn.lock
Expand Down
12 changes: 4 additions & 8 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
workflow_dispatch:
inputs:
clearLockFiles:
description: 'Clear yarn.lock files?'
description: "Clear yarn.lock files?"
required: false
type: boolean

Expand All @@ -18,13 +18,12 @@ jobs:

strategy:
matrix:
node-version: [16.x, 18.x, 20.x, 22.x]
node-version: [18.x, 20.x, 22.x]
fail-fast: false

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: yarn
Expand All @@ -51,9 +50,6 @@ jobs:
- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Bootstrap packages
run: yarn bootstrap

- name: Build packages
run: yarn build

Expand Down
12 changes: 8 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@
We are using `yarn` to manage dependencies.

1. `yarn install` to install dependencies
2. Run `yarn bootstrap` to install and cross-link packages in `packages/*`
3. Run `yarn build` to build all packages
4. To run tests
2. Run `yarn build` to build all packages
3. To run tests
1. Run `yarn test` to run all tests
2. To run tests for a single package use `yarn test packages/node` to run tests only from the node package for example
2. To run tests for a single package, run for example `yarn test packages/node`
4. To use `example-project` with the locally built packages
1. Make sure all dependencies are installed and all packages built
2. Run `npm install` in the `/example-project` directory
3. Run `yarn boostrap-example` in the root directory
4. To run the example project, run `node index.js <source-token>` in the `/example-project` directory
2 changes: 1 addition & 1 deletion example-project/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const customLog = logWithNodeVersion("Logging using custom helper function.");

// Logging methods are async function returning Promises
const logPromises = [debugLog, infoLog, warningLog, errorLog, customLog];
Promise.all(logPromises).then(function() {
Promise.all(logPromises).then(function () {
console.info("All done! You can check your logs now.");

console.log("Logs created: ", logger.logged);
Expand Down
27 changes: 15 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,28 @@
"homepage": "https://github.com/logtail/logtail-js",
"private": true,
"scripts": {
"bootstrap": "lerna bootstrap",
"bootstrap-example": "rm -rf example-project/node_modules/@logtail && ln -s ../../packages example-project/node_modules/@logtail",
"build": "lerna run build",
"lint": "prettier -c \"packages/**\" \"example-project/**\"",
"lint:save": "prettier --write \"packages/**\" \"example-project/**\"",
"test": "jest"
},
"workspaces": [
"packages/*"
],
"devDependencies": {
"@edge-runtime/jest-environment": "^2.3.1",
"@types/babel__core": "7.0.4",
"@types/babel__traverse": "7.0.4",
"@types/jest": "^29.5.4",
"@types/node": "^12.7.2",
"jest": "^29.6.4",
"@edge-runtime/jest-environment": "^2.3.10",
"@types/babel__core": "^7.20.5",
"@types/babel__traverse": "^7.20.6",
"@types/jest": "^29.5.12",
"@types/node": "^20.14.9",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"lerna": "^3.16.4",
"prettier": "^1.18.2",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
"typescript": "^4.9.5"
"lerna": "^8.1.5",
"npm-run-all": "^4.1.5",
"prettier": "^3.3.2",
"ts-jest": "^29.1.5",
"ts-node": "^10.9.2",
"typescript": "^5.5.3"
}
}
10 changes: 2 additions & 8 deletions packages/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,17 @@
},
"devDependencies": {
"@logtail/types": "^0.4.20",
"@types/babel__core": "7.0.4",
"@types/babel__traverse": "7.0.4",
"@types/nock": "^11.1.0",
"@types/node": "^14.18.59",
"@types/webpack": "^5.28.2",
"nock": "^13.3.3",
"npm-run-all": "^4.1.5",
"ts-loader": "^6.0.4",
"ts-node": "^10.9.1",
"typescript": "^4.9.5",
"ts-loader": "^9.5.1",
"webpack": "^5.88.2",
"webpack-cli": "^5.1.4"
},
"dependencies": {
"@logtail/core": "^0.4.21",
"@logtail/tools": "^0.4.21",
"cross-fetch": "^3.0.4"
"cross-fetch": "^4.0.0"
},
"gitHead": "0f816cacc21b352576a5707741f9151aa1481041"
}
8 changes: 2 additions & 6 deletions packages/browser/src/browser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ describe("browser tests", () => {
// });

it("should echo log if logtail sends 20x status code", async () => {
nock("https://in.logs.betterstack.com")
.post("/")
.reply(201);
nock("https://in.logs.betterstack.com").post("/").reply(201);

const message: string = String(Math.random());
const expectedLog = getRandomLog(message);
Expand All @@ -48,9 +46,7 @@ describe("browser tests", () => {
});

it("should throw error if logtail sends non 200 status code", async () => {
nock("https://in.logs.betterstack.com")
.post("/")
.reply(401);
nock("https://in.logs.betterstack.com").post("/").reply(401);

const browser = new Browser("invalid source token", {
throwExceptions: true,
Expand Down
Loading

0 comments on commit ce3ed55

Please sign in to comment.