Skip to content

Commit 522827d

Browse files
committed
CODAP-121
1 parent 6bc7895 commit 522827d

File tree

3 files changed

+26
-53
lines changed

3 files changed

+26
-53
lines changed

README.md

Lines changed: 16 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# CODAP Plugin Starter Project
22

3-
This is a bare-bones React project, created with the `--typescript` version of [Create React App](https://github.com/facebook/create-react-app), and left un-ejected. This is simply a trivial React view with the libraries for using the [CODAP Plugin API](https://github.com/concord-consortium/codap/wiki/CODAP-Data-Interactive-Plugin-API).
3+
This is a bare-bones React project. It contains a simple React view with the libraries for using the [CODAP Plugin API](https://github.com/concord-consortium/codap/wiki/CODAP-Data-Interactive-Plugin-API).
44

55
## Development
66

@@ -57,55 +57,22 @@ This is a bare-bones React project, created with the `--typescript` version of [
5757
5858
## Testing the plugin in CODAP
5959
60-
Currently there is no trivial way to load a plugin running on a local server with `http` into the online CODAP, which forces `https`. One simple solution is to download the latest `build_[...].zip` file from https://codap.concord.org/releases/zips/, extract it to a folder and run it locally. If CODAP is running on port 8080, and this project is running by default on 3000, you can go to
60+
There are two ways to test the plugin in CODAP:
61+
- running it locally on https and use the deployed CODAP
62+
- running it and CODAP locally on http
6163
62-
http://127.0.0.1:8080/static/dg/en/cert/index.html?di=http://localhost:3000
64+
### HTTPS
65+
1. Start the plugin with `npm run start:secure`. You need to first setup a local http certificate if you haven't done so: https://github.com/concord-consortium/codap/blob/main/v3/README.md#run-using-https
66+
2. Run CODAP v2 or v3 with the `di` parameter:
67+
- v2: https://codap.concord.org/app/?di=https://localhost:8080/
68+
- v3: https://codap3.concord.org/?di=https://localhost:8080/
6369
64-
to see the plugin running in CODAP.
70+
### HTTP
71+
1. Start plugin webserver `npm start` (it will be on 8080 by default)
72+
2. Setup a local webserver running CODAP.
73+
- v2: Download the latest `build_[...].zip` file https://codap.concord.org/releases/zips/. Extract the zip to a folder and run it with a local webserver. For example `npx httpserver -p 8081`
74+
- v3: Checkout the v3 source, install the dependencies, and start the dev server: https://github.com/concord-consortium/codap/blob/main/v3/README.md#initial-steps. The dev server should automatically choose the next avaiable port which would normally be 8081
75+
3. Open CODAP with the plugin embedded in it: http://localhost:8081/static/dg/en/cert/index.html?di=http://localhost:8080
6576
66-
# Create React App Readme
6777
68-
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
69-
70-
## Available Scripts
71-
72-
In the project directory, you can run:
73-
74-
### `npm start`
75-
76-
Runs the app in the development mode.<br>
77-
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
78-
79-
The page will reload if you make edits.<br>
80-
You will also see any lint errors in the console.
81-
82-
### `npm test`
83-
84-
Launches the test runner in the interactive watch mode.<br>
85-
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
86-
87-
### `npm run build`
88-
89-
Builds the app for production to the `build` folder.<br>
90-
It correctly bundles React in production mode and optimizes the build for the best performance.
91-
92-
The build is minified and the filenames include the hashes.<br>
93-
Your app is ready to be deployed!
94-
95-
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
96-
97-
### `npm run eject`
98-
99-
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
100-
101-
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
102-
103-
Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
104-
105-
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
106-
107-
## Learn More
108-
109-
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
110-
111-
To learn React, check out the [React documentation](https://reactjs.org/).
78+
For further information on [CODAP Data Interactive Plugin API](https://github.com/concord-consortium/codap/wiki/CODAP-Data-Interactive-Plugin-API).

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"scripts": {
3838
"start": "webpack serve --no-https",
3939
"start:secure": "webpack serve",
40-
"start:secure:no-certs": "webpack serve --no-https-request-cert",
40+
"start:secure:no-certs": "webpack serve --server-options-cert-reset --server-options-key-reset",
4141
"build": "npm-run-all lint:build build:webpack",
4242
"build:webpack": "webpack --mode production",
4343
"build:top-test": "cross-env DEPLOY_PATH=specific/release/ webpack --mode production --output-path top-test/specific/release && cp top-test/specific/release/index-top.html top-test/",

webpack.config.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,15 @@ module.exports = (env, argv) => {
2121
devServer: {
2222
static: 'dist',
2323
hot: true,
24-
https: {
25-
key: path.resolve(os.homedir(), '.localhost-ssl/localhost.key'),
26-
cert: path.resolve(os.homedir(), '.localhost-ssl/localhost.pem'),
24+
headers: {
25+
'Access-Control-Allow-Origin': '*'
26+
},
27+
server: {
28+
type: 'https',
29+
options: {
30+
key: path.resolve(os.homedir(), '.localhost-ssl/localhost.key'),
31+
cert: path.resolve(os.homedir(), '.localhost-ssl/localhost.pem'),
32+
}
2733
},
2834
},
2935
devtool: devMode ? 'eval-cheap-module-source-map' : 'source-map',

0 commit comments

Comments
 (0)