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

@amopro/widget-installer

v4.0.0

Published

Automatic installation of a widget in amoCRM

Downloads

26

Readme

amoCRM widget installer

Сервис, который упаковывает директорию в zip-архив и загружает в аккаунт amoCRM. Если в amoCRM виджет не существует, он будет создан, иначе будет обновлен.

Обратите внимание, что с 2022-06-08 amoCRM добавила amoМаркет. Если аккаунт обновился и имеет доступ к маркету (вместо раздела Настройки -> Интеграции), то в объекте параметров конструктора WidgetInstaller можете указать amoMarket: true. Иначе укажате amoMarket: false.

Установка

# npm
npm install --save-dev @amopro/widget-installer
# or yarn
yarn add --dev @amopro/widget-installer

Использование

Вы можете посмотреть заготовку виджета в репозитории amocrm-widget-starter-kit

const path = require('path');
const WIDGET_DIR = path.resolve('widget');

// ...
// Здесь вы собираете виджет в папку "widget"
// ...

try {
    const installer = require('@amopro/widget-installer');
    const {WidgetInstaller, makeZipArchive} = installer;

    console.log('Make widget archive...');
    
    const widgetZipPath = await makeZipArchive(WIDGET_DIR);
    
    console.log('Widget uploading...');
    const installerParams = {
        subDomain: process.env.AMO_SUBDOMAIN,
        login: process.env.AMO_LOGIN,
        password: process.env.AMO_PASSWORD,
        widgetZipPath: widgetZipPath,
        redirectUri: process.env.APP_URL + '/amocrm/auth',
        revokeAccessHookUri: process.env.APP_URL + '/amocrm/destroy',
        amoMarket: true, // true - если аккаунт имеет доступ к amoМаркет (с 2022-06-08)
    };
    const wi = new WidgetInstaller(installerParams);
    
    await wi.upload();
    console.log('Widget uploaded!');

    // после загрузки можно удалить архив
    const fse = require('fs-extra'); 
    fse.removeSync(path.resolve('widget.zip'));
} catch (e) {
    console.error('uploading error', e.toString());
    throw e;
}