1.2.0 • Published 3 years ago

@wizeline/optimizely-sync v1.2.0

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

Optimizely Sync

Infrustructure as code for your Optimizely configuration.

Getting started

  1. Install as a devDependency:
    npm i --save-dev @wizeline/optimizely-sync
  2. Create your configuration. This can either be done in a single JSON file or in a directory of JSON files:

    • A single JSON file: config.json

      {
        "development": {
          "feature-one": 10000,
          "other-feature": 10000
        },
        "production": {
          "feature-one": 0,
          "other-feature": 10000
        }
      }
    • A directory of JSON files, where each file is the key of an environment:

      config/development.json

      {
        "created-by-js": 10000,
        "feature-one": 10000,
        "other-feature": 10000
      }

      config/production.json

      {
        "created-by-js": 0,
        "feature-one": 0,
        "other-feature": 10000
      }

      Note: This option allows you to control who can edit configuration for various environments via a CODEOWNERS file.

  3. Create an Optimizely Personal Token.

  4. Run npx optimizely-sync -d config/ -p 12345678901 -t "your-token-here" --dry-run

CLI Flags

FlagDescription
--dry-runLog what would be done
-c <path> or --config-file <path>The path to the file that contains your desired configuration.
-d <path> or --config-dir <path>The path to the directory that contains json files with your desired configurations.
-p <projectId> or --project-id <projectId>The id of the Optimizely project. Can also be set via the OPTIMIZELY_PROJECT_ID environment variable.
-t <token> or --access-token <token>An Optimizely Personal Access Token. Can also be set via the OPTIMIZELY_ACCESS_TOKEN environment variable.
-h or --helpdisplay help for command

TODO

  • Improve README
  • Add tests
  • Add support for creating/deleting environments