-
Notifications
You must be signed in to change notification settings - Fork 66
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
support for creating widget bundles #69
Conversation
✅ Deploy Preview for boisterous-sunburst-a5c941 ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
991bc39
to
aabad7c
Compare
aabad7c
to
623e804
Compare
It can be useful to include custom widgets with Grist, so they can be used offline, or for simpler archiving, or for tighter integration with the rest of the app. This PR includes a script for collecting custom widget files in a structured bundle. It will need some parallel work in Grist itself to serve the bundle.
623e804
to
a7afabc
Compare
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 think dist can be added to .gitignore.
} | ||
|
||
// Start a widget server. | ||
start() { |
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.
Maybe something like this, to make sure it works, (I have python 2.7 by default so it breaks for me):
async start() {
this.localServer = spawn('python', [
'-u', '-m', 'http.server', this.port,
], {
cwd: process.cwd(),
});
await new Promise((resolve, reject) => {
this.localServer.stdout.on('data', (data) => {
if (data.toString().includes('Serving HTTP on')) {
resolve();
}
});
this.localServer.stderr.on('data', (data) => {
reject(data.toString());
});
});
}
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 this to wait for the server to be up and responsive, instead of the wait()
method? I think I'd still have a weak preference for waiting for a fetch()
to succeed, since it seems easier to be confident of it. When checking a message on console, I find myself asking is this printed before or after the server is started. I'm a bit daunted about tracking down exact python source code, but it may be like this:
https://github.com/python/cpython/blob/20cfab903db70cf952128bc6b606e3ec4a216498/Lib/http/server.py#L1267-L1275
which at first glance looks like it prints the message first.
Separately, maybe I should write python3
instead of python
?
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.
Yes, python3 will be enough :)
* included in the bundle. Material needed by any | ||
* extra entry-point pages will be included as well. | ||
* | ||
* The bundle will also include grist-plugin-api.js. |
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.
This doesn't work for me, should it be added to the domains?
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.
Ah, sorry, I had commented out a // domains.push('getgrist.com')
line. I put it back in.
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.
Thanks.
It can be useful to include custom widgets with Grist, so they can be used offline, or for simpler archiving, or for tighter integration with the rest of the app. This PR includes a script for collecting custom widget files in a structured bundle. It is parallel work to developments in grist-core, including gristlabs/grist-core#714