Skip to content

Commit 95c20ef

Browse files
authored
Merge pull request #114 from egekorkan/chore-administrative-fixes
Build and Package.json Fixes
2 parents 502226b + 4524374 commit 95c20ef

File tree

8 files changed

+3807
-83
lines changed

8 files changed

+3807
-83
lines changed

.github/workflows/publish-to-gh-pages.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ jobs:
1111
- uses: actions/setup-node@v2
1212
with:
1313
node-version: "20"
14-
- run: npm install
15-
- run: npm run build
14+
- run: yarn install
15+
- run: yarn build
1616
- name: Deploy 🚀
1717
uses: JamesIves/github-pages-deploy-action@3.7.1
1818
with:
1919
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2020
BRANCH: gh-pages
21-
FOLDER: build
21+
FOLDER: dist

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,5 @@ npm-debug.log*
2929
yarn-debug.log*
3030
yarn-error.log*
3131

32-
yarn.lock
3332
.yarn
3433
/doc/tests

README.md

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,6 @@ Find the ediTDor here to try it out:
77

88
https://eclipse.github.io/editdor/
99

10-
## Building the App
11-
12-
There are two ways this app can be built. One way would be for using it as a standalone application, the
13-
other one for using it embedded into a production environment.
14-
The available environment variables are:
15-
16-
```bash
17-
REACT_APP_IS_STANDALONE={flag} # true or false
18-
```
19-
20-
If the REACT_APP_IS_STANDALONE environment variable is set to true, REACT_APP_HOST and REACT_APP_PORT are going to be
21-
used for building the UIs target. Otherwise "/" is used.
22-
The package.json already contains build options for this (build, build-standalone).
23-
2410
## About this project
2511

2612
The goal of this project is the easy creation of W3C Thing Description instances and Thing Models by providing a platform-independent ediTDor tool. The following features are addressed in this project
@@ -50,16 +36,14 @@ Please follow our [contribution guide](./CONTRIBUTING.md).
5036

5137
- [Node.js](https://nodejs.org/), version 10+ (e.g., 10.13.0 LTS)
5238

53-
## Start Locally
54-
55-
`yarn dev` starts a local development server on Port 3000 (http://localhost:3000)
56-
5739
## Build
5840

5941
`yarn install` install all the dependencies listed within package.json
6042

6143
`yarn build` builds the project for deployment
6244

45+
`yarn dev` starts a local development server on Port 3000 (http://localhost:3000)
46+
6347
## Implemented Features:
6448

6549
- JSON Editor with JSON Schema support for TD (Autocompletion, JSON Schema Validation)

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,15 @@
44
"version": "0.7.0",
55
"type": "module",
66
"homepage": "https://eclipse.github.io/editdor/",
7+
"license": "EPL-2.0 OR W3C-20150513",
8+
"author": "Eclipse ediTDor <editdor-dev@eclipse.org>",
9+
"repository": {
10+
"type": "git",
11+
"url": "git+https://github.com/eclipse/editdor.git"
12+
},
713
"scripts": {
814
"dev": "cross-env REACT_APP_TARGET_URL=http://localhost:8080 vite",
915
"build": "vite build",
10-
"build-standalone": "cross-env REACT_APP_TARGET_URL= vite build",
1116
"lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
1217
"preview": "vite preview",
1318
"format": "prettier --write ."

src/components/TDViewer/TDViewer.jsx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,6 @@ export default function TDViewer() {
4747
addFormDialog.current.openModal();
4848
};
4949

50-
useEffect(() => {
51-
try {
52-
setTd(JSON.parse(context.offlineTD));
53-
} catch (e) {
54-
console.debug(e);
55-
}
56-
}, [context.offlineTD]);
57-
5850
const onDrop = useCallback(
5951
(acceptedFiles) => {
6052
const file = acceptedFiles[0];

src/main.jsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
import React from "react";
22
import ReactDOM from "react-dom/client";
33
import "./index.css";
4-
import { initializeTargetUrl } from "./services/targetUrl";
54
import App from "./App";
65

76
// require('string-direction').patch();
87

9-
initializeTargetUrl();
10-
118
const root = ReactDOM.createRoot(document.getElementById("root"));
129
root.render(
1310
<React.StrictMode>

src/services/targetUrl.ts

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -27,52 +27,4 @@ const setTargetUrl = (targetUrl: string): void => {
2727
localStorage.setItem(TARGET_URL_KEY, targetUrl);
2828
};
2929

30-
/**
31-
* @description
32-
* Initializes the target url if not already done.
33-
*
34-
* If a REACT_APP_TARGET_URL is provided through an ENV variable, it is assumed
35-
* that the UI is hosted as a standalone application. If not, it is assumed
36-
* that it runs as part of another application, e.g. an intermediary or thing
37-
* directory. In this case, the target url is initialized according to the host
38-
* address the UI is running on.
39-
*
40-
* To start the UI without a target url and configure it to simply use file
41-
* handles for persisting, provide an empty "REACT_APP_TARGET_URL=" environment
42-
* variable.
43-
*
44-
* @returns void
45-
*/
46-
const initializeTargetUrl = (): void => {
47-
let targetUrl: string | null = localStorage.getItem(TARGET_URL_KEY);
48-
if (targetUrl !== null) {
49-
console.debug(
50-
`didn't initialize target url - already initialized as '${targetUrl}'`
51-
);
52-
return;
53-
}
54-
55-
if (process.env.REACT_APP_TARGET_URL) {
56-
targetUrl = process.env.REACT_APP_TARGET_URL;
57-
if (!targetUrl?.endsWith("/")) {
58-
targetUrl = targetUrl + "/";
59-
}
60-
61-
localStorage.setItem(TARGET_URL_KEY, targetUrl);
62-
console.debug(
63-
`initialized target url from environment variable as '${targetUrl}'`
64-
);
65-
return;
66-
}
67-
68-
const windowUrl = new URL(window.location.href);
69-
70-
targetUrl = `${windowUrl.protocol}//${windowUrl.host}`;
71-
72-
localStorage.setItem(TARGET_URL_KEY, targetUrl);
73-
console.debug(
74-
`initialized target url from production host as '${targetUrl}'`
75-
);
76-
};
77-
78-
export { getTargetUrl, setTargetUrl, initializeTargetUrl };
30+
export { getTargetUrl, setTargetUrl };

0 commit comments

Comments
 (0)