contensis-cli 1.1.2-beta.10 → 1.1.2-beta.12

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/version.js CHANGED
@@ -21,7 +21,7 @@ __export(version_exports, {
21
21
  LIB_VERSION: () => LIB_VERSION
22
22
  });
23
23
  module.exports = __toCommonJS(version_exports);
24
- const LIB_VERSION = "1.1.2-beta.10";
24
+ const LIB_VERSION = "1.1.2-beta.12";
25
25
  // Annotate the CommonJS export names for ESM import in node:
26
26
  0 && (module.exports = {
27
27
  LIB_VERSION
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/version.ts"],
4
- "sourcesContent": ["export const LIB_VERSION = \"1.1.2-beta.10\";\n"],
4
+ "sourcesContent": ["export const LIB_VERSION = \"1.1.2-beta.12\";\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,cAAc;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contensis-cli",
3
- "version": "1.1.2-beta.10",
3
+ "version": "1.1.2-beta.12",
4
4
  "description": "A fully featured Contensis command line interface with a shell UI provides simple and intuitive ways to manage or profile your content in any NodeJS terminal.",
5
5
  "repository": "https://github.com/contensis/cli",
6
6
  "homepage": "https://github.com/contensis/cli/tree/main/packages/contensis-cli#readme",
@@ -18,7 +18,7 @@ export const makeCreateCommand = () => {
18
18
  .argument('<name>', 'the name of the project to create')
19
19
  .argument('[description]', 'optional description of the project')
20
20
  .option(
21
- '-l --language',
21
+ '-l --language <language>',
22
22
  'the default language of the project to create',
23
23
  'en-GB'
24
24
  )
@@ -183,9 +183,9 @@ export const LogMessages = {
183
183
  removed: (env: string, id: string, commit: boolean) =>
184
184
  `[${env}] ${
185
185
  commit ? `Deleted` : `Will delete`
186
- } content type ${Logger.highlightText(id)}`,
186
+ } content type(s) ${Logger.highlightText(id)}`,
187
187
  failedRemove: (env: string, id: string) =>
188
- `[${env}] Unable to delete content type ${Logger.highlightText(id)}`,
188
+ `[${env}] Unable to delete content type(s) ${Logger.highlightText(id)}`,
189
189
  },
190
190
  components: {
191
191
  list: (projectId: string) =>
@@ -199,9 +199,9 @@ export const LogMessages = {
199
199
  removed: (env: string, id: string, commit: boolean) =>
200
200
  `[${env}] ${
201
201
  commit ? `Deleted` : `Will delete`
202
- } component ${Logger.highlightText(id)}`,
202
+ } component(s) ${Logger.highlightText(id)}`,
203
203
  failedRemove: (env: string, id: string) =>
204
- `[${env}] Unable to delete component ${Logger.highlightText(id)}`,
204
+ `[${env}] Unable to delete component(s) ${Logger.highlightText(id)}`,
205
205
  },
206
206
  version: {
207
207
  set: (env: string, versionStatus: string) =>
@@ -1406,7 +1406,7 @@ class ContensisCli {
1406
1406
  log.error(
1407
1407
  messages.contenttypes.failedRemove(
1408
1408
  currentProject,
1409
- contentTypeIds.join('", "')
1409
+ contentTypeIds.join(', ')
1410
1410
  ),
1411
1411
  err
1412
1412
  );
@@ -1414,14 +1414,12 @@ class ContensisCli {
1414
1414
  log.success(
1415
1415
  messages.contenttypes.removed(
1416
1416
  currentProject,
1417
- contentTypeIds.join('", "'),
1417
+ contentTypeIds.join(', '),
1418
1418
  !contensis.isPreview
1419
1419
  )
1420
1420
  );
1421
1421
  // print the results to console
1422
- await this.HandleFormattingAndOutput(result, () =>
1423
- log.object(jsonFormatter(result))
1424
- );
1422
+ await this.HandleFormattingAndOutput(result, log.object);
1425
1423
  }
1426
1424
  }
1427
1425
  };
@@ -1452,28 +1450,37 @@ class ContensisCli {
1452
1450
  });
1453
1451
 
1454
1452
  if (contensis) {
1455
- // Pass each content type to the target repo
1456
- for (const contentType of fileData) {
1457
- // Fix invalid data
1458
- contentType.projectId = currentProject;
1459
- delete contentType.uuid;
1460
-
1461
- const [err, created, createStatus] = await contensis.models.targetRepos[
1462
- currentProject
1463
- ].repo.UpsertContentType(false, contentType);
1464
-
1465
- if (err) log.error(err.message, err);
1466
- if (createStatus) {
1467
- log.success(
1468
- messages.contenttypes.created(
1469
- currentProject,
1470
- contentType.id,
1471
- createStatus
1472
- )
1473
- );
1474
- // print the content type to console
1475
- await this.HandleFormattingAndOutput(contentType, () => {});
1453
+ if (fromFile)
1454
+ // Pass each content type to the target repo
1455
+ for (const contentType of fileData) {
1456
+ // Fix invalid data
1457
+ contentType.projectId = currentProject;
1458
+ delete contentType.uuid;
1459
+
1460
+ const [err, created, createStatus] =
1461
+ await contensis.models.targetRepos[
1462
+ currentProject
1463
+ ].repo.UpsertContentType(false, contentType);
1464
+
1465
+ if (err) log.error(err.message, err);
1466
+ if (createStatus) {
1467
+ log.success(
1468
+ messages.contenttypes.created(
1469
+ currentProject,
1470
+ contentType.id,
1471
+ createStatus
1472
+ )
1473
+ );
1474
+ // print the content type to console
1475
+ await this.HandleFormattingAndOutput(contentType, () => {});
1476
+ }
1476
1477
  }
1478
+ else {
1479
+ const result = await contensis.simpleMigration.Migrate(
1480
+ contentTypeIds,
1481
+ []
1482
+ );
1483
+ await this.HandleFormattingAndOutput(result, log.object);
1477
1484
  }
1478
1485
  }
1479
1486
  };
@@ -1590,7 +1597,7 @@ class ContensisCli {
1590
1597
  log.error(
1591
1598
  messages.components.failedRemove(
1592
1599
  currentProject,
1593
- componentIds.join('", "')
1600
+ componentIds.join(', ')
1594
1601
  ),
1595
1602
  err
1596
1603
  );
@@ -1598,14 +1605,12 @@ class ContensisCli {
1598
1605
  log.success(
1599
1606
  messages.components.removed(
1600
1607
  currentProject,
1601
- componentIds.join('", "'),
1608
+ componentIds.join(', '),
1602
1609
  !contensis.isPreview
1603
1610
  )
1604
1611
  );
1605
1612
  // print the results to console
1606
- await this.HandleFormattingAndOutput(result, () =>
1607
- log.info(jsonFormatter(result))
1608
- );
1613
+ await this.HandleFormattingAndOutput(result, log.object);
1609
1614
  }
1610
1615
  }
1611
1616
  };
@@ -1637,27 +1642,36 @@ class ContensisCli {
1637
1642
 
1638
1643
  if (contensis) {
1639
1644
  // Pass each component to the target repo
1640
- for (const component of fileData) {
1641
- // Fix invalid data
1642
- component.projectId = currentProject;
1643
- delete component.uuid;
1644
-
1645
- const [err, created, createStatus] = await contensis.models.targetRepos[
1646
- currentProject
1647
- ].repo.UpsertComponent(false, component);
1648
-
1649
- if (err) log.error(err.message, err);
1650
- if (createStatus) {
1651
- log.success(
1652
- messages.components.created(
1653
- currentProject,
1654
- component.id,
1655
- createStatus
1656
- )
1657
- );
1658
- // print the component to console
1659
- await this.HandleFormattingAndOutput(component, () => {});
1645
+ if (fromFile)
1646
+ for (const component of fileData) {
1647
+ // Fix invalid data
1648
+ component.projectId = currentProject;
1649
+ delete component.uuid;
1650
+
1651
+ const [err, created, createStatus] =
1652
+ await contensis.models.targetRepos[
1653
+ currentProject
1654
+ ].repo.UpsertComponent(false, component);
1655
+
1656
+ if (err) log.error(err.message, err);
1657
+ if (createStatus) {
1658
+ log.success(
1659
+ messages.components.created(
1660
+ currentProject,
1661
+ component.id,
1662
+ createStatus
1663
+ )
1664
+ );
1665
+ // print the component to console
1666
+ await this.HandleFormattingAndOutput(component, () => {});
1667
+ }
1660
1668
  }
1669
+ else {
1670
+ const result = await contensis.simpleMigration.Migrate(
1671
+ [],
1672
+ componentIds
1673
+ );
1674
+ await this.HandleFormattingAndOutput(result, log.object);
1661
1675
  }
1662
1676
  }
1663
1677
  };
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const LIB_VERSION = "1.1.2-beta.10";
1
+ export const LIB_VERSION = "1.1.2-beta.12";