当前位置: 首页 > 软件库 > 手机/移动开发 > >

ngxp-seed

授权协议 AGPL-3.0 License
开发语言 JavaScript TypeScript
所属分类 手机/移动开发
软件类型 开源软件
地区 不详
投 递 者 林修真
操作系统 iOS
开源组织
适用人群 未知
 软件概览

NGXP Seed

Docker Image CI

A "simple" starter project to create native mobile and web apps with single shared code base using angular and nativescript. It is designed to plug to the spring-rest-api-starter backend.

The frontend is based on the nativescript-angular-web-starter project.

Check this Open Souce Cross Platform Quotes Application for reference, which is made with the exact same architecture as this starter project.

Prerequisites

  1. Globally installed
  1. Globally installed Angular CLI - npm install -g @angular/cli@9
  2. Globally installed NativeScript - npm install -g nativescript@6
  3. (optional). Mac OS to build iOS app and Android emulator or device for building Android app.

Installation

  1. git clone https://github.com/Monogramm/ngxp-seed.git
  2. cd ngxp-seed
  3. npm run ngxp-install
  4. Make sure to edit the local adress of your backend in backend.service.ts.

Run Web application

npm run start - This will start the application at http://localhost:4200 or http://localhost:4200/webpack-dev-server/.

Run iOS Application

  • First start the simulator or connect the iOS device.
  • Execute npm run start.ios
  • Note - If you are using XCode8 then you need to set the DEVELPMENT_TEAM. There are two ways to set it.
    1. Using XCode
      • After executing npm run start.ios command, open project wordspace file nativescript/platforms/ios/nativescript.xcworkspace in XCode
      • Click on nativescript project in XCode and set Team from General Tab.
      • The issue with thie approach is, you need to set it everytime you remove and add the iOS platform.
    2. From build.xconfig (preferable)
      • Open nativescript/app/App_Resources/iOS/build.xconfig file.
      • Uncomment DEVELOPMENT_TEAM = YOUR_TEAM_ID; line, and enter your team id.

Run Android Application

  • First start the emulator or connect the iOS device.
  • Execute npm run start.android

Project Folder Structure

nativescript

This contains a nativescript project for creating Android/iOS applications.

tools

This contains scripts useful during development.

web

This contains nothing but a web project created using angular-cli.

x-shared

All the code/assets which are common to both web and nativescript projects resides here. This folder is symlinked to nativescript/app/x-shared and web/src/x-shared folder. So changes in x-shared folder from any of the three locations will get reflected in other two folders.

Commands

You can execute any valid command of angular-cli from web/ folder and any valid command of nativescript-cli from nativescript/ folder.For convenince below are the commands which you can execute from root directory.

Common

Command Description
npm run ngxp-install Installs dependencies of web and nativescript applications. Creates symlink of x-shared folder in both web and nativescript project.
npm run tslint Calls TSLint globally.

Web Application

Command Description
npm start Starts web application at http://localhost:4200
npm run start.prod Starts web application in production mode. Runs uglification and minification.
npm run start.aot Performs AOT for web application templates and starts web application.
npm run start.aot.prod Performs AOT, minification, uglification and starts web application.
npm run build Builds the web application and copy the built project in web/dist folder.
npm run build.prod Builds the web application in production mode and copy the built project in web/dist folder.
npm run build.aot Performs AOT, build the project and then copy the built project in web/dist folder.
npm run build.aot.prod Performs AOT, prepares production build and then copy the built project in web/dist folder.
npm test Runs web application and x-shared unit test cases. It will not generate code coverage report.
npm run test-cc Runs web application and x-shared unit test cases and generates code coverage report.

Nativescript Application

Command Description
npm run build.ios Builds application on iOS emulator/device
npm run build.android Builds application on Android emulator/device
npm run start.ios Runs application on iOS emulator/device
npm run start.android Runs application on Android emulator/device
npm run debug.ios Debugs application on iOS emulator/device
npm run debug.android Debugs application on Android emulator/device
npm run clean.ios Cleans application on iOS emulator/device
npm run clean.android Cleans application on Android emulator/device
npm run restart.ios Cleans and restarts application on iOS emulator/device
npm run restart.android Cleans and restarts application on Android emulator/device
npm run test.ios Runs tests on iOS emulator/device. It will not generate code coverage report.
npm run test.android Runs tests on Android emulator/device. It will not generate code coverage report.

FAQ

How to change package/bundle id for Android/iOS apps?

To change the package/bundle id you need to do changes in below files.

  1. nativescript/package.json
  • Change id property of nativescript object as follows:
"nativescript": {
    "id": "com.domain.yourapp"
}
  1. Open nativescript/app/App_Resources/Android/app.gradle file and change applicationId as shown below:
android {
  defaultConfig {
    ...
    applicationId = "com.domain.yourapp"
  }
  ...
}

How to change Android and iOS Application Display Name?

For Android, open nativescript/app/App_Resources/Android/values/strings.xml file and write your app name where Nativescript Angular Web Starter is written:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="app_name">Nativescript Angular Web Starter</string>
    <string name="title_activity_kimera">Nativescript Angular Web Starter</string>
</resources>

For iOS, open nativescript/app/App_Resources/iOS/info.plist file and change value of CFBundleDisplayName and CFBundleName to your app name:

<dict>
  ...
  <key>CFBundleDisplayName</key>
	<string>Nativescript Angular Web Starter</string>
  <key>CFBundleName</key>
	<string>NativescriptAngularWebStarter</string>
  ...
</dict>

How to use angular dependencies from common node_modules folder. (Not tested properly yet!)

Currently you can see that for web project, angular modules are there as dependencies in common package.json and at web/package.json. So currently to update version of angular modules for web project,you need to update version at both of these package.json files. To avoid this, you can add path mapping in web project's tsconfig.json file as shown below:

web/src/tsconfig.json

"paths": {
  "@angular/*": ["../../node_modules/@angular/*"]
}

Once you add above configuration, the web project will try to find the @angular pacakges from common node_modules folder.

Attributes

  1. Angular Framework
  2. Nativescript Framework
  3. Nativescript Core Theme
  4. nativescript-swiss-army-knife
  5. tools/install.js from angular-advanced-seed

Awesome Contributors

 相关资料
  • NGXP Quotes App Quotes application for Web and Mobile (Android, iOS) with single code base buit with Angular and Nativescript. If you want to create your own cross-platform app similar to this, check

  • 问题内容: SQLite是否支持 以与MySQL相同的方式Seeding函数 ? 从MySQL手册中了解: 如果指定了常量整数参数N,它将用作种子值,这将产生可重复的列值序列。在下面的示例中,请注意RAND(3)生成的值的序列在出现它的两个地方都是相同的。 如果不是,是否有任何方法可以仅使用一个查询来归档相同的效果? 问题答案: 如果您需要伪随机顺序,则可以执行以下操作(PHP): 另外,您可以将

  • 问题内容: 如何在第一次迁移中插入一些种子数据?如果迁移不是最佳选择,那么最佳实践是什么? 问题答案: Alembic作为其操作之一。该文档提供了以下示例(包含一些我已修复的问题): 还要注意,Alembic具有一个操作,就像SQLAlchemy中的普通功能:你可以运行所需的任何SQL,如文档示例所示: 请注意,用于创建update语句中使用的元数据的表是直接在架构中定义的。这似乎打破了DRY(不

  • Phinx 0.5.0 支持数据库中使用seeding插入测试数据。Seed 类可以很方便的在数据库创建以后填充数据。这些文件默认放置在 seeds 目录,路径可以在配置文件中修改 数据库 seeding 是可选的,Phinx 并没有默认创建 seeds 目录 创建Seed类 Phinx 用下面命令创建一个新的 seed 类 $ php vendor/bin/phinx seed:create U

  • 我的理解是它需要检查,然后如果它是,则调用下一个方法来获取迭代器中的元素。 问题: 它在检索元素后调用,在我的例子中,使用Next检索最后一个元素并检查,然后返回并结束循环。所以我处理元素而不是元素。 或者,我使用了下面的代码。 复制代码: 输出: 缺少最后一个元素 它的工作原理类似于for循环,在Java API中,在文档中说hasNext和next是误导性的。 什么相当于Streams中的以下

  • 我是新的Laravel,当我运行php工匠db:种子我收到以下消息: [ReflectionException]类DatabaseSeeder不存在 我已经运行了composer dump自动加载,但没有任何结果。我的类位于默认文件夹/种子中 类中的代码: 我做错了什么?

相关阅读

相关文章

相关问答

相关文档