Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added cordova/mobile template + bugfixes #113

Merged
merged 93 commits into from
Aug 1, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
06b9ee6
Added mobile prompts
sinedied May 19, 2017
8a8eaf8
Added cordova base packages and scripts
sinedied May 19, 2017
cea7a44
Added config.xml
sinedied May 19, 2017
26f69e4
Added ionic/mobile dependencies
sinedied May 19, 2017
800bcec
Fixed template
sinedied May 19, 2017
7682e8b
Added platform init
sinedied May 19, 2017
9a8279c
Breaking change: disabled IE polyfills by default
sinedied Jul 7, 2017
7c11045
Added ionic theming
sinedied Jul 7, 2017
49a5550
Updated cordova config
sinedied Jul 7, 2017
1198b51
Updated browser support for mobile
sinedied Jul 7, 2017
cd35341
Fixed typo
sinedied Jul 7, 2017
7f18ef6
Include ionic style
sinedied Jul 7, 2017
2ffc941
Removed ionic package dependency
sinedied Jul 24, 2017
94b92e9
Fixed install
sinedied Jul 24, 2017
0952db5
Removed translations from assets (fixes #101)
sinedied Jul 24, 2017
0881fdb
Fixed #102
sinedied Jul 24, 2017
bbd56cd
Removed extra translate directive
sinedied Jul 24, 2017
b1646a9
Changed absolute path to relative (fix IDE linters)
sinedied Jul 24, 2017
4c0fd0a
Updated translations
sinedied Jul 24, 2017
1e1c38a
Added silent option for npm subscripts
sinedied Jul 24, 2017
1916fd6
Fixed translations conditions
sinedied Jul 24, 2017
0452056
Re-enabled polyfills (needed for PhantomJS)
sinedied Jul 24, 2017
7395ad7
Updated dependencies
sinedied Jul 24, 2017
2818fed
Updated stylelint rules
sinedied Jul 24, 2017
88e399d
Added PWA manifest (#93)
sinedied Jul 24, 2017
a52f005
Updated ionic theme
sinedied Jul 24, 2017
7baad47
Added cordova script and mobile target
sinedied Jul 24, 2017
4dc4cba
Fixed target condition
sinedied Jul 24, 2017
e2f9bae
Fixed server URL in production builds
sinedied Jul 24, 2017
6d5df59
Ionic app module
sinedied Jul 24, 2017
04a0138
Ionic shared module
sinedied Jul 24, 2017
d038e86
Fixed extra coma
sinedied Jul 24, 2017
6100091
Updated dependencies
sinedied Jul 24, 2017
d9e19a9
Ionic login module
sinedied Jul 24, 2017
f0b59fa
Ionic home module
sinedied Jul 24, 2017
e6eb88f
Browser language is now used as default (closes #103)
sinedied Jul 24, 2017
b1441d2
Fixed #102
sinedied Jul 24, 2017
470fb92
Fixed #104
sinedied Jul 24, 2017
7b751d4
Bumped core dependency
sinedied Jul 24, 2017
888fe28
Ionic core module
sinedied Jul 24, 2017
5a8e2a5
Ionic about module
sinedied Jul 24, 2017
363fcdf
Added ionic without authentication template
sinedied Jul 24, 2017
8e1280c
Added ionic test cases
sinedied Jul 24, 2017
497e37e
Added support for multiple targets (closes #105)
sinedied Jul 24, 2017
b1c1c49
Fixed jasmine-spec-reporter version
sinedied Jul 24, 2017
ea5d331
Fixed npm warning filtering
sinedied Jul 24, 2017
a9e3bc4
Fixed indentation issues
sinedied Jul 24, 2017
75e7179
Fixed cordova target
sinedied Jul 24, 2017
026d295
Fixed indentation
sinedied Jul 24, 2017
0824c2d
Fixed line breaks
sinedied Jul 24, 2017
c3779e2
Fixed unit test
sinedied Jul 24, 2017
e1c2dbb
Fixed ionic module init
sinedied Jul 24, 2017
0c45918
Made ionic default choice for cordova apps
sinedied Jul 24, 2017
e45349b
Fixed e2e tests
sinedied Jul 24, 2017
0fda14d
Updated to fixed angular-cli version
sinedied Jul 24, 2017
8e58bb5
Changed build tasks
sinedied Jul 27, 2017
a4d6938
Fixed ionic/no auth template
sinedied Jul 27, 2017
6bf22b7
Fixed test script
sinedied Jul 27, 2017
5a57a2a
Added cordova command documentation and updated readme
sinedied Jul 27, 2017
2a937a5
Updated tasks
sinedied Jul 28, 2017
5d403c5
Updated readme
sinedied Jul 28, 2017
e1c3953
Added cordova icon/splash and fixed config.xml
sinedied Jul 28, 2017
aad2e64
Updated default logo, favicon and added apple-touch-icon
sinedied Jul 28, 2017
7dca1e7
Fixed image path
sinedied Jul 28, 2017
65b4ecf
Fixed cordova/bootstrap branch
sinedied Jul 28, 2017
4ba166e
Fixed lint error
sinedied Jul 28, 2017
68eab58
Updated updating doc to reflect npm@5 changes to lock files
sinedied Jul 31, 2017
8b96606
Updated doc
sinedied Jul 31, 2017
83679da
Updated config.xml
sinedied Jul 31, 2017
3e44b30
Added cordova docs (closes #79)
sinedied Jul 31, 2017
42b056a
Fixed ionic cordova/no auth template
sinedied Jul 31, 2017
2ebaa3f
Added more test cases
sinedied Jul 31, 2017
84c40b7
Added ionic limitations notes (closes #111)
sinedied Jul 31, 2017
07dbd1c
Use ionic config options instead of provider override
sinedied Jul 31, 2017
728514e
Fixed link
sinedied Jul 31, 2017
55c18c4
Added mobile platform choice (closes #78)
sinedied Jul 31, 2017
376099e
Removed auto changelog push
sinedied Jul 31, 2017
9266d81
Updated readme
sinedied Jul 31, 2017
b73bd51
Fixed mobile platform property
sinedied Jul 31, 2017
dfb0a04
Fixed #112
sinedied Jul 31, 2017
e02b07c
Added WKWebView and Crosswalk support (closes #77)
sinedied Jul 31, 2017
62d77b4
Updated test cases
sinedied Jul 31, 2017
1d7a27c
Added cordova/ionic deploy branch
sinedied Jul 31, 2017
90676fb
Added cordova-custom-config plugin with proper status bar color and u…
sinedied Jul 31, 2017
aaa32b3
Moved sw-toolbox dependency to PWA branch
sinedied Jul 31, 2017
3e0ff21
Removed extra spaces
sinedied Jul 31, 2017
51911fb
Moved manifest link to PWA branch
sinedied Jul 31, 2017
4467ccc
Fixed indentation
sinedied Jul 31, 2017
c8d7864
Removed extra import
sinedied Jul 31, 2017
4c41969
Fixed prepare script
sinedied Aug 1, 2017
06dbe60
Fixed error due to log limit
sinedied Aug 1, 2017
39dd6af
Added log traces for tests
sinedied Aug 1, 2017
12c02ce
Reworked CI to avoid Travis erroring
sinedied Aug 1, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,24 @@ node_js:
- stable

addons:
apt:
sources:
- google-chrome
packages:
- google-chrome-stable
chrome: stable

matrix:
fast_finish: true

env:
matrix:
- CASE=cordova/bootstrap
- CASE=cordova/bootstrap-authentication
- CASE=cordova/ionic
- CASE=cordova/ionic-authentication
- CASE=web/bootstrap
- CASE=web/bootstrap-authentication
- CASE=web/ionic
- CASE=web/ionic-authentication
- CASE=web+cordova/bootstrap-authentication
- CASE=web+cordova/ionic-authentication

install:
- npm install -g yo
- npm install
Expand All @@ -30,4 +39,4 @@ before_script:
- sh -e /etc/init.d/xvfb start

script:
- npm test
- npm test $CASE
78 changes: 54 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
# :rocket: generator-ngx-rocket

**:loudspeaker: We have moved! :loudspeaker:**

As you may have noticed, this generator [has moved](https://github.com/ngx-rocket/generator-ngx-rocket/issues/65) to the `ngx-rocket`
organization, and has been renamed from `generator-ngx-app` to `generator-ngx-rocket`, so update your bookmarks/remotes! :rocket:

---

[![NPM version](https://img.shields.io/npm/v/generator-ngx-rocket.svg)](https://www.npmjs.com/package/generator-ngx-rocket)
[![Build status](https://img.shields.io/travis/ngx-rocket/generator-ngx-rocket/master.svg)](https://travis-ci.org/ngx-rocket/generator-ngx-rocket)
![Node version](https://img.shields.io/badge/node-%3E%3D6.0.0-brightgreen.svg)
Expand All @@ -31,20 +24,34 @@ See generated project example [here](https://github.com/ngx-rocket/starter-kit).

# Getting started

## Using ngX-Rocket CLI

1. Install required tools:
```sh
npm install -g @ngx-rocket/cli
```

2. Create your application:
```sh
ngx new
```

## Using Yeoman

1. Install required tools:
```bash
```sh
npm install -g yo generator-ngx-rocket
```

2. Create your application:
```bash
```sh
yo ngx-rocket
```

# Project structure

```
dist/ compiled version
dist/ app production build
docs/ project docs and coding guides
e2e/ end-to-end tests
src/ project source code
Expand Down Expand Up @@ -72,16 +79,26 @@ proxy.conf.js backend proxy configuration

Task automation is based on [NPM scripts](https://docs.npmjs.com/misc/scripts).

Tasks | Description
------------------------------|---------------------------------------------------------------------------------------
npm start | Run development server on `http://localhost:4200/`
npm run build [-- --env=prod] | Lint code and build app for production in `dist/` folder
npm test | Run unit tests via [Karma](https://karma-runner.github.io) in watch mode
npm run test:ci | Lint code and run unit tests once for continuous integration
npm run e2e | Run e2e tests using [Protractor](http://www.protractortest.org)
npm run lint | Lint code
npm run translations:extract | Extract strings from code and templates to `src/app/translations/template.json`
npm run docs | Display project documentation
Task | Description
--------------------------------|---------------------------------------------------------------------------------------
`npm start` | Run development server on `http://localhost:4200/`
`npm run build [-- --env=prod]` | Lint code and build web app for production in `dist/` folder
`npm test` | Run unit tests via [Karma](https://karma-runner.github.io) in watch mode
`npm run test:ci` | Lint code and run unit tests once for continuous integration
`npm run e2e` | Run e2e tests using [Protractor](http://www.protractortest.org)
`npm run lint` | Lint code
`npm run translations:extract` | Extract strings from code and templates to `src/app/translations/template.json`
`npm run docs` | Display project documentation

Additional tasks for Cordova-based projects:

Task | Description
--------------------------------|---------------------------------------------------------------------------------------
`npm run cordova:prepare` | Prepare for building mobile app (restore Cordova platforms and plugins)
`npm run cordova:run <ios/android> [--device]` | Run app on target platform device or simulator
`npm run cordova:build [-- --env=prod]` | Build mobile app for production in `dist/` folder
`npm run cordova:clean` | Removes `www/`, `platforms/` and `plugins/` folders


When building the application, you can specify the target environment using the additional flag `--env <name>` (do not
forget to prepend `--` to pass arguments to npm scripts).
Expand Down Expand Up @@ -123,19 +140,31 @@ Development, build and quality processes are based on [angular-cli](https://gith
[Stylelint](http://stylelint.io) and [HTMLHint](http://htmlhint.com/)
- Local knowledgebase server using [Hads](https://github.com/sinedied/hads)

Native mobile application bundling is based on [Cordova](https://cordova.apache.org).
Alternative enhanced web views are also supported:
- [WkWebView](https://github.com/ionic-team/cordova-plugin-wkwebview-engine) for iOS (Ionic fixed version)
- [Crosswalk](https://crosswalk-project.org) for Android


#### Libraries

- [Angular 4](https://angular.io)
- [Bootstrap 4](https://v4-alpha.getbootstrap.com)
- [Font Awesome](http://fontawesome.io)
- [Angular](https://angular.io)
- [RxJS](http://reactivex.io/rxjs)
- [ng-bootsrap](https://ng-bootstrap.github.io/)
- [ngx-translate](https://github.com/ngx-translate/core)
- [Lodash](https://lodash.com)
- UI based on:
* Bootstrap
- [Bootstrap 4](https://v4-alpha.getbootstrap.com)
- [ng-bootsrap](https://ng-bootstrap.github.io/)
- [Font Awesome](http://fontawesome.io)
* Ionic:
- [Ionic](http://ionicframework.com)
- [Ionic Native](https://ionicframework.com/docs/native/)

#### Coding guides

- [Angular](https://github.com/ngx-rocket/starter-kit/blob/master/docs/coding-guides/angular.md)
- [Ionic](https://github.com/ngx-rocket/starter-kit/blob/mobile/ionic/docs/coding-guides/ionic.md)
- [TypeScript](https://github.com/ngx-rocket/starter-kit/blob/master/docs/coding-guides/typescript.md)
- [Sass](https://github.com/ngx-rocket/starter-kit/blob/master/docs/coding-guides/sass.md)
- [HTML](https://github.com/ngx-rocket/starter-kit/blob/master/docs/coding-guides/html.md)
Expand All @@ -149,6 +178,7 @@ Development, build and quality processes are based on [angular-cli](https://gith
- [Updating dependencies and tools](https://github.com/ngx-rocket/starter-kit/blob/master/docs/updating.md)
- [Using a backend proxy for development](https://github.com/ngx-rocket/starter-kit/blob/master/docs/backend-proxy.md)
- [Browser routing](https://github.com/ngx-rocket/starter-kit/blob/master/docs/routing.md)
- [Cordova](https://github.com/ngx-rocket/starter-kit/blob/mobile/ionic/docs/cordova.md)

# Contributing

Expand Down
40 changes: 27 additions & 13 deletions generators/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ const Insight = require('insight');
const Generator = require('@ngx-rocket/core');
const asciiLogo = require('@ngx-rocket/ascii-logo');

const prompts = require('./prompts');
const options = require('./options.json');
const prompts = require('./prompts.json');
const pkg = require('../../package.json');

class NgxGenerator extends Generator {

initializing() {
this.version = pkg.version;
this.insight = new Insight({trackingCode: 'UA-93069862-1', pkg});
Expand Down Expand Up @@ -48,7 +47,7 @@ class NgxGenerator extends Generator {
// Composition
const addonsOption = this.options.addons;
const addons = addonsOption ? addonsOption.split(' ') : [];
addons.forEach(addon => this.composeWith(addon));
addons.forEach(addon => this.composeWith(addon, this.options));

this.insight.track('generator', this.version);
this.insight.track('node', process.version);
Expand All @@ -57,25 +56,31 @@ class NgxGenerator extends Generator {
}

prompting() {
return super.prompting().then(() => this.shareProps(this.props));
return super.prompting()
.then(() => {
this.props.mobile = this.props.mobile || [];
this.props.webview = this.props.webview || [];
this.shareProps(this.props);
});
}

configuring() {
this.insight.track('generator', 'web', 'bootstrap');
this.insight.track(
'generator',
this.props.target,
this.props.target.includes('cordova') ? this.props.mobile : '',
this.props.ui,
this.props.auth ? 'auth' : 'no-auth'
);
}

install() {
const skipInstall = this.options['skip-install'];

if (!skipInstall) {
this.log(`\nRunning ${chalk.yellow('npm install')}, please wait...`);
this.npmInstall(null, {loglevel: 'error'});
}

this.installDependencies({
skipInstall,
bower: false,
skipMessage: true
});
}

end() {
Expand All @@ -86,13 +91,22 @@ class NgxGenerator extends Generator {

this.log('\nAll done! Get started with these tasks:');
this.log(`- $ ${chalk.green('npm start')}: start dev server with live reload on http://localhost:4200`);
this.log(`- $ ${chalk.green('npm run build')}: build app for production`);

if (this.props.target.includes('web')) {
this.log(`- $ ${chalk.green('npm run build')}: build web app for production`);
}

if (this.props.target.includes('cordova')) {
this.log(`- $ ${chalk.green('npm run cordova:prepare')}: prepare for building mobile app`);
this.log(`- $ ${chalk.green('npm run cordova:run')}: run app on device or simulator`);
this.log(`- $ ${chalk.green('npm run cordova:build')}: build mobile app for production`);
}

this.log(`- $ ${chalk.green('npm test')}: run unit tests in watch mode for TDD`);
this.log(`- $ ${chalk.green('run test:ci')}: lint code and run units tests with coverage`);
this.log(`- $ ${chalk.green('run e2e')}: launch e2e tests`);
this.log(`- $ ${chalk.green('run docs')}: show docs and coding guides\n`);
}

}

module.exports = Generator.make({
Expand Down
104 changes: 104 additions & 0 deletions generators/app/prompts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
'use strict';

module.exports = [
{
type: 'input',
name: 'appName',
message: 'What\'s the name of your app?'
},
{
type: 'checkbox',
name: 'target',
message: 'What kind of app do you want to create?',
choices: [
{
value: 'web',
name: 'Responsive web app',
checked: true
},
{
value: 'cordova',
name: 'Mobile app (using Cordova)'
}
// {
// value: 'electron',
// name: 'Desktop app (using Cordova)'
// }
]
},
// {
// type: 'confirm',
// name: 'pwa',
// message: 'Do you want progressive web app support? (manifest and service worker)',
// default: true,
// when: props => props.target.includes('web')
// },
{
type: 'checkbox',
name: 'mobile',
message: 'Which mobile platform do you want to support?',
when: props => props.target.includes('cordova'),
choices: [
{
value: 'ios',
name: 'iOS',
checked: true
},
{
value: 'android',
name: 'Android',
checked: true
}
// {
// value: 'windows',
// name: 'Windows (Universal)'
// }
]
},
{
type: 'checkbox',
name: 'webview',
message: 'Use enhanced web view?',
when: props => props.target.includes('cordova'),
choices: props => {
const choices = [];
if (props.mobile.includes('ios')) {
choices.push({
value: 'wkwebview',
name: '[iOS] WKWebView (Ionic version)',
checked: true
});
}
if (props.mobile.includes('android')) {
choices.push({
value: 'crosswalk',
name: '[Android] Crosswalk',
checked: false
});
}
return choices;
}
},
{
type: 'list',
name: 'ui',
message: 'Which UI framework do you want?',
choices: [
{
value: 'bootstrap',
name: 'Bootstrap (more website-oriented)'
},
{
value: 'ionic',
name: 'Ionic (more mobile-oriented)'
}
],
default: props => props.target.includes('cordova') ? 'ionic' : 'bootstrap'
},
{
type: 'confirm',
name: 'auth',
message: 'Do you want authentication?',
default: true
}
];
13 changes: 0 additions & 13 deletions generators/app/prompts.json

This file was deleted.

7 changes: 4 additions & 3 deletions generators/app/templates/.stylelintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "stylelint-config-standard",
"extends": ["stylelint-config-standard", "stylelint-config-recommended-scss"],
"rules": {
"font-family-name-quotes": "always-where-recommended",
"function-url-quotes": ["always", { "except": ["empty"] }],
Expand All @@ -17,10 +17,11 @@
"no-empty-source": null,
"selector-class-pattern": "[a-z-]+",
"selector-id-pattern": "[a-z-]+",
"selector-no-id": true,
"selector-max-id": 0,
"selector-no-qualifying-type": true,
"selector-no-universal": true,
"selector-max-universal": 0,
"unit-whitelist": ["px", "%", "rem", "vw", "vh", "deg"],
"max-empty-lines": 2,
"max-line-length": 120
}
}
Loading