Skip to content

Commit

Permalink
Fiddle: update deployment to point to new box (#108)
Browse files Browse the repository at this point in the history
* .

* .

* .

* .

* .

* .

* .

* .

* .

* .

* .
  • Loading branch information
krishan711 committed Sep 4, 2023
1 parent 7e59440 commit aac4e9b
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 60 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/deploy.yml
Expand Up @@ -92,10 +92,10 @@ jobs:
- name: executing remote ssh commands
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.APIBOX_URL }}
username: ${{ secrets.APIBOX_USER }}
key: ${{ secrets.APIBOX_SSH_KEY }}
port: ${{ secrets.APIBOX_PORT }}
host: ${{ secrets.KIBA_APP_BOX_URL }}
username: ${{ secrets.KIBA_APP_BOX_USER }}
key: ${{ secrets.KIBA_APP_BOX_SSH_KEY }}
port: ${{ secrets.KIBA_APP_BOX_PORT }}
envs: DOCKER_IMAGE,NAME,VERSION
script_stop: true
script: |
Expand Down Expand Up @@ -124,10 +124,10 @@ jobs:
- name: executing remote ssh commands
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.WORKERBOX_URL }}
username: ${{ secrets.WORKERBOX_USER }}
key: ${{ secrets.WORKERBOX_SSH_KEY }}
port: ${{ secrets.WORKERBOX_PORT }}
host: ${{ secrets.KIBA_APP_BOX_URL }}
username: ${{ secrets.KIBA_APP_BOX_USER }}
key: ${{ secrets.KIBA_APP_BOX_SSH_KEY }}
port: ${{ secrets.KIBA_APP_BOX_PORT }}
envs: DOCKER_IMAGE,NAME,VERSION,NETWORK
script_stop: true
script: |
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/release.yml
Expand Up @@ -84,10 +84,10 @@ jobs:
- name: executing remote ssh commands
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.APIBOX_URL }}
username: ${{ secrets.APIBOX_USER }}
key: ${{ secrets.APIBOX_SSH_KEY }}
port: ${{ secrets.APIBOX_PORT }}
host: ${{ secrets.KIBA_APP_BOX_URL }}
username: ${{ secrets.KIBA_APP_BOX_USER }}
key: ${{ secrets.KIBA_APP_BOX_SSH_KEY }}
port: ${{ secrets.KIBA_APP_BOX_PORT }}
envs: DOCKER_IMAGE,NAME,VERSION
script_stop: true
script: |
Expand Down Expand Up @@ -116,10 +116,10 @@ jobs:
- name: executing remote ssh commands
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.WORKERBOX_URL }}
username: ${{ secrets.WORKERBOX_USER }}
key: ${{ secrets.WORKERBOX_SSH_KEY }}
port: ${{ secrets.WORKERBOX_PORT }}
host: ${{ secrets.KIBA_APP_BOX_URL }}
username: ${{ secrets.KIBA_APP_BOX_USER }}
key: ${{ secrets.KIBA_APP_BOX_SSH_KEY }}
port: ${{ secrets.KIBA_APP_BOX_PORT }}
envs: DOCKER_IMAGE,NAME,VERSION,NETWORK
script_stop: true
script: |
Expand Down
50 changes: 25 additions & 25 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion packages/cli/package.json
Expand Up @@ -31,7 +31,7 @@
"@kibalabs/core": "^0.5.10",
"@kibalabs/core-react": "^0.9.4-next.1",
"@kibalabs/everypage": "0.9.9",
"@kibalabs/ui-react": "^0.11.0-next.38",
"@kibalabs/ui-react": "0.11.0-next.38",
"@loadable/component": "^5.14.1",
"@loadable/server": "^5.13.2",
"commander": "^10.0.0",
Expand Down
14 changes: 7 additions & 7 deletions packages/cli/src/app.tsx
@@ -1,10 +1,10 @@
import React from 'react';

import ReactDOM from 'react-dom';

import { IRoute, Router } from '@kibalabs/core-react';
import { IndexPage, IWebsite } from '@kibalabs/everypage';
import { IHeadRootProviderProps, ITheme } from '@kibalabs/ui-react';
import { createRoot, hydrateRoot } from 'react-dom/client';

export interface RouteData {
path: string;
Expand Down Expand Up @@ -44,10 +44,10 @@ export const App = (props: IAppProps): React.ReactElement => {
};

if (typeof document !== 'undefined') {
const target = document.getElementById('root');
const renderMethod = target.hasChildNodes() ? ReactDOM.hydrate : ReactDOM.render;
const render = (Component: React.ReactElement): void => {
renderMethod(<Component />, target);
};
render(App);
const target = document.getElementById('root') as HTMLDivElement;
if (target.hasChildNodes()) { // && window.location.pathname === renderedPath) {
hydrateRoot(target, <React.StrictMode><App /></React.StrictMode>);
} else {
createRoot(target).render(<React.StrictMode><App /></React.StrictMode>);
}
}
2 changes: 1 addition & 1 deletion packages/cli/src/renderer.tsx
Expand Up @@ -47,7 +47,7 @@ export const render = async (siteDirectoryPath?: string, assetsDirectoryPath?: s
const pages = loadPathsFromDirectory(siteDirectory, '', buildHash, initialContent, undefined);
console.log(`EP: loaded ${pages.length} pages`);
const content404 = fs.existsSync(path.join(siteDirectory, '404.json')) ? loadContentFromFileSync(path.join(siteDirectory, '404.json')) : default404Content;
const page404: IPage = { path: '404', filename: '/404.html', content: content404 as unknown as IWebsite, theme: pages[0].theme };
const page404: IPage = { path: '/404', filename: '/404.html', content: content404 as unknown as IWebsite, theme: pages[0].theme };

const siteData = {
routes: pages,
Expand Down
2 changes: 1 addition & 1 deletion packages/console/package.json
Expand Up @@ -12,7 +12,7 @@
"@kibalabs/core-react": "^0.9.4-next.1",
"@kibalabs/everypage": "0.9.9",
"@kibalabs/everyview-tracker": "^0.4.1",
"@kibalabs/ui-react": "^0.11.0-next.38",
"@kibalabs/ui-react": "0.11.0-next.38",
"@kibalabs/ui-react-dropzone": "0.2.0-next.2",
"@stripe/react-stripe-js": "^1.16.3",
"@stripe/stripe-js": "^1.46.0",
Expand Down
19 changes: 12 additions & 7 deletions packages/console/src/index.tsx
@@ -1,12 +1,17 @@
import React from 'react';

import ReactDOM from 'react-dom';
import { createRoot, hydrateRoot } from 'react-dom/client';

import { App } from './App';

ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root'),
);
const renderedPath = window.KIBA_RENDERED_PATH;
const pageData = window.KIBA_PAGE_DATA;

if (typeof document !== 'undefined') {
const target = document.getElementById('root') as HTMLDivElement;
if (target.hasChildNodes() && window.location.pathname === renderedPath) {
hydrateRoot(target, <React.StrictMode><App pageData={pageData} /></React.StrictMode>);
} else {
createRoot(target).render(<React.StrictMode><App pageData={pageData} /></React.StrictMode>);
}
}
4 changes: 2 additions & 2 deletions packages/core/package.json
Expand Up @@ -32,7 +32,7 @@
"devDependencies": {
"@kibalabs/build": "0.12.1-next.5",
"@kibalabs/everyview-tracker": "^0.4.1",
"@kibalabs/ui-react": "^0.11.0-next.38",
"@kibalabs/ui-react": "0.11.0-next.38",
"@types/react": "18.0.26",
"@types/react-dom": "18.0.10",
"@types/styled-components": "5.1.26",
Expand All @@ -41,7 +41,7 @@
"styled-components": "^5.3.6"
},
"peerDependencies": {
"@kibalabs/ui-react": "^0.11.0-next.38",
"@kibalabs/ui-react": "0.11.0-next.38",
"react": "^16.9.0 || ^17.0.0 || ^18.0.0",
"react-dom": "^16.9.0 || ^17.0.0 || ^18.0.0",
"styled-components": "^5.3.0"
Expand Down

0 comments on commit aac4e9b

Please sign in to comment.