diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 91d4909c..d56650fc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,5 +24,6 @@ jobs: with: node-version: "18.4.0" - run: npm ci + - run: npm run ropm - run: npm run build # - run: npm run publish-coverage diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 43cd8f6f..e33107a1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,6 +19,8 @@ jobs: node-version: "14.18.1" - name: Run full CI run: npm ci + - name: ropm + run: npm run ropm - name: Build run: npm run build - name: Configure npm diff --git a/docs/About:-Bsc-plugin.md b/docs/About-Bsc-plugin.md similarity index 100% rename from docs/About:-Bsc-plugin.md rename to docs/About-Bsc-plugin.md diff --git a/docs/About:-Getting-started.md b/docs/About-Getting-started.md similarity index 100% rename from docs/About:-Getting-started.md rename to docs/About-Getting-started.md diff --git a/docs/About:-Justification.md b/docs/About-Justification.md similarity index 100% rename from docs/About:-Justification.md rename to docs/About-Justification.md diff --git a/docs/List-Component:-Callbacks.md b/docs/List-Component-Callbacks.md similarity index 100% rename from docs/List-Component:-Callbacks.md rename to docs/List-Component-Callbacks.md diff --git a/docs/List-Component:-CustomCells.md b/docs/List-Component-CustomCells.md similarity index 100% rename from docs/List-Component:-CustomCells.md rename to docs/List-Component-CustomCells.md diff --git a/docs/List-Component:-Getting-started.md b/docs/List-Component-Getting-started.md similarity index 100% rename from docs/List-Component:-Getting-started.md rename to docs/List-Component-Getting-started.md diff --git a/docs/List-Component:-Sample.md b/docs/List-Component-Sample.md similarity index 100% rename from docs/List-Component:-Sample.md rename to docs/List-Component-Sample.md diff --git a/docs/MVVM-Framework:-Observables-and-ViewModels.md b/docs/MVVM-Framework-Observables-and-ViewModels.md similarity index 100% rename from docs/MVVM-Framework:-Observables-and-ViewModels.md rename to docs/MVVM-Framework-Observables-and-ViewModels.md diff --git a/docs/MVVM-Framework:-XML-binding-syntax.md b/docs/MVVM-Framework-XML-binding-syntax.md similarity index 100% rename from docs/MVVM-Framework:-XML-binding-syntax.md rename to docs/MVVM-Framework-XML-binding-syntax.md diff --git a/docs/Node-Classes:-Config.md b/docs/Node-Classes-Config.md similarity index 100% rename from docs/Node-Classes:-Config.md rename to docs/Node-Classes-Config.md diff --git a/docs/Node-Classes:-How-to-write.md b/docs/Node-Classes-How-to-write.md similarity index 100% rename from docs/Node-Classes:-How-to-write.md rename to docs/Node-Classes-How-to-write.md diff --git a/docs/Node-Classes:-Implementation.md b/docs/Node-Classes-Implementation.md similarity index 100% rename from docs/Node-Classes:-Implementation.md rename to docs/Node-Classes-Implementation.md diff --git a/docs/Node-Classes:-Node-task.md b/docs/Node-Classes-Node-task.md similarity index 100% rename from docs/Node-Classes:-Node-task.md rename to docs/Node-Classes-Node-task.md diff --git a/docs/Node-Classes:-Testing.md b/docs/Node-Classes-Testing.md similarity index 100% rename from docs/Node-Classes:-Testing.md rename to docs/Node-Classes-Testing.md diff --git a/docs/Utils:-mc-maestro-core-utils.md b/docs/Utils-mc-maestro-core-utils.md similarity index 100% rename from docs/Utils:-mc-maestro-core-utils.md rename to docs/Utils-mc-maestro-core-utils.md diff --git a/docs/Utils:-mc.tasks-maestro-core-tasks.md b/docs/Utils-mc.tasks-maestro-core-tasks.md similarity index 100% rename from docs/Utils:-mc.tasks-maestro-core-tasks.md rename to docs/Utils-mc.tasks-maestro-core-tasks.md diff --git a/docs/Utils:-mc.utils.Collections.md b/docs/Utils-mc.utils.Collections.md similarity index 100% rename from docs/Utils:-mc.utils.Collections.md rename to docs/Utils-mc.utils.Collections.md diff --git a/docs/Utils:-mc.utils.Serialization.md b/docs/Utils-mc.utils.Serialization.md similarity index 100% rename from docs/Utils:-mc.utils.Serialization.md rename to docs/Utils-mc.utils.Serialization.md diff --git a/docs/View-Framework:-Aggregate-Views.md b/docs/View-Framework-Aggregate-Views.md similarity index 100% rename from docs/View-Framework:-Aggregate-Views.md rename to docs/View-Framework-Aggregate-Views.md diff --git a/docs/View-Framework:-BaseScreen.md b/docs/View-Framework-BaseScreen.md similarity index 100% rename from docs/View-Framework:-BaseScreen.md rename to docs/View-Framework-BaseScreen.md diff --git a/docs/View-Framework:-BaseView.md b/docs/View-Framework-BaseView.md similarity index 100% rename from docs/View-Framework:-BaseView.md rename to docs/View-Framework-BaseView.md diff --git a/docs/View-Framework:-Component-lifecycle.md b/docs/View-Framework-Component-lifecycle.md similarity index 100% rename from docs/View-Framework:-Component-lifecycle.md rename to docs/View-Framework-Component-lifecycle.md diff --git a/docs/View-Framework:-Mixins.md b/docs/View-Framework-Mixins.md similarity index 100% rename from docs/View-Framework:-Mixins.md rename to docs/View-Framework-Mixins.md diff --git a/docs/View-Framework:-Styles-and-Bundles.md b/docs/View-Framework-Styles-and-Bundles.md similarity index 100% rename from docs/View-Framework:-Styles-and-Bundles.md rename to docs/View-Framework-Styles-and-Bundles.md diff --git a/docs/View-Framework:-View-Transitions.md b/docs/View-Framework-View-Transitions.md similarity index 100% rename from docs/View-Framework:-View-Transitions.md rename to docs/View-Framework-View-Transitions.md diff --git a/docs/View-Framework.md b/docs/View-Framework.md index bf78c8d4..cbe6f303 100644 --- a/docs/View-Framework.md +++ b/docs/View-Framework.md @@ -15,3 +15,114 @@ In addition the view framework contains many base classes that can be used Maestro makes use of many different mixin classes, which handle different aspects of view management (e.g. utils, focus, key handling), and then bundles these together in base classes (views and screens). Aggregate views for tab (i.e. iOS style TabController navigation) and stack (i.e. iOS style NavController navigation) are provided + + +## Fragments and json support + +in Maestro framework, we predominantly build our views and screens from json. Why? + +- It's generally quicker to work with than the xml +- Easy to export from figma +- Easy to import form apis/CMS +- Easy to write inline +- Gives better performance control, as one can defer view instantion. + + +Maestro has several methods for building views in this manner, all available on BaseView. These methods allow for view creation, and automatically creating field pointers to the created views, and can even automatically bind views. + +An example of creating a fragment. + + +``` + @it("creates a view fragment, with children, with bindings, and works multiple times") + function _() + json = { + "_type": "Rectangle" + "id": "v1" + "height": "${json.height}" + "_children": [ + { + "_type": "mv_Label" + "id": "v2" + "text": "${json.item1.a}" + } + { + "_type": "mv_Label" + "id": "v3" + "text": "${json.item2.subItem.b}" + "_children": [ + { + "_type": "mv_Label" + "id": "v4" + "text": "${json.others[1]}" + } + ] + } + ] + } + + data = { + json: { + "height": 200.0 + item1: { + "a": "first" + } + item2: { + subItem: { + "b": "second" + } + } + others: [ + "third", "fourth" + ] + } + } + view = mv.createFragment(json, invalid, data) + + m.assertSubType(view, "Rectangle") + m.assertEqual(view.id, "v1") + m.assertEqual(view.height, 200.0) + + child1 = view.getChild(0) + + m.assertSubType(child1, "mv_Label") + m.assertEqual(child1.id, "v2") + m.assertEqual(child1.text, "first") + + child2 = view.getChild(1) + + m.assertSubType(child2, "mv_Label") + m.assertEqual(child2.id, "v3") + m.assertEqual(child2.text, "second") + + child2_1 = child2.getChild(0) + + m.assertSubType(child2_1, "mv_Label") + m.assertEqual(child2_1.id, "v4") + m.assertEqual(child2_1.text, "fourth") + + view = mv.createFragment(json, invalid, data) + + m.assertSubType(view, "Rectangle") + m.assertEqual(view.id, "v1") + m.assertEqual(view.height, 200.0) + + child1 = view.getChild(0) + + m.assertSubType(child1, "mv_Label") + m.assertEqual(child1.id, "v2") + m.assertEqual(child1.text, "first") + + child2 = view.getChild(1) + + m.assertSubType(child2, "mv_Label") + m.assertEqual(child2.id, "v3") + m.assertEqual(child2.text, "second") + + child2_1 = child2.getChild(0) + + m.assertSubType(child2_1, "mv_Label") + m.assertEqual(child2_1.id, "v4") + m.assertEqual(child2_1.text, "fourth") + end function +``` \ No newline at end of file diff --git a/docs/index.md b/docs/index.md index 6ed3b3d6..3a6d9fa1 100644 --- a/docs/index.md +++ b/docs/index.md @@ -65,38 +65,38 @@ Been in production for > 2 years at: ## Table of Contents * [About](/docs/About.md) - - [Getting started](/docs/About:-Getting-started.md) - - [Bsc plugin](/docs/About:-Bsc-plugin.md) - - [Justification](/docs/About:-Justification.md) + - [Getting started](/docs/About-Getting-started.md) + - [Bsc plugin](/docs/About-Bsc-plugin.md) + - [Justification](/docs/About-Justification.md) * [Utils](/docs/Utils.md) - - [mc (maestro core utils)](/docs/Utils:-mc-maestro-core-utils.md) - - [mc.Tasks](/docs/Utils:-mc.tasks-maestro-core-tasks.md) - - [mc.Serialization](/docs/Utils:-mc.utils.Serialization.md) - - [mc.Collections](/docs/Utils:-mc.utils.Collections.md) + - [mc (maestro core utils)](/docs/Utils-mc-maestro-core-utils.md) + - [mc.Tasks](/docs/Utils-mc.tasks-maestro-core-tasks.md) + - [mc.Serialization](/docs/Utils-mc.utils.Serialization.md) + - [mc.Collections](/docs/Utils-mc.utils.Collections.md) * [Node Classes](/docs/Node-Classes.md) - - [Testing](/docs/Node-Classes:-Testing.md) - - [Config](/docs/Node-Classes:-Config.md) - - [How to write](/docs/Node-Classes:-How-to-write.md) - - [Implementation](/docs/Node-Classes:-Implementation.md) - - [Node task](/docs/Node-Classes:-Node-task.md) + - [Testing](/docs/Node-Classes-Testing.md) + - [Config](/docs/Node-Classes-Config.md) + - [How to write](/docs/Node-Classes-How-to-write.md) + - [Implementation](/docs/Node-Classes-Implementation.md) + - [Node task](/docs/Node-Classes-Node-task.md) * [View Framework](/docs/View-Framework.md) - - [BaseScreen](/docs/View-Framework:-BaseScreen.md) - - [BaseView](/docs/View-Framework:-BaseView.md) - - [Aggregate Views](/docs/View-Framework:-Aggregate-Views.md) - - [View Transitions](/docs/View-Framework:-View-Transitions.md) - - [Component lifecycle](/docs/View-Framework:-Component-lifecycle.md) - - [Mixins](/docs/View-Framework:-Mixins.md) - - [Styles and Bundles](/docs/View-Framework:-Styles-and-Bundles.md) + - [BaseScreen](/docs/View-Framework-BaseScreen.md) + - [BaseView](/docs/View-Framework-BaseView.md) + - [Aggregate Views](/docs/View-Framework-Aggregate-Views.md) + - [View Transitions](/docs/View-Framework-View-Transitions.md) + - [Component lifecycle](/docs/View-Framework-Component-lifecycle.md) + - [Mixins](/docs/View-Framework-Mixins.md) + - [Styles and Bundles](/docs/View-Framework-Styles-and-Bundles.md) * [MVVM Framework](/docs/MVVM-Framework.md) - - [Observables and ViewModels](/docs/MVVM-Framework:-Observables-and-ViewModels.md) - - [XML binding syntax](/docs/MVVM-Framework:-XML-binding-syntax.md) + - [Observables and ViewModels](/docs/MVVM-Framework-Observables-and-ViewModels.md) + - [XML binding syntax](/docs/MVVM-Framework-XML-binding-syntax.md) * [IOC Framework](/docs/IOC-Framework.md) * [More maestro goodness](/docs/More-maestro-goodness.md) * [List Component](/docs/List-Component.md) - - [Sample](/docs/List-Component:-Sample.md) - - [Getting started](/docs/About:-Getting-started.md) - - [Callbacks](/docs/List-Component:-Callbacks.md) - - [CustomCells](/docs/List-Component:-CustomCells.md) + - [Sample](/docs/List-Component-Sample.md) + - [Getting started](/docs/About-Getting-started.md) + - [Callbacks](/docs/List-Component-Callbacks.md) + - [CustomCells](/docs/List-Component-CustomCells.md) * [Command Sequences and controlling application launch] (/docs/command-and-launch.md) * [Debugging](/docs/Debugging.md) * [API documentation](/docs/API-Docs.md) diff --git a/package-lock.json b/package-lock.json index f46d8bd3..12e93b7d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,8 @@ "dependencies": { "@rokucommunity/bslib": "^0.1.1", "cz-conventional-changelog": "^3.3.0", - "log": "npm:roku-log@^0.10.1" + "log": "npm:roku-log@^0.10.1", + "rename": "^1.0.4" }, "devDependencies": { "@rokucommunity/bslint": "^0.8.1", @@ -6204,6 +6205,27 @@ "node": ">=12" } }, + "node_modules/rename": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/rename/-/rename-1.0.4.tgz", + "integrity": "sha512-YMM6Fn3lrFOCjhORKjj+z/yizj8WSzv3F3YUlpJA20fteWCb0HbJU19nvuRBPUM5dWgxJcHP+kix3M+5NowJyA==", + "dependencies": { + "debug": "^2.5.2" + } + }, + "node_modules/rename/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/rename/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + }, "node_modules/request": { "version": "2.88.2", "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", @@ -12806,6 +12828,29 @@ } } }, + "rename": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/rename/-/rename-1.0.4.tgz", + "integrity": "sha512-YMM6Fn3lrFOCjhORKjj+z/yizj8WSzv3F3YUlpJA20fteWCb0HbJU19nvuRBPUM5dWgxJcHP+kix3M+5NowJyA==", + "requires": { + "debug": "^2.5.2" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + } + } + }, "request": { "version": "2.88.2", "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", diff --git a/package.json b/package.json index 7ffab61a..7a1c7b5e 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,8 @@ "dependencies": { "@rokucommunity/bslib": "^0.1.1", "cz-conventional-changelog": "^3.3.0", - "log": "npm:roku-log@^0.10.1" + "log": "npm:roku-log@^0.10.1", + "rename": "^1.0.4" }, "devDependencies": { "@rokucommunity/bslint": "^0.8.1",