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

zendesk_app_migrator

v0.3.3

Published

CLI to migrate v1 zendesk_app_framework apps to v2

Downloads

242

Readme

Zendesk App Migration Helper

Build Status

What is it?

The App Migration Helper is CLI tool for assisting with the migration of v1 App Framework apps to v2

How does it work?

The migrator executes a series of tasks to:

  • Reorganise files and folders
    • Copies templates
    • Copies translations
    • Copies stylesheets
    • Copies and rewrites Common JS modules
  • Update the manifest file
    • Change to "frameworkVersion": "2.0"
    • Rewrite locations to v2 hash syntax
  • Rewrite JavaScript code from v1 app.js
  • Creates an HTML file from template that imports all the necessary deps., including v1 shims/helpers

App Scaffold

The migrator has a hard dependency on the public App Scaffold project.

When a v1 app is migrated, we leverage the features already built into the App Scaffold to transpile v1 app assets for v2.

Usage

Options

| Option | Default | Required | Description | | --------------- | ------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | | -p --path | | Yes | The location of the v1 app | | -r --replace-v1 | false | No | Whether to backup v1 files, and replace with v2 during migration. Backed up files will be moved to a v1 folder, alongside the new v2 files. | | -a --auto | false | No | Enables more end-to-end transformations of JavaScript, and CSS code. See the expanded Auto option section below for more details. |

Auto option

Please note that auto transforms may not work as expected. Use with caution, and always test extensively after migration. For a better understanding of how auto transforms are expected to behave, look at tests for the migrate_app_js step tests. Transforms currently available:

  • Rewrites synchronous v1 API calls to be asynchronous. This works by adding a shim for the ZAF SDK APIs. The shim will be combined with the use of async/awaits.
  • Injecting JavaScript and CSS assets to support the use of the zdSelectMenu API available in v1.

For development...

Source files are under src, test files under src/test. The codebase currently makes use of ES6 features by way of the Typescript compiler. To that end, all of the source code is written in Typescript. An added bonus is that the package will ship with type declarations alongside the JavaScript.

Setting up your dev environment

You will need:

  • Yarn
  • NodeJS

brew install yarn && yarn install

Dependencies

Dependencies are declared via yarn in the package.json file.

Testing the CLI

Optionally install ts-node and typescript globally, like npm install -g ts-node typescript.

Run ts-node src/index.ts migrate --path ~/path/to/v1/app/source

If not installing ts-node and typescript globally, reference the local versions of those packages like ./node_modules/.bin/ts-node src/index.ts migrate --path ~/path/to/v1/app/source

After running yarn build, it is possible to run the down-level version of the Migrator like node ./lib/index.js migrate --path ~/path/to/v1/app/source. Similarly, the down-level tests can be run like ./node_modules/.bin/mocha ./lib/test/**/*.test.js. Doing so effectively just demonstrates that the output from the Typescript compiler is valid JavaScript for NodeJS.

Running tests

yarn test

Tests are run using the mocha test runner. chai is the assertion library. We make use of chai-as-promised to provide more elegant assertions against async behaviour.

Other scripts

  • yarn test-watch
  • yarn build
  • yarn build-watch

Contributing

We welcome contributions. First, please read the Pull Request Guidelines and Style Guide pages on our wiki.

Deployment

The App Migrator will be deployed as a node package, and/or as a dependency of other projects.