How to run this Go application locally? - javascript

I want to be able to run the application from the repository https://github.com/jbowens/codenames locally on my machine. Is it possible?
Steps I've tried:
Installed Go. Added PATH variable.
Cloned the repository to my machine in the right go path location.
Opened command prompt and ran the command "go run main.go" from the "cmd" folder
I really don't know anything about Go so maybe I just have to run another command or install dependencies or whatever. If someone could figure this out I would be super happy! This is an awesome game I would like to play from my machine.

I'm guessing you are just typing go build from the cmd/codenames directory, creating a binary called 'codenames' in that directory and running from there.
Unfortunately the app is hard-coded to look for its assets in a ./assets/ directory relative to the binary.
So you want your binary in the root of the app:
i.e
from the cmd/codenames directory go build -o ../../run-me-from-here
then from the root of the app ./run-me-from-here
.

Running them locally is very easy in go
I usually run go get while in my local go directory.
Go get https://github.com/jbowens/codenames

Set gopath and goroot then install dependencies.

Related

nodejs cmd dynamic directory navigation with sudo extension

Hi, right now I'm writing an electron program in which I execute a powershell file with:
sudo.exec('Powershell.exe -Command "D:\Directory\...\file.ps1"');
but since this will only work on my device I want to make the directory dynamic
like this:
sudo.exec('Powershell.exe -Command "../file.ps1"');
but for that to work I would need to know in which directory the cmd/powershell starts initially
or rather how I get it to start in the directory where the javascript file which runs this
is located (the file.ps1 isn't in this directory, but it would be easy to navigate from there)
Thx in advance

Deployment to external server using Circle Ci

It's my first time I'm trying to do that.
I'd like to set up config file in circle.ci in order to deploy my React app to expternal server. Before I just used Ftp connection to upload files to the production server. But now I'd like to do that authomatically. So in my circle config file I've already configured steps to run yarn install and yarn build, all is just doing fine, but the last step needs to be done, I basically have no knowledge how to connect it all, ie. files comes from github, then they are used for build purpose by circle.ci, then I'd like to deploy it to the production server. What is the flow here, and what should I use (ssh somehow, but how?). Thanks
If you're hosting provider supports it, I would suggest using rsync over FTP since it will ensure files are replicated without needing to upload everything, only changes. The --delete option will al\so remove extraneous files on the webhost that you may have removed from github.
- run:
name: Deploy public folder to YOURDOMAIN
command: |
rsync -avz --delete /local/path/ USERNAME#HOSTNAME:/Path/on/remote/server/
if yo have not made any changes to default CIrcleCI images, your local path is likely /home/circleci/project/

NodeWebkit - deploy the application

I have one code base for both Web and NodeWebkit (NW) application.
I use the following stack:
- React
- Hapi
- Sequelize
- Windows environment
Web version of the application uses MySQL, while NW uses Sqlite. It all works fine. I have config file that compiles application for what I need (web or NW).
The problem that I face now is how to deploy the NW application. Idea is to provide NW applicaiton to a client, where he will open it clicking the icon.
Since I use the Node for the NW version, and the application uses many modules which are stored in node_modules, I face a challenge how to pack it all up.
My idea is to make an Windows installer. User will click it and the installer will extract all files to the destination. And also make an icon on the user desktop to run it.
Problem is with the Windows file name limitation. Inside the node_modules, there are many subdirectories that simply violate the Windows limitation. I cant even copy the node_modules folder. I cant even delete it. Well sure I can copy it If I zip it... or remove manually long folders.
I have not yet started working on the installer, but I am thinking I will hit the wall with this approach.
Does anyone have an idea how to make this deployment?
How can I integrate NPM3 in NW?
My plan now is to make Windows installer. That windows installer will install normally application files. The node_modules will be zipped previously and placed inside the installer. Installer will then simply unzip it to the destionation folder.
I will post my progress here.
Some update here.
Main issue here was the depth of the node_modules. I have many modules in node_modules, and after some thinking I figured out there is a simple rule there. Some modules are server side modules, while other ones are used by react.
And since Webpack already creates a huge files in which all of the modules are already included, I simply do not need them at all.
So I have removed all front end side modules(babel modules, react-*), and left only server side (Hapi, sequelize...). Miracle happened, application run and was much faster at the startup.
I am going to use Inno setup to make a manifest file, and it should be good to go.
I am still not out of the danger zone, as developer might need a server side module, which has huge depth. But I will think about that if it happens.
More to follow...
actually in nodejs you can do the following:
1-Create another folder inside your project folder for example "server_modules"
2-In the created folder create another package.json file and install any modules needed for server out there
3-All these modules will be accessible as normal node_modules using require('module_name') and you can delete "server_modules" folder when you package your desktop version if you don't need it
Note: this approach used by some developers to achive micro services in nodejs but it is useful in your case

How can I run my node script using a shell script file

I am creating a personal site using node. It is going to help me keep track of the ebooks that I am reading.
At the moment, I need to cd to the project folder and run node server.js.
I thought I'd create a shell script and then I'd just have to double click on the file. The file would have the following code:
#!/usr/bin/env bash
node server.js
The first error I've got was that server.js is not found at the root directory, I fixed that by typing the full back, then it threw same error for all the dependencies in the application
(I have never used shell scripting)
Is what I am trying to do possible?
I am assuming you are Linux user.
Set the path in your $HOME/.profile
export MY_COOL_NODE_APP=$HOME/nodejs/app/cool_app
Now your script will run as:
node $MY_COOL_NODE_APP/server.js
So in case if you move your app, you will need to update your .profile

JSDoc setting up?

I am not that good at computers but am trying to use JSDoc for one of my projects,
The tutorial to get it up and running is here
http://usejsdoc.org/about-jsdoc3.html
I have downloaded the program from github, but now do not understand what I have to do. I have a bunch of files in a folder and dont know how to get it actually running for my project.
Could someone please give me a step by step instruction on how to actually get JSDoc working, how do I set it up, how do I use it etc.
I know this may be mundane to some of you, but hey we all gotta start somewhere right?
Well, are you using windows or GNU/Linux?
First, you have to follow the default tags to markup your source code, identifying your classes, methods, parameters, etc...
After that, you download the file here: https://github.com/jsdoc3/jsdoc
Extract it and then go to folder jsdoc-master.
Inside it, you have a script called jsdoc (with no extension). Only you have to do is execute it pointing the whole path to your .js file you want to create a documentation like this: ./jsdoc your_class.js
Then, in a couple minutes you'll have the output inside the 'out' folder. Open the .html file and bang! You have your documentation working pretty good.
Right here you can find some common tags to use in your code (as comments): http://usejsdoc.org/
This solution is for Unix based system. But, there is another one using nodejs (that you can run with windows, Linux, mac, etc...). First, download the nodejs here: http://nodejs.org/
Then go to this website to take a look at the package jsdoc: https://npmjs.org/
Then, go back to your terminal (in any operating system after installed node) and type: npm install -g jsdoc
The option -g means globally, so you have inside the main folder of your node packages and they are available for whatever project you have and you don't need to install it again and again...
Finally, you can just use this command: jsdoc path/to/your/file.js
And that's it! I hope it helps you.
Once you've extracted the file you downloaded off of github, navigate within the folder and run in a terminal:
./jsdoc
with the options you want.
If you want to display the help menu
./jsdoc --help
If you want to install the program on your system, assuming a mac or linux machine, use root user or sudo:
npm install --save -g [~/Downloads/jsdoc-3.2.2 or your path to the downloaded extracted files]

Categories

Resources