-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEATURE] Add generateResourcesJson task (#390)
Introduces new task "generateResourcesJson" which creates the file resources.json for libraries, applications and themes. The task analyses the resources and collects meta information and stores them in a file called resources.json. This meta information includes module name, size, dependencies, includes, ... Co-authored-by: Tobias Sorn <tobias.sorn@sap.com> Co-authored-by: Matthias Osswald <mat.osswald@sap.com>
- Loading branch information
1 parent
4ca59a7
commit 021f439
Showing
79 changed files
with
2,942 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
const Resource = require("./Resource"); | ||
|
||
|
||
function extractName(path) { | ||
return path.slice( "/resources/".length); | ||
} | ||
|
||
|
||
class LocatorResource extends Resource { | ||
constructor(pool, resource) { | ||
super(pool, extractName(resource.getPath()), null, resource.getStatInfo()); | ||
this.resource = resource; | ||
} | ||
|
||
buffer() { | ||
return this.resource.getBuffer(); | ||
} | ||
|
||
getProject() { | ||
return this.resource._project; | ||
} | ||
} | ||
|
||
module.exports = LocatorResource; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const ResourcePool = require("./ResourcePool"); | ||
const LocatorResource = require("./LocatorResource"); | ||
|
||
|
||
class LocatorResourcePool extends ResourcePool { | ||
constructor() { | ||
super(); | ||
} | ||
|
||
prepare(resources) { | ||
resources = resources.filter( (res) => !res.getStatInfo().isDirectory() ); | ||
return Promise.all( | ||
resources.map( | ||
(resource) => this.addResource( new LocatorResource(this, resource) ) | ||
).filter(Boolean) | ||
); | ||
} | ||
} | ||
|
||
module.exports = LocatorResourcePool; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.