Skip to content

Commit

Permalink
Merge pull request #574 from ghiscoding/feat/vanilla-force-package
Browse files Browse the repository at this point in the history
chore(build): rename package to `vanilla-force-bundle`
  • Loading branch information
ghiscoding authored Dec 10, 2021
2 parents b4a889f + 9ab05c0 commit 7a50725
Show file tree
Hide file tree
Showing 20 changed files with 39 additions and 35 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ Slickgrid-Universal has **100%** Unit Test Coverage, we are talking about +15,00
| [@slickgrid-universal/row-detail-view-plugin](https://github.com/ghiscoding/slickgrid-universal/tree/master/packages/row-detail-view-plugin) | [![npm](https://img.shields.io/npm/v/@slickgrid-universal/row-detail-view-plugin.svg?color=forest)](https://www.npmjs.com/package/@slickgrid-universal/row-detail-view-plugin) | Row Detail View (plugin) | [changelog](https://github.com/ghiscoding/slickgrid-universal/blob/master/packages/row-detail-view-plugin/CHANGELOG.md) |
| [@slickgrid-universal/rxjs-observable](https://github.com/ghiscoding/slickgrid-universal/tree/master/packages/rxjs-observable) | [![npm](https://img.shields.io/npm/v/@slickgrid-universal/rxjs-observable.svg?color=forest)](https://www.npmjs.com/package/@slickgrid-universal/rxjs-observable) | RxJS Observable Service Wrapper | [changelog](https://github.com/ghiscoding/slickgrid-universal/blob/master/packages/rxjs-observable/CHANGELOG.md) |
| [@slickgrid-universal/vanilla-bundle](https://github.com/ghiscoding/slickgrid-universal/tree/master/packages/vanilla-bundle) | [![npm](https://img.shields.io/npm/v/@slickgrid-universal/vanilla-bundle.svg?color=forest)](https://www.npmjs.com/package/@slickgrid-universal/vanilla-bundle) | Vanilla TypeScript/ES6 implementation | [changelog](https://github.com/ghiscoding/slickgrid-universal/blob/master/packages/vanilla-bundle/CHANGELOG.md)
| [@slickgrid-universal/vanilla-force-bundle](https://github.com/ghiscoding/slickgrid-universal/tree/master/packages/vanilla-force-bundle) | [![npm](https://img.shields.io/npm/v/@slickgrid-universal/vanilla-force-bundle.svg?color=forest)](https://www.npmjs.com/package/@slickgrid-universal/vanilla-force-bundle) | Vanilla TypeScript/ES6 implementation | [changelog](https://github.com/ghiscoding/slickgrid-universal/blob/master/packages/vanilla-force-bundle/CHANGELOG.md)

## Installation
To get going and do development with this monorepo, you will need to clone the repo and then follow the steps below
Expand Down
7 changes: 4 additions & 3 deletions examples/webpack-demo-vanilla-bundle/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
## Vanilla Bundle Webpack Demo

Standalone package to simply demo the Vanilla Bundle implementation (no framework associated), it also used to build the [GitHub Demo](https://ghiscoding.github.io/slickgrid-universal) page and run the Cypress E2E tests.
Standalone package to simply demo the Vanilla Bundle implementation (no framework associated), we also use it to build the [GitHub Demo](https://ghiscoding.github.io/slickgrid-universal) page from which we run the Cypress E2E tests.

This is basically a simple UI implementation written in plain TypeScript with Webpack bundler to demo most features. We also use this demo to run all our Cypress E2E tests.

### Installation
To get started with this demo, you need to run it from the root of monorepo structure.
Go to the root of the repo and follow the instructions provided in the main [README](https://github.com/ghiscoding/slickgrid-universal#installation)
To get started with this demo, you will need to install the entire project and do the following 2 things:
1. Go to the root of the repo and follow the instructions provided in the main [README](https://github.com/ghiscoding/slickgrid-universal#installation), make sure you do the `bundle`
2. Run the npm script `dev:watch`
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
} from '@slickgrid-universal/common';
import { ExcelExportService } from '@slickgrid-universal/excel-export';
import { SlickerGridInstance } from '@slickgrid-universal/vanilla-bundle';
import { SalesforceVanillaGridBundle, Slicker } from '@slickgrid-universal/salesforce-vanilla-bundle';
import { VanillaForceGridBundle, Slicker } from '@slickgrid-universal/vanilla-force-bundle';
import { CompositeEditor, SlickCompositeEditorComponent } from '@slickgrid-universal/composite-editor-component';

import { ExampleGridOptions } from './example-grid-options';
Expand Down Expand Up @@ -100,8 +100,8 @@ export class Example12 {
{ value: 4, label: 'Very Complex' },
];

// you would typically use `SlickVanillaGridBundle` instead, we use `SalesforceVanillaGridBundle` just to test that Salesforce package
sgb: SalesforceVanillaGridBundle;
// you would typically use `SlickVanillaGridBundle` instead, we use `VanillaForceGridBundle` just to test that Salesforce package
sgb: VanillaForceGridBundle;

get slickerGridInstance(): SlickerGridInstance {
return this.sgb?.instances;
Expand Down
2 changes: 1 addition & 1 deletion packages/vanilla-bundle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ Vanilla Bundle implementation (no framework, plain TypeSript implementation). Th
- [whatwg-fetch](https://github.com/whatwg/fetch) - Fetch Standard

### Installation
This Vanilla Bundle is used in our SalesForce implementation (since it requires plain ES6) and is also used by the standalone `webpack-demo-vanilla-bundle` which serves for demo purposes.
This Vanilla Bundle is used used by the standalone [webpack-demo-vanilla-bundle](https://github.com/ghiscoding/slickgrid-universal/tree/master/examples/webpack-demo-vanilla-bundle) which serves for demo purposes.

Go to the root of the repo and follow the instructions provided in the main [README](https://github.com/ghiscoding/slickgrid-universal#installation)
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](http://www.typescriptlang.org/)
[![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org/)
[![npm](https://img.shields.io/npm/v/@slickgrid-universal/salesforce-vanilla-bundle.svg?color=forest)](https://www.npmjs.com/package/@slickgrid-universal/salesforce-vanilla-bundle)
[![npm](https://img.shields.io/npm/dy/@slickgrid-universal/salesforce-vanilla-bundle?color=forest)](https://www.npmjs.com/package/@slickgrid-universal/salesforce-vanilla-bundle)
[![npm](https://img.shields.io/npm/v/@slickgrid-universal/vanilla-force-bundle.svg?color=forest)](https://www.npmjs.com/package/@slickgrid-universal/vanilla-force-bundle)
[![npm](https://img.shields.io/npm/dy/@slickgrid-universal/vanilla-force-bundle?color=forest)](https://www.npmjs.com/package/@slickgrid-universal/vanilla-force-bundle)

[![Actions Status](https://github.com/ghiscoding/slickgrid-universal/workflows/CI%20Build/badge.svg)](https://github.com/ghiscoding/slickgrid-universal/actions)
[![Cypress.io](https://img.shields.io/badge/tested%20with-Cypress-04C38E.svg)](https://www.cypress.io/)
[![jest](https://jestjs.io/img/jest-badge.svg)](https://github.com/facebook/jest)
[![codecov](https://codecov.io/gh/ghiscoding/slickgrid-universal/branch/master/graph/badge.svg)](https://codecov.io/gh/ghiscoding/slickgrid-universal)

## Salesforce Vanilla Bundle
#### @slickgrid-universal/salesforce-vanilla-bundle
## Vanilla Force Bundle
#### @slickgrid-universal/vanilla-force-bundle

Vanilla Bundle implementation (no framework, plain TypeSript implementation). This package is similar to the [@slickgrid-universal/vanilla-bundle](https://github.com/ghiscoding/slickgrid-universal/tree/master/packages/vanilla-bundle), it actually extends it, with the small exception that it adds 3 extra packages that are optional in the `vanilla-bundle` but required here and those are: CompositeEditor, CustomTooltip, TextExport (CSV)).
Vanilla Force Bundle is similar to the Vanilla Bundle but oriented towards a Salesforce (LWC) implementation which requires an all-in-1 bundle (zip) with all necessary package loaded at once. So this package is very similar to the [@slickgrid-universal/vanilla-bundle](https://github.com/ghiscoding/slickgrid-universal/tree/master/packages/vanilla-bundle), it actually extends it, with the difference that it adds and imports 3 extra packages (which are optional in the `vanilla-bundle` but required for our Salesforce implementation) and those are:
- CompositeEditor
- CustomTooltip
- TextExport (CSV))

This package does what other framework would do, that is to make all the features usable in 1 bundle so that it could then be used by other Apps/Projects, for example we use this bundle in our SalesForce (with Lighning Web Component) App and it requires plain ES6 JavaScript which this bundle also produce (for that there's a [dist-grid-bundle-zip](https://github.com/ghiscoding/slickgrid-universal/tree/master/packages/salesforce-vanilla-bundle/dist-grid-bundle-zip) folder which will zip the ES6 `dist` folder which we then import in SalesForce as a static resource).
This package does what other framework would do, that is to make all the features usable in 1 bundle so that it could then be used by other Apps/Projects, for example we use this bundle in our SalesForce (with Lighning Web Component) App and it requires plain ES6 JavaScript which this bundle also produce (for that there's a [dist-grid-bundle-zip](https://github.com/ghiscoding/slickgrid-universal/tree/master/packages/vanilla-force-bundle/dist-grid-bundle-zip) folder which will zip the ES6 `dist` folder which we then import in SalesForce as a static resource).

### Internal Dependencies
- [@slickgrid-universal/common](https://github.com/ghiscoding/slickgrid-universal/tree/master/packages/common)
Expand All @@ -25,11 +28,12 @@ This package does what other framework would do, that is to make all the feature
- [@slickgrid-universal/empty-warning-component](https://github.com/ghiscoding/slickgrid-universal/tree/master/packages/empty-warning-component)
- [@slickgrid-universal/pagination-component](https://github.com/ghiscoding/slickgrid-universal/tree/master/packages/pagination-component)
- [@slickgrid-universal/text-export](https://github.com/ghiscoding/slickgrid-universal/tree/master/packages/text-export)
- [@slickgrid-universal/vanilla-bundle](https://github.com/ghiscoding/slickgrid-universal/tree/master/packages/vanilla-bundle)

### External Dependencies
- [whatwg-fetch](https://github.com/whatwg/fetch) - Fetch Standard

### Installation
This Vanilla Bundle is used in our SalesForce implementation (since it requires plain ES6) and is also used by the standalone `webpack-demo-vanilla-bundle` which serves for demo purposes.
This Vanilla Bundle is used in our SalesForce implementation (since it requires plain ES6) and is also used by the standalone [webpack-demo-vanilla-bundle](https://github.com/ghiscoding/slickgrid-universal/tree/master/examples/webpack-demo-vanilla-bundle) which serves for demo purposes.

Go to the root of the repo and follow the instructions provided in the main [README](https://github.com/ghiscoding/slickgrid-universal#installation)
File renamed without changes.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@slickgrid-universal/salesforce-vanilla-bundle",
"name": "@slickgrid-universal/vanilla-force-bundle",
"version": "0.19.2",
"description": "Salesforce Vanilla Slick Grid Bundle - Similar to Vanilla Bundle, the only difference is that it adds extra packages within its bundle (CustomTooltip, CompositeEditor & TextExport)",
"description": "Vanilla Slick Grid Bundle (mostly exist for our Salesforce implementation) - Similar to Vanilla Bundle, the only difference is that it adds extra packages within its bundle (CustomTooltip, CompositeEditor & TextExport)",
"main": "dist/commonjs/index.js",
"browser": "src/index.ts",
"module": "dist/esm/index.js",
Expand All @@ -14,7 +14,7 @@
"/dist"
],
"scripts": {
"test": "echo testing slickgrid-universal salesforce-vanilla-bundle code",
"test": "echo testing slickgrid-universal vanilla-force-bundle code",
"dev": "webpack --env development",
"dev:watch": "run-p build:watch",
"build": "cross-env tsc --build",
Expand All @@ -31,16 +31,16 @@
"webpack:prod": "webpack --env production",
"zip:dist:dev": "cross-env node compress.js --output-filename=slickgrid-vanilla-bundle-DEV --output-folder=\"dist-grid-bundle-zip/\"",
"zip:dist": "cross-env node compress.js --output-filename=slickgrid-vanilla-bundle --output-folder=\"dist-grid-bundle-zip/\"",
"package:add-browser-prop": "cross-env node ../change-package-browser.js --add-browser=true --folder-name=salesforce-vanilla-bundle",
"package:remove-browser-prop": "cross-env node ../change-package-browser.js --remove-browser=true --folder-name=salesforce-vanilla-bundle"
"package:add-browser-prop": "cross-env node ../change-package-browser.js --add-browser=true --folder-name=vanilla-force-bundle",
"package:remove-browser-prop": "cross-env node ../change-package-browser.js --remove-browser=true --folder-name=vanilla-force-bundle"
},
"license": "MIT",
"author": "Ghislain B.",
"homepage": "https://github.com/ghiscoding/slickgrid-universal",
"repository": {
"type": "git",
"url": "https://github.com/ghiscoding/slickgrid-universal.git",
"directory": "packages/salesforce-vanilla-bundle"
"directory": "packages/vanilla-force-bundle"
},
"bugs": {
"url": "https://github.com/ghiscoding/slickgrid-universal/issues"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('Testing library entry point', () => {
expect(typeof entry.SlickCompositeEditorComponent).toBe('function');
expect(typeof entry.SlickEmptyWarningComponent).toBe('function');
expect(typeof entry.SlickPaginationComponent).toBe('function');
expect(typeof entry.SalesforceVanillaGridBundle).toBe('function');
expect(typeof entry.VanillaForceGridBundle).toBe('function');
expect(typeof entry.Aggregators).toBe('object');
expect(typeof entry.Editors).toBe('object');
expect(typeof entry.Enums).toBe('object');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { TextExportService } from '@slickgrid-universal/text-export';
import { UniversalContainerService } from '@slickgrid-universal/vanilla-bundle';
import * as formatterUtilities from '@slickgrid-universal/common/dist/commonjs/formatters/formatterUtilities';

import { SalesforceVanillaGridBundle } from '../salesforce-vanilla-grid-bundle';
import { VanillaForceGridBundle } from '../vanilla-force-bundle';
import { TranslateServiceStub } from '../../../../test/translateServiceStub';
import { MockSlickEvent, MockSlickEventHandler } from '../../../../test/mockSlickEvent';
import { RxJsResourceStub } from '../../../../test/rxjsResourceStub';
Expand Down Expand Up @@ -256,13 +256,13 @@ const mockDataViewImplementation = jest.fn().mockImplementation(() => mockDataVi
const mockGridImplementation = jest.fn().mockImplementation(() => mockGrid);
const template = `<div class="demo-container"><div class="grid1"></div></div>`;

describe('Slick-Vanilla-Grid-Bundle Component instantiated via Constructor', () => {
describe('Vanilla-Force-Grid-Bundle Component instantiated via Constructor', () => {
jest.mock('slickgrid/slick.grid', () => mockGridImplementation);
Slick.Grid = mockGridImplementation;
Slick.EventHandler = mockSlickEventHandlerImplementation;
Slick.Data = { DataView: mockDataViewImplementation, };

let component: SalesforceVanillaGridBundle;
let component: VanillaForceGridBundle;
let divContainer: HTMLDivElement;
let cellDiv: HTMLDivElement;
let columnDefinitions: Column[];
Expand Down Expand Up @@ -298,7 +298,7 @@ describe('Slick-Vanilla-Grid-Bundle Component instantiated via Constructor', ()
jest.spyOn(mockGrid, 'getOptions').mockReturnValue(gridOptions);
dataset = [];

component = new SalesforceVanillaGridBundle(
component = new VanillaForceGridBundle(
divContainer,
columnDefinitions,
gridOptions,
Expand Down Expand Up @@ -525,7 +525,7 @@ describe('Slick-Vanilla-Grid-Bundle Component instantiated via Constructor', ()
expect(filterServiceSpy).toHaveBeenCalled();
expect(sortServiceSpy).toHaveBeenCalled();
expect(paginationServiceSpy).toHaveBeenCalled();
expect(component.registeredResources.length).toBe(4); // RxJsResourceStub, GridService, GridStateService, SlickEmptyCompositeEditorComponent
expect(component.registeredResources.length).toBe(5); // RxJsResourceStub, GridService, GridStateService, CustomTooltip, SlickEmptyCompositeEditorComponent
expect(component.registeredResources[0] instanceof RxJsResourceStub).toBeTrue();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { EventPubSubService } from '@slickgrid-universal/event-pub-sub';
import { SlickCompositeEditorComponent } from '@slickgrid-universal/composite-editor-component';
import { SlickEmptyWarningComponent } from '@slickgrid-universal/empty-warning-component';
import { SlickPaginationComponent } from '@slickgrid-universal/pagination-component';
import { SalesforceVanillaGridBundle } from './salesforce-vanilla-grid-bundle';
import { VanillaForceGridBundle } from './vanilla-force-bundle';

const Slicker = {
GridBundle: SalesforceVanillaGridBundle,
GridBundle: VanillaForceGridBundle,
Aggregators,
BindingService,
Editors,
Expand All @@ -26,5 +26,5 @@ if (typeof window !== 'undefined') {

export { BindingService };
export { Aggregators, Editors, Enums, EventPubSubService, Filters, Formatters, GroupTotalFormatters, SortComparers, Utilities };
export { SlickCompositeEditorComponent, SlickEmptyWarningComponent, SlickPaginationComponent, SalesforceVanillaGridBundle }; // export the custom components & interfaces
export { SlickCompositeEditorComponent, SlickEmptyWarningComponent, SlickPaginationComponent, VanillaForceGridBundle }; // export the custom components & interfaces
export { Slicker };
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { SlickVanillaGridBundle, UniversalContainerService } from '@slickgrid-un

import { SalesforceGlobalGridOptions } from './salesforce-global-grid-options';

export class SalesforceVanillaGridBundle extends SlickVanillaGridBundle {
export class VanillaForceGridBundle extends SlickVanillaGridBundle {
slickCompositeEditor: SlickCompositeEditorComponent | undefined;

/**
Expand Down Expand Up @@ -107,12 +107,10 @@ export class SalesforceVanillaGridBundle extends SlickVanillaGridBundle {

protected registerResources() {
// when using Salesforce, we want the Export to CSV always enabled without registering it
if (this.gridOptions.enableTextExport && this.gridOptions.useSalesforceDefaultGridOptions) {
if (this.gridOptions.enableTextExport) {
this._registeredResources.push(new TextExportService());
}
if (this.gridOptions.useSalesforceDefaultGridOptions) {
this._registeredResources.push(new SlickCustomTooltip());
}
this._registeredResources.push(new SlickCustomTooltip());

// at this point, we consider all the registered services as external services, anything else registered afterward aren't external
if (Array.isArray(this._registeredResources)) {
Expand Down Expand Up @@ -143,7 +141,7 @@ export class SalesforceVanillaGridBundle extends SlickVanillaGridBundle {

// also initialize (render) the pagination component when using the salesforce default options
// however before adding a new instance, just make sure there isn't one that might have been loaded by calling "registerExternalResources"
if (this.gridOptions.enableCompositeEditor && this.gridOptions.useSalesforceDefaultGridOptions) {
if (this.gridOptions.enableCompositeEditor) {
if (!this._registeredResources.some((resource => resource instanceof SlickCompositeEditorComponent))) {
this.slickCompositeEditor = new SlickCompositeEditorComponent();
this._registeredResources.push(this.slickCompositeEditor);
Expand Down
File renamed without changes.

0 comments on commit 7a50725

Please sign in to comment.