Skip to content

Commit

Permalink
fix: Ensure root file path is absolute.
Browse files Browse the repository at this point in the history
  • Loading branch information
RubenVerborgh committed Jan 1, 2021
1 parent ba4f7ff commit c41c41d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/init/CliRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class CliRunner {
mainModulePath: { type: 'string', alias: 'm' },
podTemplateFolder: { type: 'string', alias: 't' },
port: { type: 'number', alias: 'p', default: 3000 },
rootFilePath: { type: 'string', alias: 'f' },
rootFilePath: { type: 'string', alias: 'f', default: './' },
sparqlEndpoint: { type: 'string', alias: 's' },
})
.help();
Expand Down Expand Up @@ -85,7 +85,7 @@ export class CliRunner {
params.baseUrl ? ensureTrailingSlash(params.baseUrl) : `http://localhost:${params.port}/`,
'urn:solid-server:default:variable:loggingLevel': params.loggingLevel,
'urn:solid-server:default:variable:port': params.port,
'urn:solid-server:default:variable:rootFilePath': params.rootFilePath ?? process.cwd(),
'urn:solid-server:default:variable:rootFilePath': this.resolvePath(params.rootFilePath),
'urn:solid-server:default:variable:sparqlEndpoint': params.sparqlEndpoint,
'urn:solid-server:default:variable:podTemplateFolder':
params.podTemplateFolder ?? this.resolvePath(null, 'templates'),
Expand Down
8 changes: 4 additions & 4 deletions test/unit/init/CliRunner.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('CliRunner', (): void => {
variables: {
'urn:solid-server:default:variable:port': 3000,
'urn:solid-server:default:variable:baseUrl': 'http://localhost:3000/',
'urn:solid-server:default:variable:rootFilePath': process.cwd(),
'urn:solid-server:default:variable:rootFilePath': '/var/cwd/',
'urn:solid-server:default:variable:sparqlEndpoint': undefined,
'urn:solid-server:default:variable:loggingLevel': 'info',
'urn:solid-server:default:variable:podTemplateFolder': path.join(__dirname, '../../../templates'),
Expand Down Expand Up @@ -90,7 +90,7 @@ describe('CliRunner', (): void => {
'urn:solid-server:default:variable:loggingLevel': 'debug',
'urn:solid-server:default:variable:podTemplateFolder': 'templates',
'urn:solid-server:default:variable:port': 4000,
'urn:solid-server:default:variable:rootFilePath': '/root',
'urn:solid-server:default:variable:rootFilePath': '/var/cwd/root',
'urn:solid-server:default:variable:sparqlEndpoint': 'http://localhost:5000/sparql',
},
},
Expand All @@ -108,7 +108,7 @@ describe('CliRunner', (): void => {
'--mainModulePath', 'module/path',
'--podTemplateFolder', 'templates',
'--port', '4000',
'--rootFilePath', '/root',
'--rootFilePath', 'root',
'--sparqlEndpoint', 'http://localhost:5000/sparql',
],
});
Expand All @@ -129,7 +129,7 @@ describe('CliRunner', (): void => {
'urn:solid-server:default:variable:loggingLevel': 'debug',
'urn:solid-server:default:variable:podTemplateFolder': 'templates',
'urn:solid-server:default:variable:port': 4000,
'urn:solid-server:default:variable:rootFilePath': '/root',
'urn:solid-server:default:variable:rootFilePath': '/var/cwd/root',
'urn:solid-server:default:variable:sparqlEndpoint': 'http://localhost:5000/sparql',
},
},
Expand Down

0 comments on commit c41c41d

Please sign in to comment.