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

@kano/kit-app-shell-core

v0.0.3-alpha.90

Published

Set of tools to bundle, transpile and compress apps.

Downloads

11

Readme

KASH Core

Set of tools to bundle, transpile and compress apps.

Creating a project

This guide will explain how to create a minimal project that can be used to output an application on all the platforms supported by kit-app-shell

index.js

Create an index.js file and input the following:

// This is your app main class, the bridge between the shell and your web content
class App {
    // When your app is created, it is given a bus to communicate with the backend and
    // a config object containing your project's config
    constructor(bus, config) {
        // kit-app-shell will be looking for this property to be set as the root of your DOM tree
        this.root = document.createElement('div');
        // Show something
        this.root.innerText = 'Hello World'
    }
}

// By calling this method, you provide the shell your App class and it will be used to start the app
Shell.define(App);

With this simple configuration, you can already run kash run web ./ in your project's directory (Make sure you have @kano/kit-app-shell-web installed) and open a browser to the given URL. You should now see your Hello World message.

Environment and config

Each app is ran or built for a target environment. This environment can be defined using the --env flag with the CLI, its default value will be development Config managment for your project is done through a set of JSON files under your project's config directory.

Create a config directory and a default.json inside. The default.json file will always be loaded, but its values can be overriden by a config file matching an environment. If you add a development.json file both default and development config will be loaded and values in the development config will override the default values. Common environments are staging, production, rc, test.

You can retrieve the app's environment at runtime through the ENV property in the config object.

In your newly created default.json, add the following:

{
    "APP_ID": "com.acme.app",
    "APP_NAME": "My App"
}

Then update your index.js:

class App {
    constructor(bus, config) {
        this.root = document.createElement('div');
        this.root.innerText = `${config.APP_NAME} - ${config.ENV}`;
    }
}

Shell.define(App);

Refreshing your browser page should now display the message My App - development, you can try running kash run web ./ --env=<env> with different environment to see the changes

Versioning

The version of the app will be loaded from your project's package.json and will be added to the config object under the VERSION key.

Add a package.json file in your project if it doesn;t already have one. Set the version field to a custom version.

Update your index.js again to use the VERSION key from the config:

this.root.innerText = `${config.APP_NAME} - ${config.ENV} running version ${config.VERSION}`;