Skip to content

Commit

Permalink
feat(build): create salesforce-vanilla-bundle standalone package
Browse files Browse the repository at this point in the history
- move all Salesforce dedicated code & options into its own package to avoid adding unnecessary stuff into the vanilla bundle (e.g. our Salesforce implementation requires 3 extra packages that should be totally optional for the vanilla bundle: CompositeEditor, CustomTooltip & TextExport)
- also move the external-lib folder container jQuery/jQueryUI into this new salesforce package
- lastly the slickgrid zip file creation will now be produced in this new salesforce package as well (so the vanilla bundle will no longer have the slickgrid zip file) and so the new zip path will be: `\packages\salesforce-vanilla-bundle\dist-grid-bundle-zip`
  • Loading branch information
ghiscoding committed Dec 8, 2021
1 parent 39b9177 commit 214d8e7
Show file tree
Hide file tree
Showing 24 changed files with 1,102 additions and 122 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ import {
formatNumber,
} from '@slickgrid-universal/common';
import { ExcelExportService } from '@slickgrid-universal/excel-export';
import { Slicker, SlickerGridInstance, SlickVanillaGridBundle } from '@slickgrid-universal/vanilla-bundle';
import { SlickerGridInstance } from '@slickgrid-universal/vanilla-bundle';
import { SalesforceVanillaGridBundle, Slicker } from '@slickgrid-universal/salesforce-vanilla-bundle';
import { CompositeEditor, SlickCompositeEditorComponent } from '@slickgrid-universal/composite-editor-component';

import { ExampleGridOptions } from './example-grid-options';
Expand Down Expand Up @@ -90,7 +91,6 @@ export class Example12 {
editedItems = {};
isCompositeDisabled = false;
isMassSelectionDisabled = true;
sgb: SlickVanillaGridBundle;
gridContainerElm: HTMLDivElement;
complexityLevelList = [
{ value: 0, label: 'Very Simple' },
Expand All @@ -100,6 +100,9 @@ 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;

get slickerGridInstance(): SlickerGridInstance {
return this.sgb?.instances;
}
Expand Down
File renamed without changes.
35 changes: 35 additions & 0 deletions packages/salesforce-vanilla-bundle/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[![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)

[![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 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)).

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).

### Internal Dependencies
- [@slickgrid-universal/common](https://github.com/ghiscoding/slickgrid-universal/tree/master/packages/common)
- [@slickgrid-universal/composite-editor-component](https://github.com/ghiscoding/slickgrid-universal/tree/master/packages/composite-editor-component)
- [@slickgrid-universal/custom-tooltip-plugin](https://github.com/ghiscoding/slickgrid-universal/tree/master/packages/custom-tooltip-plugin)
- [@slickgrid-universal/event-pub-sub](https://github.com/ghiscoding/slickgrid-universal/tree/master/packages/event-pub-sub)
- [@slickgrid-universal/custom-footer-component](https://github.com/ghiscoding/slickgrid-universal/tree/master/packages/custom-footer-component)
- [@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)

### 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.

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.
79 changes: 79 additions & 0 deletions packages/salesforce-vanilla-bundle/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"name": "@slickgrid-universal/salesforce-vanilla-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)",
"main": "dist/commonjs/index.js",
"browser": "src/index.ts",
"module": "dist/esm/index.js",
"types": "dist/commonjs/index.d.ts",
"typings": "dist/commonjs/index.d.ts",
"publishConfig": {
"access": "public"
},
"files": [
"/dist"
],
"scripts": {
"test": "echo testing slickgrid-universal salesforce-vanilla-bundle code",
"dev": "webpack --env development",
"dev:watch": "run-p build:watch",
"build": "cross-env tsc --build",
"postbuild": "npm run bundle:commonjs",
"build:watch": "cross-env tsc --incremental --watch",
"prebundle": "npm run delete:dist",
"bundle": "npm-run-all bundle:commonjs bundle:esm webpack:prod",
"bundle:commonjs": "tsc --project tsconfig.bundle.json --outDir dist/commonjs --module commonjs",
"bundle:esm": "cross-env tsc --project tsconfig.bundle.json --outDir dist/esm --module esnext --target es2018",
"prebundle:zip": "npm run delete:zip",
"bundle:zip": "npm run zip:dist",
"delete:dist": "cross-env rimraf --maxBusyTries=10 dist",
"delete:zip": "cross-env rimraf --maxBusyTries=10 dist-bundle-zip",
"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"
},
"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"
},
"bugs": {
"url": "https://github.com/ghiscoding/slickgrid-universal/issues"
},
"engines": {
"node": ">=14.17.0",
"npm": ">=6.14.8"
},
"browserslist": [
"last 2 version",
"> 1%",
"not dead"
],
"dependencies": {
"@slickgrid-universal/common": "^0.19.2",
"@slickgrid-universal/composite-editor-component": "^0.19.2",
"@slickgrid-universal/custom-footer-component": "^0.19.2",
"@slickgrid-universal/custom-tooltip-plugin": "^0.19.2",
"@slickgrid-universal/empty-warning-component": "^0.19.2",
"@slickgrid-universal/event-pub-sub": "^0.19.2",
"@slickgrid-universal/pagination-component": "^0.19.2",
"@slickgrid-universal/text-export": "^0.19.2",
"@slickgrid-universal/vanilla-bundle": "^0.19.2",
"whatwg-fetch": "^3.6.2"
},
"devDependencies": {
"@types/webpack": "^5.28.0",
"archiver": "^5.3.0",
"cross-env": "^7.0.3",
"dts-bundle-webpack": "^1.0.2",
"html-loader": "^3.0.1",
"npm-run-all": "^4.1.5",
"rimraf": "^3.0.2",
"webpack": "^5.64.4"
}
}
2 changes: 2 additions & 0 deletions packages/salesforce-vanilla-bundle/src/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
index.ts
**/*.*
35 changes: 35 additions & 0 deletions packages/salesforce-vanilla-bundle/src/__tests__/index.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import * as entry from '../index';

describe('Testing library entry point', () => {
it('should have an index entry point defined', () => {
expect(entry).toBeTruthy();
});

it('should have all exported object defined', () => {
expect(typeof entry.Slicker).toBe('object');
expect(typeof entry.BindingService).toBe('function');
expect(typeof entry.EventPubSubService).toBe('function');
expect(typeof entry.Slicker.GridBundle).toBe('function');
expect(typeof entry.Slicker.Aggregators).toBe('object');
expect(typeof entry.Slicker.BindingService).toBe('function');
expect(typeof entry.Slicker.Editors).toBe('object');
expect(typeof entry.Slicker.Enums).toBe('object');
expect(typeof entry.Slicker.Filters).toBe('object');
expect(typeof entry.Slicker.Formatters).toBe('object');
expect(typeof entry.Slicker.GroupTotalFormatters).toBe('object');
expect(typeof entry.Slicker.SortComparers).toBe('object');
expect(typeof entry.Slicker.Utilities).toBe('object');
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.Aggregators).toBe('object');
expect(typeof entry.Editors).toBe('object');
expect(typeof entry.Enums).toBe('object');
expect(typeof entry.Filters).toBe('object');
expect(typeof entry.Formatters).toBe('object');
expect(typeof entry.GroupTotalFormatters).toBe('object');
expect(typeof entry.SortComparers).toBe('object');
expect(typeof entry.Utilities).toBe('object');
});
});
Loading

0 comments on commit 214d8e7

Please sign in to comment.