1
0
mirror of https://github.com/sasjs/server.git synced 2026-01-03 13:10:04 +00:00

feat: compile systemInit and inject to autoExec

This commit is contained in:
Saad Jutt
2021-11-18 03:12:05 +05:00
parent 319743a23e
commit b75139dda5
10 changed files with 169 additions and 33 deletions

View File

@@ -0,0 +1,35 @@
import path from 'path'
import {
createFile,
loadDependenciesFile,
readFile,
SASJsFileType
} from '@sasjs/utils'
import { apiRoot, sysInitCompiledPath } from '../src/utils'
const macroCorePath = path.join(apiRoot, 'node_modules', '@sasjs', 'core')
const compiledSystemInit = async (systemInit: string) =>
'options ps=max;\n' +
(await loadDependenciesFile({
fileContent: systemInit,
type: SASJsFileType.job,
programFolders: [],
macroFolders: [],
buildSourceFolder: '',
macroCorePath
}))
const createSysInitFile = async () => {
console.log('macroCorePath', macroCorePath)
const systemInitContent = await readFile(
path.join(__dirname, 'systemInit.sas')
)
await createFile(
path.join(sysInitCompiledPath),
await compiledSystemInit(systemInitContent)
)
}
createSysInitFile()

View File

@@ -0,0 +1,15 @@
/**
@file
@brief The systemInit program
@details This program is inserted into every sasjs/server program invocation,
_before_ any user-provided content.
<h4> SAS Macros </h4>
@li mcf_stpsrv_header.sas
**/
proc fcmp outcat=work.sasjs.utils;
%mcf_stpsrv_header()
quit;