Archive localResource in YARN : customize location - hadoop-yarn

I wanted to deploy a zip file as a local resource in yarn. Hence I did:
packageResource.setResource(packageUrl);
packageResource.setSize(packageFile.length());
packageResource.setTimestamp(packageFile.lastModified());
packageResource.setType(LocalResourceType.ARCHIVE);
packageResource.setVisibility(LocalResourceVisibility.APPLICATION);
If my file name is "abc.zip", Yarn unpacks all the zip contents into a folder called "abc", not the current working directory.
For example, it creates something like:
/grid/5/tmp/yarn-local/usercache/(user)/appcache/application_1394223910537_2533883/container_1394223910537_2533883_01_000002/abc
Can I customize this behavior? How do I get Yarn to unzip a file in the current working directory ,instead of creating a new directory?
The use-case is: if my app has some scripts, it would be useful to have all scripts deployed to current directory, instead of having to change the code to reference them from within the folder that Yarn creates.

Related

npm pack, include file from root folder of a package in a monorepo

I have a monorepo setup with some private packages and a couple of public packages that can be published. I have a few common files that are directly in the root folder. When I run npm pack I want to be able to pack a few common files from the root folder. Is there a way to do it? Creating symlinks didn't work. Providing '../../file' in files attribute of the package.json didn't work either (perhaps understandably as there is no way to specify the target location).
Note that I currently don't have lerna which seem to have special logic to temporarily copy the LICENSE.md file from root folder to the packages.
Looking for options other than manually creating a copy of the file in each package that can be published.
I managed to accomplish this using prepack and postpack scripts

Xcode Build path and copying additional files

I'm writing a plugin for Elgato Stream Deck. https://developer.elgato.com/documentation/stream-deck/sdk/overview/
Basically it is a binary command line tool written in C++/OBJ-C/Swift combined with a JSON manifest and optionally some HTML and JS files as well as different assets (.png, ...). All files have to be included in a folder (com.companyname.pluginname.sdPlugin) which lives in Library/Application Support/com.elgato.StreamDeck/Plugins/
At the moment, I'm building the binary to the default build path (derived data, ...) and manually copy it to the above folder. But I need to build and run that binary with an executable (Stream Deck app) defined in the scheme for debugging under Xcode. The JSON manifest and assets also lives in my xcode project folder and have to be copied manually.
So Before:
After:
So my question: how can I automate that under Xcode? I assume I can do some sort of post build scripting, but I have no knowledge about all that stuff.
Thanks
Solution:
go to target -> build settings
Deployment Location = YES
Installation Build Products Location = / (empty this one!)
Installation Directory = path to folder (= $INSTALL_PATH)
this will copy your binary to the defined installation path
go to target -> build phases
new phase -> run script
cp -r "$SRCROOT"/<FILE OR FOLDER NAME> "$INSTALL_PATH"/<FILE OR FOLDER NAME>
repeat this for all files and folders you need to be copied to the installation path. be careful with empty spaces in the folder/file names, they won't be recognized correctly and you have to use quotation marks

WebStorm run configuration - package.json path relative to project directory

Question: In WebStorm's npm run configuration: How to make the package.json path relative to project directory?
Goal: To be able to share the run configuration in VCS, it must not depend on where the project is on my machine.
Screenshot: I.e., I want to change ~\WebStormProjects\x-nest\ to PROJECT_DIR\.
package.json field doesn't support variables; but you do not need to use macros or do anything at all to make configurations shareable, this case is handled automatically: if you look inside the .idea/workspace.xml (or .idea\runConfigurations\<config name>.xml if Share through VCS is enabled for it) file you'll notice that IDE stores this path as $PROJECT_DIR$/path/to/package.json, like:
<package-json value="$PROJECT_DIR$/package.json" />
So you can safely keep this .xml file under Version Control and your colleagues will have the correct path to the file even if local path to project is different.

Get path of nw archive in node webkit application

I am building multiple applications with nwjs(node webkit).
My applications will use the same nw runtime, installing multiple instances of nw on the same machine is not productive and useless.
At the moment, I am launching my apps with a shell script pointing to nw executable and passing as argument the path to my .nw archive.
The apps are located in different folders, not in the same folder as nw executable.
So far no issues, but one of the client requests is autoupdates. In order to do that I need to download a new nw archive containing the app source and replace the old one with the new one.
The problem I'm facing is not being able to find the archive path within the running app.
Following commands fails:
process.cwd() - pointing to unpacked archive in a temp folder.
process.execPath - pointing to nw executable
All other attempts (ie window.location etc) fails, since all points to the unpacked files from where the app runs.
Is there a way to get the path of the original archive(nw file)?
I recommend to install nw.js as local module: npm install nw --save for each your project. Then you can run your project with npm start command, assuming you have "start": "./node_modules/.bin/nw" script in the package.json.
Pros:
you can choose nw.js version and build type (SDK/Normal) for each project
you can update nw.js whenever you like
you can pack the whole project into Windows/OSX/Linux installer
Cons:
more files on disk
Bonus: If you would like to programmatically retrieve the path to the nw.js binary use:
var findpath = require('nw').findpath;
var nwpath = findpath();

intellij idea run configurations backup

I would like to create a script to modify my debug configuration in intellij. The path of tomcat changes, and i have to manually go into the run config and edit things. I have tried to find the place where intellij stores these settings to no avail.
question: does anyone know where IJ stores its run configuration
The location would depend on 2 factors, whether the configuration is local to the user or shared with the other developers and if you are using the file based (legacy) or the directory based project format.
File based project, local configuration: .iws file
Directory based project, local configuration: workspace.xml file under .idea directory
File based project, shared configuration: .ipr file
Directory based project, shared configuration: .xml file under runConfigurations subdirectory of .idea directory or files inside .run directory in the project root (you can customize the location of the shared configurations in the latest versions).
Its here .idea\runConfigurations (correct for Idea 11). Just copy this folder to new project.
EDIT: As per comment, if runConfigurations folder doesn't exist, check the 'Share' box inside the Run/Debug configuration