Skip to content

compiler/prelude: move prelude to separate .js files #791

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

Closed
wants to merge 1 commit into from

Conversation

myitcv
Copy link
Member

@myitcv myitcv commented Apr 15, 2018

I've been working with the prelude quite a lot recently. One of the really painful things with the current implementation is that the JavaScript for the prelude exists as a const string in a .go file, which makes properly writing and formatting the Javascript itself very difficult.

This PR splits the prelude into separate .js files therefore and adds a formatpreludejs.go go generate-er to format those .js files in place.

@myitcv
Copy link
Member Author

myitcv commented Apr 17, 2018

@hajimehoshi @shurcooL - yes, #791 (this PR) is ready for review. It's fully rebased on top of the most recent changes in #784.

As I mentioned in #793 we need to make a decision on whether we merge:

or something else.

@myitcv myitcv changed the title compiler/prelude: move prelude to separate formatted .js files compiler/prelude: move prelude to separate .js files Apr 18, 2018
myitcv added a commit to myitcv/gopherjs that referenced this pull request Apr 18, 2018
This PR introduces automatic formatting of the prelude's now separate
.js files. Using prettier has the same argument as using gofmt on .go
source code.

As part of this we make the go generate step for the prelude include a
formatpreludejs.go step.

The resulting prelude_min.go file is slightly different now, but post
gopherjs#791 we can see these
differences are entirely and solely attributable to prettier's adjusting
of the .js files.
@myitcv myitcv force-pushed the js_file_prelude branch 2 times, most recently from db1b319 to 282938b Compare April 20, 2018 07:22
myitcv added a commit to myitcv/gopherjs that referenced this pull request Apr 20, 2018
This PR introduces automatic formatting of the prelude's now separate
.js files. Using prettier has the same argument as using gofmt on .go
source code.

As part of this we make the go generate step for the prelude include a
formatpreludejs.go step.

The resulting prelude_min.go file is slightly different now, but post
gopherjs#791 we can see these
differences are entirely and solely attributable to prettier's adjusting
of the .js files.
@myitcv
Copy link
Member Author

myitcv commented Apr 20, 2018

This has now been rebased against master

Copy link
Member

@hajimehoshi hajimehoshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@hajimehoshi hajimehoshi requested a review from dmitshur April 20, 2018 08:38
myitcv added a commit to myitcv/gopherjs that referenced this pull request Apr 20, 2018
This PR introduces automatic formatting of the prelude's now separate
.js files. Using prettier has the same argument as using gofmt on .go
source code.

As part of this we make the go generate step for the prelude include a
formatpreludejs.go step.

The resulting prelude_min.go file is slightly different now, but post
gopherjs#791 we can see these
differences are entirely and solely attributable to prettier's adjusting
of the .js files.
myitcv added a commit to myitcv/gopherjs that referenced this pull request Apr 21, 2018
This PR introduces automatic formatting of the prelude's now separate
.js files. Using prettier has the same argument as using gofmt on .go
source code.

As part of this we make the go generate step for the prelude include a
formatpreludejs.go step.

The resulting prelude_min.go file is slightly different now, but post
gopherjs#791 we can see these
differences are entirely and solely attributable to prettier's adjusting
of the .js files.
myitcv added a commit to myitcv/gopherjs that referenced this pull request Apr 22, 2018
This PR introduces automatic formatting of the prelude's now separate
.js files. Using prettier has the same argument as using gofmt on .go
source code.

As part of this we make the go generate step for the prelude include a
formatpreludejs.go step.

The resulting prelude_min.go file is slightly different now, but post
gopherjs#791 we can see these
differences are entirely and solely attributable to prettier's adjusting
of the .js files.
I've been working with the prelude quite a lot recently. One of the
really painful things with the current implementation is that the
JavaScript for the prelude exists as a const string in a .go file, which
makes properly writing and formatting the JavaScript itself very
difficult.

This PR splits the prelude into separate .js files to make editing the
JavaScript prelude more straightforward.

genmin.go becomes genprelude.go where these .js files are catted
together into a single prelude.go file. The minified prelude_min.go is
as before.

Automated formatting of these .js files will follow in a later PR.
@myitcv myitcv force-pushed the js_file_prelude branch from f08bf7f to 4633788 Compare May 4, 2018 19:36
myitcv added a commit to myitcv/gopherjs that referenced this pull request May 4, 2018
This PR introduces automatic formatting of the prelude's now separate
.js files. Using prettier has the same argument as using gofmt on .go
source code.

As part of this we make the go generate step for the prelude include a
formatpreludejs.go step.

The resulting prelude_min.go file is slightly different now, but post
gopherjs#791 we can see these
differences are entirely and solely attributable to prettier's adjusting
of the .js files.
myitcv added a commit to myitcv/gopherjs that referenced this pull request Jul 2, 2018
This PR introduces automatic formatting of the prelude's now separate
.js files. Using prettier has the same argument as using gofmt on .go
source code.

As part of this we make the go generate step for the prelude include a
formatpreludejs.go step.

The resulting prelude_min.go file is slightly different now, but post
gopherjs#791 we can see these
differences are entirely and solely attributable to prettier's adjusting
of the .js files.
myitcv added a commit to myitcv/gopherjs that referenced this pull request Jul 2, 2018
This PR introduces automatic formatting of the prelude's now separate
.js files. Using prettier has the same argument as using gofmt on .go
source code.

As part of this we make the go generate step for the prelude include a
formatpreludejs.go step.

The resulting prelude_min.go file is slightly different now, but post
gopherjs#791 we can see these
differences are entirely and solely attributable to prettier's adjusting
of the .js files.
myitcv added a commit to myitcv/gopherjs that referenced this pull request Jul 2, 2018
This PR introduces automatic formatting of the prelude's now separate
.js files. Using prettier has the same argument as using gofmt on .go
source code.

As part of this we make the go generate step for the prelude include a
formatpreludejs.go step.

The resulting prelude_min.go file is slightly different now, but post
gopherjs#791 we can see these
differences are entirely and solely attributable to prettier's adjusting
of the .js files.
@flimzy
Copy link
Member

flimzy commented Dec 28, 2021

Is this still relevant? Will it remain relevant if we switch to Go 1.16's use of embed for js files?

Thoughts @nevkontakte ?

@flimzy
Copy link
Member

flimzy commented Dec 28, 2021

As this PR is no longer mergable, and will need to effectively be done from scratch, I'm going to close it.

Further, @nevkontakte and I have discussed this, and he has some good ideas on improving the prelude handling which will render this PR obsolete, so he'll soon file a new issue to track progress on this front.

@flimzy flimzy closed this Dec 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants