Giter Site home page Giter Site logo

tc-source-content-updater's Introduction

tc-source-content-updater

Build Status npm npm

Module that updates source content for the desktop application translationCore.

Development

Use the separate helper files (as best you can) for each story.

Some functionality will most likely have to change in the main index as well, but try to keep as much logic as possible in individual helpers.

Parsers can expect the catalog to be fetched before their method is called. It will be under the catalog property of the Updater object

Please try and cleary define your input and output parameter structures so to make collaboration easier

Check __tests__/fixtures/catalog.json for example metadata return from DCS

Usage

To use this module you must first create a new instance of the object. i.e.

//es6
import updater from 'tc-source-content-updater';
const Updater = new updater();

//commonjs
const updater = require('tc-source-content-updater').default;
const Updater = new updater();

Note: In order to limit the amount of API calls the door43 repo, the Updater object uses the same catalog resource throughout its lifetime, without having to continuosly do requests to door43 API on each function call.

Workflow

  1. Create instance
  2. Fetch latest resources
  3. Download the resources that are not updated

Updater Object

getLatestResources(localResourceList):

  • Description Used to initiate a load of the latest resource so that the user can then select which ones they would like to update. Note: This function only returns the resources that are not up to date on the user machine before the request
  • @param {boolean} localResourceList - list of resources that are on the users local machine already
  • @return {Promise} - Array of languages that have updates in catalog (returns null on error)

updateCatalog():

  • description - Method to manually fetch the latest catalog for the current Updater instance. This function has no return value

downloadResources(resourceList):

  • description - Downloads the resources from the specified list using the DCS API
  • @param {Array} resourceList - list of resources that you would like to download
  • @return {Promise} Promise that resolves to success or rejects if a resource failed to download

parseBiblePackage(resourceEntry, extractedFilesPath, resultsPath):

  • description - Parses the bible package to generate json bible contents, manifest, and index
  • @param {String} extractedFilesPath - path to unzipped files from bible package
  • @param {String} resultsPath - path to store processed bible
  • @return {Boolean} true if success

processTranslationAcademy(extractedFilesPath, outputPath):

  • description - Processes the extracted files for translationAcademy to create a single file for each article
  • @param {String} extractedFilesPath - Path to the extracted files that came from the zip file in the catalog
  • @param {String} outputPath - Path to place the processed files WITHOUT version in the path
  • @return {String} The path to the processed translationAcademy files with version

processTranslationWords(extractedFilesPath, outputPath):

  • description - Processes the extracted files for translationWord to cerate the folder structure and produce the index.js file for the language with the title of each article.
  • @param {String} extractedFilesPath - Path to the extracted files that came from the zip file from the catalog
  • @param {String} outputPath - Path to place the processed resource files WIHTOUT the version in the path
  • @return {String} Path to the processed translationWords files with version

generateTwGroupDataFromAlignedBible(biblePath, outputPath):

  • description - Generates the tW Group Data files from the given aligned Bible
  • @param {string} biblePath Path to the Bible with aligned data
  • @param {string} outputPath Path where the translationWords group data is to be placed WITHOUT version
  • @return {string} Path where tW was generated with version

Testing your changes without publishing new version

  • Create your feature/bugfix/enhancement (my-feature-branch)branch off of master.
  • Make your changes in the new branch (my-feature-branch).
  • Push your changes.
  • Run npm i translationCoreApps/tc-source-content-updater#my-feature-branch in your translationCore root directory.
  • Run rm -rf node_modules/tc-source-content-updater; npm i tc-source-content-updater; to get subsequent changes.

tc-source-content-updater's People

Contributors

bspidel avatar da1nerd avatar dependabot-support avatar mannycolon avatar photonomad0 avatar richmahn avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

photonomad0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.