@celonis/content-cli 1.6.0 → 1.7.0

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/README.md CHANGED
@@ -9,10 +9,11 @@ teams and execute commands in a profile's context.
9
9
 
10
10
  1. [Getting Started](#getting-started)
11
11
  2. [About the Project](#about-the-project)
12
- 3. [Building the Project](#building-the-project)
13
- 4. [Release Process](#release-process)
14
- 5. [Contributing](#contributing)
15
- 6. [License](#license)
12
+ 3. [Building the Project](#building-and-using-the-project-locally)
13
+ 4. [Troubleshooting](#troubleshooting)
14
+ 5. [Release Process](#release-process)
15
+ 6. [Contributing](#contributing)
16
+ 7. [License](#license)
16
17
 
17
18
  ## Getting Started
18
19
 
@@ -85,16 +86,65 @@ content-cli pull package -h
85
86
  ## Building and Using the Project locally
86
87
 
87
88
  This tool is tightly connected with the Celonis Platform and all capabilities require to have access to a Celonis Platform Team.
88
- After cloning the project, the next step is to install the project dependencies. We use `yarn` as our package manager,
89
- so running `yarn install` on the project root folder should install all the necessary dependencies. After installing
90
- the project dependencies, you can run `yarn build` to build the project artifact. To use the built artifact, you can
91
- run `node content-cli.js` in the generated `dist` folder.
92
-
93
- If we want to use a specific local build of the tool globally, we can do this by:
94
- - Move to the root directory of the project.
95
- - Execute `cd dist`, to move to the `dist` directory.
96
- - Execute the `npm link` command.
97
- This will create a symbolic link in the global `node_modules` directory, allowing you to run the CLI from anywhere on your machine.
89
+
90
+ ### Prerequisites
91
+
92
+ - **Node.js** `>=18.20.5` (LTS recommended). Check with `node -v`.
93
+ - **yarn** package manager. Install with `npm install -g yarn` if not already available.
94
+
95
+ ### Build steps
96
+
97
+ ```bash
98
+ git clone https://github.com/celonis/content-cli.git
99
+ cd content-cli
100
+ yarn install
101
+ yarn build
102
+ ```
103
+
104
+ The build compiles TypeScript into the `dist/` folder and copies `package.json` there.
105
+
106
+ ### Running the built CLI
107
+
108
+ You can run the built artifact directly from the `dist` folder:
109
+
110
+ ```bash
111
+ node dist/content-cli.js -h
112
+ ```
113
+
114
+ ### Installing the local build globally
115
+
116
+ To use your local build as the global `content-cli` command:
117
+
118
+ ```bash
119
+ cd dist
120
+ npm link
121
+ ```
122
+
123
+ This creates a symbolic link in the global `node_modules` directory, allowing you to run `content-cli` from anywhere on your machine. To unlink later, run `npm unlink -g @celonis/content-cli`.
124
+
125
+ ## Troubleshooting
126
+
127
+ ### `Error: Cannot find module '...'`
128
+
129
+ If you see a `Cannot find module` error when running `content-cli`, dependencies may not be installed correctly:
130
+
131
+ - **Global install:** Try updating to the latest version: `npm install -g @celonis/content-cli@latest`.
132
+ - **Local development:** Run `yarn install` from the project root before building.
133
+
134
+ ### `content-cli: command not found`
135
+
136
+ - Ensure Node.js is installed and on your `PATH` (`node -v`).
137
+ - If installed via `npm install -g`, check that npm's global `bin` directory is in your `PATH`. You can find it with `npm bin -g`.
138
+ - If using `npm link`, make sure you ran it from the `dist/` directory (not the project root).
139
+
140
+ ### Node.js version errors
141
+
142
+ Content CLI requires Node.js `>=18.20.5`. If you see compatibility errors, upgrade your Node.js installation. We recommend using [nvm](https://github.com/nvm-sh/nvm) to manage Node.js versions:
143
+
144
+ ```bash
145
+ nvm install --lts
146
+ nvm use --lts
147
+ ```
98
148
 
99
149
  ## Release Process
100
150
 
@@ -141,7 +141,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
141
141
  const variablesManifests = this.parseEntryData(configs, batch_export_import_constants_1.BatchExportImportConstants.VARIABLES_FILE_NAME);
142
142
  configs = yield this.studioService.mapSpaces(configs, studioManifests);
143
143
  const existingStudioPackages = yield this.studioPackageApi.findAllPackages();
144
- const formData = this.buildBodyForImport(configs, variablesManifests);
144
+ const formData = this.buildBodyForImport(configs, sourceToBeImported, variablesManifests);
145
145
  const postPackageImportData = yield this.batchImportExportApi.importPackages(formData, overwrite);
146
146
  yield this.studioService.processImportedPackages(configs, existingStudioPackages, studioManifests);
147
147
  if (gitBranch) {
@@ -196,8 +196,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
196
196
  file_service_1.fileService.writeToFileWithGivenName(JSON.stringify(packagesMetadata), filename);
197
197
  logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + filename);
198
198
  }
199
- buildBodyForImport(configs, variablesManifests) {
199
+ buildBodyForImport(configs, sourcePath, variablesManifests) {
200
200
  const formData = new FormData();
201
+ this.assertUncompressedSizeWithinLimit(configs, sourcePath);
201
202
  const readableStream = this.getReadableStream(configs);
202
203
  formData.append("file", readableStream, { filename: "configs.zip" });
203
204
  if (variablesManifests) {
@@ -207,6 +208,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
207
208
  }
208
209
  return formData;
209
210
  }
211
+ assertUncompressedSizeWithinLimit(configs, sourcePath) {
212
+ const MAX_ZIP_SIZE = 4 * 1024 * 1024 * 1024;
213
+ const totalUncompressedBytes = configs.getEntries().reduce((sum, entry) => sum + entry.header.size, 0);
214
+ if (totalUncompressedBytes > MAX_ZIP_SIZE) {
215
+ throw new Error(`Failed to handle zip file "${sourcePath}": uncompressed size ${(totalUncompressedBytes / (Math.pow(1024, 3))).toFixed(2)} GB exceeds the 4 GB limit.`);
216
+ }
217
+ }
210
218
  getReadableStream(configs) {
211
219
  return new stream_1.Readable({
212
220
  read() {
@@ -18,6 +18,7 @@ export declare class BatchImportExportService {
18
18
  private getVersionedVariablesForPackagesWithKeys;
19
19
  private exportListOfPackagesMetadata;
20
20
  private buildBodyForImport;
21
+ private assertUncompressedSizeWithinLimit;
21
22
  private getReadableStream;
22
23
  private parseEntryData;
23
24
  private downloadZip;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celonis/content-cli",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "description": "CLI Tool to help manage content in Celonis Platform",
5
5
  "main": "content-cli.js",
6
6
  "bin": {
@@ -19,6 +19,7 @@
19
19
  },
20
20
  "dependencies": {
21
21
  "adm-zip": "0.5.14",
22
+ "chalk": "4.1.2",
22
23
  "uuid": "9.0.1",
23
24
  "axios": "1.13.5",
24
25
  "commander": "13.1.0",