New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

quip-cli

Package Overview
Dependencies
Maintainers
1
Versions
106
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

quip-cli - npm Package Compare versions

Comparing version 1.0.0-alpha.30 to 1.0.0-alpha.31

5

lib/commands/init.d.ts

@@ -6,4 +6,9 @@ import { Command } from "@oclif/command";

help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
"dry-run": import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
};
private promptInitialAppConfig_;
private copyTemplateToCWD_;
private mangleBoilerplate_;
private mangleJsonConfig_;
run(): Promise<void>;
}

285

lib/commands/init.js

@@ -9,136 +9,152 @@ "use strict";

const util_1 = require("../lib/util");
const promptInitialAppConfig = async () => {
console.log("Creating a new Quip Live App");
const defaultName = path_1.default
.basename(process.cwd())
.replace(/[^\w\d\s]/g, " ")
.replace(/(:?^|\s)(\w)/g, c => c.toUpperCase());
const validateNumber = val => !isNaN(parseInt(val, 10)) || "Please enter a number";
const manifestOptions = await inquirer_1.default.prompt([
{
type: "input",
name: "name",
message: "What is the name of this app?\n(This is what users will see when inserting your app)\n",
default: defaultName,
},
]);
const packageOptions = await inquirer_1.default.prompt([
{
type: "input",
name: "name",
message: "Choose a package name",
default: manifestOptions.name.toLowerCase().replace(/\s+/g, "-"),
filter: val => val.toLowerCase(),
},
{
type: "input",
name: "description",
message: "What does this app do?\n",
},
{
type: "confirm",
name: "typescript",
message: "Use Typescript?",
default: true,
},
{
type: "list",
name: "bundler",
message: "Which bundler do you want to use?",
choices: ["parcel", "webpack"],
},
]);
const { addManifestConfig } = await inquirer_1.default.prompt([
{
type: "confirm",
name: "addManifestConfig",
message: "Would you like to customize your manifest.json now?\n(see: https://corp.quip.com/dev/liveapps/documentation#app-manifest)\n",
default: true,
},
]);
if (addManifestConfig) {
const extraManifestOptions = await inquirer_1.default.prompt([
{
type: "input",
name: "version_name",
message: "Choose an initial version string",
default: "1.0.0-alpha.0",
},
{
type: "list",
name: "toolbar_color",
message: "Choose a toolbar color",
choices: ["red", "orange", "yellow", "green", "blue", "violet"],
},
{
type: "confirm",
name: "disable_app_level_comments",
message: "Disable commenting at the app level?",
default: false,
},
{
type: "list",
name: "sizing_mode",
message: "Choose a sizing mode\n(see: https://corp.quip.com/dev/liveapps/recipes#specifying-the-size-of-your-app)",
choices: ["fill_container", "fit_content", "scale"],
},
{
type: "number",
name: "initial_height",
message: "Specify an initial height for your app\nThis will be the height of the app while it is loading.\n",
default: 300,
validate: validateNumber,
filter: Number,
},
{
type: "number",
name: "initial_width",
message: "Specify an initial width for your app (optional)\nThis will be the width of the app while it is loading.\n",
default: "none",
validate: input => input === "none" || validateNumber(input),
filter: val => (val === "none" ? -1 : val),
},
]);
Object.assign(manifestOptions, extraManifestOptions);
class Init extends command_1.Command {
constructor() {
super(...arguments);
this.promptInitialAppConfig_ = async () => {
this.log("Creating a new Quip Live App");
const defaultName = path_1.default
.basename(process.cwd())
.replace(/[^\w\d\s]/g, " ")
.replace(/(:?^|\s)(\w)/g, c => c.toUpperCase());
const validateNumber = val => !isNaN(parseInt(val, 10)) || "Please enter a number";
const manifestOptions = await inquirer_1.default.prompt([
{
type: "input",
name: "name",
message: "What is the name of this app?\n(This is what users will see when inserting your app)\n",
default: defaultName,
},
]);
const packageOptions = await inquirer_1.default.prompt([
{
type: "input",
name: "name",
message: "Choose a package name",
default: manifestOptions.name
.toLowerCase()
.replace(/\s+/g, "-"),
filter: val => val.toLowerCase(),
},
{
type: "input",
name: "description",
message: "What does this app do?\n",
},
{
type: "confirm",
name: "typescript",
message: "Use Typescript?",
default: true,
},
]);
const { addManifestConfig } = await inquirer_1.default.prompt([
{
type: "confirm",
name: "addManifestConfig",
message: "Would you like to customize your manifest.json now?\n(see: https://corp.quip.com/dev/liveapps/documentation#app-manifest)\n",
default: true,
},
]);
if (addManifestConfig) {
const extraManifestOptions = await inquirer_1.default.prompt([
{
type: "input",
name: "version_name",
message: "Choose an initial version string",
default: "1.0.0-alpha.0",
},
{
type: "list",
name: "toolbar_color",
message: "Choose a toolbar color",
choices: [
"red",
"orange",
"yellow",
"green",
"blue",
"violet",
],
},
{
type: "confirm",
name: "disable_app_level_comments",
message: "Disable commenting at the app level?",
default: false,
},
{
type: "list",
name: "sizing_mode",
message: "Choose a sizing mode\n(see: https://corp.quip.com/dev/liveapps/recipes#specifying-the-size-of-your-app)",
choices: ["fill_container", "fit_content", "scale"],
},
{
type: "number",
name: "initial_height",
message: "Specify an initial height for your app\nThis will be the height of the app while it is loading.\n",
default: 300,
validate: validateNumber,
filter: Number,
},
{
type: "number",
name: "initial_width",
message: "Specify an initial width for your app (optional)\nThis will be the width of the app while it is loading.\n",
default: "none",
validate: input => input === "none" || validateNumber(input),
filter: val => (val === "none" ? -1 : val),
},
]);
Object.assign(manifestOptions, extraManifestOptions);
}
packageOptions.bundler = "webpack";
manifestOptions.description = packageOptions.description;
return { packageOptions, manifestOptions };
};
this.copyTemplateToCWD_ = (packageOptions, dryRun) => {
const { typescript, bundler, name } = packageOptions;
// get lib path
const templateName = `${typescript ? "ts" : "js"}_${bundler}`;
const templatePath = path_1.default.join(__dirname, "../../templates", templateName);
const options = {
dereference: true,
filter: (fileName) => fileName.indexOf("node_modules") === -1 &&
fileName.indexOf(".git/") === -1,
};
const dest = path_1.default.join(process.cwd(), name);
if (dryRun) {
this.log(`Would intialize ${templateName} on ${dest}`);
return;
}
else {
return util_1.copy(templatePath, dest, options);
}
};
this.mangleBoilerplate_ = (packageOptions, manifestOptions) => {
const { name, description } = packageOptions;
const packagePath = path_1.default.join(process.cwd(), name, "package.json");
this.mangleJsonConfig_(packagePath, { name, description });
const manifestPath = path_1.default.join(process.cwd(), name, "manifest.json");
this.mangleJsonConfig_(manifestPath, manifestOptions);
};
this.mangleJsonConfig_ = (configPath, updates) => {
const config = JSON.parse(fs_1.default.readFileSync(configPath).toString());
Object.assign(config, updates);
fs_1.default.writeFileSync(configPath, JSON.stringify(config, null, 4));
};
}
console.log(packageOptions);
console.log(manifestOptions);
manifestOptions.description = packageOptions.description;
return { packageOptions, manifestOptions };
};
const copyTemplateToCWD = (packageOptions) => {
const { typescript, bundler, name } = packageOptions;
// get lib path
const templateName = `${typescript ? "ts" : "js"}_${bundler}`;
const templatePath = path_1.default.join(__dirname, "../../templates", templateName);
const options = {
dereference: true,
filter: (fileName) => fileName.indexOf("node_modules") === -1 &&
fileName.indexOf(".git/") === -1,
};
return util_1.copy(templatePath, path_1.default.join(process.cwd(), name), options);
};
const mangleBoilerplate = (packageOptions, manifestOptions) => {
const { name, description } = packageOptions;
const packagePath = path_1.default.join(process.cwd(), name, "package.json");
mangleJsonConfig(packagePath, { name, description });
const manifestPath = path_1.default.join(process.cwd(), name, "manifest.json");
mangleJsonConfig(manifestPath, manifestOptions);
};
const mangleJsonConfig = (configPath, updates) => {
const config = JSON.parse(fs_1.default.readFileSync(configPath).toString());
Object.assign(config, updates);
fs_1.default.writeFileSync(configPath, JSON.stringify(config, null, 4));
};
const init = async () => {
// // initial app options from user
const { packageOptions, manifestOptions } = await promptInitialAppConfig();
await copyTemplateToCWD(packageOptions);
mangleBoilerplate(packageOptions, manifestOptions);
console.log(`Live App Project initialized: ${manifestOptions.name} (${packageOptions.name})`);
};
class Init extends command_1.Command {
async run() {
this.parse(Init);
init();
const { flags } = this.parse(Init);
const dryRun = flags["dry-run"];
// initial app options from user
const { packageOptions, manifestOptions, } = await this.promptInitialAppConfig_();
await this.copyTemplateToCWD_(packageOptions, dryRun);
if (dryRun) {
this.log("Would update package.json with", packageOptions);
this.log("Would update manifest.json with", manifestOptions);
}
else {
this.mangleBoilerplate_(packageOptions, manifestOptions);
}
this.log(`Live App Project initialized: ${manifestOptions.name} (${packageOptions.name})`);
}

@@ -150,2 +166,7 @@ }

help: command_1.flags.help({ char: "h" }),
["dry-run"]: command_1.flags.boolean({
char: "d",
hidden: true,
description: "Print what this would do, but don't create any files.",
}),
};

@@ -1,1 +0,1 @@

{"version":"1.0.0-alpha.30","commands":{"init":{"id":"init","description":"Initialize a new Live App Project","pluginName":"quip-cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"login":{"id":"login","description":"Logs in to Quip and stores credentials in the .quiprc file","pluginName":"quip-cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"force":{"name":"force","type":"boolean","char":"f","description":"forces a re-login even if a user is currently logged in","allowNo":false},"site":{"name":"site","type":"option","char":"s","description":"use a specific quip site rather than the standard quip.com login","default":"quip.com"},"port":{"name":"port","type":"option","description":"Use a custom port for the OAuth redirect server (defaults to 9898)","hidden":true,"default":9898},"hostname":{"name":"hostname","type":"option","description":"Use a custom hostname for the OAuth redirect server (defaults to 127.0.0.1)","hidden":true,"default":"127.0.0.1"},"config":{"name":"config","type":"option","description":"Use a custom config file (default ~/.quiprc)","hidden":true,"default":"/home/runner/.quiprc"}},"args":[]},"migration":{"id":"migration","description":"Creates a new migration","pluginName":"quip-cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"folder":{"name":"folder","type":"option","char":"f","description":"The folder where your migrations are stored","default":"migrations"},"manifest":{"name":"manifest","type":"option","char":"m","description":"A manifest.json file to add the migration to. By default, we'll use the first one we find."},"version":{"name":"version","type":"option","char":"v","description":"The version to generate this migration for. By default, it will use the current version_number in the manifest"},"dry-run":{"name":"dry-run","type":"boolean","char":"d","description":"Print what this would do, but don't create any files.","hidden":true,"allowNo":false}},"args":[{"name":"name","description":"A short description to generate the filename with"}]}}}
{"version":"1.0.0-alpha.31","commands":{"init":{"id":"init","description":"Initialize a new Live App Project","pluginName":"quip-cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"dry-run":{"name":"dry-run","type":"boolean","char":"d","description":"Print what this would do, but don't create any files.","hidden":true,"allowNo":false}},"args":[]},"login":{"id":"login","description":"Logs in to Quip and stores credentials in the .quiprc file","pluginName":"quip-cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"force":{"name":"force","type":"boolean","char":"f","description":"forces a re-login even if a user is currently logged in","allowNo":false},"site":{"name":"site","type":"option","char":"s","description":"use a specific quip site rather than the standard quip.com login","default":"quip.com"},"port":{"name":"port","type":"option","description":"Use a custom port for the OAuth redirect server (defaults to 9898)","hidden":true,"default":9898},"hostname":{"name":"hostname","type":"option","description":"Use a custom hostname for the OAuth redirect server (defaults to 127.0.0.1)","hidden":true,"default":"127.0.0.1"},"config":{"name":"config","type":"option","description":"Use a custom config file (default ~/.quiprc)","hidden":true,"default":"/home/runner/.quiprc"}},"args":[]},"migration":{"id":"migration","description":"Creates a new migration","pluginName":"quip-cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"folder":{"name":"folder","type":"option","char":"f","description":"The folder where your migrations are stored","default":"migrations"},"manifest":{"name":"manifest","type":"option","char":"m","description":"A manifest.json file to add the migration to. By default, we'll use the first one we find."},"version":{"name":"version","type":"option","char":"v","description":"The version to generate this migration for. By default, it will use the current version_number in the manifest"},"dry-run":{"name":"dry-run","type":"boolean","char":"d","description":"Print what this would do, but don't create any files.","hidden":true,"allowNo":false}},"args":[{"name":"name","description":"A short description to generate the filename with"}]}}}
{
"name": "quip-cli",
"description": "A Command Line Interface for the Quip Live Apps platform",
"version": "1.0.0-alpha.30",
"version": "1.0.0-alpha.31",
"author": "Quip",

@@ -78,3 +78,3 @@ "bin": {

"types": "lib/index.d.ts",
"gitHead": "bc97715bcef4edcf43be99983b31a8359ff0bd49"
"gitHead": "e488560f097db58056a1a707af7012ba8ca403cb"
}

@@ -19,3 +19,3 @@ # Quip CLI

$ qla (-v|--version|version)
quip-cli/1.0.0-alpha.30 linux-x64 node-v12.18.2
quip-cli/1.0.0-alpha.31 linux-x64 node-v12.18.2
$ qla --help [COMMAND]

@@ -65,3 +65,3 @@ USAGE

_See code: [src/commands/init.ts](https://github.com/quip/quip-apps/blob/v1.0.0-alpha.30/src/commands/init.ts)_
_See code: [src/commands/init.ts](https://github.com/quip/quip-apps/blob/v1.0.0-alpha.31/src/commands/init.ts)_

@@ -82,3 +82,3 @@ ## `qla login`

_See code: [src/commands/login.ts](https://github.com/quip/quip-apps/blob/v1.0.0-alpha.30/src/commands/login.ts)_
_See code: [src/commands/login.ts](https://github.com/quip/quip-apps/blob/v1.0.0-alpha.31/src/commands/login.ts)_

@@ -105,3 +105,3 @@ ## `qla migration [NAME]`

_See code: [src/commands/migration.ts](https://github.com/quip/quip-apps/blob/v1.0.0-alpha.30/src/commands/migration.ts)_
_See code: [src/commands/migration.ts](https://github.com/quip/quip-apps/blob/v1.0.0-alpha.31/src/commands/migration.ts)_
<!-- commandsstop -->

@@ -108,0 +108,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc