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

codenameone-cli

v1.1.38

Published

Toolkit for building Cross-platform mobile applications in Java

Downloads

17

Readme

codenameone-cli

Command-line tools for Codename One

Project Status: This project is at a very early stage. If you want to get started with Codename One, building cross-platform mobile apps in Java, I recommend you start with the official Codename One Getting Started Tutorial. Once you are familiar with the toolkit, you may want to revisit this command-line tool as it aims to boost development productivity, especially for developers who are comfortable with the command-line.

Features

Creating Projects

  • Create new Codename One projects for Netbeans, Eclipse, or IntelliJ
  • Use any existing CN1 project as a template.
  • Select existing template from GUI template browser
  • Run templates in Codename One simulator

Running Apps

  • Run Codename One apps in the CN1 simulator

Distributing Apps

  • Easily build and distribute your CN1 applications directly from the command-line

Project Settings

  • Open Codename One settings for projects from the command-line

Requirements

  • NodeJS - Only used for distribution of the tool via NPM

Installation

Windows

npm install -g codenameone-cli

Linux/Mac

sudo npm install -g codenameone-cli

NOTE: The above commands will install it globally, and you require admin permissions to do this typically (hence the sudo in the linux/mac command). You can also install it locally, using npm install codenameone-cli in which case the command will be installed at ./node_modules/.bin/cn1.

Usage

General Usage

Usage: codenameone-cli [command]

Commands:
  create - Create a new Codename One Project
  settings - Open project settings for project in current directory.
  css - CSS-related commands
  test - Unit-test related commands
  install-jars - Install latest jars into project
  install-tests - Install tests.xml file with some test targets
  install-appium-tests - Install appium.xml file with some appium tests defined.
  git-init - Same as git init, but adds suitable .gitignore file.
  git-clone - Same as git clone, but installs jars.  

Creating Projects

cn1 create <dest-dir> <package-id> <main-class-name> [-i Netbeans|Eclipse|IntelliJ] [-t http://example.com/project/template.zip]

Examples

Creating a basic project in directory named "helloworld":

cn1 create helloworld com.mycompany.hello HelloWorld

Follow the prompt for the other details (e.g. package id, main class, IDE, template, etc...)

Using the GUI "create project wizard" ... Just add -g flag:

cn1 create helloworld -g

This will open a GUI form that allows you to browse and select a template to use for the project.

Create project form

You can click on any of the templates, and get more details about it, or run the template inside the Codename One simulator directly.

Template details panel

Specifying Template and IDE in Command-line

cn1 create helloworld com.mycompany.hello HelloWorld \
    -i Netbeans \
    -t https://github.com/codenameone/SQLSample/archive/master.zip

Opening Project Settings

Navigate to any Codename One project directory, and type:

cn1 settings

This will open the Codeame One settings app so you can configure your project (e.g. add cn1libs, set up iOS signing, add build-hints etc..

Contributing Application Templates

The templates listed in the "Create Project Form" are all loaded from this json file hosted on Github. To add your own templates, you can simply fork the codenameone-templates project, and add your template to that JSON file. Then issue a pull request. We'll review it and merge it if appropriate.

Of course, templates don't need to be listed there to be available for use. If your Codename One project is on Github, you can simply provide the "master.zip" URL as the -t parameter of cn1 create and the template will be used.

Cloning Projects From github

Generally, when we host Codename One projects on Github, we strip out the common binaries like CodenameOne.jar, JavaSE.jar, etc... This can be a little annoying when you are cloning projects because you have to first copy the jar files back into the project before you can build it. The cn1 git-clone command is a thin wrapper around git clone that will automatically perform this housekeeping for you.

Example Usage

Let's take the KitchenSink project, for example.

$ cn1 git-clone https://github.com/codenameone/KitchenSink
Cloning into 'KitchenSink'...
Installing jars into KitchenSink...
Downloading 11606508 bytes
Download completed!
Project ready at KitchenSink

NOTE: It also works to specify only the project using "ownername/projectname", e.g. cn1 git-clone codenameone/KitchenSink

Now we can immediately build this project:

$ cd KitchenSink
$ ant jar

Or run it in the Codename One simulator:

$ ant run

Bonus Points: You can clone and run the project in a single line with:

$ cn1 git-clone https://github.com/codenameone/KitchenSink && cd KitchenSink && ant run

Finding Projects To clone

Use the list-demos command to find Codename One projects that can be cloned using the git-clone command.

Example

[source,bash]

$ cn1 list-demos

You'll get a readout like:

[source,bash]

shannah/GeoVizDemo : A demo app using the Codename One GeoViz Library

Adding Your Own Demos

The list-demos command lists all projects on Github that are tagged with both the codenameone and demo topics. If you have a demo project that you are hosting on Github, all you need to do is add these topics to your project, and your project will be returned by the list-demos command.