Skip to content

Commit

Permalink
fix: improve build & types exports for all targets, Node, CJS/ESM (#1188
Browse files Browse the repository at this point in the history
)

* fix: adjust types & exports for all bundlers, Node, CJS/ESM
  • Loading branch information
ghiscoding committed Nov 11, 2023
1 parent bb77376 commit 980fd68
Show file tree
Hide file tree
Showing 22 changed files with 247 additions and 234 deletions.
2 changes: 1 addition & 1 deletion examples/vite-demo-vanilla-bundle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"fetch-jsonp": "^1.3.0",
"flatpickr": "^4.6.13",
"moment-mini": "^2.29.4",
"multiple-select-vanilla": "^0.6.1",
"multiple-select-vanilla": "^0.6.2",
"rxjs": "^7.8.1",
"whatwg-fetch": "^3.6.19"
},
Expand Down
25 changes: 13 additions & 12 deletions packages/binding/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,25 @@
"name": "@slickgrid-universal/binding",
"version": "3.5.0",
"description": "Simple Vanilla Implementation of a Binding Engine & Helper to add properties/events 2 way bindings",
"main": "./dist/commonjs/index.js",
"module": "./dist/esm/index.js",
"types": "index.d.ts",
"typesVersions": {
">=4.2": {
"*": [
"dist/types/*"
]
}
},
"exports": {
".": {
"import": "./dist/esm/index.js",
"types": "./dist/types/index.d.ts",
"node": "./dist/commonjs/index.js",
"require": "./dist/commonjs/index.js",
"default": "./dist/esm/index.js"
},
"./*": "./*"
},
"typesVersions": {
"*": {
"*": [
"./dist/types/index.d.ts"
]
}
"./package.json": "./package.json"
},
"types": "dist/types/index.d.ts",
"main": "dist/commonjs/index.js",
"module": "dist/esm/index.js",
"publishConfig": {
"access": "public"
},
Expand Down
28 changes: 15 additions & 13 deletions packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,26 @@
"name": "@slickgrid-universal/common",
"version": "3.5.0",
"description": "SlickGrid-Universal Common Code",
"main": "./dist/commonjs/index.js",
"module": "./dist/esm/index.js",
"types": "index.d.ts",
"typesVersions": {
">=4.2": {
"*": [
"dist/types/*"
]
}
},
"exports": {
".": {
"import": "./dist/esm/index.js",
"types": "./dist/types/index.d.ts",
"node": "./dist/commonjs/index.js",
"require": "./dist/commonjs/index.js",
"default": "./dist/esm/index.js"
},
"./*": "./*"
},
"typesVersions": {
"*": {
"*": [
"./dist/types/index.d.ts"
]
}
"./dist/styles/*": "./dist/styles/*",
"./package.json": "./package.json"
},
"types": "dist/types/index.d.ts",
"main": "dist/commonjs/index.js",
"module": "dist/esm/index.js",
"license": "MIT",
"author": "Ghislain B.",
"homepage": "https://github.com/ghiscoding/slickgrid-universal",
Expand Down Expand Up @@ -78,7 +80,7 @@
"dompurify": "^3.0.6",
"flatpickr": "^4.6.13",
"moment-mini": "^2.29.4",
"multiple-select-vanilla": "^0.6.1",
"multiple-select-vanilla": "^0.6.2",
"slickgrid": "^4.1.3",
"sortablejs": "^1.15.0",
"un-flatten-tree": "^2.0.12"
Expand Down
25 changes: 13 additions & 12 deletions packages/composite-editor-component/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,25 @@
"name": "@slickgrid-universal/composite-editor-component",
"version": "3.5.0",
"description": "Slick Composite Editor Component - Vanilla Implementation of a Composite Editor Modal Window Component",
"main": "./dist/commonjs/index.js",
"module": "./dist/esm/index.js",
"types": "index.d.ts",
"typesVersions": {
">=4.2": {
"*": [
"dist/types/*"
]
}
},
"exports": {
".": {
"import": "./dist/esm/index.js",
"types": "./dist/types/index.d.ts",
"node": "./dist/commonjs/index.js",
"require": "./dist/commonjs/index.js",
"default": "./dist/esm/index.js"
},
"./*": "./*"
},
"typesVersions": {
"*": {
"*": [
"./dist/types/index.d.ts"
]
}
"./package.json": "./package.json"
},
"types": "dist/types/index.d.ts",
"main": "dist/commonjs/index.js",
"module": "dist/esm/index.js",
"publishConfig": {
"access": "public"
},
Expand Down
25 changes: 13 additions & 12 deletions packages/custom-footer-component/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,25 @@
"name": "@slickgrid-universal/custom-footer-component",
"version": "3.5.0",
"description": "Slick Custom Footer Component - Vanilla Implementation of a Custom Footer Component",
"main": "./dist/commonjs/index.js",
"module": "./dist/esm/index.js",
"types": "index.d.ts",
"typesVersions": {
">=4.2": {
"*": [
"dist/types/*"
]
}
},
"exports": {
".": {
"import": "./dist/esm/index.js",
"types": "./dist/types/index.d.ts",
"node": "./dist/commonjs/index.js",
"require": "./dist/commonjs/index.js",
"default": "./dist/esm/index.js"
},
"./*": "./*"
},
"typesVersions": {
"*": {
"*": [
"./dist/types/index.d.ts"
]
}
"./package.json": "./package.json"
},
"types": "dist/types/index.d.ts",
"main": "dist/commonjs/index.js",
"module": "dist/esm/index.js",
"publishConfig": {
"access": "public"
},
Expand Down
25 changes: 13 additions & 12 deletions packages/custom-tooltip-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,25 @@
"name": "@slickgrid-universal/custom-tooltip-plugin",
"version": "3.5.0",
"description": "A plugin to add Custom Tooltip when hovering a cell, it subscribes to the cell",
"main": "./dist/commonjs/index.js",
"module": "./dist/esm/index.js",
"types": "index.d.ts",
"typesVersions": {
">=4.2": {
"*": [
"dist/types/*"
]
}
},
"exports": {
".": {
"import": "./dist/esm/index.js",
"types": "./dist/types/index.d.ts",
"node": "./dist/commonjs/index.js",
"require": "./dist/commonjs/index.js",
"default": "./dist/esm/index.js"
},
"./*": "./*"
},
"typesVersions": {
"*": {
"*": [
"./dist/types/index.d.ts"
]
}
"./package.json": "./package.json"
},
"types": "dist/types/index.d.ts",
"main": "dist/commonjs/index.js",
"module": "dist/esm/index.js",
"publishConfig": {
"access": "public"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { delay, of, throwError } from 'rxjs';
import { Column, GridOption, SlickDataView, SlickGrid, SlickNamespace, SharedService, } from '@slickgrid-universal/common';
import * as utilities from '@slickgrid-universal/common/dist/commonjs/services/utilities';
import { Column, getHtmlElementOffset, GridOption, SlickDataView, SlickGrid, SlickNamespace, SharedService, } from '@slickgrid-universal/common';

import { SlickCustomTooltip } from '../slickCustomTooltip';
import { ContainerServiceStub } from '../../../../test/containerServiceStub';
import { RxJsResourceStub } from '../../../../test/rxjsResourceStub';

const mockGetHtmlElementOffset = jest.fn();
// @ts-ignore:2540
utilities.getHtmlElementOffset = mockGetHtmlElementOffset;
// mocked modules
jest.mock('@slickgrid-universal/common', () => ({
...(jest.requireActual('@slickgrid-universal/common') as any),
getHtmlElementOffset: jest.fn(),
}));

declare const Slick: SlickNamespace;
const GRID_UID = 'slickgrid12345';
Expand Down Expand Up @@ -474,7 +475,7 @@ describe('SlickCustomTooltip plugin', () => {
jest.spyOn(gridStub, 'getCellNode').mockReturnValue(cellNode);
jest.spyOn(gridStub, 'getColumns').mockReturnValue(mockColumns);
jest.spyOn(dataviewStub, 'getItem').mockReturnValue({ firstName: 'John', lastName: 'Doe' });
mockGetHtmlElementOffset.mockReturnValue({ top: 100, left: 1030, height: 75, width: 400 }); // mock cell position
(getHtmlElementOffset as any).mockReturnValue({ top: 100, left: 1030, height: 75, width: 400 }); // mock cell position

plugin.init(gridStub, container);
plugin.setOptions({
Expand Down Expand Up @@ -589,7 +590,7 @@ describe('SlickCustomTooltip plugin', () => {
expect(tooltipElm).toBeTruthy();
expect(tooltipElm.textContent).toBe('name title tooltip');
expect(tooltipElm.classList.contains('arrow-down')).toBeTruthy();
expect(tooltipElm.classList.contains('arrow-left-align')).toBeTruthy();
expect(tooltipElm.classList.contains('arrow-right-align')).toBeTruthy();
});

it('should create a tooltip on the header column when "useRegularTooltip" enabled and "onHeaderMouseEnter" is triggered', () => {
Expand Down Expand Up @@ -618,7 +619,7 @@ describe('SlickCustomTooltip plugin', () => {
expect(tooltipElm).toBeTruthy();
expect(tooltipElm.textContent).toBe('header tooltip text');
expect(tooltipElm.classList.contains('arrow-down')).toBeTruthy();
expect(tooltipElm.classList.contains('arrow-left-align')).toBeTruthy();
expect(tooltipElm.classList.contains('arrow-right-align')).toBeTruthy();
});

it('should create a tooltip on the header column when "useRegularTooltip" enabled and "onHeaderRowMouseEnter" is triggered', () => {
Expand Down Expand Up @@ -647,6 +648,6 @@ describe('SlickCustomTooltip plugin', () => {
expect(tooltipElm).toBeTruthy();
expect(tooltipElm.textContent).toBe('header row tooltip text');
expect(tooltipElm.classList.contains('arrow-down')).toBeTruthy();
expect(tooltipElm.classList.contains('arrow-left-align')).toBeTruthy();
expect(tooltipElm.classList.contains('arrow-right-align')).toBeTruthy();
});
});
25 changes: 13 additions & 12 deletions packages/empty-warning-component/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,25 @@
"name": "@slickgrid-universal/empty-warning-component",
"version": "3.5.0",
"description": "Slick Empty Warning Component - Vanilla Implementation of an Empty Dataset Warning Component",
"main": "./dist/commonjs/index.js",
"module": "./dist/esm/index.js",
"types": "index.d.ts",
"typesVersions": {
">=4.2": {
"*": [
"dist/types/*"
]
}
},
"exports": {
".": {
"import": "./dist/esm/index.js",
"types": "./dist/types/index.d.ts",
"node": "./dist/commonjs/index.js",
"require": "./dist/commonjs/index.js",
"default": "./dist/esm/index.js"
},
"./*": "./*"
},
"typesVersions": {
"*": {
"*": [
"./dist/types/index.d.ts"
]
}
"./package.json": "./package.json"
},
"types": "dist/types/index.d.ts",
"main": "dist/commonjs/index.js",
"module": "dist/esm/index.js",
"publishConfig": {
"access": "public"
},
Expand Down
25 changes: 13 additions & 12 deletions packages/event-pub-sub/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,25 @@
"name": "@slickgrid-universal/event-pub-sub",
"version": "3.4.0",
"description": "Simple Vanilla Implementation of an Event PubSub Service to do simply publish/subscribe inter-communication while optionally providing data in the event",
"main": "./dist/commonjs/index.js",
"module": "./dist/esm/index.js",
"types": "index.d.ts",
"typesVersions": {
">=4.2": {
"*": [
"dist/types/*"
]
}
},
"exports": {
".": {
"import": "./dist/esm/index.js",
"types": "./dist/types/index.d.ts",
"node": "./dist/commonjs/index.js",
"require": "./dist/commonjs/index.js",
"default": "./dist/esm/index.js"
},
"./*": "./*"
},
"typesVersions": {
"*": {
"*": [
"./dist/types/index.d.ts"
]
}
"./package.json": "./package.json"
},
"types": "dist/types/index.d.ts",
"main": "dist/commonjs/index.js",
"module": "dist/esm/index.js",
"publishConfig": {
"access": "public"
},
Expand Down
25 changes: 13 additions & 12 deletions packages/excel-export/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,25 @@
"name": "@slickgrid-universal/excel-export",
"version": "3.5.0",
"description": "Excel Export (xls/xlsx) Service.",
"main": "./dist/commonjs/index.js",
"module": "./dist/esm/index.js",
"types": "index.d.ts",
"typesVersions": {
">=4.2": {
"*": [
"dist/types/*"
]
}
},
"exports": {
".": {
"import": "./dist/esm/index.js",
"types": "./dist/types/index.d.ts",
"node": "./dist/commonjs/index.js",
"require": "./dist/commonjs/index.js",
"default": "./dist/esm/index.js"
},
"./*": "./*"
},
"typesVersions": {
"*": {
"*": [
"./dist/types/index.d.ts"
]
}
"./package.json": "./package.json"
},
"types": "dist/types/index.d.ts",
"main": "dist/commonjs/index.js",
"module": "dist/esm/index.js",
"publishConfig": {
"access": "public"
},
Expand Down
Loading

0 comments on commit 980fd68

Please sign in to comment.