Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paxperscientiam/40b696d1877d630f7efec8b42b3e656d to your computer and use it in GitHub Desktop.
Save paxperscientiam/40b696d1877d630f7efec8b42b3e656d to your computer and use it in GitHub Desktop.
[Pro-tip][macOS][iCloud] Renaming components directories for compatibility with iCloud on macOS ~10.14
By default, it's a bad idea to store component heavy projects in an iCloud syncronized directory as the frequent shuffling of hundreds of files puts a heavy burden on the sync service. Moreover, it gets in the way of keeping the important stuff syncronized.
Let's say your project structure looks like this:
~/Documents/project/
└── node_modules
Let's adopt it accordingly:
~/Documents/project/
└── modules.noSync
└── node_modules
Any directory name suffixed with ".noSync" will be ignored by iCloud sync. In our case, this will prevent updating/uninstalling/installing libraries from burdening sync services as child directories of "modules.noSync" are ignored.
Important consideration: you will almost definitely have to adopt your project settings to account for this tweak.
For example, `yarn` users should tweak their `.yarnrc` by adding the following line:
`--modules-folder "./modules.noSync/node_modules"`
function Req(base) {
this.base = base;
}
Req.prototype.get = function(module, opts) {
if (typeof require(path.resolve(this.base, module)) === 'function' && opts !== undefined) {
return require(path.resolve(this.base, module))(opts)
} else {
return require(path.resolve(this.base, module))
}
process.exit()
}
// EG
const req = new Req("./node_modules.noSync/node_modules")
const somePlugin = req.get("SomePlugin")
@paxperscientiam
Copy link
Author

Honestly, this isn't really recommended. Though, you might have a reason.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment