mirror of
https://github.com/status-im/re-natal.git
synced 2025-01-27 12:54:49 +00:00
support platform-specific modules in infer-components command
This commit is contained in:
parent
fac4825fcf
commit
3b072819b2
@ -845,22 +845,25 @@ useComponent = (name, platform) ->
|
|||||||
catch {message}
|
catch {message}
|
||||||
logErr message
|
logErr message
|
||||||
|
|
||||||
|
logModuleDifferences = (platform, existingModules, newModules) ->
|
||||||
|
modules = new Set(existingModules)
|
||||||
|
diff = new Set(newModules.filter((m) -> !modules.has(m)))
|
||||||
|
if(diff.size isnt 0)
|
||||||
|
log "new #{platform} component import found #{Array.from(diff)}"
|
||||||
|
|
||||||
inferComponents = () ->
|
inferComponents = () ->
|
||||||
requiresByPlatform = buildRequireByPlatformMap()
|
requiresByPlatform = buildRequireByPlatformMap()
|
||||||
|
|
||||||
allRequires = []
|
|
||||||
for k,v of requiresByPlatform
|
|
||||||
allRequires = Array.from(new Set(allRequires.concat(v)))
|
|
||||||
|
|
||||||
config = readConfig() # re-natal file
|
config = readConfig() # re-natal file
|
||||||
modules = new Set(config.modules)
|
logModuleDifferences('common', config.modules, requiresByPlatform.common)
|
||||||
difference = new Set(Array.from(allRequires).filter((m) -> !modules.has(m)))
|
config.modules = requiresByPlatform.common
|
||||||
if(difference.size isnt 0)
|
|
||||||
log "new component import found #{Array.from(difference)}"
|
platforms = Object.keys config.platforms
|
||||||
config.modules = Array.from(allRequires)
|
for platform in platforms
|
||||||
|
logModuleDifferences(platform, config.platforms[platform].modules, requiresByPlatform[platform])
|
||||||
|
config.platforms[platform].modules = requiresByPlatform[platform]
|
||||||
|
|
||||||
writeConfig(config)
|
writeConfig(config)
|
||||||
else
|
|
||||||
log "no new component was imported, defaulting to #{Array.from(modules)}"
|
|
||||||
|
|
||||||
autoRequire = (enabled) ->
|
autoRequire = (enabled) ->
|
||||||
config = readConfig()
|
config = readConfig()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user