From a701bb25e77c783c09df60fd892449f571dcccb8 Mon Sep 17 00:00:00 2001 From: Saad Jutt Date: Wed, 23 Mar 2022 17:58:18 +0500 Subject: [PATCH 1/3] Revert "fix: quick fix for executables" This reverts commit 9e53470947350f4b8d835a2cb6b70e3dabf247c4. --- api/src/utils/copySASjsCore.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api/src/utils/copySASjsCore.ts b/api/src/utils/copySASjsCore.ts index 3d3d553..9a5e07c 100644 --- a/api/src/utils/copySASjsCore.ts +++ b/api/src/utils/copySASjsCore.ts @@ -1,8 +1,10 @@ -import { copy } from '@sasjs/utils' +import { copy, createFolder } from '@sasjs/utils' import { getTmpMacrosPath, sasJSCoreMacros } from '.' export const copySASjsCore = async () => { + await createFolder(sasJSCoreMacros) + const macrosDrivePath = getTmpMacrosPath() await copy(sasJSCoreMacros, macrosDrivePath) } From d2956fc64128c116ead7c8f8461b2af4813dd1d8 Mon Sep 17 00:00:00 2001 From: Saad Jutt Date: Wed, 23 Mar 2022 17:59:06 +0500 Subject: [PATCH 2/3] Revert "fix: moved macros from codebase to drive" This reverts commit 9ac3191891bf53ff07135ccec6ddc83b34ea871a. --- api/src/app.ts | 3 --- api/src/controllers/internal/Execution.ts | 6 +++--- api/src/utils/copySASjsCore.ts | 10 ---------- api/src/utils/file.ts | 2 -- api/src/utils/index.ts | 3 +-- 5 files changed, 4 insertions(+), 20 deletions(-) delete mode 100644 api/src/utils/copySASjsCore.ts diff --git a/api/src/app.ts b/api/src/app.ts index 9fdf244..17350ee 100644 --- a/api/src/app.ts +++ b/api/src/app.ts @@ -7,7 +7,6 @@ import cors from 'cors' import { connectDB, - copySASjsCore, getWebBuildFolderPath, loadAppStreamConfig, sasJSCoreMacros, @@ -43,8 +42,6 @@ const onError: ErrorRequestHandler = (err, req, res, next) => { } export default setProcessVariables().then(async () => { - await copySASjsCore() - // loading these modules after setting up variables due to // multer's usage of process var process.driveLoc const { setupRoutes } = await import('./routes/setupRoutes') diff --git a/api/src/controllers/internal/Execution.ts b/api/src/controllers/internal/Execution.ts index ff6bdcd..052cc42 100644 --- a/api/src/controllers/internal/Execution.ts +++ b/api/src/controllers/internal/Execution.ts @@ -13,9 +13,9 @@ import { extractHeaders, generateFileUploadSasCode, getTmpFilesFolderPath, - getTmpMacrosPath, HTTPHeaders, - isDebugOn + isDebugOn, + sasJSCoreMacros } from '../../utils' export interface ExecutionVars { @@ -106,7 +106,7 @@ export class ExecutionController { ` program = ` -options insert=(SASAUTOS="${getTmpMacrosPath()}"); +options insert=(SASAUTOS="${sasJSCoreMacros}"); /* runtime vars */ ${varStatments} diff --git a/api/src/utils/copySASjsCore.ts b/api/src/utils/copySASjsCore.ts deleted file mode 100644 index 9a5e07c..0000000 --- a/api/src/utils/copySASjsCore.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { copy, createFolder } from '@sasjs/utils' - -import { getTmpMacrosPath, sasJSCoreMacros } from '.' - -export const copySASjsCore = async () => { - await createFolder(sasJSCoreMacros) - - const macrosDrivePath = getTmpMacrosPath() - await copy(sasJSCoreMacros, macrosDrivePath) -} diff --git a/api/src/utils/file.ts b/api/src/utils/file.ts index 42bb12c..2cce265 100644 --- a/api/src/utils/file.ts +++ b/api/src/utils/file.ts @@ -18,8 +18,6 @@ export const getTmpFolderPath = () => process.driveLoc export const getTmpAppStreamConfigPath = () => path.join(getTmpFolderPath(), 'appStreamConfig.json') -export const getTmpMacrosPath = () => path.join(getTmpFolderPath(), 'sasjscore') - export const getTmpUploadsPath = () => path.join(getTmpFolderPath(), 'uploads') export const getTmpFilesFolderPath = () => diff --git a/api/src/utils/index.ts b/api/src/utils/index.ts index 80b3580..1527080 100644 --- a/api/src/utils/index.ts +++ b/api/src/utils/index.ts @@ -1,14 +1,13 @@ export * from './appStreamConfig' export * from './connectDB' -export * from './copySASjsCore' export * from './extractHeaders' export * from './file' export * from './generateAccessToken' export * from './generateAuthCode' export * from './generateRefreshToken' +export * from './isDebugOn' export * from './getCertificates' export * from './getDesktopFields' -export * from './isDebugOn' export * from './parseLogToArray' export * from './removeTokensInDB' export * from './saveTokensInDB' From e68090181acd844f86f3e81153cb5a4e3f4a307f Mon Sep 17 00:00:00 2001 From: Saad Jutt Date: Wed, 23 Mar 2022 18:05:03 +0500 Subject: [PATCH 3/3] fix: included sasjs core macros at compile time --- api/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/api/package.json b/api/package.json index 346bb49..25395ec 100644 --- a/api/package.json +++ b/api/package.json @@ -29,6 +29,7 @@ "assets": [ "./build/public/**/*", "./build/sasjsbuild/**/*", + "./build/sasjscore/**/*", "./web/build/**/*" ], "targets": [