-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Allow for custom CLI and variable options
* feat: (AppRunner) Mechanism to configure cli args and derive componentsjs vars from them implemented * fix: (AppRunner) tidying * fix: (AppRunner) tidying up * fix: (AppRunner) runCli method made sync * fix; (VarResolver) refactored to multiple files, and other stylistic fixes. * chore: (AppRunner) Uses builder pattern for yargs base arguments setup to enable better typescript inference * fix(AppRunner): refactoring AppRunner and VarResolver * fix(AppRunner): refactoring AppRunner promise handling * fix(AppRunner): verror dependency removal * fix: Simplify CLI error handling * feat: Use same config for both CLI and app instantiation * fix: Update typings and imports * feat: Split VariableResolver behaviour to 2 classes * feat: Move default value behaviour from CLI to ValueComputers * test: Add unit tests for new CLI classes * feat: Integrate new CLI configuration with all default configurations * feat: Add createApp function to AppRunner * docs: Update comments in CLI-related classes * fix: Various fixes and refactors Co-authored-by: damooo <damodara@protonmail.com>
- Loading branch information
Showing
39 changed files
with
1,003 additions
and
350 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
#!/usr/bin/env node | ||
// eslint-disable-next-line @typescript-eslint/naming-convention | ||
const { AppRunner } = require('..'); | ||
new AppRunner().runCli(process); | ||
new AppRunner().runCliSync(process); |
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,67 @@ | ||
{ | ||
"@context": "https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^2.0.0/components/context.jsonld", | ||
"@graph": [ | ||
{ | ||
"comment": "Extracts CLI arguments into a key/value object. Config and mainModulePath are only defined here so their description is returned.", | ||
"@id": "urn:solid-server-app-setup:default:CliExtractor", | ||
"@type": "YargsCliExtractor", | ||
"parameters": { | ||
"config": { | ||
"alias": "c", | ||
"requiresArg": true, | ||
"type": "string", | ||
"describe": "The configuration for the server. The default only stores data in memory; to persist to your filesystem, use @css:config/file.json." | ||
}, | ||
"mainModulePath": { | ||
"alias": "m", | ||
"requiresArg": true, | ||
"type": "string", | ||
"describe": "Path from where Components.js will start its lookup when initializing configurations." | ||
}, | ||
"loggingLevel": { | ||
"alias": "l", | ||
"requiresArg": true, | ||
"type": "string", | ||
"describe": "The detail level of logging; useful for debugging problems." | ||
}, | ||
"baseUrl": { | ||
"alias": "b", | ||
"requiresArg": true, | ||
"type": "string", | ||
"describe": "The public URL of your server." | ||
}, | ||
"port": { | ||
"alias": "p", | ||
"requiresArg": true, | ||
"type": "number", | ||
"describe": "The TCP port on which the server runs." | ||
}, | ||
"rootFilePath": { | ||
"alias": "f", | ||
"requiresArg": true, | ||
"type": "string", | ||
"describe": "Root folder of the server, when using a file-based configuration." | ||
}, | ||
"showStackTrace": { | ||
"alias": "t", | ||
"type": "boolean", | ||
"describe": "Enables detailed logging on error pages." | ||
}, | ||
"sparqlEndpoint": { | ||
"alias": "s", | ||
"requiresArg": true, | ||
"type": "string", | ||
"describe": "URL of the SPARQL endpoint, when using a quadstore-based configuration." | ||
}, | ||
"podConfigJson": { | ||
"requiresArg": true, | ||
"type": "string", | ||
"describe": "Path to the file that keeps track of dynamic Pod configurations." | ||
} | ||
}, | ||
"options": { | ||
"usage": "node ./bin/server.js [args]" | ||
} | ||
} | ||
] | ||
} |
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,16 @@ | ||
{ | ||
"@context": "https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^2.0.0/components/context.jsonld", | ||
"import": [ | ||
"files-scs:config/app/variables/cli/cli.json", | ||
"files-scs:config/app/variables/resolver/resolver.json" | ||
], | ||
"@graph": [ | ||
{ | ||
"comment": "Combines a CliExtractor and SettingsResolver to be used by the AppRunner.", | ||
"@id": "urn:solid-server-app-setup:default:CliResolver", | ||
"@type": "CliResolver", | ||
"cliExtractor": { "@id": "urn:solid-server-app-setup:default:CliExtractor" }, | ||
"settingsResolver": { "@id": "urn:solid-server-app-setup:default:SettingsResolver" } | ||
} | ||
] | ||
} |
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,65 @@ | ||
{ | ||
"@context": "https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^2.0.0/components/context.jsonld", | ||
"@graph": [ | ||
{ | ||
"comment": "Converts an input key/value object into an object mapping values to Components.js variables", | ||
"@id": "urn:solid-server-app-setup:default:SettingsResolver", | ||
"@type": "CombinedSettingsResolver", | ||
"computers": [ | ||
{ | ||
"CombinedSettingsResolver:_computers_key": "urn:solid-server:default:variable:baseUrl", | ||
"CombinedSettingsResolver:_computers_value": { | ||
"@type": "BaseUrlExtractor" | ||
} | ||
}, | ||
{ | ||
"CombinedSettingsResolver:_computers_key": "urn:solid-server:default:variable:loggingLevel", | ||
"CombinedSettingsResolver:_computers_value": { | ||
"@type": "KeyExtractor", | ||
"key": "loggingLevel", | ||
"defaultValue": "info" | ||
} | ||
}, | ||
{ | ||
"CombinedSettingsResolver:_computers_key": "urn:solid-server:default:variable:port", | ||
"CombinedSettingsResolver:_computers_value": { | ||
"@type": "KeyExtractor", | ||
"key": "port", | ||
"defaultValue": 3000 | ||
} | ||
}, | ||
{ | ||
"CombinedSettingsResolver:_computers_key": "urn:solid-server:default:variable:rootFilePath", | ||
"CombinedSettingsResolver:_computers_value": { | ||
"@type": "AssetPathExtractor", | ||
"key": "rootFilePath", | ||
"defaultPath": "./" | ||
} | ||
}, | ||
{ | ||
"CombinedSettingsResolver:_computers_key": "urn:solid-server:default:variable:sparqlEndpoint", | ||
"CombinedSettingsResolver:_computers_value": { | ||
"@type": "KeyExtractor", | ||
"key": "sparqlEndpoint" | ||
} | ||
}, | ||
{ | ||
"CombinedSettingsResolver:_computers_key": "urn:solid-server:default:variable:showStackTrace", | ||
"CombinedSettingsResolver:_computers_value": { | ||
"@type": "KeyExtractor", | ||
"key": "showStackTrace", | ||
"defaultValue": false | ||
} | ||
}, | ||
{ | ||
"CombinedSettingsResolver:_computers_key": "urn:solid-server:default:variable:AssetPathResolver", | ||
"CombinedSettingsResolver:_computers_value": { | ||
"@type": "AssetPathExtractor", | ||
"key": "podConfigJson", | ||
"defaultPath": "./pod-config.json" | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} |
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
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Oops, something went wrong.