UNPKG

nodekit-cli

Version:

A command-line tool for creating {NK} NodeKit applications

87 lines (65 loc) 2 kB
<!-- # # Licensed to OffGrid Networks (OGN) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. OGN licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. # --> # NodeKit-Lib ## ConfigParser wraps a valid nodekit nodekit.json file ### Usage ### Include the ConfigParser module in a projet var ConfigParser = require('nodekit-cli')['nodekit-cli-lib'].configparser; ### Create a new ConfigParser var config = new ConfigParser('path/to/nodekit/json/'); ### Utility Functions #### packageName(id) returns document root 'id' attribute value #### Usage config.packageName: function(id) /* * sets document root element 'id' attribute to @id * * @id - new id value * */ #### setPackageName(id) set document root 'id' attribute to function(id) { this.doc.getroot().attrib['id'] = id; }, ### name: function() { return getNodeTextSafe(this.doc.find('name')); }, setName: function(name) { var el = findOrCreate(this.doc, 'name'); el.text = name; }, ### read the description element config.description() var text = "New and improved description of App" setDescription(text) ### version management version() android_versionCode() ios_CFBundleVersion() setVersion() ### read author element config.author(); ### read preference config.getPreference(name);