Skip to content

Commit

Permalink
docs: Fixed npm publish issues with @deephaven/jsapi-nodejs (#2265)
Browse files Browse the repository at this point in the history
Fixed a couple of issues with the @deephaven/jsapi-nodejs npm package
publish
- Added .js extensions to relative imports to make compatible with
NodeNext consumers (still works for CommonJS as well)
- Fixed issue where types didn't get built
- Fixed package title in README
  • Loading branch information
bmingles authored Oct 22, 2024
1 parent fff0155 commit 2198781
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 11 deletions.
2 changes: 1 addition & 1 deletion packages/jsapi-nodejs/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# @deephaven/jsapi-components
# @deephaven/jsapi-nodejs

Deephaven utils for consuming Jsapi from a server from a nodejs app. It can
optionally convert the server module format from `ESM` -> `CJS` or `CJS` -> `ESM`
Expand Down
10 changes: 5 additions & 5 deletions packages/jsapi-nodejs/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export * from './errorUtils';
export * from './fsUtils';
export * from './loaderUtils';
export * from './polyfillWs';
export * from './serverUtils';
export * from './errorUtils.js';
export * from './fsUtils.js';
export * from './loaderUtils.js';
export * from './polyfillWs.js';
export * from './serverUtils.js';
6 changes: 3 additions & 3 deletions packages/jsapi-nodejs/src/loaderUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import fs from 'node:fs';
import path from 'node:path';
import esbuild from 'esbuild';

import { downloadFromURL, urlToDirectoryName } from './serverUtils';
import { polyfillWs } from './polyfillWs';
import { ensureDirectoriesExist, getDownloadPaths } from './fsUtils';
import { downloadFromURL, urlToDirectoryName } from './serverUtils.js';
import { polyfillWs } from './polyfillWs.js';
import { ensureDirectoriesExist, getDownloadPaths } from './fsUtils.js';

type NonEmptyArray<T> = [T, ...T[]];

Expand Down
2 changes: 1 addition & 1 deletion packages/jsapi-nodejs/src/serverUtils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as http from 'node:http';
import * as https from 'node:https';
import { hasErrorCode, isAggregateError } from './errorUtils';
import { hasErrorCode, isAggregateError } from './errorUtils.js';

export const SERVER_STATUS_CHECK_TIMEOUT = 3000;

Expand Down
7 changes: 7 additions & 0 deletions packages/jsapi-nodejs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
// NodeNext is the recommended module setting for Node.js v12 or later. This
// allows CommonJS and ESM consumers to use this package.
"module": "NodeNext",
// This is the required setting when `module` is set to `NodeNext`. One side
// effect of this setting is that relative imports require explicit `.js`
// extensions.
"moduleResolution": "NodeNext",
"rootDir": "src/",
"outDir": "dist/"
},
Expand Down
7 changes: 6 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@
"excludeDirectories": ["**/node_modules", "**/dist"]
},
"references": [
// `npm run types` relies on project references to build types. All packages
// must be included in the reference tree somewhere. Top-level packages need
// to be included here, and their respective `tsconfig.json` files should
// reference their dependencies.
{ "path": "./packages/code-studio" },
{ "path": "./packages/embed-widget" }
{ "path": "./packages/embed-widget" },
{ "path": "./packages/jsapi-nodejs" }
]
}

0 comments on commit 2198781

Please sign in to comment.