Skip to content
This repository has been archived by the owner on May 10, 2023. It is now read-only.

Commit

Permalink
chore: remove most of kinto apart from user parts
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelKohler committed May 3, 2020
1 parent ef09186 commit 371025f
Show file tree
Hide file tree
Showing 11 changed files with 4 additions and 1,153 deletions.
13 changes: 3 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 1 addition & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,13 @@
"run-prod": "docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d",
"test:frontend": "jest",
"test:server": "ava",
"test": "npm run lint && npm run test:frontend && npm run test:server",
"db-helper": "npm run build:server && npm run env node dist/db-helper",
"init-db": "npm run db-helper init",
"flush-db": "npm run db-helper flush",
"list-db": "npm run db-helper list",
"export": "npm run db-helper export",
"backup": "npm run db-helper backup",
"flush": "npm run db-helper delete"
"test": "npm run lint && npm run test:frontend && npm run test:server"
},
"dependencies": {
"connected-react-router": "^6.6.1",
"cors": "^2.8.5",
"express": "^4.17.1",
"hammerjs": "^2.0.8",
"hash.js": "^1.1.7",
"iso-639-1": "^2.1.0",
"kinto": "^12.7.0",
"kinto-http": "^4.7.3",
Expand Down Expand Up @@ -78,8 +70,6 @@
"gh-pages": "^2.1.1",
"husky": "^3.1.0",
"jest": "^24.9.0",
"kinto-node-test-server": "^1.0.5",
"node-fetch": "^2.6.0",
"parcel-bundler": "^1.12.4",
"parcel-plugin-eslint": "^1.0.7",
"parcel-plugin-markdown": "github:mikehenrty/parcel-plugin-markdown#upgrade-asset",
Expand Down
227 changes: 0 additions & 227 deletions scripts/db-helper.js

This file was deleted.

32 changes: 0 additions & 32 deletions scripts/exporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,6 @@ const LANGUAGE_MAPPING = {
'pa-IN': 'pa',
};

export async function startBackup(db, exportPath) {
const startTime = Date.now();
const allLanguages = await db.getLanguages();

for (const languageCode of allLanguages) {
await backupAllLanguage(db, languageCode, exportPath);
}

const endTime = Date.now();
console.log('Duration to backup everything (ms): ', endTime - startTime);
}

export async function startExport(db, exportPath) {
const startTime = Date.now();
const cvResponse = await fetch(CV_LANGUAGES_URL);
Expand Down Expand Up @@ -100,26 +88,6 @@ async function writeExport(cvPath, metaData, sentences = []) {
writeFileSync(dataPath, sentences.join('\n'));
}

async function backupAllLanguage(db, languageCode, exportPath) {
console.log(`Starting backup for ${languageCode}..`);

const dbLanguageCode = LANGUAGE_MAPPING[languageCode] || languageCode;
const cvPath = `${exportPath}/${languageCode}`;
let sentences = [];
try {
sentences = await db.getAllSentences(dbLanguageCode);
} catch (err) { /* ignore for now, as we also get this if the code does not exist */ }

if (!sentences || sentences.length === 0) {
return;
}

console.log(` - Found ${sentences.length} sentences`);

prepareExport(cvPath);
writeExport(cvPath, sentences);
}

function getValidatedSentences(languageCode, sentences) {
const sentencesOnly = sentences.map((sentenceMeta) => sentenceMeta.sentence);
const { filtered } = validation.validateSentences(languageCode, sentencesOnly);
Expand Down
Loading

0 comments on commit 371025f

Please sign in to comment.