Skip to content

Commit 7a5c7ab

Browse files
committed
chore: clean up markdown
1 parent 65de174 commit 7a5c7ab

File tree

1 file changed

+38
-30
lines changed

1 file changed

+38
-30
lines changed

content/plugins/plugin-workspace-guide.md

Lines changed: 38 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -38,33 +38,32 @@ cd nativescript-ui-kit
3838

3939
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.
4040

41-
```cli
42-
npm run setup
43-
```
41+
```cli
42+
npm run setup
43+
```
4444

4545
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.
4647

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
5150
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?
52+
› nstudio
5453
55-
? What is the git repository address?
56-
› https://github.com/nstudio/nativescript-ui-kit
54+
? What is the git repository address?
55+
› https://github.com/nstudio/nativescript-ui-kit
5756
58-
? What is the author display name?
59-
› nstudio
57+
? What is the author display name?
58+
› nstudio
6059
61-
? What is the author email?
62-
63-
```
60+
? What is the author email?
61+
62+
```
6463

6564
**Your workspace is now configured and ready to go!**
6665

67-
## Add a package
66+
## Adding a package
6867

6968
Let's add a package to develop a plugin, for example: `@nstudio/nativescript-label-marquee`
7069

@@ -89,7 +88,7 @@ This created a `packages/nativescript-label-marquee` folder containing a plugin
8988
- Updating the `npm start` interactive display
9089
- Updating the README here to list the new package
9190

92-
## How to focus on just 1 package to develop in isolation
91+
## Focus on a single package to develop in isolation
9392

9493
```cli
9594
npm start
@@ -102,7 +101,7 @@ Note: _good to always clean the demo you plan to run after focusing. (You can cl
102101

103102
You can reset anytime with `npm start` > `focus.reset` ENTER
104103

105-
## How to publish packages?
104+
## Publishing packages
106105

107106
```cli
108107
npm run publish-packages
@@ -112,7 +111,7 @@ npm run publish-packages
112111
- 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).
113112
- You will then be given a brief sanity check 🧠😊
114113

115-
## If needed, add Angular compatibility to a package
114+
## Adding Angular compatibility to a package
116115

117116
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.
118117

@@ -124,7 +123,7 @@ npm run add-angular
124123

125124
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.
126125

127-
## Migrating your plugin workspace
126+
## Migrating a plugin workspace
128127

129128
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):
130129

@@ -148,7 +147,7 @@ Your plugin workspace will now be up to date regarding various configurations, s
148147

149148
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.
150149

151-
#### How often do migrations need to be run?
150+
### How often do migrations need to be run?
152151

153152
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.
154153

@@ -191,7 +190,7 @@ packages/nativescript-loading-indicator/index.android.ts:122:19 - error TS2693:
191190
192191
This just means the `tsconfig.base.json` still needs this following adjustment:
193192
194-
```ts
193+
```json
195194
"target": "ES2020",
196195
"module": "esnext",
197196
"lib": ["ESNext", "dom"],
@@ -205,7 +204,7 @@ This also updates transient dependencies to Angular 15. When migrating your plug
205204
206205
For any angular specific behavior you may encounter the following if you are extending `ListViewComponent`:
207206
208-
```
207+
```bash
209208
✖ Compiling with Angular sources in Ivy partial compilation mode.
210209
Error: packages/picker/angular/picker.directive.ts:60:40 - error TS2345: Argument of type 'NgZone' is not assignable to parameter of type 'ChangeDetectorRef'.
211210
Type 'NgZone' is missing the following properties from type 'ChangeDetectorRef': markForCheck, detach, detectChanges, checkNoChanges, reattach
@@ -218,11 +217,20 @@ https://github.com/NativeScript/angular/blob/main/packages/angular/src/lib/cdk/l
218217
219218
Can fix by modifying signature to the following:
220219
221-
```
222-
export class PickerFieldComponent extends ListViewComponent implements AfterContentInit {
223-
constructor(_elementRef: ElementRef, _iterableDiffers: IterableDiffers, _cdRef: ChangeDetectorRef) {
224-
super(_elementRef, _iterableDiffers, _cdRef);
225-
}
220+
```ts
221+
export class PickerFieldComponent
222+
extends ListViewComponent
223+
implements AfterContentInit
224+
{
225+
constructor(
226+
_elementRef: ElementRef,
227+
_iterableDiffers: IterableDiffers,
228+
_cdRef: ChangeDetectorRef
229+
) {
230+
super(_elementRef, _iterableDiffers, _cdRef)
231+
}
232+
// ...
233+
}
226234
```
227235
228236
### Migration 4.0.0 (Released July 3, 2022)
@@ -238,7 +246,7 @@ After migrating:
238246
239247
- If using angular integrations you may run into issues like the following:
240248
241-
```cli
249+
```bash
242250
✖ Compiling with Angular sources in Ivy partial compilation mode.
243251
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.
244252

0 commit comments

Comments
 (0)