Skip to content
Merged
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
7 changes: 6 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@
"**/*"
],
"plugins": [
"@nx"
"@nx",
"sort-destructure-keys",
"sort-keys-fix",
"react",
"react-hooks",
"prettier"
],
"overrides": [
{
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,8 @@ jobs:
# Prepend any command with "nx-cloud record --" to record its logs to Nx Cloud
# - run: npx nx-cloud record -- echo Hello World
# Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected
- run: npx nx affected -t lint test build
- name: Run lint, test, and build
env:
NODE_OPTIONS: --max-old-space-size=6144
run: npx nx affected -t lint test build
- run: npx nx affected --parallel 1 -t e2e-ci
6 changes: 2 additions & 4 deletions libs/managers/logging/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@
},
"private": false,
"version": "1.0.5",
"dependencies": {
"@swc/helpers": "~0.5.11"
},
"dependencies": {},
"peerDependencies": {
"@benzinga/subscribable": ">=1.0.0",
"@benzinga/safe-await": ">=2.0.0",
"@benzinga/safe-await": "1.0.6",
"@benzinga/session": ">=1.0.0"
},
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion libs/managers/logging/src/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import { Verbosity } from './entities';
export class Environment {
public static getName = () => 'benzinga-logging';
public static getEnvironment = (env: Record<string, string>) => ({
verbosity: (env["verbosity"] ?? 'info') as Verbosity,
verbosity: (env['verbosity'] ?? 'info') as Verbosity,
});
}
13 changes: 5 additions & 8 deletions libs/managers/logging/src/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,11 @@ export class LoggingManager extends Subscribable<LoggingManagerEvent> {
errorType?: string;
type: 'error';
};
this.log(
'error',
{
category: event.errorType ?? '',
data: event?.error,
message: event?.error?.toString() ?? '',
},
);
this.log('error', {
category: event.errorType ?? '',
data: event?.error,
message: event?.error?.toString() ?? '',
});
}
},
);
Expand Down
71 changes: 37 additions & 34 deletions libs/managers/logging/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ export default defineConfig(() => {
let external: string[] = [];
try {
const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
external = [
...Object.keys(pkg.dependencies || {}),
...Object.keys(pkg.peerDependencies || {})
];
external = [...Object.keys(pkg.dependencies || {}), ...Object.keys(pkg.peerDependencies || {})];
} catch (e) {
console.warn('Could not read package.json, external dependencies might not be correctly identified');
}
Expand All @@ -24,58 +21,64 @@ export default defineConfig(() => {
const workspacePackageRegex = /from\s+['"]\.\.\/\.\.\/\.\.\/.*\/([^/]+)\/src\/.*['"]/g;

return {
root: __dirname,
cacheDir: '../../../node_modules/.vite/libs/managers/logging',
plugins: [
nxViteTsPaths(),
nxCopyAssetsPlugin(['*.md']),

dts({
entryRoot: path.join(__dirname, "src"),
tsconfigPath: path.join(__dirname, 'tsconfig.lib.json'),
// Preserve the import paths for external modules
staticImport: true,

beforeWriteFile: (filePath, content) => {
// Generic replace function for workspace packages (converts relative paths to @benzinga/package format)

const updatedContent = content.replace(workspacePackageRegex, (match, packageName) => {
return `from '@benzinga/${packageName}'`;
});

console.log(`Updating file: ${filePath}`);
console.log(`Original content: ${content}`);
console.log(`Updated content: ${updatedContent}`);
return { filePath, content: updatedContent };
}
}),
],
// Uncomment this if you are using workers.
// worker: {
// plugins: [ nxViteTsPaths() ],
// },
// Configuration for building your library.
// See: https://vitejs.dev/guide/build.html#library-mode
build: {
outDir: '../../../dist/libs/managers/logging',
emptyOutDir: true,
reportCompressedSize: true,
commonjsOptions: {
transformMixedEsModules: true,
},
emptyOutDir: true,
lib: {
// Could also be a dictionary or array of multiple entry points.
entry: 'src/index.ts',
name: 'containers',
fileName: 'index',
// Change this to the formats you want to support.
// Don't forget to update your package.json as well.
formats: ['es' as const],

name: 'containers',
},
outDir: '../../../dist/libs/managers/logging',
reportCompressedSize: true,
rollupOptions: {
// Use the automatically detected external packages
external,
},
},

cacheDir: '../../../node_modules/.vite/libs/managers/logging',

plugins: [
nxViteTsPaths(),
nxCopyAssetsPlugin(['*.md']),

dts({
beforeWriteFile: (filePath, content) => {
// Generic replace function for workspace packages (converts relative paths to @benzinga/package format)

const updatedContent = content.replace(workspacePackageRegex, (match, packageName) => {
return `from '@benzinga/${packageName}'`;
});

console.log(`Updating file: ${filePath}`);
console.log(`Original content: ${content}`);
console.log(`Updated content: ${updatedContent}`);
return { content: updatedContent, filePath };
},

entryRoot: path.join(__dirname, 'src'),

// Preserve the import paths for external modules
staticImport: true,

tsconfigPath: path.join(__dirname, 'tsconfig.lib.json'),
}),
],

root: __dirname,
};
});
6 changes: 5 additions & 1 deletion libs/react-utils/session-context/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
"@benzinga/session": "2.0.5",
"vite": "^6.4.1",
"@vitejs/plugin-react": "^4.2.0",
"vite-plugin-dts": "~4.5.0",
"@nx/vite": "20.7.2"
},
"peerDependenciesMeta": {
"react-dom": {
Expand Down
61 changes: 32 additions & 29 deletions libs/react-utils/session-context/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ export default defineConfig(() => {
let external: string[] = [];
try {
const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
external = [
...Object.keys(pkg.dependencies || {}),
...Object.keys(pkg.peerDependencies || {})
];
external = [...Object.keys(pkg.dependencies || {}), ...Object.keys(pkg.peerDependencies || {})];
} catch (e) {
console.warn('Could not read package.json, external dependencies might not be correctly identified');
}
Expand All @@ -25,52 +22,58 @@ export default defineConfig(() => {
const workspacePackageRegex = /from\s+['"][^'"]*\/([^/]+)\/src\/.*['"]/g;

return {
root: __dirname,
cacheDir: '../../../node_modules/.vite/libs/react-utils/session-context',
plugins: [
react(),
nxViteTsPaths(),
nxCopyAssetsPlugin(['*.md']),
dts({
entryRoot: path.join(__dirname, "src"),
tsconfigPath: path.join(__dirname, 'tsconfig.lib.json'),
// Preserve the import paths for external modules
staticImport: true,
beforeWriteFile: (filePath, content) => {
// Generic replace function for workspace packages (converts relative paths to @benzinga/package format)
const updatedContent = content.replace(workspacePackageRegex, (match, packageName) => {
return `from '@benzinga/${packageName}'`;
});
return { filePath, content: updatedContent };
}
}),
],
// Uncomment this if you are using workers.
// worker: {
// plugins: [ nxViteTsPaths() ],
// },
// Configuration for building your library.
// See: https://vitejs.dev/guide/build.html#library-mode
build: {
outDir: '../../../dist/libs/react-utils/session-context',
emptyOutDir: true,
reportCompressedSize: true,
commonjsOptions: {
transformMixedEsModules: true,
},
emptyOutDir: true,
lib: {
// Could also be a dictionary or array of multiple entry points.
entry: 'src/index.ts',
name: 'session-context',
fileName: 'index',
// Change this to the formats you want to support.
// Don't forget to update your package.json as well.
formats: ['es' as const],

name: 'session-context',
},
outDir: '../../../dist/libs/react-utils/session-context',
reportCompressedSize: true,
rollupOptions: {
// External packages that should not be bundled into your library.
external: [...external, 'react', 'react-dom', 'react/jsx-runtime'],
},
},
}

cacheDir: '../../../node_modules/.vite/libs/react-utils/session-context',

plugins: [
react(),
nxViteTsPaths(),
nxCopyAssetsPlugin(['*.md']),
dts({
beforeWriteFile: (filePath, content) => {
// Generic replace function for workspace packages (converts relative paths to @benzinga/package format)
const updatedContent = content.replace(workspacePackageRegex, (match, packageName) => {
return `from '@benzinga/${packageName}'`;
});
return { content: updatedContent, filePath };
},

entryRoot: path.join(__dirname, 'src'),

// Preserve the import paths for external modules
staticImport: true,
tsconfigPath: path.join(__dirname, 'tsconfig.lib.json'),
}),
],

root: __dirname,
};
});
9 changes: 9 additions & 0 deletions libs/react-utils/use-subscribable/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,14 @@
"import": "./index.mjs",
"require": "./index.js"
}
},
"dependencies": {
"@benzinga/helper-functions": "1.0.4",
"@benzinga/subscribable": "2.0.10",
"@nx/vite": "20.7.2",
"@vitejs/plugin-react": "^4.2.0",
"react": "18.3.1",
"vite": "^6.4.1",
"vite-plugin-dts": "~4.5.0"
}
}
Loading