Skip to content

Commit 7b86ccc

Browse files
Merge pull request #123 from GauravWalia19/dev
Sync job updates
2 parents 0404654 + eaa1680 commit 7b86ccc

File tree

4 files changed

+20
-27
lines changed

4 files changed

+20
-27
lines changed

.github/workflows/sync-driver.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ jobs:
1111
with:
1212
node-version: 'latest'
1313
- run: yarn install
14-
- run: yarn run syncDriver
14+
- run: yarn run syncDriver:github
1515
env:
1616
MONGODB_URI: ${{ secrets.MONGODB_URI }}
17+
DOWNLOAD_URL: ${{ secrets.DOWNLOAD_URL }}
18+
VIEW_URL: ${{secrets.VIEW_URL}}

driver.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ const mongoose = require('mongoose');
33
const fs = require('fs').promises;
44

55
const connectMongoDB = async () => {
6-
require('dotenv').config(); // for running locally
76
await mongoose.connect(process.env.MONGODB_URI).catch(async (err) => {
87
console.log('Error while mongoose connection: ', err);
98
await disconnectMongoDB(1);
@@ -41,10 +40,8 @@ init();
4140

4241
// traversing fileNames and extract data
4342
const extractDataFromMarkdown = async (fileNames) => {
44-
const DOWNLOAD_URL =
45-
'https://github.com/GauravWalia19/Free-Algorithms-Books/raw/master/Library/';
46-
const VIEW_URL =
47-
'https://github.com/GauravWalia19/Free-Algorithms-Books/blob/master/Library/';
43+
const DOWNLOAD_URL = process.env.DOWNLOAD_URL;
44+
const VIEW_URL = process.env.VIEW_URL;
4845
let objectDatabase = [];
4946

5047
for (let i = 0; i < fileNames.length; i++) {

package.json

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
{
2-
"name": "free-algorithm-books",
3-
"version": "1.0.0",
4-
"description": "Free Algorithm Books driver project",
5-
"main": "driver.js",
6-
"scripts": {
7-
"syncDriver": "node driver.js"
8-
},
9-
"repository": "https://github.com/GauravWalia19/Free-Algorithms-Books.git",
10-
"author": "Gaurav Walia <[email protected]>",
11-
"license": "MIT",
12-
"devDependencies": {
13-
"dotenv": "^16.4.4"
14-
},
15-
"dependencies": {
16-
"mongoose": "^8.1.3"
17-
}
2+
"name": "free-algorithm-books",
3+
"version": "1.1.0",
4+
"description": "Free Algorithm Books driver project",
5+
"main": "driver.js",
6+
"scripts": {
7+
"syncDriver:local": "node --env-file=.env driver.js",
8+
"syncDriver:github": "node driver.js"
9+
},
10+
"repository": "https://github.com/GauravWalia19/Free-Algorithms-Books.git",
11+
"author": "Gaurav Walia <[email protected]>",
12+
"license": "MIT",
13+
"devDependencies": {},
14+
"dependencies": {
15+
"mongoose": "^8.1.3"
16+
}
1817
}

yarn.lock

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,6 @@ [email protected]:
3333
dependencies:
3434
ms "2.1.2"
3535

36-
dotenv@^16.4.4:
37-
version "16.4.4"
38-
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.4.4.tgz#a26e7bb95ebd36272ebb56edb80b826aecf224c1"
39-
integrity sha512-XvPXc8XAQThSjAbY6cQ/9PcBXmFoWuw1sQ3b8HqUCR6ziGXjkTi//kB9SWa2UwqlgdAIuRqAa/9hVljzPehbYg==
40-
4136
4237
version "2.5.1"
4338
resolved "https://registry.yarnpkg.com/kareem/-/kareem-2.5.1.tgz#7b8203e11819a8e77a34b3517d3ead206764d15d"

0 commit comments

Comments
 (0)