Skip to content
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

Deploy demo apps to GH pages #65

Merged
merged 6 commits into from
Feb 15, 2023
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
25 changes: 25 additions & 0 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Deploy PR previews
run-name: ${{ github.actor }} is deploying a PR
on: [pull_request]

concurrency: preview-${{ github.ref }}

jobs:
deploy-preview:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install and Build Demo apps
run: |
npm install
npm run build:demos
with:
node-version: '19'

- uses: rossjrw/pr-preview-action@v1.3.0
with:
source-dir: ./build
preview-branch: gh-pages
umbrella-dir: pr-preview
action: auto
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
node_modules
npm-debug.log
dist
bin
*.pem
coverage
build
Expand Down
3 changes: 2 additions & 1 deletion demo-v1/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "HubSpot calling integration sdk test app",
"private": true,
"scripts": {
"build": "webpack",
"build": "webpack && cp -a dist/. ../build",
"start": "npm i && webpack-dev-server --open"
},
"license": "ISC",
Expand All @@ -25,6 +25,7 @@
"@types/styled-components": "^5.1.26",
"babel-loader": "^9.1.2",
"babel-plugin-styled-components": "^2.0.7",
"html-webpack-plugin": "^5.5.0",
"prettier": "2.8.4",
"prop-types": "^15.8.1",
"webpack": "^5.75.0",
Expand Down
10 changes: 9 additions & 1 deletion demo-v1/src/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,15 @@ function App() {
setTooltipBackgroundColor(WHITE)
)}
>
<div>{screenComponent}</div>
<div
style={{
backgroundColor: "#f5f8fa",
minWidth: "400px",
minHeight: "600px",
}}
>
{screenComponent}
</div>
</ThemeProvider>
);
}
Expand Down
28 changes: 28 additions & 0 deletions demo-v1/src/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<head>
<meta charset=”utf-8″>
<link href='https://fonts.googleapis.com/css?family=Lexend' rel='stylesheet'>
<style>
body {
font-family: 'Lexend';
margin: 0;
}

#app {
align-items: center;
display: flex;
flex-direction: column;
justify-content: center;
vertical-align: initial;
}
</style>
</head>

<body>
<div id="app"></div>
<script src="https://unpkg.com/react@18/umd/react.development.js" crossorigin></script>
<script src="https://unpkg.com/react-dom@18/umd/react-dom.development.js" crossorigin></script>
<script src="demo-v1.bundle.js"></script>
</body>
</html>
17 changes: 14 additions & 3 deletions demo-v1/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");

module.exports = {
entry: "./src/index.tsx",
mode: "development",
plugins: [
new HtmlWebpackPlugin({
template: "./src/index.html",
inject: false,
filename: "demo-v1.html",
}),
],
resolve: {
extensions: [".tsx", ".ts", ".js"],
},
output: {
path: path.resolve(__dirname, "dist"),
filename: "bundle.js",
filename: "demo-v1.bundle.js",
clean: true,
},
module: {
rules: [
Expand All @@ -28,8 +37,10 @@ module.exports = {
https: true,
port: 9025,
static: {
directory: path.join(__dirname, "dist"),
directory: path.resolve(__dirname, "dist"),
},
historyApiFallback: {
index: "demo-v1.html",
},
open: false,
},
};
2 changes: 1 addition & 1 deletion demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@
<div>Incoming Messages</div>
<div id="incomingMsgs"></div>

<script src="./bin/index_combined.js" async></script>
<script src="demo.bundle.js" async></script>
</body>
</html>
9 changes: 5 additions & 4 deletions demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@
"description": "HubSpot calling extension sdk demo",
"private": true,
"scripts": {
"build": "webpack",
"build": "NODE_OPTIONS=--openssl-legacy-provider webpack && cp -a bin/. ../build",
"serve": "npm i && webpack-dev-server --open",
"start": "node scripts/start.js npm run serve"
},
"license": "ISC",
"devDependencies": {
"clean-webpack-plugin": "^0.1.19",
"cross-env": "^7.0.3",
"webpack": "^4.23.1",
"webpack-cli": "^3.1.2",
"webpack-dev-server": "^3.1.10"
"html-webpack-plugin": "^5.5.0",
"webpack": "^5.75.0",
"webpack-cli": "^5.0.1",
"webpack-dev-server": "^4.11.1"
},
"dependencies": {
"@hubspot/calling-extensions-sdk": "^0.0.6"
Expand Down
23 changes: 16 additions & 7 deletions demo/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
const path = require("path");
const CleanWebpackPlugin = require("clean-webpack-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");
module.exports = {
entry: "./index.js",
mode: "development",
plugins: [new CleanWebpackPlugin("build")],
plugins: [new HtmlWebpackPlugin({
template: "./index.html",
inject: false,
filename: "demo.html"
})],
output: {
filename: "index_combined.js",
libraryTarget: "umd",
path: path.resolve(__dirname, "bin")
path: path.resolve(__dirname, "bin"),
filename: "demo.bundle.js",
clean: true
},
devServer: {
contentBase: "./",
publicPath: "/bin",
https: true,
port: 9025
port: 9025,
static: {
directory: path.resolve(__dirname, "bin")
},
historyApiFallback: {
index: "demo.html"
}
}
};
11 changes: 9 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
{
"name": "@hubspot/calling-extensions-sdk",
"version": "0.0.10",
"homepage": "https://github.hubspot.com/calling-extensions-sdk",
"description": "HubSpot calling extensions sdk for call widget integration.",
"publishConfig": {
"access": "public"
},
"scripts": {
"build": "webpack",
"build": "NODE_OPTIONS=--openssl-legacy-provider webpack",
"build:test": "npm run build && npm run test",
"prepublish": "npm run build:test",
"test": "karma start karma.conf.js --browsers ChromeHeadless --single-run",
"test:debug": "karma start karma.conf.js --browsers Chrome",
"cover": "open coverage/lcov-report/index.html",
"eslint": "eslint src --ext .js",
"eslint:fix": "eslint src .js --fix",
"travis": "npm run build:test"
"travis": "npm run build:test",
"build:demo": "cd demo && npm run build",
"build:demo-v1": "cd demo-v1 && npm run build",
"build:demos": "npm run build:demo-v1 && npm run build:demo && cp ./src/index.html build/index.html",
"predeploy": "npm run build:demos",
"deploy": "gh-pages -d build"
},
"main": "./dist/main.js",
"module": "./index.js",
Expand All @@ -35,6 +41,7 @@
"eslint-plugin-jsx-a11y": "^3.0.2",
"eslint-plugin-mocha": "^4.7.0",
"eslint-plugin-react": "^6.9.0",
"gh-pages": "^5.0.0",
"jasmine-core": "^3.3.0",
"karma": "^6.3.17",
"karma-babel-preprocessor": "^8.0.2",
Expand Down
11 changes: 11 additions & 0 deletions src/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<head>
<title>Index Page</title>
<meta charset="utf-8">
</head>
<body>
<a href="./demo.html">Demo App</a>
<br />
<a href="./demo-v1.html">Demo V1 App</a>
</body>
</html>