@24i/smartapps-bigscreen-rnv-build-engine 0.8.6-alpha.1394 → 0.8.6-alpha.1402

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -18,6 +18,7 @@ sidebar_label: Rnv Build Engine
18
18
  - [Available Webpack Injections](#available-webpack-injections)
19
19
  - [Package content](#package-content)
20
20
  - [How to set up new project with SmartApps BIGscreen build engine](#how-to-set-up-new-project-with-smartapps-bigscreen-build-engine)
21
+ - [How to add new platform](#how-to-add-new-platform)
21
22
 
22
23
  ---
23
24
  ## About the package
@@ -46,7 +47,7 @@ it
46
47
  | **webOS** | LG | `webos` | `.ipk` | `*.webos.tv.{js,jsx,ts,tsx,json}` | |
47
48
  | **WebTV** | N/A | `webtv` | `.zip` | `*.webtv.{js,jsx,ts,tsx,json}` | for previewing builds in browser |
48
49
 
49
- When building the application with ReNative, if file with ***registered platform extensinon*** is found,
50
+ When building the application with ReNative, if file with ***registered platform extension*** is found,
50
51
  it takes precedence and is bundled instead of file without registered file extension (such as `index.ts`).
51
52
  For instance, this approach is useful (and is used) for platform drivers - only concrete driver can be bundled into the final package for selected platform:
52
53
 
@@ -107,11 +108,12 @@ Currently, following variable names are configured for replacing:
107
108
  | :-------------------------------------------- | :----: | ------------------------------------------------------- | :-----------------------------------------: |
108
109
  | **WEBPACK_INJECTION_APP_CONFIG_ID** | string | flavour id *(value of rnv CLI `-c` param value)* | `'animated_1080'`, `'basic_720'` |
109
110
  | **WEBPACK_INJECTION_APP_CREATED** | string | build time in ISO 8601 format | `'2021-07-30T09:18:26.014Z'` |
111
+ | **WEBPACK_INJECTION_APP_SCHEME** | string | scheme used during the build | `'debug'`, `'rc:latest'`, `'release:dist'` |
110
112
  | **WEBPACK_INJECTION_APP_RESOLUTION** | string | app resolution in `<WIDTH>x<HEIGHT>` format (in pixels) | `'1920x1080'`, `'1280x720'` |
111
113
  | **WEBPACK_INJECTION_APP_VERSION** | string | app version | `'v0.0.1.dev'`, `'v0.0.1.rc-1'`, `'v0.0.1'` |
112
114
  | **WEBPACK_INJECTION_APP_ENVIRONMENT** | string | environment used during the build | `'development'`, `'production'` |
113
115
  | **WEBPACK_INJECTION_APP_PLATFORM** | string | platform id *(value of rnv CLI `-p` param value)* | `'webtv'`, `'webos'`, `'tizen'`, `'entone'` |
114
- | **WEBPACK_INJECTION_APP_RUNTIME_CONFIG_PATH** | string | path to JSON app config, imported when app is starting | `'./public/content/conf/config.json'` |
116
+ | **WEBPACK_INJECTION_APP_CONTENT_PATH** | string | path to content directory | `'./public/content'` |
115
117
 
116
118
  An example:
117
119
  ```typescript
@@ -210,3 +212,7 @@ and `.travis.yml`config file (related to Travis CI).
210
212
  > To **start a new project** with usage of our build process,
211
213
  > please use [SmartApps BIGscreen Template repository](https://github.com/24i/smartapps-bigscreen-template),
212
214
  > it uses this package and contains other required configuration files as well.
215
+
216
+ ---
217
+ ## How to add new platform
218
+ To see how to add new platform, click [here](docs/PLATFORM_ADD.md).
@@ -50,10 +50,9 @@ const includeRtlFiles = ({ shouldIncludeRtlFiles }) => (content, loaderContext)
50
50
  }
51
51
  return content;
52
52
  };
53
- const relativePathToAppRuntimeCfg = path_1.default.join('conf', 'config.json');
54
- const getAppRuntimeConfigPath = (baseUrl, isBuildHosted = false) => {
53
+ const getAppContentPath = (baseUrl, isBuildHosted = false) => {
55
54
  const isBuildHostedAndHasBaseUrl = isBuildHosted && !!baseUrl;
56
- const relativePath = path_1.default.join(isBuildHostedAndHasBaseUrl ? './public' : '', 'content', relativePathToAppRuntimeCfg);
55
+ const relativePath = path_1.default.join(isBuildHostedAndHasBaseUrl ? './public' : '', 'content');
57
56
  return isBuildHostedAndHasBaseUrl
58
57
  ? `${baseUrl}/${relativePath}`
59
58
  : relativePath;
@@ -151,7 +150,7 @@ function generateConfig(config) {
151
150
  }
152
151
  });
153
152
  }
154
- const appRuntimeConfigPath = getAppRuntimeConfigPath(baseUrl, isBuildHosted);
153
+ const appContentPath = getAppContentPath(baseUrl, isBuildHosted);
155
154
  const copiedDirWithPublicContentPath = path_1.default.join(appBuildDir, `../${path_1.default.parse(appBuildDir).name}-public`);
156
155
  const plugins = {
157
156
  forkTsChecker: new fork_ts_checker_webpack_plugin_1.default({
@@ -163,11 +162,12 @@ function generateConfig(config) {
163
162
  webpack: new webpack_1.default.DefinePlugin({
164
163
  WEBPACK_INJECTION_APP_CONFIG_ID: JSON.stringify(config.appConfigId || ''),
165
164
  WEBPACK_INJECTION_APP_CREATED: JSON.stringify(new Date().toISOString()),
165
+ WEBPACK_INJECTION_APP_SCHEME: JSON.stringify(config.scheme || ''),
166
166
  WEBPACK_INJECTION_APP_RESOLUTION: JSON.stringify(getResolutionString(config)),
167
167
  WEBPACK_INJECTION_APP_VERSION: JSON.stringify(buildVersion || ''),
168
168
  WEBPACK_INJECTION_APP_ENVIRONMENT: JSON.stringify(config.environment || ''),
169
169
  WEBPACK_INJECTION_APP_PLATFORM: JSON.stringify(PLATFORM || ''),
170
- WEBPACK_INJECTION_APP_RUNTIME_CONFIG_PATH: JSON.stringify(appRuntimeConfigPath),
170
+ WEBPACK_INJECTION_APP_CONTENT_PATH: JSON.stringify(appContentPath),
171
171
  }),
172
172
  html: new html_webpack_plugin_1.default({
173
173
  alwaysWriteToDisk: true,
@@ -201,8 +201,8 @@ function generateConfig(config) {
201
201
  isDevServer ? {
202
202
  move: [
203
203
  {
204
- source: path_1.default.join(appBuildDir, 'project', 'public', 'content', relativePathToAppRuntimeCfg),
205
- destination: path_1.default.join(appBuildEngineProjectDir, 'content', relativePathToAppRuntimeCfg),
204
+ source: path_1.default.join(appBuildDir, 'project', 'public', 'content'),
205
+ destination: path_1.default.join(appBuildEngineProjectDir, 'content'),
206
206
  },
207
207
  ],
208
208
  } : null,
@@ -0,0 +1,60 @@
1
+ # rnv-build-engine
2
+ ## How to add new platform
3
+
4
+ ---
5
+ ### Choose platform ID
6
+ To see actual list of platform IDs, see table in [Supported platforms](../README.md#supported-platforms) section.
7
+
8
+ Platform ID is needed for ReNative CLI - to specify requested platform for build or for example for deploy:
9
+
10
+ `rnv build -c <flavour> -s <scheme> -p <platform_id>`
11
+
12
+ `rnv deploy -c <flavour> -s <scheme> -p <platform_id>`
13
+
14
+ ---
15
+ ### Choose file extension for new platform
16
+ Please read [Supported platforms](../README.md#supported-platforms) section,
17
+ where platform file extensions and their usage are described.
18
+
19
+ ---
20
+ ### Prepare driver for new platform
21
+ #### 1. Implement new platform driver
22
+ - Use [packages/create-package](../../create-package) to create a new package with driver for requested platform.
23
+ Name the new package `driver-<platform_id>` and implement the platform driver inside it.
24
+ Have a look at other driver packages to inspire.
25
+
26
+ #### 2. Include new platform driver into `device` package
27
+ - In [packages/device/src/resolver/index.ts](../../device/src/resolver/index.ts),
28
+ import driver for new platform from just created package with platform driver (previous step)
29
+ by the same way as other platform drivers.
30
+ - According to [Choose file extension for new platform](#choose-file-extension-for-new-platform) section,
31
+ in [packages/device/src/driver/](../../device/src/driver) dir,
32
+ add `index.<platform_extension>.ts` file and inside it, export new driver by the same way as other drivers.
33
+
34
+ ---
35
+ ### How to extend build engine with new platform
36
+ - in [package.json](../package.json), in `peerDependencies`, update version of `@24i/smartapps-bigscreen-device` package to new version (created in step above)
37
+ - add requested platform record into [renative.engine.json](../renative.engine.json)
38
+ - add requested platform record into [src/constants/platforms.ts](../src/constants/platforms.ts)
39
+ - add requested platform record into [src/index.ts](../src/index.ts):
40
+ - set file extension(s) for requested platform *(see [Choose file extension for new platform](#choose-file-extension-for-new-platform) section)*
41
+ - set value for `defaultPort`
42
+ - set `isWebHosted` to `true`
43
+ - add following webpack configs into `templates/platforms/<platform_id>/` dir *(you can copy them from `webtv` platform and edit as you need)*:
44
+ - `webpack.config.dev.ts`
45
+ - `webpack.config.prod.ts`
46
+ - add record for new platform into [src/scripts/release/urlsMarkdown.ts](../src/scripts/release/urlsMarkdown.ts) file, in `beautifyPlatformName` function
47
+ - extend build engine [tasks](../src/tasks) with new platform:
48
+ - extend `buildFn` in [src/tasks/task.rnv.build.ts](../src/tasks/task.rnv.build.ts) file with new platform
49
+ - extend `configureFn` in [src/tasks/task.rnv.configure.ts](../src/tasks/task.rnv.configure.ts) file with new platform
50
+ - extend `deployFn` in [src/tasks/task.rnv.deploy.ts](../src/tasks/task.rnv.deploy.ts) file with new platform
51
+ - extend `startFn` in [src/tasks/task.rnv.start.ts](../src/tasks/task.rnv.start.ts) file with new platform
52
+ - add info about new platform into [Supported platforms](../README.md#supported-platforms) section
53
+ - if needed, do other custom modifications / extends
54
+ - create alpha version of the package
55
+ (tutorial [here](https://24imedia.atlassian.net/wiki/spaces/PRDNGBIGSCR/pages/1183481960/Preparing+Alpha+Builds+After+Merged+PR+and+Before+Full+Publish))
56
+
57
+ ---
58
+ ### How to extend SmartApps Template repository with new platform
59
+ The last step is updating [SmartApps Template repository](https://github.com/24i/smartapps-bigscreen-template),
60
+ see its [documentation](https://github.com/24i/smartapps-bigscreen-template/blob/development/docs/PLATFORM_ADD.md) about adding a new platform.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@24i/smartapps-bigscreen-rnv-build-engine",
3
- "version": "0.8.6-alpha.1394+0fca2ad5",
3
+ "version": "0.8.6-alpha.1402+fdefc217",
4
4
  "description": "Package with build engine for SmartApps BIGscreen projects...",
5
5
  "main": "dist/src/index.js",
6
6
  "scripts": {
@@ -61,5 +61,5 @@
61
61
  "keywords": [],
62
62
  "author": "24i",
63
63
  "license": "ISC",
64
- "gitHead": "0fca2ad5a9cc12107cb5c33ccbe1fdb1340d1704"
64
+ "gitHead": "fdefc21765850532808963bb3756f6399010354e"
65
65
  }