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

panela

v0.2.0

Published

A lightweight web development framework, rich in functionality.

Downloads

5

Readme

panela

A lightweight web development framework, rich in functionality.

Highlights

  • Static pages are served with nginx.
  • Subdomains + ssl updgrades are also handled with nginx.
  • Dynamic pages are rendered with express.
  • Works with most Connect middlewares, and all Express middlewares.
  • Database configuration with model scaffolding is powered by knex.
  • Includes a watchable build processor w/ a seamless LiveReload integration.

Panela is a framework intended to be a practical tool for web development.

As a web developer you may need to create frontend heavy website with no or very little server-side features, or a server-side heavy site with multiple domains.

Panela provides an intuitive and familiar api.

If you are familiar with express, Panela's api is very similar, and you can take advantage of existing express middlewares.

Panela lets you create hosts on-the-go

The hosts file in your OS is automatically modified so can preview your website locally using the intended domain name. Also, a nginx configuration file is created so that you can host multiple domains, locally.

This is done through the host method, and the only required argument is the domain name. Panela handles serving static files as well as forwarding to a express server.

Panela serves a configurable live reload script to all html pages.

By taking advantage of the Build Processor api, files that are built can be watched for changes and update a page being previewed in the browser automatically.

This feature is not included in a production enviroment.

Installation

npm i panela --save

Basic Usage

const panela = require('panela');

const app = panela();

app.host('chiki.com', {})
  .get('/', '~/Home.html')
  .get('/add/:url', (req, res) => {
    res.end('ok');
  })
  .get('/:hash', (req, res) => {
    res.end('ok');
  })

app.listen()
  .then((hostname, port, pid) => {
    console.log('Ok!');
  })
  .catch(e => console.log(e));

Advance Usage

const panela = require('panela');

const app = panela();

app.builder('website', {
  out: './dist'
})
.step((done) => {
  // Create Directory
  done();
})
.step((done) => {
  // Create Directory
  done();
})
.step((done) => {
  // LESS
  done();
})
.step((done) => {
  // JS
  done();
})
.step((done) => {
  // FONTS
  done();
})
.step((done) => {
  // Images, Videos, Audio
  done();
});

app.database('main', {
  client: 'sqlite',
  connection: {
    filename: './chiki.db'
  },
  migrations: {
    extension: 'js',
    tableName: 'knex_migrations',
    directory: './migrations',
    disableTransactions: false
  },
  pool: { max: 10, min: 2 },
  seeds: {
    extension: 'js',
    directory: './seeds'
  },
  useNullAsDefault: true,
});

app.engine('mustache-regexp', {
  views: '~/views',
  extension: 'html',
  defaultLocals: {},
  defaultLayout: '',
  render: (path, options={}) => {
    const { layout, locals } = options;
    return new Promise((ok, bad) => {
      ok('<render>');
    });
  }
});

app.host('chiki.com', {
  port: 80,
  nginx: {},
})
.options('/', (req, res) => {
  res.end();
})
.get('/', (req, res) => {
  res.end();
})

app.host('static.chiki.com', {})
.static('~/static/')

app.host('chiki.com', {})
.get('/', '~/Home.html')
.get('/add/:url', (req, res) => {
  res.end('ok');
})
.get('/x/:url', (req, res) => {
  res.end('ok');
})
.get('/:hash', (req, res) => {
  res.end('ok');
})

app.host('api.chiki.com', {})
.get('/', (req, res) => {
  res.json({ok: true});
})
.get('/:hash', (req, res) => {
  res.json({ok: true});
})
.post('/:hash', (req, res) => {
  res.json({ok: true});
})
.route('/extra', route => {
  route
  .get('/', '~/extra.html')
  .get('/apples', '~/extra-apples.html')
  .get('/oranges', '~/extra-oranges.html')
  .route('/eat', route => {
    route.get('/', 'xxx');
    route.post('/eat', 'xxx');
  })
})

app.builder('website').build()
.then(b => {
  app.database('main').latest()
  .then(k => {
    app.listen()
    .then(l => {
      console.log('Ok!');
    })
    .catch(e => console.log(e));
  })
  .catch(e => console.log(e))
})
.catch(e => console.log(e));