Skip to content
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
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,20 @@ Set up a new React, Vue, or Angular App so the new app and final package repo is

## Creating Test Apps

### React Example App
Each shim ships with a ready-to-run example under its `example/` folder. After
building the codegen (`npm run build`), the easiest way to try the shims
locally is:

```
cd build/react/example # or build/vue/v2/example, build/vue/v3/example, build/onesignal-ngx/example
vp run start
```

The `prestart` hook invokes `scripts/setup.sh`, which builds the parent shim,
packs it as a tarball, and installs it into the example before launching the
dev server on http://localhost:4000.

### React Example App (alternative)

```
cd ~/tmp
Expand All @@ -85,7 +98,7 @@ cd web-shim-test-react
npm link {YOUR_PATH_HERE}/web-shim-codegen/build/react
```

### Vue Example App
### Vue Example App (alternative)

```
cd ~/tmp
Expand Down
4 changes: 2 additions & 2 deletions outputs/onesignal-ngx/bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions outputs/onesignal-ngx/example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
onesignal-ngx.tgz

# build outputs
/dist
/.angular

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*

# local HTTPS certs (mkcert)
/.certs
36 changes: 36 additions & 0 deletions outputs/onesignal-ngx/example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# example-angular

A minimal Angular standalone app showcasing `onesignal-ngx`.

## Setup

Replace `<YOUR_APP_ID>` in `src/app/app.component.ts` with your OneSignal app id.

For a locally-trusted HTTPS cert (recommended; OneSignal requires HTTPS),
install [mkcert](https://github.com/FiloSottile/mkcert) once on your machine:

```bash
brew install mkcert nss
mkcert -install
```

If mkcert isn't installed the example falls back to Angular's self-signed
cert and the browser will show a security warning.

## Available Scripts

In the project directory, you can run:

### `npm start` (or `vp run start`)

Packs the parent `onesignal-ngx` package as a tarball, installs it locally,
generates a local HTTPS cert (via mkcert if available), and runs `ng serve`
on [https://localhost:4000](https://localhost:4000).

The page will reload if you make edits.

## Re-running setup

Run `vp run setup` to re-pack the parent package and re-install the freshly
packed tarball into the example. If you've changed the SDK source, rebuild it
first by running `npm run build` from the `web-shim-codegen` repo root.
72 changes: 72 additions & 0 deletions outputs/onesignal-ngx/example/angular.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"cli": {
"analytics": false
},
"projects": {
"example-angular": {
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
"style": "css",
"standalone": true
}
},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:application",
"options": {
"outputPath": "dist/example-angular",
"index": "src/index.html",
"browser": "src/main.ts",
"polyfills": ["zone.js"],
"tsConfig": "tsconfig.app.json",
"assets": [
{
"glob": "**/*",
"input": "public"
}
],
"styles": ["src/styles.css"],
"scripts": []
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
}
],
"outputHashing": "all"
},
"development": {
"optimization": false,
"extractLicenses": false,
"sourceMap": true
}
},
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"configurations": {
"production": {
"buildTarget": "example-angular:build:production"
},
"development": {
"buildTarget": "example-angular:build:development"
}
},
"defaultConfiguration": "development"
}
}
}
}
}
Loading