mirror of
https://github.com/sasjs/server.git
synced 2026-01-05 05:40:06 +00:00
Merge pull request #214 from sasjs/fix-runtime-filePath
fix: getRuntimeAndFilePath function
This commit is contained in:
@@ -5,14 +5,10 @@ import { RunTimeType } from '.'
|
|||||||
|
|
||||||
export const getRunTimeAndFilePath = async (programPath: string) => {
|
export const getRunTimeAndFilePath = async (programPath: string) => {
|
||||||
const ext = path.extname(programPath)
|
const ext = path.extname(programPath)
|
||||||
// if program path is provided with extension we should split that into code path and ext as run time
|
// If programPath (_program) is provided with a ".sas" or ".js" extension
|
||||||
if (ext) {
|
// we should use that extension to determine the appropriate runTime
|
||||||
|
if (ext && Object.values(RunTimeType).includes(ext.slice(1) as RunTimeType)) {
|
||||||
const runTime = ext.slice(1)
|
const runTime = ext.slice(1)
|
||||||
const runTimeTypes = Object.values(RunTimeType)
|
|
||||||
|
|
||||||
if (!runTimeTypes.includes(runTime as RunTimeType)) {
|
|
||||||
throw `The '${runTime}' runtime is not supported.`
|
|
||||||
}
|
|
||||||
|
|
||||||
const codePath = path
|
const codePath = path
|
||||||
.join(getFilesFolder(), programPath)
|
.join(getFilesFolder(), programPath)
|
||||||
|
|||||||
Reference in New Issue
Block a user