-
Notifications
You must be signed in to change notification settings - Fork 79
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
(Partially) Automate generating examples from TypeScript to JavaScript #178
Conversation
I would support this PR and also combining demo-servients. I don't understand however the following:
|
The reason for begin/end is that one needs to manually copy the code between the 2 markers to scripts in https://github.com/eclipse/thingweb.node-wot/tree/master/examples/scripts (as I also did in this PR for the counter.js example). The package uses TS while the scripts folder is meant to be used for CLI environment. @egekorkan do you have a better approach. I am all open! |
The recent update simplifies the process/workflow Workflow
On improvements or automatic scripts can be worked on later. |
It is not possible anymore to dynamically add/remove properties and such (needs to create a *new* exposed thing)
* change name to title * add security
I asked @sebastiankb for review. @egekorkan If you can check as well would be great! I think this PR contains NOW all changes I wanted to work on.
Remaining future topics:
|
…manually edited it points to the workflow that describes how JS files are generated
### Workflow | ||
|
||
1. Run `npm run build` | ||
2. Remove the following 3/4 lines in JS files of folder `dist/` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what I have to do here? 3/4 lines (do you mean 3-4 lines)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the tsc
command creates the 3/4 lines mentioned below which at the moment need to be removed manually. In the future we should have an automates travis script
|
||
## Test Thing | ||
|
||
Test thing and client is located in `src\testthing`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the test thing related to the example? or is this a generic test thing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The TestThing is developed in TypeScript in the example package. The result is copied to the examples folder so that people don't need to build/run node-wot but instead have a JavaScript file that can be used right away.
Thanks @danielpeintner for clarification and for this PR. This will improve the quality of node-wot and its examples. Let's merge |
Couldn't be sure where to put this information but instead of doing this removal of 3-4 lines in Travis, I think it would be better to have a postbuild script that gets triggered by npm once the npm run build is finished. This way, it would be easier to develop new examples and not need to push them to GitHub to trigger the Travis script. However, it must be made sure that this script runs on WIndows and Linux systems, which probably means a node.js script |
I started a test PR for issue #171.
The idea is to have a package
examples
where we can use TypeScript to create examples and we are sure that the syntax and the API usages are correct.To be able to run it as JavaScript with the CLI one needs to copy the code between
// --> BEGIN CODE for scripts
and
// <-- END CODE for scripts
to the scripts folder (e.g., danielpeintner@fe19c76) so that the CLI can properly run it.
This is not ideal but I think doing so at least there is a guarantee that the code fits the API and the syntax is correct.
Any opinions?
Note: I also wonder whether the package
demo-servients
should be combined.