UNPKG

@google/clasp

Version:

Develop Apps Script Projects locally

32 lines (31 loc) 1.34 kB
import { Command } from 'commander'; import inquirer from 'inquirer'; import { intl } from '../intl.js'; import { isInteractive, withSpinner } from './utils.js'; export const command = new Command('create-version') .alias('version') .arguments('[description]') .description('Creates an immutable version of the script') .action(async function (description) { const clasp = this.opts().clasp; if (!description && isInteractive()) { const prompt = intl.formatMessage({ id: "6U9ksF", defaultMessage: [{ type: 0, value: "Give a description:" }] }); const answer = await inquirer.prompt([ { default: '', message: prompt, name: 'description', type: 'input', }, ]); description = answer.description; } const spinnerMsg = intl.formatMessage({ id: "HhBwsB", defaultMessage: [{ type: 0, value: "Creating a new version..." }] }); const versionNumber = await withSpinner(spinnerMsg, async () => { return clasp.project.version(description); }); const successMessage = intl.formatMessage({ id: "TVOEZz", defaultMessage: [{ type: 0, value: "Created version " }, { type: 2, value: "version", style: null }] }, { version: versionNumber, }); console.log(successMessage); });