diff --git a/package-lock.json b/package-lock.json index ee29292..169f182 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "polyapi", - "version": "0.24.0", + "version": "0.24.4", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "polyapi", - "version": "0.24.0", + "version": "0.24.4", "license": "MIT", "dependencies": { "@guanghechen/helper-string": "4.7.1", diff --git a/package.json b/package.json index 6981f9b..3cc327b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "polyapi", - "version": "0.24.3", + "version": "0.24.4", "description": "Poly is a CLI tool to help create and manage your Poly definitions.", "license": "MIT", "repository": { diff --git a/src/commands/prepare.ts b/src/commands/prepare.ts index f71e840..0b5db55 100644 --- a/src/commands/prepare.ts +++ b/src/commands/prepare.ts @@ -160,16 +160,13 @@ export const prepareDeployables = async ( writeUpdatedDeployable(deployable, disableDocs), ), ); - const staged = shell.exec('git diff --name-only --cached') + const staged = shell.exec('git diff --name-only --cached', {silent:true}) .toString().split('\n').filter(Boolean); - const rootPath: string = shell.exec('git rev-parse --show-toplevel', {silent:true}) - .toString('utf8').replace('\n', ''); for (const deployable of dirtyDeployables) { try{ - const deployableName = deployable.file.replace(`${rootPath}/`, ''); - if (staged.includes(deployableName)) { - shell.echo(`Staging ${deployableName}`); - shell.exec(`git add ${deployableName}`); + if (staged.includes(deployable.file)) { + shell.echo(`Staging ${deployable.file}`); + shell.exec(`git add ${deployable.file}`); } } catch (error) { diff --git a/src/deployables.ts b/src/deployables.ts index b6ffed5..bbb3698 100644 --- a/src/deployables.ts +++ b/src/deployables.ts @@ -177,15 +177,13 @@ export const getAllDeployableFilesWindows = ({ .join(' ') : ''; const pattern = typeNames.length > 0 - ? typeNames.map((name) => `\\`).join(' ') - : 'polyConfig'; + ? typeNames.map((name) => `/C:"polyConfig: ${name}"`).join(' ') + : 'C/:"polyConfig"'; - // Using two regular quotes or two smart quotes throws "The syntax of the command is incorrect". - // For some reason, starting with a regular quote and leaving the end without a quote works. const excludeCommand = excludePattern - ? ` | findstr /V /I "${excludePattern}` + ? ` | findstr /V /I "${excludePattern}"` : ''; - const searchCommand = ` | findstr /M /I /F:/ ${pattern}`; + const searchCommand = ` | findstr /M /I /S /F:/ ${pattern} *.*`; let result: string[] = []; for (const dir of includeDirs) { @@ -197,10 +195,10 @@ export const getAllDeployableFilesWindows = ({ : includeFilesOrExtensions .map((f) => (f.includes('.') ? f : `${dir}*.${f}`)) .join(' '); - const dirCommand = `dir ${includePattern} /S /P /B`; + const dirCommand = `dir ${includePattern} /S /P /B > NUL`; const fullCommand = `${dirCommand}${excludeCommand}${searchCommand}`; try { - const output = shell.exec(fullCommand).toString('utf8'); + const output = shell.exec(fullCommand, {silent:true}).toString('utf8'); result = result.concat(output.split(/\r?\n/).filter(Boolean)); } catch {} }