From 65f0435bfe0c21741db6c9f52a65e27f9103c5a8 Mon Sep 17 00:00:00 2001 From: Daniel Estoll Date: Mon, 16 Jun 2025 11:05:56 -0600 Subject: [PATCH 1/6] Changed command structure to fix windows glide bug --- src/deployables.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/deployables.ts b/src/deployables.ts index a4b72b5..8fcf895 100644 --- a/src/deployables.ts +++ b/src/deployables.ts @@ -176,20 +176,23 @@ export const getAllDeployableFilesWindows = ({ .map((f) => (f.includes('.') ? f : `*.${f}`)) .join(' ') : '*'; - const excludePattern = excludeDirs.length > 0 ? excludeDirs.join('|') : ''; + const excludePattern = excludeDirs.length > 0 + ? excludeDirs + .map((f) => `\\${f}`) + .join(' ') : ''; const pattern = typeNames.length > 0 - ? typeNames.map((name) => `polyConfig: ${name}`).join('|') + ? typeNames.map((name) => `\\`).join(' ') : 'polyConfig'; const excludeCommand = excludePattern - ? ` | findstr /V /I "${excludePattern}"` + ? ` | findstr /V /I "${excludePattern}”` : ''; - const searchCommand = ` | findstr /M /I /F:/ /C:"${pattern}"`; + const searchCommand = ` | findstr /M /I /F:/ ${pattern}`; let result: string[] = []; for (const dir of includeDirs) { - const dirCommand = `dir /S /P /B ${includePattern} ${dir}`; + const dirCommand = `dir ${includePattern} /S /P /B`; const fullCommand = `${dirCommand}${excludeCommand}${searchCommand}`; try { const output = shell.exec(fullCommand).toString('utf8'); From 9217f4b3c4c633d2186be574dbb69f29aa4f2ed8 Mon Sep 17 00:00:00 2001 From: Daniel Estoll Date: Mon, 16 Jun 2025 11:41:07 -0600 Subject: [PATCH 2/6] Added comment to explain strange syntax --- src/deployables.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/deployables.ts b/src/deployables.ts index 8fcf895..38e76b6 100644 --- a/src/deployables.ts +++ b/src/deployables.ts @@ -185,6 +185,8 @@ export const getAllDeployableFilesWindows = ({ ? typeNames.map((name) => `\\`).join(' ') : 'polyConfig'; + // Using two regular quotes or two smart quotes throws "The syntax of the command is incorrect". + // For some reason this configuration works. const excludeCommand = excludePattern ? ` | findstr /V /I "${excludePattern}”` : ''; From c7c1c521a7c5a7ccfd23cdb844bd3aca1c1de1de Mon Sep 17 00:00:00 2001 From: Daniel Estoll Date: Mon, 16 Jun 2025 12:17:20 -0600 Subject: [PATCH 3/6] Allowed directories to be specified in the command --- src/deployables.ts | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/deployables.ts b/src/deployables.ts index 38e76b6..ad16a32 100644 --- a/src/deployables.ts +++ b/src/deployables.ts @@ -170,12 +170,6 @@ export const getAllDeployableFilesWindows = ({ excludeDirs, }: PolyDeployConfig): string[] => { // To get the equivalent of grep in Windows we use a combination of `dir` and `findstr` - const includePattern = - includeFilesOrExtensions.length > 0 - ? includeFilesOrExtensions - .map((f) => (f.includes('.') ? f : `*.${f}`)) - .join(' ') - : '*'; const excludePattern = excludeDirs.length > 0 ? excludeDirs .map((f) => `\\${f}`) @@ -194,6 +188,14 @@ export const getAllDeployableFilesWindows = ({ let result: string[] = []; for (const dir of includeDirs) { + const includePattern = + dir === '.' + ? includeFilesOrExtensions + .map((f) => (f.includes('.') ? f : `*.${f}`)) + .join(' ') + : includeFilesOrExtensions + .map((f) => (f.includes('.') ? f : `${dir}*.${f}`)) + .join(' '); const dirCommand = `dir ${includePattern} /S /P /B`; const fullCommand = `${dirCommand}${excludeCommand}${searchCommand}`; try { @@ -235,13 +237,13 @@ export const getAllDeployableFilesLinux = ({ export const getAllDeployableFiles = ( config: Partial = {}, ): string[] => { - config.typeNames = config.typeNames = DeployableTypeEntries.map((p) => p[0]); - config.includeDirs = config.includeDirs = ['.']; - config.includeFilesOrExtensions = config.includeFilesOrExtensions = [ + config.typeNames = config.typeNames || DeployableTypeEntries.map((p) => p[0]); + config.includeDirs = config.includeDirs || ['.']; + config.includeFilesOrExtensions = config.includeFilesOrExtensions || [ 'ts', 'js', ]; - config.excludeDirs = config.excludeDirs = [ + config.excludeDirs = config.excludeDirs || [ 'node_modules', 'dist', 'build', From 2b42d6aea0448c91bebe82c5c3c3d7563f8f869d Mon Sep 17 00:00:00 2001 From: Daniel Estoll Date: Mon, 16 Jun 2025 12:41:36 -0600 Subject: [PATCH 4/6] Updated excludeCommand quotations and comment --- src/deployables.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/deployables.ts b/src/deployables.ts index ad16a32..419cfa1 100644 --- a/src/deployables.ts +++ b/src/deployables.ts @@ -180,9 +180,9 @@ export const getAllDeployableFilesWindows = ({ : 'polyConfig'; // Using two regular quotes or two smart quotes throws "The syntax of the command is incorrect". - // For some reason this configuration works. + // 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}`; From 2562716750f32852d928c4a26fab80802e1063c6 Mon Sep 17 00:00:00 2001 From: Daniel Estoll Date: Mon, 16 Jun 2025 12:49:41 -0600 Subject: [PATCH 5/6] Updated version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ed47453..537f65d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "polyapi", - "version": "0.23.24", + "version": "0.23.26", "description": "Poly is a CLI tool to help create and manage your Poly definitions.", "license": "MIT", "repository": { From 351c826091750f6c9fcdc63401462ae0b601d170 Mon Sep 17 00:00:00 2001 From: Daniel Estoll Date: Mon, 16 Jun 2025 12:54:04 -0600 Subject: [PATCH 6/6] Added package-lock.json --- package-lock.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index d1a76da..e48cb08 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "polyapi", - "version": "0.23.24", + "version": "0.23.26", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "polyapi", - "version": "0.23.24", + "version": "0.23.26", "license": "MIT", "dependencies": { "@guanghechen/helper-string": "4.7.1",