Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ckeditor5-dev-env#upload may end with an error due to passing a number in a cell to cli-table #10861

Closed
pomek opened this issue Nov 18, 2021 · 1 comment · Fixed by ckeditor/ckeditor5-dev#732
Assignees
Labels
package:dev squad:devops Issue to be handled by the Devops team. type:bug This issue reports a buggy (incorrect) behavior.

Comments

@pomek
Copy link
Member

pomek commented Nov 18, 2021

📝 Provide detailed reproduction steps (if any)

When executing translations:upload, at the end of the task we display a summary with changes. Unfortunately, passing a number as an argument in table.push, ends with an error when calling table.toString().

const Table = require( 'cli-table' );

const table = new Table( {
			head: [ 'Package name', 'Added', 'Updated', 'Removed' ],
			style: { compact: true }
		} );

{
	changedItems: [
		[
			'ckeditor5-foo',
			{
				strings_added: 0,
				strings_updated: 1,
				strings_skipped: 0,
				strings_delete: 1,
				redirect: '/ckeditor-5-package-generator/ckeditor-5-package-generator/ckeditor5-foo/'
			}
		]
	]
}

table.push( [ packageName, response.strings_added, response.strings_updated, response.strings_delete ] );

✔️ Expected result

No error, just a table.

image

❌ Actual result

(node:61679) UnhandledPromiseRejectionWarning: TypeError: stripped.split is not a function
    at Object.exports.strlen (/Users/pomek/Projects/tmp/ckeditor5-foo/node_modules/cli-table/lib/utils.js:86:24)
    at get_width (/Users/pomek/Projects/tmp/ckeditor5-foo/node_modules/cli-table/lib/index.js:138:70)
    at /Users/pomek/Projects/tmp/ckeditor5-foo/node_modules/cli-table/lib/index.js:131:68
    at Array.forEach (<anonymous>)
    at extractColumnWidths (/Users/pomek/Projects/tmp/ckeditor5-foo/node_modules/cli-table/lib/index.js:130:9)
    at /Users/pomek/Projects/tmp/ckeditor5-foo/node_modules/cli-table/lib/index.js:104:11
    at Array.forEach (<anonymous>)
    at Table.toString (/Users/pomek/Projects/tmp/ckeditor5-foo/node_modules/cli-table/lib/index.js:101:16)
    at printSummary (/Users/pomek/Projects/tmp/ckeditor5-foo/node_modules/@ckeditor/ckeditor5-dev-env/lib/translations/upload.js:146:22)
    at /Users/pomek/Projects/tmp/ckeditor5-foo/node_modules/@ckeditor/ckeditor5-dev-env/lib/translations/upload.js:49:4

❓ Possible solution

Cast all data to string when adding new rows when using the cli-table package.

@pomek pomek added type:bug This issue reports a buggy (incorrect) behavior. squad:devops Issue to be handled by the Devops team. package:dev labels Nov 18, 2021
@pomek pomek self-assigned this Nov 18, 2021
@pomek pomek added this to the iteration 49 milestone Nov 18, 2021
@pomek
Copy link
Member Author

pomek commented Nov 18, 2021

Yhm. See: Automattic/cli-table#152.

pomek added a commit to ckeditor/ckeditor5-dev that referenced this issue Nov 18, 2021
Fix (env): All numbers returned by the Transifex service will be cast to strings due to an error in the `cli-package`. See: Automattic/cli-table#152. Closes ckeditor/ckeditor5#10861.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:dev squad:devops Issue to be handled by the Devops team. type:bug This issue reports a buggy (incorrect) behavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant