Coder Social home page Coder Social logo

dystudio / ionic-jhipster-starter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from oktadev/ionic-jhipster-starter

0.0 1.0 0.0 347 KB

Starter Template for Ionic Apps with JHipster

Home Page: https://developer.okta.com/blog/2019/06/24/ionic-4-angular-spring-boot-jhipster

License: Apache License 2.0

TypeScript 85.34% HTML 9.08% CSS 3.25% JavaScript 2.33%

ionic-jhipster-starter's Introduction

The Ionic JHipster Starter ๐Ÿค“

Because Ionic Apps need some JHipster ๐Ÿ’™ too!

Ionic JHipster

The Ionic JHipster Starter is designed to be used with a JHipster backend. You can create a project with it directly, or use Ionic for JHipster.

This project provides a base template of functionality for an Ionic app. The Ionic for JHipster module provides entity generation and additional features that require logic to install (e.g. OAuth authentication).

Build Status

Table of Contents

  1. Getting Started
  2. Pages
  3. Providers
  4. i18n (adding languages)
  5. Testing

Getting Started

To use this starter, install the latest version of the Ionic CLI and run:

ionic start ionic4j oktadeveloper/jhipster --type angular

You can also install it using the Ionic for JHipster Module:

npm install -g generator-jhipster-ionic ionic @angular/cli
yo jhipster-ionic

This module allows you to generate entities using:

yo jhipster-ionic:entity <name>	

Or by importing JDL:

yo jhipster-ionic:import-jdl <file.jdl>

Tips

In production, you will need to enable CORS in your backend's src/main/resources/config/application-prod.yml file. Set the allowed-origins so it works with ionic serve:

cors:
    allowed-origins: "http://localhost:8100"

Pages

The Ionic JHipster Starter comes with a variety of ready-made pages.

Services

The Ionic JHipster Starter comes with some basic implementations of common services.

User

The User service is used to authenticate users through its login(accountInfo) and signup(accountInfo) methods, which perform POST requests to an API endpoint that you will need to configure.

Api

The ApiService is a simple CRUD frontend to an API.

i18n

The Ionic JHipster Starter comes with internationalization (i18n) out of the box with ngx-translate. This makes it easy to change the text used in the app by modifying only one file.

Adding Languages

To add new languages, add new files to the src/assets/i18n directory, following the pattern of LANGCODE.json where LANGCODE is the language/locale code (ex: en/gb/de/es/etc.).

Testing

This starter borrows its testing infrastructure from Daniel Sogl's Ionic Super Starter. Thanks Daniel!

Usage

There are a number of scripts in package.json you can use to run tests:

"test": "jest",
"test:watch": "jest --watch",
"test:ci": "jest --runInBand",
"test:coverage": "jest --coverage",
"e2e": "npm run e2e-update && npm run e2e-test",
"e2e-test": "protractor ./e2e/protractor.conf.js",
"e2e-update": "node node_modules/webdriver-manager/bin/webdriver-manager update --gecko false"

Unit Tests

Jest is used as the unit test runner in this project. Jest is a complete and easy to set-up JavaScript testing solution created by Facebook. Some of its benefits are:

  • Fast and sandboxed
  • Built-in code coverage reports
  • Zero configuration

NOTE: If you'd like to convert your project so you can run ng test to run your tests, see Angular CLI: "ng test" with Jest in 3 minutes.

To run a unit test you have three options.

  1. Run npm test runs all your created unit-tests
  2. Run npm run test:ci if you want to run the unit-tests with you favorite CI
  3. To create a test-coverage report you can run npm run test:coverage

Daniel created Ionic Mocks with Jest Support by forking the ionic-mocks ionic-mock repository. There are still some issues. Feel free to help him out with his ionic-mocks-jest repository.

If you want to add ionic-native mocks you should definitely check out Chris Griffith's ionic-native-mocks repository

See the unit test example at src/app/app.component.spec.ts.

E2E Tests

The E2E test configuration is from the official ionic-unit-testing-example repository. The e2e folder structure has been changed a bit.

/e2e
  - pages
  - spec

Add your pages into the /pages folder and your tests into the /spec folder.

See the example end-to-end test in e2e/spec/app.e2e-spec.ts.

To run the e2e tests, start your app, then run the tests (in two separate terminal windows):

ionic serve
npm run e2e

Apache-2.0 ยฉ Okta

ionic-jhipster-starter's People

Contributors

fleboulch avatar imgbot[bot] avatar mraible avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.