Skip to content

chore: latest plugin-tools #49

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged --allow-empty
66 changes: 64 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,69 @@ npm start
- @nativescript/canvas-polyfill
- @nativescript/canvas-three

# How to use?

## License
This workspace manages the suite of plugins listed above.

In general, when in doubt with what to do, just `npm start`.

```bash
npm run setup
npm start

// Ensure all plugins build properly first
> type "build-all" (and hit ENTER)
```

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.

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.

In general, when in doubt with what to do, just `npm start`.

## How to add a new package to workspace?

```bash
npm run add
```

At the prompt, enter the name of the new package.

- This adds a plugin harness in `packages` with the necessary boilerplate to just start developing
- Updates all demo app flavors to support demoing the new package
- Adds shared code in `tools/demo` where you can write demo code **once** and share across all demo flavors
- Updates build tooling to support the new package
- Updates the `npm start` interactive display
- Updates the README here to list the new package

## How to add Angular compatibility to a package

```bash
npm run add-angular
```

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.

## How to focus on just 1 package to develop in isolation

```bash
npm start
```

- Choose the focus commands for the package you wish to focus on and hit enter.
- 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.

Note: _good to always clean the demo you plan to run after focusing. (You can clean any demo from `npm start` as well)_

## How to publish packages?

```bash
npm run publish-packages
```

- You will be prompted for the package names to publish. Leaving blank and hitting enter will publish them all.
- 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).
- You will then be given a brief sanity check 🧠😊

<h3 align="center">Made with ❤️</h3>

Apache License 2.0
25 changes: 4 additions & 21 deletions apps/demo-angular/package.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,7 @@
{
"main": "main.js",
"main": "./src/main.ts",
"dependencies": {
"@angular/animations": "file:../../node_modules/@angular/animations",
"@angular/common": "file:../../node_modules/@angular/common",
"@angular/compiler": "file:../../node_modules/@angular/compiler",
"@angular/core": "file:../../node_modules/@angular/core",
"@angular/forms": "file:../../node_modules/@angular/forms",
"@angular/platform-browser": "file:../../node_modules/@angular/platform-browser",
"@angular/platform-browser-dynamic": "file:../../node_modules/@angular/platform-browser-dynamic",
"@angular/router": "file:../../node_modules/@angular/router",
"@nativescript/angular": "file:../../node_modules/@nativescript/angular",
"@nativescript/core": "file:../../node_modules/@nativescript/core",
"nativescript-theme-core": "file:../../node_modules/nativescript-theme-core",
"reflect-metadata": "file:../../node_modules/reflect-metadata",
"rxjs": "file:../../node_modules/rxjs",
"zone.js": "file:../../node_modules/zone.js",
"@nativescript/canvas-media": "file:../../dist/packages/canvas-media",
"@nativescript/canvas": "file:../../dist/packages/canvas",
"@nativescript/canvas-babylon": "file:../../dist/packages/canvas-babylon",
Expand All @@ -25,11 +12,7 @@
"@nativescript/canvas-three": "file:../../dist/packages/canvas-three"
},
"devDependencies": {
"@angular/compiler-cli": "file:../../node_modules/@angular/compiler-cli",
"@nativescript/android": "~7.0.0",
"@nativescript/ios": "7.0.0",
"@nativescript/webpack": "~3.0.0",
"@ngtools/webpack": "file:../../node_modules/@ngtools/webpack",
"typescript": "file:../../node_modules/typescript"
"@nativescript/android": "8.0.0",
"@nativescript/ios": "8.0.0"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@import '~nativescript-theme-core/css/core.light.css';
@import 'nativescript-theme-core/scss/light';
@import 'nativescript-theme-core/scss/index';

button, label, stack-layout {
horizontal-align: center;
Expand Down
9 changes: 6 additions & 3 deletions apps/demo-angular/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { platformNativeScriptDynamic } from "@nativescript/angular";
import { AppModule } from "./app.module";
import { runNativeScriptAngularApp, platformNativeScript } from '@nativescript/angular';
import { AppModule } from './app.module';

platformNativeScriptDynamic().bootstrapModule(AppModule);
runNativeScriptAngularApp({
appModuleBootstrap: () => platformNativeScript().bootstrapModule(AppModule),
});

21 changes: 21 additions & 0 deletions apps/demo-angular/src/polyfills.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* NativeScript Polyfills
*/

// Install @nativescript/core polyfills (XHR, setTimeout, requestAnimationFrame)
import '@nativescript/core/globals';
// Install @nativescript/angular specific polyfills
import '@nativescript/angular/polyfills';

/**
* Zone.js and patches
*/
// Add pre-zone.js patches needed for the NativeScript platform
import '@nativescript/zone-js/dist/pre-zone-polyfills';

// Zone JS is required by default for Angular itself
import 'zone.js';

// Add NativeScript specific Zone JS patches
import '@nativescript/zone-js';

35 changes: 24 additions & 11 deletions apps/demo-angular/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDirs": [".", "../.."],
"baseUrl": ".",
"paths": {
"~/*": ["src/*"],
"@nativescript/*": ["../../dist/packages/*"],
"@demo/shared": ["../../tools/demo/index.ts"]
}
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDirs": [
".",
"../.."
],
"baseUrl": ".",
"paths": {
"~/*": [
"src/*"
],
"@nativescript/*": [
"../../dist/packages/*"
],
"@demo/shared": [
"../../tools/demo/index.ts"
]
}
},
"files": ["./references.d.ts", "./src/main.ts"],
}
"files": [
"./references.d.ts",
"./src/main.ts",
"./src/polyfills.ts"
]
}
Loading