Skip to content

Commit

Permalink
Merge pull request #123 from GauravWalia19/dev
Browse files Browse the repository at this point in the history
Sync job updates
  • Loading branch information
GauravWalia19 authored Feb 24, 2024
2 parents 0404654 + eaa1680 commit 7b86ccc
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 27 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/sync-driver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ jobs:
with:
node-version: 'latest'
- run: yarn install
- run: yarn run syncDriver
- run: yarn run syncDriver:github
env:
MONGODB_URI: ${{ secrets.MONGODB_URI }}
DOWNLOAD_URL: ${{ secrets.DOWNLOAD_URL }}
VIEW_URL: ${{secrets.VIEW_URL}}
7 changes: 2 additions & 5 deletions driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const mongoose = require('mongoose');
const fs = require('fs').promises;

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

// traversing fileNames and extract data
const extractDataFromMarkdown = async (fileNames) => {
const DOWNLOAD_URL =
'https://github.com/GauravWalia19/Free-Algorithms-Books/raw/master/Library/';
const VIEW_URL =
'https://github.com/GauravWalia19/Free-Algorithms-Books/blob/master/Library/';
const DOWNLOAD_URL = process.env.DOWNLOAD_URL;
const VIEW_URL = process.env.VIEW_URL;
let objectDatabase = [];

for (let i = 0; i < fileNames.length; i++) {
Expand Down
31 changes: 15 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
{
"name": "free-algorithm-books",
"version": "1.0.0",
"description": "Free Algorithm Books driver project",
"main": "driver.js",
"scripts": {
"syncDriver": "node driver.js"
},
"repository": "https://github.com/GauravWalia19/Free-Algorithms-Books.git",
"author": "Gaurav Walia <gauravwalia019@gmail.com>",
"license": "MIT",
"devDependencies": {
"dotenv": "^16.4.4"
},
"dependencies": {
"mongoose": "^8.1.3"
}
"name": "free-algorithm-books",
"version": "1.1.0",
"description": "Free Algorithm Books driver project",
"main": "driver.js",
"scripts": {
"syncDriver:local": "node --env-file=.env driver.js",
"syncDriver:github": "node driver.js"
},
"repository": "https://github.com/GauravWalia19/Free-Algorithms-Books.git",
"author": "Gaurav Walia <gauravwalia019@gmail.com>",
"license": "MIT",
"devDependencies": {},
"dependencies": {
"mongoose": "^8.1.3"
}
}
5 changes: 0 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ debug@4.x:
dependencies:
ms "2.1.2"

dotenv@^16.4.4:
version "16.4.4"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.4.4.tgz#a26e7bb95ebd36272ebb56edb80b826aecf224c1"
integrity sha512-XvPXc8XAQThSjAbY6cQ/9PcBXmFoWuw1sQ3b8HqUCR6ziGXjkTi//kB9SWa2UwqlgdAIuRqAa/9hVljzPehbYg==

kareem@2.5.1:
version "2.5.1"
resolved "https://registry.yarnpkg.com/kareem/-/kareem-2.5.1.tgz#7b8203e11819a8e77a34b3517d3ead206764d15d"
Expand Down

0 comments on commit 7b86ccc

Please sign in to comment.