storyblok 4.2.0 → 4.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -25,9 +25,9 @@ const commands = {
25
25
  USER: "user",
26
26
  COMPONENTS: "components",
27
27
  LANGUAGES: "languages",
28
- MIGRATIONS: "Migrations",
29
- TYPES: "Types",
30
- DATASOURCES: "Datasources",
28
+ MIGRATIONS: "migrations",
29
+ TYPES: "types",
30
+ DATASOURCES: "datasources",
31
31
  CREATE: "create"
32
32
  };
33
33
  const colorPalette = {
@@ -441,9 +441,9 @@ function formatHeader(title) {
441
441
  const konsola = {
442
442
  title: (message, color, subtitle) => {
443
443
  if (subtitle) {
444
- console.log(`${formatHeader(chalk.bgHex(color).bold(` ${message} `))} ${subtitle}`);
444
+ console.log(`${formatHeader(chalk.bgHex(color).bold(` ${capitalize(message)} `))} ${subtitle}`);
445
445
  } else {
446
- console.log(formatHeader(chalk.bgHex(color).bold(` ${message} `)));
446
+ console.log(formatHeader(chalk.bgHex(color).bold(` ${capitalize(message)} `)));
447
447
  }
448
448
  console.log("");
449
449
  console.log("");
@@ -773,7 +773,7 @@ program$i.command(commands.LOGIN).description("Login to the Storyblok CLI").opti
773
773
  "-r, --region <region>",
774
774
  `The region you would like to work in. Please keep in mind that the region must match the region of your space. This region flag will be used for the other cli's commands. You can use the values: ${allRegionsText}.`
775
775
  ).action(async (options) => {
776
- konsola.title(` ${commands.LOGIN} `, colorPalette.LOGIN);
776
+ konsola.title(`${commands.LOGIN}`, colorPalette.LOGIN);
777
777
  const verbose = program$i.opts().verbose;
778
778
  const { token, region } = options;
779
779
  const { state, updateSession, persistCredentials, initializeSession } = session();
@@ -895,7 +895,7 @@ program$i.command(commands.LOGIN).description("Login to the Storyblok CLI").opti
895
895
 
896
896
  const program$h = getProgram();
897
897
  program$h.command(commands.LOGOUT).description("Logout from the Storyblok CLI").action(async () => {
898
- konsola.title(` ${commands.LOGOUT} `, colorPalette.LOGOUT);
898
+ konsola.title(`${commands.LOGOUT}`, colorPalette.LOGOUT);
899
899
  const verbose = program$h.opts().verbose;
900
900
  try {
901
901
  const { state, initializeSession } = session();
@@ -946,7 +946,7 @@ async function openSignupInBrowser(url) {
946
946
 
947
947
  const program$g = getProgram();
948
948
  program$g.command(commands.SIGNUP).description("Sign up for Storyblok").action(async () => {
949
- konsola.title(` ${commands.SIGNUP} `, colorPalette.SIGNUP);
949
+ konsola.title(`${commands.SIGNUP}`, colorPalette.SIGNUP);
950
950
  const verbose = program$g.opts().verbose;
951
951
  const { state, initializeSession } = session();
952
952
  await initializeSession();
@@ -995,7 +995,7 @@ const getUser = async (token, region) => {
995
995
 
996
996
  const program$f = getProgram();
997
997
  program$f.command(commands.USER).description("Get the current user").action(async () => {
998
- konsola.title(` ${commands.USER} `, colorPalette.USER);
998
+ konsola.title(`${commands.USER}`, colorPalette.USER);
999
999
  const { state, initializeSession } = session();
1000
1000
  await initializeSession();
1001
1001
  if (!requireAuthentication(state)) {
@@ -1020,7 +1020,7 @@ program$f.command(commands.USER).description("Get the current user").action(asyn
1020
1020
  });
1021
1021
 
1022
1022
  const program$e = getProgram();
1023
- const componentsCommand = program$e.command("components").alias("comp").description(`Manage your space's block schema`).option("-s, --space <space>", "space ID").option("-p, --path <path>", "path to save the file. Default is .storyblok/components");
1023
+ const componentsCommand = program$e.command(commands.COMPONENTS).alias("comp").description(`Manage your space's block schema`).option("-s, --space <space>", "space ID").option("-p, --path <path>", "path to save the file. Default is .storyblok/components");
1024
1024
 
1025
1025
  let instance = null;
1026
1026
  const createMapiClient = (options) => {
@@ -1480,7 +1480,7 @@ async function readConsolidatedFiles$1(resolvedPath, suffix) {
1480
1480
 
1481
1481
  const program$d = getProgram();
1482
1482
  componentsCommand.command("pull [componentName]").option("-f, --filename <filename>", "custom name to be used in file(s) name instead of space id").option("--sf, --separate-files", "Argument to create a single file for each component").option("--su, --suffix <suffix>", "suffix to add to the file name (e.g. components.<suffix>.json)").description(`Download your space's components schema as json. Optionally specify a component name to pull a single component.`).action(async (componentName, options) => {
1483
- konsola.title(` ${commands.COMPONENTS} `, colorPalette.COMPONENTS, componentName ? `Pulling component ${componentName}...` : "Pulling components...");
1483
+ konsola.title(`${commands.COMPONENTS}`, colorPalette.COMPONENTS, componentName ? `Pulling component ${componentName}...` : "Pulling components...");
1484
1484
  const verbose = program$d.opts().verbose;
1485
1485
  const { space, path } = componentsCommand.opts();
1486
1486
  const { separateFiles, suffix, filename = "components" } = options;
@@ -2760,7 +2760,7 @@ const saveDatasourcesToFiles = async (space, datasources, options) => {
2760
2760
 
2761
2761
  const program$c = getProgram();
2762
2762
  componentsCommand.command("push [componentName]").description(`Push your space's components schema as json`).option("-f, --from <from>", "source space id").option("--fi, --filter <filter>", "glob filter to apply to the components before pushing").option("--sf, --separate-files", "Read from separate files instead of consolidated files").option("--su, --suffix <suffix>", "Suffix to add to the component name").action(async (componentName, options) => {
2763
- konsola.title(` ${commands.COMPONENTS} `, colorPalette.COMPONENTS, componentName ? `Pushing component ${componentName}...` : "Pushing components...");
2763
+ konsola.title(`${commands.COMPONENTS}`, colorPalette.COMPONENTS, componentName ? `Pushing component ${componentName}...` : "Pushing components...");
2764
2764
  const verbose = program$c.opts().verbose;
2765
2765
  const { space, path } = componentsCommand.opts();
2766
2766
  const { from, filter } = options;
@@ -2916,9 +2916,9 @@ const saveLanguagesToFile = async (space, internationalizationOptions, options)
2916
2916
  };
2917
2917
 
2918
2918
  const program$b = getProgram();
2919
- const languagesCommand = program$b.command("languages").alias("lang").description(`Manage your space's languages`).option("-s, --space <space>", "space ID").option("-p, --path <path>", "path to save the file. Default is .storyblok/languages");
2919
+ const languagesCommand = program$b.command(commands.LANGUAGES).alias("lang").description(`Manage your space's languages`).option("-s, --space <space>", "space ID").option("-p, --path <path>", "path to save the file. Default is .storyblok/languages");
2920
2920
  languagesCommand.command("pull").description(`Download your space's languages schema as json`).option("-f, --filename <filename>", "filename to save the file as <filename>.<suffix>.json").option("--su, --suffix <suffix>", "suffix to add to the file name (e.g. languages.<suffix>.json). By default, the space ID is used.").action(async (options) => {
2921
- konsola.title(` ${commands.LANGUAGES} `, colorPalette.LANGUAGES);
2921
+ konsola.title(`${commands.LANGUAGES}`, colorPalette.LANGUAGES);
2922
2922
  const verbose = program$b.opts().verbose;
2923
2923
  const { space, path } = languagesCommand.opts();
2924
2924
  const { filename = "languages", suffix = options.space } = options;
@@ -2961,7 +2961,7 @@ languagesCommand.command("pull").description(`Download your space's languages sc
2961
2961
  });
2962
2962
 
2963
2963
  const program$a = getProgram();
2964
- const migrationsCommand = program$a.command("migrations").alias("mig").description(`Manage your space's migrations`).option("-s, --space <space>", "space ID").option("-p, --path <path>", "path to save the file. Default is .storyblok/migrations");
2964
+ const migrationsCommand = program$a.command(commands.MIGRATIONS).alias("mig").description(`Manage your space's migrations`).option("-s, --space <space>", "space ID").option("-p, --path <path>", "path to save the file. Default is .storyblok/migrations");
2965
2965
 
2966
2966
  const getMigrationTemplate = () => {
2967
2967
  return `export default function (block) {
@@ -2991,7 +2991,7 @@ const generateMigration = async (space, path, component, suffix) => {
2991
2991
 
2992
2992
  const program$9 = getProgram();
2993
2993
  migrationsCommand.command("generate [componentName]").description("Generate a migration file").option("--su, --suffix <suffix>", "suffix to add to the file name (e.g. {component-name}.<suffix>.js)").action(async (componentName, options) => {
2994
- konsola.title(` ${commands.MIGRATIONS} `, colorPalette.MIGRATIONS, componentName ? `Generating migration for component ${componentName}...` : "Generating migrations...");
2994
+ konsola.title(`${commands.MIGRATIONS}`, colorPalette.MIGRATIONS, componentName ? `Generating migration for component ${componentName}...` : "Generating migrations...");
2995
2995
  const verbose = program$9.opts().verbose;
2996
2996
  const { space, path } = migrationsCommand.opts();
2997
2997
  const { suffix } = options;
@@ -3410,7 +3410,7 @@ const isStoryWithUnpublishedChanges = (story) => {
3410
3410
 
3411
3411
  const program$8 = getProgram();
3412
3412
  migrationsCommand.command("run [componentName]").description("Run migrations").option("--fi, --filter <filter>", "glob filter to apply to the components before pushing").option("-d, --dry-run", "Preview changes without applying them to Storyblok").option("-q, --query <query>", 'Filter stories by content attributes using Storyblok filter query syntax. Example: --query="[highlighted][in]=true"').option("--starts-with <path>", 'Filter stories by path. Example: --starts-with="/en/blog/"').option("--publish <publish>", "Options for publication mode: all | published | published-with-changes").action(async (componentName, options) => {
3413
- konsola.title(` ${commands.MIGRATIONS} `, colorPalette.MIGRATIONS, componentName ? `Running migrations for component ${componentName}...` : "Running migrations...");
3413
+ konsola.title(`${commands.MIGRATIONS}`, colorPalette.MIGRATIONS, componentName ? `Running migrations for component ${componentName}...` : "Running migrations...");
3414
3414
  const verbose = program$8.opts().verbose;
3415
3415
  const { filter, dryRun = false, query, startsWith, publish } = options;
3416
3416
  const { space, path } = migrationsCommand.opts();
@@ -3567,7 +3567,7 @@ migrationsCommand.command("run [componentName]").description("Run migrations").o
3567
3567
 
3568
3568
  const program$7 = getProgram();
3569
3569
  migrationsCommand.command("rollback [migrationFile]").description("Rollback a migration").action(async (migrationFile) => {
3570
- konsola.title(` ${commands.MIGRATIONS} `, colorPalette.MIGRATIONS, `Rolling back migration ${chalk.hex(colorPalette.MIGRATIONS)(migrationFile)}...`);
3570
+ konsola.title(`${commands.MIGRATIONS}`, colorPalette.MIGRATIONS, `Rolling back migration ${chalk.hex(colorPalette.MIGRATIONS)(migrationFile)}...`);
3571
3571
  const verbose = program$7.opts().verbose;
3572
3572
  const { space, path } = migrationsCommand.opts();
3573
3573
  const { state, initializeSession } = session();
@@ -4309,7 +4309,7 @@ const generateStoryblokTypes = async (options = {}) => {
4309
4309
 
4310
4310
  const program$5 = getProgram();
4311
4311
  typesCommand.command("generate").description("Generate types d.ts for your component schemas").option("--sf, --separate-files", "").option("--strict", "strict mode, no loose typing").option("--type-prefix <prefix>", "prefix to be prepended to all generated component type names").option("--suffix <suffix>", "Components suffix").option("--custom-fields-parser <path>", "Path to the parser file for Custom Field Types").option("--compiler-options <options>", "path to the compiler options from json-schema-to-typescript").action(async (options) => {
4312
- konsola.title(` ${commands.TYPES} `, colorPalette.TYPES, "Generating types...");
4312
+ konsola.title(`${commands.TYPES}`, colorPalette.TYPES, "Generating types...");
4313
4313
  const verbose = program$5.opts().verbose;
4314
4314
  const { space, path } = typesCommand.opts();
4315
4315
  const spinner = new Spinner({
@@ -4351,11 +4351,11 @@ typesCommand.command("generate").description("Generate types d.ts for your compo
4351
4351
  });
4352
4352
 
4353
4353
  const program$4 = getProgram();
4354
- const datasourcesCommand = program$4.command("datasources").alias("ds").description(`Manage your space's datasources`).option("-s, --space <space>", "space ID").option("-p, --path <path>", "path to save the file. Default is .storyblok/datasources");
4354
+ const datasourcesCommand = program$4.command(commands.DATASOURCES).alias("ds").description(`Manage your space's datasources`).option("-s, --space <space>", "space ID").option("-p, --path <path>", "path to save the file. Default is .storyblok/datasources");
4355
4355
 
4356
4356
  const program$3 = getProgram();
4357
4357
  datasourcesCommand.command("pull [datasourceName]").option("-f, --filename <filename>", "custom name to be used in file(s) name instead of space id").option("--sf, --separate-files", "Argument to create a single file for each datasource").option("--su, --suffix <suffix>", "suffix to add to the file name (e.g. datasources.<suffix>.json)").description("Pull datasources from your space").action(async (datasourceName, options) => {
4358
- konsola.title(` ${commands.DATASOURCES} `, colorPalette.DATASOURCES, datasourceName ? `Pulling datasource ${datasourceName}...` : "Pulling datasources...");
4358
+ konsola.title(`${commands.DATASOURCES}`, colorPalette.DATASOURCES, datasourceName ? `Pulling datasource ${datasourceName}...` : "Pulling datasources...");
4359
4359
  const verbose = program$3.opts().verbose;
4360
4360
  const { space, path } = datasourcesCommand.opts();
4361
4361
  const { separateFiles, suffix, filename = "datasources" } = options;
@@ -4425,7 +4425,7 @@ datasourcesCommand.command("pull [datasourceName]").option("-f, --filename <file
4425
4425
 
4426
4426
  const program$2 = getProgram();
4427
4427
  datasourcesCommand.command("push [datasourceName]").description(`Push your space's datasources schema as json`).option("-f, --from <from>", "source space id").option("--fi, --filter <filter>", "glob filter to apply to the datasources before pushing").option("--sf, --separate-files", "Read from separate files instead of consolidated files").option("--su, --suffix <suffix>", "Suffix to add to the datasource name").action(async (datasourceName, options) => {
4428
- konsola.title(` ${commands.DATASOURCES} `, colorPalette.DATASOURCES, datasourceName ? `Pushing datasource ${datasourceName}...` : "Pushing datasources...");
4428
+ konsola.title(`${commands.DATASOURCES}`, colorPalette.DATASOURCES, datasourceName ? `Pushing datasource ${datasourceName}...` : "Pushing datasources...");
4429
4429
  const verbose = program$2.opts().verbose;
4430
4430
  const { space, path } = datasourcesCommand.opts();
4431
4431
  const { from, filter } = options;
@@ -4544,7 +4544,7 @@ async function deleteDatasource(space, id) {
4544
4544
 
4545
4545
  datasourcesCommand.command("delete [name]").description("Delete a datasource from your space by name or id").option("--id <id>", "Delete by datasource id instead of name").option("--force", "Skip confirmation prompt for deletion (useful for CI)").action(async (name, options) => {
4546
4546
  konsola.title(
4547
- ` ${commands.DATASOURCES} `,
4547
+ `${commands.DATASOURCES}`,
4548
4548
  colorPalette.DATASOURCES,
4549
4549
  options.id ? `Deleting datasource with id ${options.id}...` : `Deleting datasource with name ${name}...`
4550
4550
  );
@@ -4742,7 +4742,7 @@ const createSpace = async (space) => {
4742
4742
 
4743
4743
  const program$1 = getProgram();
4744
4744
  program$1.command(`${commands.CREATE} [project-path]`).alias("c").description(`Scaffold a new project using Storyblok`).option("-b, --blueprint <blueprint>", "technology starter blueprint").option("--skip-space", "skip space creation").action(async (projectPath, options) => {
4745
- konsola.title(` ${commands.CREATE} `, colorPalette.CREATE);
4745
+ konsola.title(`${commands.CREATE}`, colorPalette.CREATE);
4746
4746
  const verbose = program$1.opts().verbose;
4747
4747
  const { blueprint } = options;
4748
4748
  const { state, initializeSession } = session();
@@ -4872,7 +4872,7 @@ program$1.command(`${commands.CREATE} [project-path]`).alias("c").description(`S
4872
4872
  konsola.br();
4873
4873
  });
4874
4874
 
4875
- const version = "4.2.0";
4875
+ const version = "4.2.2";
4876
4876
  const pkg = {
4877
4877
  version: version};
4878
4878