From 65d29d7b3c5419603d2bd0d5c0f22c34babaae6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Crist=C3=B3bal=20Contreras=20Rubio?= Date: Thu, 16 May 2024 08:15:57 +0200 Subject: [PATCH 1/4] remove nested node_modules folders too --- clean_monorepo.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/clean_monorepo.sh b/clean_monorepo.sh index b0871ee..d491f02 100644 --- a/clean_monorepo.sh +++ b/clean_monorepo.sh @@ -1,5 +1,5 @@ rm -rf node_modules \ - packages/nmea-parser/dist \ - packages/norsub-emru/dist \ - packages/septentrio-sbf/dist \ - packages/thelmabiotel-tblive/dist + packages/nmea-parser/node_modules packages/nmea-parser/dist \ + packages/norsub-emru/node_modules packages/norsub-emru/dist \ + packages/septentrio-sbf/node_modules packages/septentrio-sbf/dist \ + packages/thelmabiotel-tblive/node_modules packages/thelmabiotel-tblive/dist From 5597e72ba8aff2caeb260814ba83b9dd00219a40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Crist=C3=B3bal=20Contreras=20Rubio?= Date: Thu, 16 May 2024 08:23:58 +0200 Subject: [PATCH 2/4] removes nested coverage folders --- clean_monorepo.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/clean_monorepo.sh b/clean_monorepo.sh index d491f02..bb00ef6 100644 --- a/clean_monorepo.sh +++ b/clean_monorepo.sh @@ -1,5 +1,5 @@ rm -rf node_modules \ - packages/nmea-parser/node_modules packages/nmea-parser/dist \ - packages/norsub-emru/node_modules packages/norsub-emru/dist \ - packages/septentrio-sbf/node_modules packages/septentrio-sbf/dist \ - packages/thelmabiotel-tblive/node_modules packages/thelmabiotel-tblive/dist + packages/nmea-parser/dist packages/nmea-parser/node_modules packages/nmea-parser/coverage \ + packages/norsub-emru/dist packages/norsub-emru/node_modules packages/norsub-emru/coverage \ + packages/septentrio-sbf/dist packages/septentrio-sbf/node_modules packages/septentrio-sbf/coverage \ + packages/thelmabiotel-tblive/dist packages/thelmabiotel-tblive/node_modules packages/thelmabiotel-tblive/coverage From decd6301169a81dbca1f151c954ffd1e6a027f92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Crist=C3=B3bal=20Contreras=20Rubio?= Date: Thu, 16 May 2024 08:43:46 +0200 Subject: [PATCH 3/4] NORSUB-eMRU: __dirname for CJS and ESM --- packages/norsub-emru/package.json | 2 +- packages/norsub-emru/src/constants.ts | 13 +++++++++++++ packages/norsub-emru/src/parser.ts | 3 ++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/packages/norsub-emru/package.json b/packages/norsub-emru/package.json index f621aa6..1aaba50 100644 --- a/packages/norsub-emru/package.json +++ b/packages/norsub-emru/package.json @@ -51,7 +51,7 @@ "test:coverage": "vitest run --coverage" }, "dependencies": { - "@coremarine/nmea-parser": ">=1.6.11", + "@coremarine/nmea-parser": ">=1.6.13", "@schemasjs/valibot-numbers": "^1.0.8" }, "peerDependencies": { diff --git a/packages/norsub-emru/src/constants.ts b/packages/norsub-emru/src/constants.ts index 413b615..79ab729 100644 --- a/packages/norsub-emru/src/constants.ts +++ b/packages/norsub-emru/src/constants.ts @@ -1,3 +1,16 @@ +import path from 'node:path' +import { fileURLToPath } from 'node:url' +// DIR +export const DIRNAME = ((): string => { + try { + // CJS + return __dirname + } catch (error) { + // ESM + const filename = fileURLToPath(import.meta.url) + return path.dirname(filename) + } +})() // GENERATE NUMBERS export const UINT8_MAX = Uint8Array.from([0b1111_1111])[0] export const UINT16_MAX = Uint16Array.from([0b1111_1111_1111_1111])[0] diff --git a/packages/norsub-emru/src/parser.ts b/packages/norsub-emru/src/parser.ts index be2b782..aef593f 100644 --- a/packages/norsub-emru/src/parser.ts +++ b/packages/norsub-emru/src/parser.ts @@ -7,6 +7,7 @@ import { getStatus } from './status' import { NorsubSentence } from './types' import { BooleanSchema } from './schemas' import { UnsignedIntegerSchema } from '@schemasjs/valibot-numbers' +import { DIRNAME } from './constants' export class NorsubParser { // Parser @@ -20,7 +21,7 @@ export class NorsubParser { constructor (memory: boolean = true, limit: number = MAX_CHARACTERS) { this.memory = memory this.bufferLimit = limit - const NORSUB_FILE = path.join(__dirname, 'norsub.yaml') + const NORSUB_FILE = path.join(DIRNAME, 'norsub.yaml') this.addProtocols({ file: NORSUB_FILE }) } From 1b9638b3754975cbf295efb034cc3ff89c6d07ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Crist=C3=B3bal=20Contreras=20Rubio?= Date: Thu, 16 May 2024 08:44:45 +0200 Subject: [PATCH 4/4] NORSUB-eMRU: upgrade patch to have new feature in prod --- packages/norsub-emru/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/norsub-emru/package.json b/packages/norsub-emru/package.json index 1aaba50..a83670b 100644 --- a/packages/norsub-emru/package.json +++ b/packages/norsub-emru/package.json @@ -1,6 +1,6 @@ { "name": "@coremarine/norsub-emru", - "version": "1.0.4", + "version": "1.0.5", "description": "Library to work with eMRU devices of NorSub company", "author": "Core Marine", "license": "MIT",