-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Enable SAS_PACKAGES in SASjs Server
- Loading branch information
Showing
6 changed files
with
208 additions
and
9 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import axios from 'axios' | ||
import Downloader from 'nodejs-file-downloader' | ||
import { createFile, listFilesInFolder } from '@sasjs/utils' | ||
|
||
import { sasJSCoreMacros, sasJSCoreMacrosInfo } from '../src/utils/file' | ||
|
||
export const downloadMacros = async () => { | ||
const url = | ||
'https://api.github.com/repos/yabwon/SAS_PACKAGES/contents/SPF/Macros' | ||
|
||
console.info(`Downloading macros from ${url}`) | ||
|
||
await axios | ||
.get(url) | ||
.then(async (res) => { | ||
await downloadFiles(res.data) | ||
}) | ||
.catch((err) => { | ||
throw new Error(err) | ||
}) | ||
} | ||
|
||
const downloadFiles = async function (fileList: any) { | ||
for (const file of fileList) { | ||
const downloader = new Downloader({ | ||
url: file.download_url, | ||
directory: sasJSCoreMacros, | ||
fileName: file.path.replace(/^SPF\/Macros/, ''), | ||
cloneFiles: false | ||
}) | ||
await downloader.download() | ||
} | ||
|
||
const fileNames = await listFilesInFolder(sasJSCoreMacros) | ||
|
||
await createFile(sasJSCoreMacrosInfo, fileNames.join('\n')) | ||
} | ||
|
||
downloadMacros() |
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