Skip to content

Commit

Permalink
Merge pull request #231 from lyra/fix/example-issues
Browse files Browse the repository at this point in the history
feat(examples): Update framework examples and add e2e tests for them
  • Loading branch information
s-yagues authored Sep 21, 2022
2 parents f90bc79 + 6d3a8e0 commit 7b7b420
Show file tree
Hide file tree
Showing 85 changed files with 65,362 additions and 64,917 deletions.
11 changes: 9 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,17 @@ jobs:
- checkout
- browser-tools/install-browser-tools
- node/install-packages
# - run:
# name: 'Start http server'
# background: true
# command: npm run e2e-server
- run:
name: 'Start http server'
name: 'Build examples'
command: npm run build:examples
- run:
name: 'start servers'
background: true
command: npm run e2e-server
command: npm run e2e-servers
- run:
name: 'Run tests'
command: npm run test-ci
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
*.pyc
node_modules
.history
examples_build
.angular
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ First you need to load the theme files in your HEAD section:
```javascript
<!-- theme and plugins. should be loaded in the HEAD section -->
<link rel="stylesheet"
href="https://[CHANGE_ME: JAVASCRIPT ENDPOINT]/static/js/krypton-client/V4.0/ext/classic-reset.css">
href="~~CHANGE_ME_ENDPOINT~~/static/js/krypton-client/V4.0/ext/classic-reset.css">
<script
src="https://[CHANGE_ME: JAVASCRIPT ENDPOINT]/static/js/krypton-client/V4.0/ext/classic.js">
src="~~CHANGE_ME_ENDPOINT~~/static/js/krypton-client/V4.0/ext/classic.js">
</script>
```
**note**: Replace **[CHANGE_ME]** with your credentials and end-points.
Expand All @@ -71,8 +71,8 @@ Import the component:
and Load the [Lyra Javascript library][JS Link]:

```javascript
const publicKey = 'CHANGE_ME: YOUR PUBLIC KEY';
const endPoint = 'CHANGE_ME: JAVASCRIPT ENDPOINT'; /* should include https:// */
const publicKey = '~~CHANGE_ME_PUBLIC_KEY~~';
const endPoint = '~~CHANGE_ME_ENDPOINT~~'; /* should include https:// */

/* WARNING: You should always use promises chaining with KR method calls */
KRGlue.loadLibrary(endPoint, publicKey) /* Load the remote library */
Expand Down
33 changes: 33 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

mkdir -p examples_build/react
mkdir examples_build/next
mkdir examples_build/server
mkdir examples_build/svelte

cd examples

npm ci --prefix server &&
npm ci --prefix angular/minimal-example &&
npm ci --prefix emberjs &&
npm ci --legacy-peer-deps --prefix ionic/minimal-example &&
npm ci --prefix react/minimal-example &&
npm ci --prefix react/next-minimal &&
npm ci --prefix vuejs/minimal-example &&
npm ci --prefix svelte/minimal-example

wait

npm run build:example --prefix angular/minimal-example &&
npm run build:example --prefix emberjs &&
npm run build:example --prefix ionic/minimal-example &&
npm run build:example --prefix react/minimal-example &&
npm run build:example --prefix react/next-minimal &&
npm run build:example --prefix vuejs/minimal-example &&
npm run build:example --prefix svelte/minimal-example

wait

cp -R server ../examples_build/

gulp replaceKeys
12 changes: 6 additions & 6 deletions examples/angular/minimal-example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ Add them in src/index.html in the the HEAD section:
```javascript
<!-- theme and plugins. should be loaded in the HEAD section -->
<link rel="stylesheet"
href="https://[CHANGE_ME: JAVASCRIPT ENDPOINT]/static/js/krypton-client/V4.0/ext/classic-reset.css">
href="~~CHANGE_ME_ENDPOINT~~/static/js/krypton-client/V4.0/ext/classic-reset.css">
<script
src="https://[CHANGE_ME: JAVASCRIPT ENDPOINT]/static/js/krypton-client/V4.0/ext/classic.js">
src="~~CHANGE_ME_ENDPOINT~~/static/js/krypton-client/V4.0/ext/classic.js">
</script>
```

Expand Down Expand Up @@ -107,8 +107,8 @@ import KRGlue from "@lyracom/embedded-form-glue";
export class AppComponent implements OnInit {
title = "minimal-example";
ngOnInit() {
const endpoint = "CHANGE_ME: JAVASCRIPT ENDPOINT";
const publicKey = "CHANGE_ME: YOUR PUBLIC KEY";
const endpoint = "~~CHANGE_ME_ENDPOINT~~";
const publicKey = "~~CHANGE_ME_PUBLIC_KEY~~";
const formToken = "DEMO-TOKEN-TO-BE-REPLACED";
KRGlue.loadLibrary(endpoint, publicKey) /* Load the remote library */
.then(({ KR }) =>
Expand Down Expand Up @@ -187,8 +187,8 @@ export class AppComponent implements OnInit {
(...),
ngOnInit() {
/* Use your endpoint and personal public key */
const endpoint = 'CHANGE_ME: JAVASCRIPT ENDPOINT'
const publicKey = 'CHANGE_ME: YOUR PUBLIC KEY'
const endpoint = '~~CHANGE_ME_ENDPOINT~~'
const publicKey = '~~CHANGE_ME_PUBLIC_KEY~~'
const formToken = 'DEMO-TOKEN-TO-BE-REPLACED'
KRGlue.loadLibrary(endpoint, publicKey) /* Load the remote library */
.then(({KR}) => KR.setFormConfig({ /* set the minimal configuration */
Expand Down
5 changes: 4 additions & 1 deletion examples/angular/minimal-example/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,8 @@
}
}
},
"defaultProject": "minimal-example"
"defaultProject": "minimal-example",
"cli": {
"analytics": false
}
}
Loading

0 comments on commit 7b7b420

Please sign in to comment.