You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/plugins/plugin-workspace-guide.md
+38-30Lines changed: 38 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,33 +38,32 @@ cd nativescript-ui-kit
38
38
39
39
1. This first step will ensure all the dependencies are installed properly and only really needs to be run once after cloning the workspace. You can also use it anytime you simply want to clean/reset the workspace dependencies.
40
40
41
-
```cli
42
-
npm run setup
43
-
```
41
+
```cli
42
+
npm run setup
43
+
```
44
44
45
45
2. Now let's configure it to use the settings we prefer like which organization we want these plugins associated with.
46
+
This will also give us a chance to configure the default package.json repository url and author details we want each package to use.
46
47
47
-
This will also give us a chance to configure the default package.json repository url and author details we want each package to use.
48
-
49
-
```cli
50
-
npm run config
48
+
```cli
49
+
npm run config
51
50
52
-
? What npm scope would you like to use for this workspace?
53
-
› nstudio
51
+
? What npm scope would you like to use for this workspace?
**Your workspace is now configured and ready to go!**
66
65
67
-
## Add a package
66
+
## Adding a package
68
67
69
68
Let's add a package to develop a plugin, for example: `@nstudio/nativescript-label-marquee`
70
69
@@ -89,7 +88,7 @@ This created a `packages/nativescript-label-marquee` folder containing a plugin
89
88
- Updating the `npm start` interactive display
90
89
- Updating the README here to list the new package
91
90
92
-
## How to focus on just 1 package to develop in isolation
91
+
## Focus on a single package to develop in isolation
93
92
94
93
```cli
95
94
npm start
@@ -102,7 +101,7 @@ Note: _good to always clean the demo you plan to run after focusing. (You can cl
102
101
103
102
You can reset anytime with `npm start` > `focus.reset` ENTER
104
103
105
-
## How to publish packages?
104
+
## Publishing packages
106
105
107
106
```cli
108
107
npm run publish-packages
@@ -112,7 +111,7 @@ npm run publish-packages
112
111
- You will then be prompted for the version to use. Leaving blank will auto bump the patch version (it also handles prerelease types like alpha, beta, rc, etc. - It even auto tags the corresponding prelease type on npm).
113
112
- You will then be given a brief sanity check 🧠😊
114
113
115
-
## If needed, add Angular compatibility to a package
114
+
## Adding Angular compatibility to a package
116
115
117
116
Not all packages need specific Angular compatibility. Only if you want to provide Angular specific behavior for example, custom directives, components or other extended behavior to expand on top of your NativeScript plugin will you need to do this.
118
117
@@ -124,7 +123,7 @@ npm run add-angular
124
123
125
124
At the prompt, enter the name of the package to add an `angular` folder to it with the necessary boilerplate to provide Angular support to the package.
126
125
127
-
## Migrating your plugin workspace
126
+
## Migrating a plugin workspace
128
127
129
128
One of the nice benefits of using our plugin workspaces is updating them is made simple and efficient through Nx tooling. The TSC maintains plugin workspace migrations so whenever one is available you can update your plugin workspace with just a few simple commands (which will often provide dependency version bumps of supporting packages to latest NativeScript versions, configuration improvements, as well as other welcome additions to help you create and maintain NativeScript plugins):
130
129
@@ -148,7 +147,7 @@ Your plugin workspace will now be up to date regarding various configurations, s
148
147
149
148
After running migrations you can always _delete_ the `migrations.json` file as it will no longer be used. A `migrations.json` file is always generated if migrations are available to run. After applied, you no longer need the file.
150
149
151
-
####How often do migrations need to be run?
150
+
### How often do migrations need to be run?
152
151
153
152
Not very often actually. Most plugin workspaces can maintain it's set of dependencies for often 1-2 years or longer but if a migration is available which mentions things you want/need feel free to run the migrations anytime.
This just means the `tsconfig.base.json` still needs this following adjustment:
193
192
194
-
```ts
193
+
```json
195
194
"target": "ES2020",
196
195
"module": "esnext",
197
196
"lib": ["ESNext", "dom"],
@@ -205,7 +204,7 @@ This also updates transient dependencies to Angular 15. When migrating your plug
205
204
206
205
For any angular specific behavior you may encounter the following if you are extending `ListViewComponent`:
207
206
208
-
```
207
+
```bash
209
208
✖ Compiling with Angular sources in Ivy partial compilation mode.
210
209
Error: packages/picker/angular/picker.directive.ts:60:40 - error TS2345: Argument of type 'NgZone' is not assignable to parameter of type 'ChangeDetectorRef'.
211
210
Type 'NgZone' is missing the following properties from type 'ChangeDetectorRef': markForCheck, detach, detectChanges, checkNoChanges, reattach
- If using angular integrations you may run into issues like the following:
240
248
241
-
```cli
249
+
```bash
242
250
✖ Compiling with Angular sources in Ivy partial compilation mode.
243
251
Error: packages/picker/angular/picker.accessors.ts:30:14 - error NG3001: Unsupported private class PickerValueAccessor. This class is visible to consumers via NativeScriptPickerModule -> PickerValueAccessor, but is not exported from the top-level library entrypoint.
0 commit comments