1.0.2 • Published 5 years ago

tc-sub-cli v1.0.2

Weekly downloads
12
License
-
Repository
-
Last release
5 years ago

tc-submission-cli

Dependencies

Configuration

Configuration for the application is at config/default.js. The following parameters can be set in config files or in env variables:

PropertyEnvironment varibleDefault valueDescription
LOG_LEVELLOG_LEVELinfocontrol log level
SUBMISSION_API_URLTEST_SUBMISSION_API_URLhttps://api.topcoder.com/v5/submissionsthe TC submission API URL
TC_AUTHN_URLTC_AUTHN_URLhttps://topcoder.auth0.com/oauth/roAPI that is used to fetch JWT token v2
TC_AUTHZ_URLTC_AUTHZ_URLhttps://api.topcoder.com/v3/authorizationsAPI that is used to fetch JWT token v3
TC_CLIENT_IDTC_CLIENT_ID6ZwZEUo2ZK4c50aLPpgupeg5v2Ffxp9PTC client ID
TC_CLIENT_V2CONNECTIONCLIENT_V2CONNECTIONLDAPTC client connection protocol

Publish the package to npm

  • Create a npm account on https://www.npmjs.com/signup if you don't have one.
  • Use the account to sign in via cli: npm login
  • In the root directory of the project, run npm publish --access=public to publish the package to npm registry.

Notes

  • In rare cases the module name would have been used by others. You may need to change the value of the name field in package.json to a unique one.
  • When you make changes to your code and want to update the package you'll need to update the version of the package. After that, run npm publish again to republish the package.
  • If you want to remove the package from npm registry anyway, run npm unpublish --force under the root directory of the project.

Installation

  • After you published the package to npm registry you can then install the package via npm-cli:
npm install -g <your package name here>

Usage

First, install the package, and then run tc-submission-cli command on the root directory of your project with .topcoderrc file. It'll then automatically zip all files under the root directory recursively(except the .topcoderrc file itself) and finally upload the zip file to the TC challenge as a submission.

An example .topcoderrc file should conform to at least the following structure.

{
  "challengeIds": [
    "30095545" // at least one item here
  ],
  "userId": "8547899",
  "username": "TonyJ",
  "password": "appirio123"
}

test

Prepare

  • Install dependencies npm install

Unit test

To run unit tests alone

npm run test

To run unit tests with coverage report

npm run test:cov