Skip to content

Commit 6fc4298

Browse files
Joren BroekemaLarsDenBakker
Joren Broekema
authored andcommitted
fix(create): support number for optionsToCommand
1 parent b7ec0cd commit 6fc4298

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

packages/create/src/core.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ export function optionsToCommand(options, generatorName = '@open-wc') {
284284
let command = `npm init ${generatorName} `;
285285
Object.keys(options).forEach(key => {
286286
const value = options[key];
287-
if (typeof value === 'string') {
287+
if (typeof value === 'string' || typeof value === 'number') {
288288
command += `--${key} ${value} `;
289289
} else if (typeof value === 'boolean' && value === true) {
290290
command += `--${key} `;

packages/create/test/core.test.js

+7
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,13 @@ describe('optionsToCommand', () => {
255255
expect(optionsToCommand(options)).to.equal('npm init @open-wc --type scaffold ');
256256
});
257257

258+
it('supports numbers', async () => {
259+
const options = {
260+
version: 2,
261+
};
262+
expect(optionsToCommand(options)).to.equal('npm init @open-wc --version 2 ');
263+
});
264+
258265
it('supports boolean', async () => {
259266
const options = {
260267
writeToDisk: true,

0 commit comments

Comments
 (0)