• This repository has been archived on 13/May/2021
  • Stars
    star
    1,625
  • Rank 28,787 (Top 0.6 %)
  • Language
    JavaScript
  • License
    Other
  • Created over 9 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Node.js tool for App Generation

DEPRECATION NOTICE

This CLI for PWABuilder is no longer maintained. Please use PWABuilder.com instead. If you need to open an issue for PWABuilder-related things, please do so at https://github.com/pwa-builder/PWABuilder/issues

PWA Builder CLI

This tool is used to create hosted web applications based on a W3C Web App manifest.

Installation

npm install -g pwabuilder

Documentation

To get started, visit our wiki.

Command Line Interface

Usage

pwabuilder <website-url> [options]

-or-

pwabuilder <command> [options]

Options

      Option       Description
website-url URL of the hosted website. This parameter is not required if a manifest location is specified with the -m option
-d, --directory (optional) Path to the generated project files (default value: current directory)
-s, --shortname (optional) Application short name. When specified, it overrides the short_name value of the manifest
-l, --loglevel (optional) Tracing log level options. Available log levels: debug,info,warn,error (default value: warn)
-p, --platforms (optional) Platforms to generate. Supported platforms: windows,windows10,android,ios,web (default value: all platforms)
-m, --manifest (optional) Location of the W3C Web App manifest file (URL or local path). If not specified, the tool looks for a manifest in the site URL. Otherwise, a new manifest will be created pointing to the site URL.
-i, --image (optional) Local path to the image file used to generate missing icons in the manifest
-f, --forceManifestFormat (optional) Allows to specify the manifest format and skip the automatic detection. Can be used when the manifest contains additional, non-standard members.
-c, --crosswalk (optional) Enable Crosswalk for Android. Crosswalk is a web runtime that can be used to replace the stock WebView used by Android Cordova apps. Crosswalk is based on Google Chromium with Cordova API support and has better HTML5 feature support compared to the default WebView available in Android.
-w, --webAppToolkit (optional) Adds the Web App Toolkit cordova plugin. The Web App Toolkit is a plugin for creating Windows, Android and iOS apps based on existing web content. It depends on the Hosted Web App Plugin. Used in the right way, it can facilitate the creation of compelling extensions to your web content for users across platforms.
-S, --Sign (deprecated --optional - for package command) Return a signed package for Windows 10.
-W, --DotWeb (deprecated --optional - for package command) Generate a .web package for Windows 10.
-a, --AutoPublish (deprecated --optional - for package command) Auto-publish a package for Windows 10.

Commands

            Command           Description
package [directory] [options] Creates a package for supported platforms (windows10, android, iOS) for uploading to the Store. In some cases, like Windows 10, data must be pulled from the store and updated in the manifest before it can be uploaded. directory is the root path where to look for the target platforms (defaults to the current location). options: -l | --loglevel, -p | --platforms, -S | --Sign, -W | --DotWeb, -a | --AutoPublish
platform add <platform-id> <source> [options] Adds a new platform. platform-id is the platform to be added. source could be either npm package, a GitHub reporitory or a local path to the platform source code. options: -l | --loglevel
platform remove <platform-id> [options] Removes an existing platform. platform-id is the platform to be removed. options: -l | --loglevel
platform list [options] List the existing platforms. options: -l | --loglevel
run <platform> [directory] [options] Launches the app of the specified platform. Currently, android, ios, windows and windows10 platforms are supported by this command. directory is the root path where to look for the target platforms (defaults to the current location). options: -l | --loglevel
open <platform> [directory] [options] (for Windows only) Opens the project file of the generated Windows 8.1 / Windows 10 app in Visual Studio. directory is the root path where to look for the target platforms (defaults to the current location). options: -l | --loglevel

Example

Creating a new hosted web application

pwabuilder http://shiftr.azurewebsites.net -d C:\Projects -l info -p windows10,android

Packaging a Windows 10 app for submission to the Store

pwabuilder package -p windows10 -l debug

Client Library

Manifest Module

var manifestTools = require('manifestTools');

getManifestFromSite(siteUrl, callback)

Retrieves a manifest from a website. It looks for a manifest meta tag in the HTML content of the specified website URL; if no manifest is found, a new W3C manifest is retrieved with default start_name and short_name values.

siteUrl is the URL of the website that hosts the manifest.

callback(err, manifestInfo) returns an error or the manifest object in manifestInfo.

getManifestFromFile(filePath, callback)

Retrieves a manifest from a local path.

siteUrl is the path there the manifest file is located.

callback(err, manifestInfo) returns an error or the manifest object in manifestInfo.

writeToFile(manifestInfo, filePath, callback)

Writes manifest info to the specified path. manifestInfo Manifest data in JSON format.

filePath The path to write to.

callback(err, validationResults) returns an error or an array of validation results.

fetchManifestUrlFromSite(siteUrl, callback)

If found, gets the manifest URL from the specified website URL.

siteUrl is the URL of the website.

callback(err, content) returns an error or a content object with start_url and short_name members.

downloadManifestFromUrl(manifestUrl, callback)

Downloads the manifest from the specified URL.

manifestUrl is the URL of the manifest.

callback(err, manifestInfo) returns an error or the manifest object in manifestInfo.

validateAndNormalizeStartUrl(siteUrl, manifestInfo, callback)

Validates the format of the manifest is a W3C manifest format.

siteUrl is the URL of the website.

manifestInfo is the manifest's data in JSON format.

callback returns an error or the manifest object in manifestInfo.

convertTo(manifestInfo, outputFormat, callback)

Converts the manifest data to the specified output format.

manifestInfo is the manifest's data in JSON format.

outputformat is the format to which the manifest will be converted.

callback(err, manifestInfo) returns an error or the manifest object in manifestInfo.

validateManifest(manifestInfo, targetPlatforms, callback)

Makes sure the manifest is valid for the specified target platforms.

manifestInfo is the manifest's data in JSON format.

targetPlatforms are the platforms to validate against.

callback(err, validationResults) returns an error or an array of validation results.

manifestInfo format

manifestInfo.content stores the manifest content.

manifestInfo.format specifies the type of manifest (possible values: W3C, undefined).


Builder Module

var projectBuilder = require('projectBuilder');

createApps(w3cManifestInfo, rootDir, platforms, options, callback)

Generates the applications for the specified platforms.

w3cManifestInfo is the manifest's data in JSON format.

rootDir is the root directory where the apps will be generated.

platforms a string array specifying one or more target platforms: windows10,windows,android,ios,web.

options an object with one or more properties that customize the generated application:

callback(err) returns an error, if any.


Project Tools module

var projectTools = require('projectTools');

runApp(platform, callback)

Execute the app for the chosen platform.

platform The app will execute for the selected platform.

callback returns an error, if any.

openVisualStudio(callback)

Opens the Visual Studio project.

callback returns an error, if any.


Unit Tests

In the terminal, install the Grunt task runner:

npm install -g grunt-cli

In order to run tests and jshint, execute the following command:

grunt

Supported Input Manifests

We plan to support the following manifest files in the future:

Navigation Scope

The W3C manifest defines a scope that restricts the URLs to which the application can navigate. PWA Builder supports the scope setting for the Android, iOS and Windows platforms (more details here).

Changelog

Releases are documented in GitHub.

Known Issues

  • Creating the directory shortcuts to the Cordova platform-specific projects may fail when running in the Windows environment. The tool reports _"WARNING: Failed to create shortcut for Cordova platform: XXXX."__ where XXXX is ios, windows, or android. This is caused by an issue in Node.js which has been fixed in more recent releases. To resolve this issue, upgrade Node.js to the latest version.

  • Adding the windows platform in the Linux and Mac OS environments fails. The tool reports "WARNING: Failed to add the Cordova platforms: XXXX." where XXXX includes windows. This is caused by an issue in the Windows platform for Cordova. Depending on the cordova-windows version, running the tool can show one of two errors: "Cannot find module 'Q'." or "No such file or directory.". Until this problem is fixed by Cordova, we've removed the windows platform from the default list when creating the app in Linux or Mac OS.

  • Error when building an iOS application for projects generated in a Windows machine and then copied to an OS X machine. Xcode reports "Shell Script Invocation Error - Command /bin/sh failed with exit code 126". This happens when the execution permission (+x) is lost on some scripts when copying between the different file systems.

    To resolve this, open a Terminal window in OS X and execute the following command to restore the executable bit on the script.

    chmod +x [path to the PWA Builder project]/cordova/platforms/ios/cordova/lib/copy-www-build-step.sh
    
  • Issues in Visual Studio 2015 RC with the Windows solution generated by Cordova:

    • Opening the CordovaApp.sln solution file might hang Visual Studio while loading the Windows 8 project. As a workaround, remove the Windows 8 project file from the solution.
    • When building the solution, Visual Studio reports the following error in the Windows 10 project: "'ValidateAppxManifest' failed. Unspecified error". As a workaround, clean and rebuild the solution.

License

PWA Builder

Copyright (c) Microsoft Corporation

All rights reserved.

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

More Repositories

1

PWABuilder

The simplest way to create progressive web apps across platforms and devices. Start here. This repo is home to several projects in the PWABuilder family of tools.
TypeScript
2,693
star
2

pwa-starter

Welcome to the PWABuilder pwa-starter! Looking to build a new Progressive Web App and not sure where to get started? This is what you are looking for!
TypeScript
1,148
star
3

pwa-install

Web Component from the PWABuilder team that brings an awesome "install" experience to your Progressive Web App!
JavaScript
365
star
4

pwa-auth

Web component that lets your users sign-in/sign-up using their Microsoft, Google, Facebook, or Apple account. Your app receives their email address, name, and profile picture.
TypeScript
205
star
5

CloudAPK

Build Android APK packages on the cloud
TypeScript
143
star
6

pwabuilder-serviceworkers

JavaScript
118
star
7

ManifoldCordova

JS Plugin for Cordova
JavaScript
94
star
8

pwa-studio

PWA Studio makes VSCode the best developer platform for building PWAs!
TypeScript
74
star
9

pwa-update

pwa-update is a web component from the PWABuilder team that brings an awesome "update" experience to your Progressive Web App!
TypeScript
71
star
10

web-whiteboard

TypeScript
70
star
11

pwabuilder-ios

iOS platform for PWABuilder
C#
69
star
12

pwabuilder-web

PWABuilder Web Platform
JavaScript
52
star
13

pwa-inking

A web component that adds a 2D inking canvas (and optional toolbar) to your PWA 🎨 ✨
TypeScript
45
star
14

pwabuilder-blog

Blog for PWABuilder
Nunjucks
33
star
15

pwabuilder-snippits

JavaScript
31
star
16

pwabuilder-MacOS

A Mac client for PWAs
JavaScript
29
star
17

pwabuilder-vscode-extension

TypeScript
25
star
18

pwabuilder-windows10

PWABuilder Windows 10 Platform
JavaScript
15
star
19

pwa-features

Welcome to the PWABuilder components and demos showcase!
TypeScript
13
star
20

pwabuilder-lib

PWABuilder Core Library
JavaScript
13
star
21

pwabuilder-api

Node.js API for PWABuilder
JavaScript
13
star
22

pwabuilder-windows-chromium-docs

Docs for users of PWABuilder's Windows platform built atop Edge Chromium
13
star
23

pwabuilder-android

PWABuilder Android Platform
JavaScript
12
star
24

pwabuilder-docs

documentation site for pwabuilder
HTML
12
star
25

pwabuilder-api-v2

Our new, Azure Functions based API for PWABuilder
TypeScript
9
star
26

pwabuilder-android-twa

PWABuilder Android Trusted Web Activity Platform
JavaScript
7
star
27

pwa-starter-vanilla

JavaScript
6
star
28

manifest-previewer

Web component that helps you visualize your manifest.json file!
TypeScript
6
star
29

pwabuilder-oculus

PWABuilder platform for Oculus PWAs
C#
6
star
30

pwa-cli

This is a new CLI we are working on that will enable you to use all the features of PWABuilder locally on your machine!
TypeScript
6
star
31

manifoldjs-edgeextension

ManifoldJS Edge Extension Platform
JavaScript
6
star
32

manifoldjs-cordova

ManifoldJS Cordova Platform
JavaScript
6
star
33

chatgpt-poc

This prototype explores possibilities and horizons of using LLM like ChatGPT in PWA development
TypeScript
5
star
34

pwabuilder-MSTeams

Microsoft Teams platform for PWABuilder
JavaScript
5
star
35

pwa-screenshots

TypeScript
4
star
36

vscode-extension

TypeScript
4
star
37

manifoldjs-strawman

base template for new Manifoldjs platform
JavaScript
4
star
38

pwab-push

JavaScript
3
star
39

pwabuilder-components

TypeScript
3
star
40

serviceworker-finder

.NET solution that uses Puppeteer (headless Chrome) to find a service worker from a given URL
C#
3
star
41

contoso-pwa

TypeScript
2
star
42

pwa-snippets

New PWABuilder VSCode snippits that make it super easy to improve the UX of your PWA!
2
star
43

pwa-journal-workshop

This repository contains the source code and solutions for the Progressive Web App Intro Workshop.
TypeScript
2
star
44

pwabuilder-signin-functions

TypeScript
2
star
45

pwabuilder-manifest-finder

C#
2
star
46

pwabuilder-chromium-extension

Hackathon Project - An experiment, not officially supported.... for now 😊
TypeScript
2
star
47

zip-creator

Azure compute microservice for fetching image files and generating a zip for download.
TypeScript
2
star
48

integration-tests

JavaScript
2
star
49

safe-url-proxy

Azure function app that fetches a URL and returns its contents. Used when CloudAPK is blocked from fetching a web resource
C#
2
star
50

pwa-docs

A documentation repo for the PWA Builder tool chain, built with Docsify!
1
star
51

pwa-simulator

Experience your PWA!
TypeScript
1
star
52

docker-image-for-oculus

Dockerfile
1
star
53

.github

Default Community Health Files for the PWA-Builder organization on GitHub
1
star
54

pwa-starter-basic

The Basic PWA Starter is a simplified version of the PWA Starter with reduced dependencies and a vanilla JS service worker.
TypeScript
1
star
55

pwabuilder-samsung

JavaScript
1
star
56

hackathon-inking-test

Test repo for the Hackathon Core team.
TypeScript
1
star
57

pwabuilder-sw-server

TypeScript
1
star
58

pwa-ratings

A web component that prompts your users to leave a rating or review in the Microsoft Store 📋🎯💯
TypeScript
1
star
59

pwa-whisper-starter

TypeScript
1
star