SimonBiggs / scriptedforms

Quickly create live-update GUIs for Python packages using Markdown and simple HTML elements.
Apache License 2.0
508 stars 34 forks source link

Inline webpack #249

Closed SimonBiggs closed 6 years ago

SimonBiggs commented 6 years ago

Next step:

https://github.com/SimonBiggs/scriptedforms/issues/233

SimonBiggs commented 6 years ago

@saulshanabrook would I be able to get you to do a quick review of this?

SimonBiggs commented 6 years ago

For some reason the angular linter wasn't picking up the html template as a string. ... So... It was my quick attempt to make the linter be quiet.

I'll have to work out a nicer way.

On Sat., 21 Apr. 2018, 3:10 am Saul Shanabrook, notifications@github.com wrote:

@saulshanabrook approved this pull request.

Looks good!

In scriptedforms/src/app/variables-module/variable-table.component.ts https://github.com/SimonBiggs/scriptedforms/pull/249#discussion_r183114182 :

@@ -41,10 +39,14 @@ import { PandasTable } from '../interfaces/pandas-table';

import { VariableParameterComponent } from './variable-parameter.component';

+import * as htmlTemplate from 'html-loader!./variable-table.component.html'; +const template = '' + htmlTemplate;

What's this for?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/SimonBiggs/scriptedforms/pull/249#pullrequestreview-114056558, or mute the thread https://github.com/notifications/unsubscribe-auth/AGQVezvHuOVs_aefl-44oAIfxy3layKwks5tqhZ6gaJpZM4Tdw5s .

SimonBiggs commented 6 years ago

Thanks Saul :)

On Sat., 21 Apr. 2018, 3:12 am Simon Biggs, mail@simonbiggs.net wrote:

For some reason the angular linter wasn't picking up the html template as a string. ... So... It was my quick attempt to make the linter be quiet.

I'll have to work out a nicer way.

On Sat., 21 Apr. 2018, 3:10 am Saul Shanabrook, notifications@github.com wrote:

@saulshanabrook approved this pull request.

Looks good!

In scriptedforms/src/app/variables-module/variable-table.component.ts https://github.com/SimonBiggs/scriptedforms/pull/249#discussion_r183114182 :

@@ -41,10 +39,14 @@ import { PandasTable } from '../interfaces/pandas-table';

import { VariableParameterComponent } from './variable-parameter.component';

+import * as htmlTemplate from 'html-loader!./variable-table.component.html'; +const template = '' + htmlTemplate;

What's this for?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/SimonBiggs/scriptedforms/pull/249#pullrequestreview-114056558, or mute the thread https://github.com/notifications/unsubscribe-auth/AGQVezvHuOVs_aefl-44oAIfxy3layKwks5tqhZ6gaJpZM4Tdw5s .

saulshanabrook commented 6 years ago

Oh, odd. I would think it could infer that from the declaration file, but I guess it is getting confused somewhere.

SimonBiggs commented 6 years ago

Yeah. I might need to look into the linter code itself. Might need an upstream fix.

On Sat., 21 Apr. 2018, 3:13 am Saul Shanabrook, notifications@github.com wrote:

Oh, odd. I would think it could infer that from the declaration file, but I guess it is getting confused somewhere.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/SimonBiggs/scriptedforms/pull/249#issuecomment-383162684, or mute the thread https://github.com/notifications/unsubscribe-auth/AGQVe3B2vPCVM1fTCJDpb0klMb6gs87Uks5tqhdUgaJpZM4Tdw5s .

SimonBiggs commented 6 years ago

@saulshanabrook unfortunately it completely breaks the linting of the angular template file. In its standard form the angular language service recognises that the template file and component are linked and it uses the typescript file to lint what is written within the html template file.

So, this method works, but the original pull request is still significantly preferable.

SimonBiggs commented 6 years ago

https://angular.io/guide/language-service

SimonBiggs commented 6 years ago

Unfortunately I don't know where to begin on providing a pull request to angular to allow interpreting imports as I've done it as a html template :/

https://github.com/angular/angular/tree/master/packages/language-service/src

SimonBiggs commented 6 years ago

And the template linter error wasn't a type error (hence why being a string didn't fix it) it's the angular language service not finding the template itself. By making '' + something be the "template" it stops complaining because it found a template of ''.

SimonBiggs commented 6 years ago

What if I tried using rollup? Might I have success down that path?

SimonBiggs commented 6 years ago

@saulshanabrook alright, I've created an initial issue over at Angular. I'll let you know how I progress.

https://github.com/angular/angular/issues/23478

Once that is sorted out, I'll sort out https://github.com/SimonBiggs/scriptedforms/issues/233, and then I might make an Angular JupyterLab extension cookie cutter so that others can use Angular to create JupyterLab extensions.

SimonBiggs commented 6 years ago

@robmarkcole by the way, this pull requests makes jupyterlab work with the current pypi jupyterlab release. I'm just going to implement a few usability things and then ScriptedForms should be a fully fledged jupyterlab extension. :)

robmarkcole commented 6 years ago

Excellent will try it out this week. The acid test is does it run on my windows machine at work :)