Nebulous Pumpkin Moons

    sentry-files

    1.0.1 • Public • Published

    sentry-files

    Zero-dependency Node library to upload source maps to Sentry

    Installation

    yarn add sentry-files --dev

    Usage

    import path from 'path';
    const { upload } = require('sentry-files');
     
    const config = {
      version: '1.0.0',
      organization: 'example-organization',
      project: 'example-project',
      token: 'YOUR_API_TOKEN_HERE',
      files: [
        {
          name: 'http://example.com/assets/main.js.map',
          path: path.resolve(__dirname, 'path/to/main.js.map'),
        },
      ],
    };
     
    upload(config)
      .then(data => console.log('----- SUCCESS ----\n', data))
      .catch(error => console.log('---- ERROR ----\n', error));

    For an example uploading source maps of a React app check this post.

    API

    upload(options)

    Type: function
    Returns: Promise

    It creates a release and uploads the files to that release.

    options

    Type: Object
    Required

    An object specifying the options used to create the release and upload the files.

    options.version

    Type: String
    Required

    Version used to create the release.

    options.organization

    Type: String
    Required

    Sentry organization name.

    options.project

    Type: String
    Required

    Sentry project name.

    options.token

    Type: String
    Required

    Authentication token required to perform actions against the Sentry API.

    Ensure you have project:write selected under scopes.

    options.files

    Type: Array
    Required

    Array of objects describing the files to upload to Sentry.

    [
      {
        name: 'Sentry file name',
        path: 'Local file path'
      },
      {
        name: '...',
        path: '...'
      }
    ]

    options.files.name

    Type: String
    Required

    Name of the file on Sentry.

    More about Sentry file names: Upload a New File, Uploading Source Maps to Sentry and Assets Accessible at Multiple Origins

    options.files.path

    Type: String
    Required

    Path to the file locally.

    License

    MIT

    Install

    npm i sentry-files

    DownloadsWeekly Downloads

    2,066

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    19.1 kB

    Total Files

    15

    Last publish

    Collaborators

    • jzabala