npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

qordoba-file-helper

v0.2.6

Published

helps manage file uploads, update and downloads to & from qordoba

Downloads

4

Readme

qordoba-file-helper

npm cli package to upload, update, and download files to / from qordoba

Getting Started

Before getting started, you will need to visit Qordoba.com, set up an account, and create a new project. Select JSON as your file type. Once your project is created, go to the settings tab and at the top click on cli config to get your organizationId, and projectId.

Install via npm

npm install qordoba-file-helper

File Structure.

├── root
│   ├── bin
│   │   ├── download.js 
│   │   ├── update.js
│   │   ├── uploadAll.js
│   │   ├── uploadModified.js
│   │   ├── uploadnew.js
│   ├── lib
│   ├── src
│   │   ├── App.js
│   │   ├── download.js
│   │   ├── helpers.js
│   │   ├── index.js
│   │   ├── lang_codes.js
│   │   ├── update.js
│   │   ├── upload.js
│   ├── test
│   ├── node_modules
│   ├── gulpfile.js // handles 'gulp build' command
│   ├── package.json

An example of how you might use the plugin

├── example
│   ├── locales
│   │   ├── en-us (source language folder)
│   │   │   ├── sourceLanguageFile.json (source language file)
│   │   ├── es-mx (target language folder)
│   │   │   ├── targetLanguageFile.json
│   ├── node_modules
│   ├── package.json

Configuration

Create a 'qordoba.config.json' file in your root directory;

{
  "config": {
    "loadPath": "./locales",
    "savePath": "./locales",
    "organizationId": ORGANIZATION_ID,
    "projectId": PROJECT_ID,
    "milestoneId": MILESTONE_ID,
    "consumerKey": "CONSUMER_KEY",
    "sourceLanguage": "en-us",
  }
}

// loadPath = path to directory that contains source language folder (i.e. 'en-us')
// savePath = path to save target language folders into (i.e. 'es-mx')
// projectId = id of your qordoba project
// organizationId = id of your qordoba organization
// milestoneId = id of milestone (eg. 'Proofreading' ) that you want to pull translations from
// sourceLanguage = source language of your project
// consumer-key = qordoba api access key

Copy and paste the commands below into the scripts section of you packageJson

{
  "scripts": {
      "test": "echo \"Error: no test specified\" && exit 1",
      "download": "node node_modules/.bin/qordoba-download",
      "update": "node node_modules/.bin/qordoba-update",
      "uploadNew": "node node_modules/.bin/qordoba-uploadNew",
      "uploadModified": "node node_modules/.bin/qordoba-uploadModified",
      "uploadAll": "node node_modules/.bin/qordoba-uploadAll"
    }
}

When you install npm install qordoba-file-helper, npm will add the qordoba-download, qordoba-update, etc .js file into the .bin folder of you root node_modules directory. Feel free to rename the keys to whatever you like.

API

Download

  • downloads all modified or new files from qordoba
  • checks most recent versions of each file at qordoba and compares them to file metadata inside target section of qordoba.config.json
  • if the files don't exist or if the updated timestamp doens't match, it will download and overwrite files to savePath/{{languageCode}}/{{filename}}

npm command

basic download

npm run download

function call

Basic download

const download = require('qordoba-file-helper').download

download()

Download with custom arguments

const download = require('qordoba-file-helper').download
const downloadWithoutCheckingTimestamps = true;

download({ limit: 50, offset: 0 }, downloadWithoutCheckingTimestamps)

// downloadWithoutCheckingTimestamps will download all files
// even if they have not been modified on qordoba

Upload New

  • uploads any new files in the soruce language folder
  • checks all files in specified loadPath against the source key in the config file and uploads any files missing from qordoba.config.json
  • writes new file into to config file after successful upload
npm run uploadNew 1.0

NOTE: Requires passing a version number as an arguments (see above command)

Upload Modified

  • uploads all new and modified files to qordoba
  • checks filesystem timestamp against saved
  • timestamp in qordoba.config.json
  • updates timestamp and fileId in config file after successful upload
npm run uploadModified 1.1

NOTE: Requires passing a version number as an arguments (see above command)

Upload All

  • updates all source files in qordoba.config.json that have been modified
  • updates config with new fileId and timestamp after successful update
npm run uploadAll 2.0

NOTE: Requires passing a version number as an arguments (see above command)

Update

  • updates all source files in qordoba.config.json that have been modified
  • updates config with new fileId and timestamp after successful update
npm run update

Development Scripts

Root Directory

gulp build // transpliles ES6 code from src -> lib into ES5. Provides runtime support for promises.

Prerequisites

  • none

Running the tests

'npm test' in the root directory

Built With

Authors

  • Erik Suddath -

License

This project is licensed under the MIT License - see the LICENSE.md file for details