@nzz/q-cli
Cli tool to setup new Q tools, new Q server implementations and start Q dev server to test developing Q tools
Last updated 8 months ago by manuelroth .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @nzz/q-cli 
SYNC missed versions from official npm registry.

Q cli Build Status

Maintainer: manuelroth

Table of contents

Installation

npm install -g @nzz/q-cli

to the top

Development

git clone git@github.com:nzzdev/Q-cli.git
cd Q-cli
nvm use
npm install

to the top

Functionality

Q dev server

Once Q cli installed one can start Q dev server by running:

Q server

With the Q dev server running one can now test a tool with fixture data. Of course the respective tool has to be started as well.

  • Default port is 5000 and can be overwritten by using -p or --port as option while starting Q dev server:
Q server -p 4001
  • Default base url of the tool your are currently developing is http://localhost:3000, this can also be changed by passing the option -b or --tool-base-url while starting Q dev server.
Q server -b http://localhost:4000
  • Default target is nzz_ch and can be overwritten by using -t or --target.
Q server -t your_target
  • One can optionally specify a path to a config file by using option -c or --config, e.g.
Q server -c ./config-file-name.js

A config file should export an async function returning a config object. The config object has to contain an object for each target. Target objects can contain

  • tool specific additionalRenderingInfo like additional stylesheets and scripts to load
  • a target specific context which can also contain stylesheets, scripts or background information
  • toolRuntimeConfig containing information which a tool might need at runtime Config file example:
async function getConfig() {
  return {
    nzz_ch: {
      // target name
      additionalRenderingInfo: {
        // additionalRenderingInfo is tool based
        stylesheets: [
          {
            url:
              "https://service.sophie.nzz.ch/bundle/sophie-q@1,sophie-font@1,sophie-color@1,sophie-viz-color@1,sophie-input@1.css"
          }
        ]
      },
      context: {
        // context is target based
        stylesheets: [
          {
            url: "https://context-service.st.nzz.ch/stylesheet/all/nzz.ch.css"
          }
        ],
        background: {
          color: "#fff"
        }
      },
      toolRuntimeConfig: {
        displayOptions: {
          hideTitle: true
        }
      }
    }
  };
}

module.exports = getConfig;

Creating new Q server implementation

Once Q cli is installed one can create the skeleton of a Q server implementation by executing

Q new-server my-server-name
  • The directory name where the server implementation is being created defaults to the server name and can be overwritten by using option -d or --dir
Q new-server my-server-name -d my-server-directory

Creating new tool

Once Q cli is installed one can create the skeleton of a new tool by executing

Q new-tool my-tool-name
  • The directory name where the new tool is being created defaults to the tool name and can be overwritten by using option -d or --dir
Q new-tool my-tool-name -d my-tool-directory

to the top

License

Copyright (c) 2019 Neue Zürcher Zeitung.

This software is licensed under the MIT License.

Current Tags

  • 1.3.11                                ...           latest (8 months ago)

17 Versions

  • 1.3.11                                ...           8 months ago
  • 1.3.10                                ...           9 months ago
  • 1.3.9                                ...           9 months ago
  • 1.3.8                                ...           10 months ago
  • 1.3.7                                ...           10 months ago
  • 1.3.6                                ...           10 months ago
  • 1.3.5                                ...           10 months ago
  • 1.3.4                                ...           10 months ago
  • 1.3.3                                ...           10 months ago
  • 1.3.2                                ...           10 months ago
  • 1.3.1                                ...           10 months ago
  • 1.3.0                                ...           2 years ago
  • 1.2.0                                ...           2 years ago
  • 1.1.2                                ...           2 years ago
  • 1.1.1                                ...           2 years ago
  • 1.1.0                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
Downloads
Today 0
This Week 0
This Month 2
Last Day 0
Last Week 1
Last Month 19
Dependencies (12)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |