New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@withkoji/vcc

Package Overview
Dependencies
Maintainers
3
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@withkoji/vcc

Core library for developing remixable Koji templates

latest
Source
npmnpm
Version
1.1.49
Version published
Maintainers
3
Created
Source

Koji VCC (deprecated)

npm (scoped)

Core library for developing remixable Koji templates.

Overview

The @withkoji/vcc package enables you to implement core platform features in your Koji template, including instant remixing, Visual Customization Controls (VCCs), and the Koji feed.

[DEPRECATED] This package is deprecated and is included only for backwards compatibility. For new templates, use @withkoji/core.

Installation

Install the package in your Koji project.

npm install --save @withkoji/vcc

Basic use

Start the watcher

Reconfigure the package.json file to run the watcher (koji-vcc watch) concurrently with your development server. You can install and use a package like npm-run-all. For example:

{
  "scripts": {
    ...
    "start": "npm-run-all -p watch start:server",
    "watch": "koji-vcc watch",
    "start:server": "webpack-dev-server --config ./.internals/webpack.development.js --inline --hot"
  }
}

NOTE: Make sure to replace the value of "start:server" with the "start" command for your project and remove the prestart command, if there is one.

Support TypeScript

To ensure that VCCs work correctly in your TypeScript project, add the following line to the scripts section of the package.json file.

"prebuild": "koji-vcc preinstall-ts"

InstantRemixing

Instant remixing enables users to customize values directly from the template preview, rather than from the Koji editor, for a quick and easy way to remix without coding.

To enable instant remixing for your Koji template, you must implement the InstantRemixing class and enable the InstantRemixing entitlement in the .koji/project/entitlements.json file.

{
  "entitlements": {
    "InstantRemixing": true
  }
}

Instantiate InstantRemixing.

import { InstantRemixing } from '@withkoji/vcc';
const instantRemixing = new InstantRemixing();

VccMiddleware

This package includes an Express middleware to manage the environment variables for instant remixes and for access to VCC values from dynamic backends, as a companion to the frontend InstantRemixing class.

To implement this middleware, add it to your Express server.

import { VccMiddleware } from '@withkoji/vcc';

const app = express();
app.use(VccMiddleware.express);

This middleware is required to manage the environment variables to scope them for instant remixes of the original template. In particular, you must call this middleware before instantiating certain packages, including @withkoji/koji-iap, @withkoji/database, and @withkoji/koji-auth-sdk.

FeedSdk

The Koji feed enables users to browse available templates, moving them from off screen or out of focus, into the main window of the feed.

To ensure a template can be displayed correctly in the Koji feed, you must implement the FeedSdk and enable the FeedEvents entitlement in the .koji/project/entitlements.json file.

{
  "entitlements": {
    "FeedEvents": true
  }
}

NOTE: Kojis must be authorized by the Koji team to be displayed within the feed. When you are confident that your template is able to function well within a feed, please contact us for review and authorization.

Instantiate FeedSdk.

import { FeedSdk } from '@withkoji/vcc';
const feed = new FeedSdk();

Keystore

The Keystore module is used in conjunction with the secret VCC type to store sensitive data, ensuring the value is not visible when the project is remixed.

Instantiate Keystore.

import { Keystore } from '@withkoji/vcc';
const keystore = new Keystore();

Contributions and questions

See the contributions page on the developer site for info on how to make contributions to Koji repositories and developer documentation.

For any questions, reach out to the developer community or the @Koji Team on our Discord server.

Keywords

koji

FAQs

Package last updated on 16 Apr 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts