What is node_modules_bak? - node.js

I've got a folder in my project directory called 'node_modules_bak'. I don't know where it comes from or what it does. Google and StackOverflow do not provide any information about this name.
Does anyone know what it is and whether I can delete it safely?

It’s not a folder generated by node or npm or any well known tools.
It might be something generated internally by a script or even another developer wishing to backup the modules.
I would do a code search in all project files to see if the name comes up anywhere.

Like the other answer mentions, there are some tools that create this directory. It is not created by node or npm.
In my case it was https://github.com/siddharthkp/cost-of-modules/blob/0a009d670a4e4fcb185b29979b5f58668664da4b/src/helpers.js#L47-L49
/* Check if node modules exist and then backup */
let nodeModulesExist = fs.existsSync('node_modules')
if (nodeModulesExist) fs.copySync('node_modules', 'node_modules_bak')
There are a couple more of these on github when I search across all repos https://github.com/search?q=node_modules_bak+language%3AJavaScript&type=Code&ref=advsearch&l=JavaScript&l=

Related

Where should I put the nuspec file

I've searched the entire stackoverflow community but I couldn't find an answer for this...
I have a .nuspec file and I have no idea where I have to put it. Some topics say that I have to put it in the project directory and include in version control. Others say that its just keep the file in the same directory that the .nupkg file... but it doesn't worked to me. Any idea?
Thanks in advance.
A NUSpec file contains package metadata and is used to create a package.
A package is created from your project, which is why it would make sense to place the NUSpec file in the project folder.
It makes sense because it can then be committed to your source control as part of that project and this keeps everything in one place, it makes it easier to create the package automatically using your CI / CD pipeline.
You could, of course, do other things like create a NUSpec folder on the same level with your project folder and you could put your file there. Nuget.exe accepts a path to your NUSpec file so the actual location is irrelevant.
However, always consider your source control and how you manage / create this package, as long as you can do that easily, then place it wherever it makes sense to you.
You mentioned NPE, that doesn't really matter as behind the scenes it will more than likely call nuget.exe anyway. If you want to learn how to use it, have a look here : https://learn.microsoft.com/en-us/nuget/create-packages/creating-a-package.
They also recommend, as a convention, to have the nuspec file in the same location as the proj file.
As i understand from on of you comments you construct the package with the NPE.
As far as I remember the NPE was a ClickOnce application which opens up packages and you can put or even create packages there.
When the question is: Where do i put the nuspec within the package? the answer is: In the root folder of the package:
Otherwise the answer is already answered by the other answer.
Infos:
nuget packages are zip files
To get an idea where the nuspec resides in other packages just open one with NPE or 7zip
I had a look into the newtonsoft.json package
Unzipped it and it's obviously in the root folder of the package

Correctly set up Valves Source SDK 2013 on Linux

I just try to set up Valves Source SDK 2013 for Linux but I need to say that I find the wiki + documentation rather confusing and partly heavily outdated (Windows-only instructions, only for GoldSrc / pre-20XX SDk etc.).
I hope that someone who already has gone through the hassle can supply me with some hints on how to correctly set up the system.
I tried to use some Windows-specific instructions to understand the system but some are highly platform-specific.
So here is the current status (I based what I did on this wiki page: Wiki: Source SDK 2013:
The source of the SDK SDK 2013 from GitHub is cloned to
~/Git/source-sdk-2013/
the SDK Base 2013 installed via Steam and the steam-runtime to
~/working/steam-runtime-sdk_2013-09-05/
I was not sure whether there is a specific path I should put the steam runtime into so I just put it into my self-created working dir.
# Create a Multiplayer sample project
export SDKROOT="~/Git/source-sdk-2013"
bash $SDKROOT/mp/src/creategameprojects
bash $SDKROOT/mp/src/createallprojects
# Setup Steam Runtime
export STEAMRT="~/working/steam-runtime-sdk_2013-09-05/"
cd $STEAMRT
# Choose all build targets (i386 + amd64) and download these
./setup.sh
# Set current to target to the same as host machine (ie. amd64)
./shell.sh
# Compile the actual game
make -f $SDKROOT/mp/src/games.mak
I have not yet touched any source files as there's plenty of sources already supplied. I just wanted to confirm having a working toolchain set up
This all compiles fine but in the end the script wants to chmod the client.so and server.so but claims "not found" – but it sadly does not provide any information where it searched for them. Actually these are existant in
$SDKROOT/mp/game/mod_hl2mp/bin
and even marked as executable (-rwxr-xr-x).
So I just ignored this and hoped for the best. The next line to me sounds a bit strange:
At this point you should have client.so and server.so files to load with the Source SDK Base 2013 of your choice.
So I should be able so load the files with "the Source SDK Base 2013" (of your choice?!? Valve is the only one providing it O.o). How am I supposed to do that? I have not found any hint whatsoever for that, sadly.
But they hint me to the README.txt of the steam-runtime which tells me to do this:
run.sh ./MyGame
But where's the executable? I only have .so's
And this is the point where I currently am. I'm quite confused as I have many questions now:
Why do only the Linux users need to download the steam runtime? What if I want to not ship via Steam?
Is that chmod failure a script failure or a mistake in my directory setup?
How do I load these libraries via the SDK Base
Where is the binary? I'm quite confused here...
Have I overlooked something?
I appreciate any hints or links to resources, maybe explanations when I just were to dumb to understand what they mean :P
EDIT: Actually there is a GitHub repo for the steam-runtime too (GitHub/steam-runtime) – why is the download so outdated, the git repo has some updated stuff going on. Which should one choose?
With the help of a friend I didn't expect to be able to answer this (he didn't know about Linux but we could figure it out) I could solve it faster than expected.
To "load" the game via the Steam SDK Base just append the -game parameter and point it to the directory with the gameinfo.txt (ie. $SDKROOT/mp/game/mod_hl2mp/) in it.
Alternatively just copy the contents of this directory to
~/.local/share/Steam/steamapps/sourcemods/$MYSOURCEMOD
where $MYSOURCEMOD is how you want to call it (do not use spaces). Then add a steam.inf file in that dir with following content:
appID=243750
ProductName=$MYSOURCEMOD
PatchVersion=1.0.0.0
After a restart Steam will be able to find the sourcemod.
I'm not quite sure what the "steam-runtime" thingy is but I suppose it is to set up the build environment (to use a custom gcc etc.) as this is how the scripts look like. I'm not sure why you should run the game via the run.sh in the bin/ subfolder of the runtime instead of via Steam or via the parameter one the Source SDK Base but maybe someone can enlighten me here.
The archive one shall download is only a downloader/configurator for the steam-runtime hosted on GitHub.

About updating a node-webkit app

I want to set auto-updates up for my apps before I release. I'm a budding programmer, so when I looked into node-webkit-updater I was pretty confused. It seems under-documented to me. Can someone explain the overall update mechanism that it helps implement?
As an alternative to node-webkit-updater, I was thinking of creating my own update system. I kinda like how Apple handles extension updates and I was thinking about replicating it. This would involve putting a JSON/XML manifest file on Amazon S3 along with the latest versions of the app for all platforms. The app checks the file at startup and replaces itself with the new version.
Is the latter sound plausible? Am I better off going with node-webkit-updater? If so, can someone explain it to me please? My app is a Mac + Windows project.
This is what we did:
The first script of the page checks a custom "manifest" (.txt file) on the server, which contains some arbitrary text, e.g. version number.
If this value differs from a local version of the manifest, then download a .zip file from server. (The zip contains the latest nwjs website. You could have a separate one for each platform).
Unzip into a local directory (we use 7za command line util).
Set window.location.href to above local directory (index.html).
I know this is a old question, but here is the answer :)
https://www.npmjs.org/package/node-webkit-updater

Get all files located on a server?

I'm trying to find all of the (javascript) resources located on a specific site.
What would be a efficient way of finding them?
Everything I could think of is bruteforcing every possible name and check whether there's a file with this name at the server, although this isn't exactly that efficient.
Yes you can do this. The thing which you actually want to do is web directory traversal..
It is a kind of web vulnerability which is usually taken in to consideration by the web master so you get 403-Forbidden or 404-Not Found Error. Manual exploitation on this is surely possible with trial and error basis in case u get to know directory that contains .js files. For automation You can take use of Python/Perl for ease of use. I am personally working on a same project targeting the same objective using PHP and cURL. At very present I can not help about any source code but for sure I'll be posting same.

How do I move ExpressionEngine (EE) to another server?

What are the best steps to take to prevent bugs and/or data loss in moving servers?
EDIT: Solved, but I should specify I mean in the typical shared hosting environment e.g. DreamHost or GoDaddy.
Bootstrap config is the smartest method (Newism has a free bootstrap config module). I think it works best on fresh installs myself, but ymmv.
If you've been given an existing EE system and need to move it, there are a few simple tools that can help:
REElocate: all the EE 2.x path and config options, in one place. Swap one URL for another in setup, check what's being set and push the button.
Greenery: Again, one module to rule them all. I've not used this but it's got a good rating.
So install, set permissions, move files and and DB, and then use either free module. If you find that not all the images or CSS instantly comes back online, check your template base paths (in template prefs) and permissions.
I'm also presuming you have access to the old DB. If not, and you can't add something simple like PHPMyAdmin to back it up, try:
Backup Pro(ish): A free backup module for files and db. Easy enough that you should introduce it to the site users (most never consider backups). All done through the EE CP. The zipped output can easily be moved to the new server.
The EE User Guide offers a reasonably extensive guide to Moving ExpressionEngine to Another Server and if you follow all of these steps then you will have everything you need to try again if any bugs or data loss occur.
Verify Server Compatibility
Synchronize Templates
Back-up Database and Files
Prepare the New Database
Copy Files and Folders
Verify File Permissions
Update database.php
Verify index.php and admin.php
Log In and Update Paths
Clear Caches
As suggested by Bitmanic, a dynamic config.php file helps with moving environments tremendously. Check out Leevi Graham's Config Bootstrap for a quick and simple solution. This is helpful for dev/staging/prod environments too!
I'd say the answer is the same as any other system -- export your entire database, and download all of your files (both system and anything uploaded by users - images, etc). Then, mirror this process by importing/uploading to the new server.
Before I run my export, I like to use the Deeploy Helper module to change all of my file paths in EE to the new server's settings.
Preventing data loss primarily revolves around the database and upload directories.
Does your website allow users to interact with the database? If so at some point you'll need to turn off EE to prevent DB changes. If not that you don't have too much to worry about as you can track and changes on the database end between the old and new servers.
Both Philip and Derek offer good advice for migrating EE. I've also found that having a bootstrap config file helps tremendously - especially since you can configure your file upload directories directly via config values now (as of EE2.4, I think).
For related information, please check out the answers to this similar Stack Overflow question.

Resources