npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@coon-js/siesta-lib-helper

v0.2.0

Published

Collection of utility- and helper-methods when working with Siesta (https://bryntum.com) in an ExtJS-Browser environment.

Downloads

26

Readme

@coon-js/siesta-lib-helper MIT npm version build

Easy setup for testing Ext JS with Siesta.

About

This npm-package provides a collection of utility- and helper-methods for Siesta and Ext JS.

Installation

To use this package with Ext JS-projects, include the package as a devDependency:

$ npm i --save-dev @coon-js/siesta-lib-helper

A binary of @coon-js/siesta-lib-helper can then be called:

npx siesta-lib-helper

Usage

Using the BoilerPlate.js for setting up Ext JS Browser Environment

The BoilerPlate.js contains code that automatically creates an Ext JS-testing environment. To use the BoilerPlate, it should be sufficient to copy the index.extjs-browser.html into the target directory where your tests should run. Paths should be adjusted accordingly, if your testing environment does not match the following structure:

(In this example, index.extjs-browser.html will be placed into tests)

./[MODULE_ROOT]
./node_modules
./tests

To simplify setting up your testing environment, siesta-lib-helper is available as a cli-programm that will copy a tests.redirect.html- and a index.extjs-browser.html-file into your module:

$ npx siesta-lib-helper
./tests/index.extjs-browser.html
./tests.redirect.html

Note: tests.redirect.html serves as a redirect in case your local web server requires a file being specified as the index of the document-root. It is not require to properly create the Ext JS-Testing-Browser.

getPaths()

The following example shows how to use a test.config.js for configuring the tested environment to be used with Siesta.Harness.Browser.ExtJS. The corresponding builds and paths for the Ext JS-library were automatically created with @coon-js/extjs-link.

index.html

<!DOCTYPE html>
<html>
<head>
    <title>example</title>
    <link rel="stylesheet" type="text/css" href="../node_modules/siesta-lite/resources/css/siesta-all.css">
    <script type="text/javascript" src="../node_modules/siesta-lite/siesta-all.js"></script>
    <script type="module" src="index.js"></script>
</head>
<body>
</body>
</html>

index.js contains the instantiation of the browser-class and configures the Siesta-Browser with the required options:

index.js:

import groups from "./groups.config.js"; // contains test-structure
import testConfig from "./tests.config.js";
import {getPaths} from "../node_modules/@coon-js/siesta-lib-helper/dist/siesta-lib-helper.runtime.esm.js";

const 
    browser = new Siesta.Harness.Browser.ExtJS(),
    isModern = window.location.href.indexOf("toolkit=modern") !== -1,
    paths = getPaths(testConfig, isModern);

browser.configure(Object.assign({
    title: "example - " + (isModern ? "modern" : "classic"),
    isEcmaModule: true,
    disableCaching: true
}, paths));


browser.start(...groups);

In this example, the configuration looks like this. While the loaderPath is most of the time depending on the existing resources you want to include in your tests, the preload of the Ext JS-library is mandatory:

tests.config.js

export default {
    loaderPath: {
        "Ext.Package": "../node_modules/@coon-js/extjs-package-loader/packages/package-loader/src/Package.js",
        "Ext.package": "../node_modules/@coon-js/extjs-package-loader/packages/package-loader/src/package",
        "coon.core.overrides.core": "../overrides",
        "coon.core.fixtures": "./fixtures",
        "coon.core": "../src/",
        "coon.test": "./src"
    },
    preload: {
        css: {
           modern: [
               "./build/extjs-link/extjs/modern/theme-triton/resources/theme-triton-all-debug.css"
           ],
           classic: [
               "./build/extjs-link/extjs/classic/theme-triton/resources/theme-triton-all-debug.css"
           ]
       
        },
        js: ["../node_modules/@l8js/l8/dist/l8.runtime.umd.js", {
                modern: "./build/extjs-link/extjs/modern/ext-modern-all-debug.js",
                classic: "./build/extjs-link/extjs/classic/ext-all-debug.css"
        }]
    }
};

configureWithExtJsLinkPaths()

A helper method to inject the configuration generated by @coon-js/extjs-link into a configuration as defined by a tests.config.js-file, then passing it to getPaths(). Basically, toolkit-groups defined in both files get merged.

index.html

<!DOCTYPE html>
<html>
<head>
    <title>example</title>
    <link rel="stylesheet" type="text/css" href="../node_modules/siesta-lite/resources/css/siesta-all.css">
    <script type="text/javascript" src="../node_modules/siesta-lite/siesta-all.js"></script>
    <script type="module" src="index.js"></script>
</head>
<body>
</body>
</html>

index.js contains the instantiation of the browser-class and configures the Siesta-Browser with the required options:

index.js:

import testConfig from "./tests.config.js";
import groups from "./groups.config.js";
import {configureWithExtJsLinkPaths} from "../node_modules/@coon-js/siesta-lib-helper/dist/siesta-lib-helper.runtime.esm.js";

const 
    browser = new Siesta.Harness.Browser.ExtJS(),
    isModern = window.location.href.indexOf("toolkit=modern") !== -1,
    paths = await configureWithExtJsLinkPaths(testConfig, "../.extjs-link.conf.json", isModern);
console.log(paths);
browser.configure(Object.assign({
    title: "extjs-lib-core - " + (isModern ? "modern" : "classic"),
    isEcmaModule: true,
    disableCaching: true
}, paths));


browser.start(...groups);

.extjs-link.conf.json

 
   {
        "css": [{
                "modern": [
                    "foo.css"
                ],
                "classic": [
                    "bar.css"
                ]
        }],
        "js": {
                "modern": "modern.js",
                "classic": "classic.js"
       }
    }

tests.config.js

export default {
    loaderPath: {
        "Ext.Package": "../node_modules/@coon-js/extjs-package-loader/packages/package-loader/src/Package.js",
        "Ext.package": "../node_modules/@coon-js/extjs-package-loader/packages/package-loader/src/package",
        "coon.core.overrides.core": "../overrides",
        "coon.core.fixtures": "./fixtures",
        "coon.core": "../src/",
        "coon.test": "./src"
    },
    preload: {
        css: {
                modern: [
                    "./build/extjs-link/extjs/modern/theme-triton/resources/theme-triton-all-debug.css"
                ],
                classic: [
                    "./build/extjs-link/extjs/classic/theme-triton/resources/theme-triton-all-debug.css"
                ]
           
        },
        js: ["../node_modules/@l8js/l8/dist/l8.runtime.umd.js", {
                modern: "./build/extjs-link/extjs/modern/ext-modern-all-debug.js",
                classic: "./build/extjs-link/extjs/classic/ext-all-debug.css"
           
        }]
    }
};

config produced by configureWithExtJsLinkPaths(testConfig, "../.extjs-link.conf.json", true)

{
    "loaderPath": {
        "Ext.Package": "../node_modules/@coon-js/extjs-package-loader/packages/package-loader/src/Package.js",
        "Ext.package": "../node_modules/@coon-js/extjs-package-loader/packages/package-loader/src/package",
        "coon.core.overrides.core": "../overrides",
        "coon.core.fixtures": "./fixtures",
        "coon.core": "../src/",
        "coon.test": "./src"
    },
    "preload": [
       "foo.css",
       "modern.js",
       "./build/extjs-link/extjs/modern/theme-triton/resources/theme-triton-all-debug.css",
       "foo.css",
       "../node_modules/@l8js/l8/dist/l8.runtime.umd.js",
       "./build/extjs-link/extjs/modern/ext-modern-all-debug.js"
    ]
}

CI

tests

$ npm test

builds

npm run build