Skip to content

Commit 28303e8

Browse files
authored
chore: latest plugin-tools (#49)
1 parent b7ac409 commit 28303e8

26 files changed

+1953
-2520
lines changed

.husky/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npx lint-staged --allow-empty

README.md

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,69 @@ npm start
1414
- @nativescript/canvas-polyfill
1515
- @nativescript/canvas-three
1616

17+
# How to use?
1718

18-
## License
19+
This workspace manages the suite of plugins listed above.
20+
21+
In general, when in doubt with what to do, just `npm start`.
22+
23+
```bash
24+
npm run setup
25+
npm start
26+
27+
// Ensure all plugins build properly first
28+
> type "build-all" (and hit ENTER)
29+
```
30+
31+
If you don't build all the plugins, you will at least need to build `localize` to run the demos because it contains `hooks` that need to be built first.
32+
33+
If building only `localize`, type: `npm start` > `localize` (this will narrow down menu to `@nativescript.localize.build`) and then hit 'enter'. You can now run the demo apps.
34+
35+
In general, when in doubt with what to do, just `npm start`.
36+
37+
## How to add a new package to workspace?
38+
39+
```bash
40+
npm run add
41+
```
42+
43+
At the prompt, enter the name of the new package.
44+
45+
- This adds a plugin harness in `packages` with the necessary boilerplate to just start developing
46+
- Updates all demo app flavors to support demoing the new package
47+
- Adds shared code in `tools/demo` where you can write demo code **once** and share across all demo flavors
48+
- Updates build tooling to support the new package
49+
- Updates the `npm start` interactive display
50+
- Updates the README here to list the new package
51+
52+
## How to add Angular compatibility to a package
53+
54+
```bash
55+
npm run add-angular
56+
```
57+
58+
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.
59+
60+
## How to focus on just 1 package to develop in isolation
61+
62+
```bash
63+
npm start
64+
```
65+
66+
- Choose the focus commands for the package you wish to focus on and hit enter.
67+
- All the demo app's will be updated to isolate that 1 package and for supported IDE's (currently VS Code), the source code will also become isolated in the workspace.
68+
69+
Note: _good to always clean the demo you plan to run after focusing. (You can clean any demo from `npm start` as well)_
70+
71+
## How to publish packages?
72+
73+
```bash
74+
npm run publish-packages
75+
```
76+
77+
- You will be prompted for the package names to publish. Leaving blank and hitting enter will publish them all.
78+
- 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).
79+
- You will then be given a brief sanity check 🧠😊
80+
81+
<h3 align="center">Made with ❤️</h3>
1982

20-
Apache License 2.0

apps/demo-angular/package.json

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,7 @@
11
{
2-
"main": "main.js",
2+
"main": "./src/main.ts",
33
"dependencies": {
4-
"@angular/animations": "file:../../node_modules/@angular/animations",
5-
"@angular/common": "file:../../node_modules/@angular/common",
6-
"@angular/compiler": "file:../../node_modules/@angular/compiler",
7-
"@angular/core": "file:../../node_modules/@angular/core",
8-
"@angular/forms": "file:../../node_modules/@angular/forms",
9-
"@angular/platform-browser": "file:../../node_modules/@angular/platform-browser",
10-
"@angular/platform-browser-dynamic": "file:../../node_modules/@angular/platform-browser-dynamic",
11-
"@angular/router": "file:../../node_modules/@angular/router",
12-
"@nativescript/angular": "file:../../node_modules/@nativescript/angular",
134
"@nativescript/core": "file:../../node_modules/@nativescript/core",
14-
"nativescript-theme-core": "file:../../node_modules/nativescript-theme-core",
15-
"reflect-metadata": "file:../../node_modules/reflect-metadata",
16-
"rxjs": "file:../../node_modules/rxjs",
17-
"zone.js": "file:../../node_modules/zone.js",
185
"@nativescript/canvas-media": "file:../../dist/packages/canvas-media",
196
"@nativescript/canvas": "file:../../dist/packages/canvas",
207
"@nativescript/canvas-babylon": "file:../../dist/packages/canvas-babylon",
@@ -25,11 +12,7 @@
2512
"@nativescript/canvas-three": "file:../../dist/packages/canvas-three"
2613
},
2714
"devDependencies": {
28-
"@angular/compiler-cli": "file:../../node_modules/@angular/compiler-cli",
29-
"@nativescript/android": "~7.0.0",
30-
"@nativescript/ios": "7.0.0",
31-
"@nativescript/webpack": "~3.0.0",
32-
"@ngtools/webpack": "file:../../node_modules/@ngtools/webpack",
33-
"typescript": "file:../../node_modules/typescript"
15+
"@nativescript/android": "8.0.0",
16+
"@nativescript/ios": "8.0.0"
3417
}
35-
}
18+
}

apps/demo-angular/src/app.css renamed to apps/demo-angular/src/app.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
@import '~nativescript-theme-core/css/core.light.css';
1+
@import 'nativescript-theme-core/scss/light';
2+
@import 'nativescript-theme-core/scss/index';
23

34
button, label, stack-layout {
45
horizontal-align: center;

apps/demo-angular/src/main.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
import { platformNativeScriptDynamic } from "@nativescript/angular";
2-
import { AppModule } from "./app.module";
1+
import { runNativeScriptAngularApp, platformNativeScript } from '@nativescript/angular';
2+
import { AppModule } from './app.module';
33

4-
platformNativeScriptDynamic().bootstrapModule(AppModule);
4+
runNativeScriptAngularApp({
5+
appModuleBootstrap: () => platformNativeScript().bootstrapModule(AppModule),
6+
});
7+

apps/demo-angular/src/polyfills.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/**
2+
* NativeScript Polyfills
3+
*/
4+
5+
// Install @nativescript/core polyfills (XHR, setTimeout, requestAnimationFrame)
6+
import '@nativescript/core/globals';
7+
// Install @nativescript/angular specific polyfills
8+
import '@nativescript/angular/polyfills';
9+
10+
/**
11+
* Zone.js and patches
12+
*/
13+
// Add pre-zone.js patches needed for the NativeScript platform
14+
import '@nativescript/zone-js/dist/pre-zone-polyfills';
15+
16+
// Zone JS is required by default for Angular itself
17+
import 'zone.js';
18+
19+
// Add NativeScript specific Zone JS patches
20+
import '@nativescript/zone-js';
21+

apps/demo-angular/tsconfig.json

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,26 @@
11
{
2-
"extends": "../../tsconfig.base.json",
3-
"compilerOptions": {
4-
"rootDirs": [".", "../.."],
5-
"baseUrl": ".",
6-
"paths": {
7-
"~/*": ["src/*"],
8-
"@nativescript/*": ["../../dist/packages/*"],
9-
"@demo/shared": ["../../tools/demo/index.ts"]
10-
}
2+
"extends": "../../tsconfig.base.json",
3+
"compilerOptions": {
4+
"rootDirs": [
5+
".",
6+
"../.."
7+
],
8+
"baseUrl": ".",
9+
"paths": {
10+
"~/*": [
11+
"src/*"
12+
],
13+
"@nativescript/*": [
14+
"../../dist/packages/*"
15+
],
16+
"@demo/shared": [
17+
"../../tools/demo/index.ts"
18+
]
19+
}
1120
},
12-
"files": ["./references.d.ts", "./src/main.ts"],
13-
}
21+
"files": [
22+
"./references.d.ts",
23+
"./src/main.ts",
24+
"./src/polyfills.ts"
25+
]
26+
}

0 commit comments

Comments
 (0)