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

tizen-config-loader

v0.1.0

Published

Help deal with Tizen config files.

Downloads

4

Readme

tizen config loader for webpack Version Build Status

Parses your Tizen config.xml file, loading your <icon> file, and respecting your publicPath configuration.

It also treats your config file as a lodash template, so you can interpolate variables or add any other logic you need.

Installation

$ npm install --save tizen-config-loader

Usage

Documentation: Using loaders

Say you are using html-webpack-plugin for your Tizen project, and you want to add a config file. Your HTML template template.ejs could look like this:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title><%= htmlWebpackPlugin.options.title %></title>
    <link rel="config" href="<%= require('./config.xml') %>" />
  </head>
  <body>
    <div id="root"></div>
  </body>
</html>

Your config.xml file could look like this:

<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen="http://tizen.org/ns/widgets" id="<%= widgetId %>" version="<%= version %>" viewmodes="maximized">
  <tizen:application id="<%= packageId %>.<%= packageName %>" package="<%= packageId %>" required_version="2.3"/>
  <name><%= packageName %></name>
  <description><%= packageDescription %></description>
  <license href="https://opensource.org/licenses/<%= license %>"><%= license %></license>
  <author href="<%= author.url %>" email="<%= author.email %>"><%= author.name %></author>
  <icon src="./icon_117x117.png"/>
  <content src="index.html"/>
  <feature name="http://tizen.org/feature/screen.size.normal.1080.1920"/>
  <tizen:profile name="tv-samsung"/>
  <tizen:setting screen-orientation="landscape" context-menu="enable" background-support="disable" encryption="disable" install-location="auto" hwkey-event="enable"/>
</widget>

And your webpack.config.js file would glue everything together:

var HtmlWebpackPlugin = require('html-webpack-plugin')

module.exports = {
  entry: {
    app: './index.js'
  },

  output: {
    path: './dist/',
    filename: '[name].js'
  },

  module: {
    rules: [
      {
        test: /config\.xml$/,
        include: /assets\//,
        use: [
          {
            loader: 'file-loader',
            options: {
              name: '[name].[ext]'
            }
          },
          {
            loader: 'tizen-config-loader',
            options: {
              name: 'foobar',
              description: 'Just an example.',
              version: '1.0.0',
              license: 'MIT',
              private: true,
              author: {
                name: 'Daniel Perez Alvarez',
                email: '[email protected]',
                url: 'https://unindented.org/'
              },
              widgetId: 'https://github.com/unindented/tizen-config-loader',
              packageId: 'foobar',
              packageName: 'Foobar',
              packageDescription: 'An example of how to use this loader.',
            }
          }
        ]
      },
      {
        test: /\.png$/,
        include: /assets\//,
        use: {
          loader: 'file-loader',
          options: {
            name: '[name].[ext]'
          }
        }
      }
    ]
  },

  plugins: [
    new HtmlPlugin({
      title: 'Foobar',
      template: './assets/template.ejs'
    })
  ]
}

Running webpack would produce all the necessary files as expected:

$ npm run build

> [email protected] build /Users/daniel/Code/tizen-config-loader/example
> webpack

Hash: 78a7179e776b6ec428af
Version: webpack 3.0.0
Time: 449ms
           Asset       Size  Chunks             Chunk Names
      config.xml  926 bytes          [emitted]
icon_117x117.png    0 bytes          [emitted]
          app.js     2.5 kB       0  [emitted]  app
      index.html  332 bytes          [emitted]
   [0] ./index.js 22 bytes {0} [built]
Child html-webpack-plugin for "index.html":
               Asset       Size  Chunks             Chunk Names
          config.xml  926 bytes          [emitted]
    icon_117x117.png    0 bytes          [emitted]
       [0] ./node_modules/html-webpack-plugin/lib/loader.js!./assets/template.ejs 767 bytes {0} [built]
       [2] (webpack)/buildin/global.js 509 bytes {0} [built]
       [3] (webpack)/buildin/module.js 517 bytes {0} [built]
       [4] ./assets/config.xml 56 bytes {0} [built]
       [5] ./assets/icon_117x117.png 62 bytes [built]
        + 1 hidden module

Go to the example folder and try it yourself:

$ cd example
$ npm install
$ npm run build

Meta

Contributors

License

Copyright (c) 2017 Daniel Perez Alvarez (unindented.org). This is free software, and may be redistributed under the terms specified in the LICENSE file.