Does relay-compiler delete unused generated files? - relayjs

My CI process, to ensure reliability of generated files, rm -rf all __generated__ dirs then generates again. It seems there is a problem (somewhere), as my results are occasionally different on OSX (local) vs Linux (CI). I'm wondering if it is a timing problem with file events and watchman.
Then I thought, do I need to wipe out these files or will relay-compiler delete old/unused generated files?

In my experience it deletes files. Here's an example from a terminal I have open:
Parsed default in 0.32s
Writing default
Writer time: 0.46s [0.09s compiling, 0.37s generating, 0.00s extra]
Created:
- deleteCustomsBondMutation.graphql.js
- putCustomsBondMutation.graphql.js
Updated:
- BondInformationQuery.graphql.js
Deleted:
- deleteCustomsBondMutation.graphql.js
- putCustomsBondMutation.graphql.js
Unchanged: 5 files
Written default in 0.51s
Watching for changes to default...
Notice that it deleted two files. This was because I moved my mutations into a different directory.

Related

Xcode 10: what is in 'Library/Developer/Xcode/UserData/IB Support/Simulator Devices'?

I noticed that this directory:
/Users/$USER/Library/Developer/Xcode/UserData/IB Support/Simulator Devices
contains some rather large directories on my Mac:
$ du -d1 -h | sort -h
...
1.7G ./A7F495BF-B286-4A8B-83A7-7E3D32A237AE
2.4G ./E9F53010-C7A9-469D-8859-D482D6D334FC
5.9G ./E85370F1-3126-4679-AA61-35DCAA6B7871
9.8G ./56FB0674-0DA8-41BA-BA0D-0398CF2139A1
22G ./9F55C8ED-15A2-4FF7-8052-BA4464B290F9
32G ./3CA6DF23-014A-4939-9B5F-9039655B8D03
Digging a little deeper, 3CA6DF23-014A-4939-9B5F-9039655B8D03/data/tmp contains a lot of *.uicatalog files.
These UUIDs do not show up when I run xcrun simctl list.
Does anyone know what creates these files, and if it's safe to delete them?
Xcode creates those files after each build. They are unused, so you can delete them. If it is a server, you can periodically delete them:
Create a file with the library path:
sudo vim /etc/periodic.conf.local
In it, write:
daily_clean_tmps_dirs="/tmp /Users/<user-name>/Library/Developer/Xcode/UserData/"
Run to make sure files are deleted every 3 days:
du -sh /Users/<user-name>/Library/Developer/Xcode/UserData/IB\ Support/
sudo periodic daily
Best I can give at the moment is a partial answer, as I'm running into a similar issue with our test server. These files are just sqlite databases. When opening them up and viewing their contents, it appears to be lots of metadata related to UI components in your app, and references to assets in the Asset Catalog. I don't know what the purpose of these files is though.
As these things live in a /tmp/ folder, it's likely safe to delete them. I deleted them all on my server, and so far the tests have continued to run with no issues, and new *.uicatalog files are being created with each test.

Ruby change directory in code

So, I've came across an issue where I delete the current folder where my ruby script is executing ex:
/home/user/scriptfolder
Now i have my ruby gem running and I do this:
mycommand --deletefull
now mycommand is an GLI command, which should delete the content of the folder and the folder itself. I do that by using my custom class:
ClientModuleDir.rm_f(path)
now after deleting it I want to just do cd ..
however I've tried several methods:
system('cd ..')
Dir.chdir(dir) #dir is abs path without the scripfolder name, i've tried every combination with this command, nothing works so far.
However these methods are not working.
I still am in the
/home/user/scriptfolder
after executing these commands, but the folder DOES NOT EXIST. When I manually do cd .. and i do ls the folder is not there.
How do I change "physically" the folder in ruby code ?
The current working directory is always kept for the current program only. Changing the working directory in a program won't affect any other running programs, including its parent.
Thus, when you delete the directory in your Ruby script and change the working directory of the Ruby process one level down, this won't affect the shell process which has started your Ruby script.

electron how to create delta file

I use electron-builder to build my app and succeed to build the first version which contains three outputs: foosetup.exe, foo-0.0.1-full.nupkg and RELEASES.Now I want to implement the auto-update and I have deployed a back-end service by using electron-release-server.
The auto-update need to set a feedURL which will be used to fetch updates,but the problem is that I don't know what the updates exactly means?Is it the foo-0.0.1-full.nupkg or the foo-0.0.1-delta.nupkg or another file?
The second problem is that I don't know how to create the delta file.I can just find an option remoteReleases in electron-builder which is a URL to your existing updates.If given,these will be downloaded to create delta file.But what's the URL exactly means?I find a example i which "remoteRelease": "https://github.com/user/repo",and it creates some releases and uploads many extra files for each release such as foosetup.exe, foo-xx-full-nupkg, RELEASES.I guess electron-builder will fetch the ${remoteReleases/release/download/some-version/xxx} to download file and then diff the two file to create delta file,but I can't upload RELEASES when I create release on github,it reports that they don't support this file type.
Is there anyone can help?There're to few docs to follow for a beginer
For electron-release-server please take a look at the docs.
The delta-file will be create automatically if you use electron-builder. But in order for this to work remoteReleases must be set to a valid (and reachable) URL plus there must at least an empty file called RELEASES. So for the very first build just create an empty file and call it RELEASES.
On every future build there will be a RELEASES file created for you. Threw all the generated files in your release server (overwrite existing RELEASES) and it'll be fine.
Attention: For electron-release-server you do not need the RELEASES generated by electron-builder. electron-release-server will create one by itself.
To get started with auto-updates I'd recommend that you set up a dead-simple release-server locally. I. e.:
Create a directory and throw an empty file RELEASES in there.
Then start a simple webserver pointing at that directory (e. g. cd into/your/dir && php -S 0.0.0.0:80).
Edit your package.json: "remoteRelease": "http://localhost"
Then build your installer: npm run dist
It should successfully build and you should see some GET requests on your local server.
Take the generated files and stuff them into the directory you created.
Now increment your version and start another build: npm run dist
You should see some GET requests again and there should be an addition delta-file being created.
Again stuff all those things into the directory (or for electron-release-server upload the assets .nupkg, .exe and delta into a new release).
Hope that helps. Feel free to comment if something is unclear.
Check out this sample app that I have created https://github.com/electron-delta/electron-sample-app
It uses two npm packages.
#electron-delta/builder
#electron-delta/updater
More details https://github.com/electron-delta/electron-delta#installation

tests/**/*.coffee not matching root files on debian

I have a project which for its tests runs:
./node_modules/.bin/mocha tests/**/*.coffee -r coffee-script/register -c
tests/ looks like this:
_helper.coffee
database-tests.coffee
routers/
index-router-tests.coffee
team-router-tests.coffee
On my windows dev machine it works fine running _helper.coffee first and then the rest of the files.
On my CI server running debian it only tries to run routers/* missing out anything in the root folder.
I am assuming that tests/**/*.coffee isnt right for unix?
Moving Comments to an Answer for others since it appears to have fixed your problem.
I have had the same problems on Windows where it is not returning the files in the same order that you see them listed on the drive. I have therefore used tests/*.coffee and then tests/**/*.coffee.
I found that Windows will retrieve the files in the order they were likely written to the hard drive, while a directory or other list will have them sorted for display. This seemed to be the problem I was encountering.
The parent directory ('tests') does not seem to be included when using tests/** which seams to mean directories under the tests folder, and does not include the tests folder itself.

How to Delete Derived Data and Clean Project in Xcode 5 and later?

Is there a procedure I can follow that includes running a script in the terminal, to delete all the files under the derived data folder and reliably clean a project?
Sometimes, a project's assets don't always get updated to my simulator or device. It's mostly trial and error, and when I find that an old asset made its way into a test build, it's too late, not to mention embarrassing!
I've looked at this question, but it seems a little outdated:
How to Empty Caches and Clean All Targets Xcode 4
I also checked out this question, but I don't want to waste time in Organizer, if I don't absolutely need to: How to "Delete derived data" in Xcode6?
I've looked at other posts out there, but found nothing that solves the problem of reliably cleaning a project and saves time with a script.
It's basically a two-or-three-step process, which cleans the project of all cached assets.
Of course, if anyone uses this technique, and a project still does not show updated assets, then please add an answer! It’s definitely possible that someone out there has encountered situations that require a step that I’m not including.
Clean your project with Shift-Cmd-K
Delete derived data by calling a shell script (details below), defined in your bash profile
Uninstall the App from the Simulator or device.
For certain types of assets, you may also have to reset the Simulator (under the iOS Simulator menu)
To call the shell script below, simply enter enter the function name (in this case 'ddd') into your terminal, assuming it's in your bash profile. Once you've saved your bash profile, don't forget to update your terminal's environment if you kept it open, with the source command:
source ~/.bash_profile
ddd() {
#Save the starting dir
startingDir=$PWD
#Go to the derivedData
cd ~/Library/Developer/Xcode/DerivedData
#Sometimes, 1 file remains, so loop until no files remain
numRemainingFiles=1
while [ $numRemainingFiles -gt 0 ]; do
#Delete the files, recursively
rm -rf *
#Update file count
numRemainingFiles=`ls | wc -l`
done
echo Done
#Go back to starting dir
cd $startingDir
}
I hope that helps, happy coding!
Another way to delete derived data in Xcode is just by deleting the Derived Data folder.
Here is a visual tutorial of how you can do that easily without using command line: https://www.youtube.com/watch?v=ueEMGXKDBAc

Resources