Code Monkey home page Code Monkey logo

Comments (9)

rodrigo-brito avatar rodrigo-brito commented on July 17, 2024 1

It works for local repositories, but only for projects in GOPATH. I plan to include support for Go Module projects soon.

from gocity.

stevegt avatar stevegt commented on July 17, 2024

@emmanuelay I see your fork at https://github.com/emmanuelay/gocity with the "local" subcommand added. But I can't for the life of me figure out how to build and run it. How were you building it? Here's what I'm doing:

git clone [email protected]:emmanuelay/gocity.git
cd gocity
git checkout front-end
make
git checkout master
go build
./gocity local

As far as I can tell, the yarn build stuff is working, but the go:embed stuff doesn't seem to be doing its job. I'm still getting the dreaded "Please inform a valid Github URL" message. When I look at the minified js, I still see the old if statement there, without the "local" bits you added at https://github.com/emmanuelay/gocity/blob/4309562f60b68f0ff0e3c04e554933037a19f46c/src/App.js#L277, so obviously I'm missing something simple.

@rodrigo-brito I can't find any build procedure other than what's implied by the github workflow, Makefile, Dockerfile, and other hints. Am I doing the build above approximately right as far as you can tell?

The Go module support would be awesome.

from gocity.

rodrigo-brito avatar rodrigo-brito commented on July 17, 2024

Hi @stevegt, in a recent change we removed the dependency of GOPATH here e9221fe

We can make a small change now to provide this feature.
To open a local server with a public project, we can use gocity open <GITHUB_IMPORT>
To open the same server in a local project we can include support to the current dir in open command. Something like this:

gocity open . # current dir
gocity open ./myfolder # subdirectory

from gocity.

stevegt avatar stevegt commented on July 17, 2024

@rodrigo-brito Being able to gocity open . would be fantastic -- that was the first thing I tried. ;-) What would need to be changed, and do you need any help with that?

So far, I think part of the build problem I'm having with @emmanuelay's https://github.com/emmanuelay/gocity/blob/4309562f60b68f0ff0e3c04e554933037a19f46c has to do with the fact that the go build looks for assets under ./handle/assets, but the front-end Makefile leaves the built assets in ./build. It looks like that fork has a partially-implemented equivalent of #75 -- it already has the go:embed in there. @emmanuelay were you just manually copying from ./build to ./handle/assets, or am I still missing a build step?

from gocity.

rodrigo-brito avatar rodrigo-brito commented on July 17, 2024

You are correct, I'm copying the build versions manually from frontend branch to ./handle/assets. If you have a suggestion to keep in the main branch, it will help me a lot. The problem is: When we install the gocity binary, all the assets must be inside the binary.

An alternative to it is:

  • After publishing gocity frontend, we provide an online version of the JS Bundle. eg: https://go-city.github.io/main.js and
  • Instead of embedding the JS file, we only embed the index.html in which imports this file.

What you think?

from gocity.

rodrigo-brito avatar rodrigo-brito commented on July 17, 2024

Now, gociy open . works.
Implemented here ff93c3e

from gocity.

stevegt avatar stevegt commented on July 17, 2024

Works! Looking through the diff, I can see that wasn't a small change. ;-) Thank you.

For the assets, I'd keep embedding them in the binary. Was there a good reason for putting all of the front-end stuff in a different branch, rather than in a subdirectory in the master branch?

For now, and if front-end does need to stay in a different branch, than I'd do something like this:

  • have the front-end Makefile copy the assets into ./assets
  • put ./assets in .gitignore in both branches
  • have the master Makefile copy the assets from ./assets into ./handle/assets

Want me to give you a PR for that?

from gocity.

rodrigo-brito avatar rodrigo-brito commented on July 17, 2024

Was there a good reason for putting all of the front-end stuff in a different branch, rather than in a subdirectory in the master branch?

When we put the JS files in the master branch, Github recognizes the project as a JS Project instead of a Go Project.

Want me to give you a PR for that?

Thank you, but don't
I'm planning to remove React and Bulma and transform the front-end in a simple interface. Then I will include everything in a single and external asset.

from gocity.

rodrigo-brito avatar rodrigo-brito commented on July 17, 2024

I'm closing the issue.
I will track the demand of the embeded asset in another issue.

from gocity.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.