Skip to content

Commit 20bba63

Browse files
4504 p3 glide bug npx poly prepare does not find any deployables in windows (#21)
* Changed command structure to fix windows glide bug * Added comment to explain strange syntax * Allowed directories to be specified in the command * Updated excludeCommand quotations and comment * Updated version * Added package-lock.json * Fixed config name TypeError * Revert "Fixed config name TypeError" This reverts commit 7b32086. * Fixed windows find deployables command to ignore files without polyConfig
1 parent d166c4b commit 20bba63

File tree

4 files changed

+13
-18
lines changed

4 files changed

+13
-18
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "polyapi",
3-
"version": "0.24.3",
3+
"version": "0.24.4",
44
"description": "Poly is a CLI tool to help create and manage your Poly definitions.",
55
"license": "MIT",
66
"repository": {

src/commands/prepare.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -160,16 +160,13 @@ export const prepareDeployables = async (
160160
writeUpdatedDeployable(deployable, disableDocs),
161161
),
162162
);
163-
const staged = shell.exec('git diff --name-only --cached')
163+
const staged = shell.exec('git diff --name-only --cached', {silent:true})
164164
.toString().split('\n').filter(Boolean);
165-
const rootPath: string = shell.exec('git rev-parse --show-toplevel', {silent:true})
166-
.toString('utf8').replace('\n', '');
167165
for (const deployable of dirtyDeployables) {
168166
try{
169-
const deployableName = deployable.file.replace(`${rootPath}/`, '');
170-
if (staged.includes(deployableName)) {
171-
shell.echo(`Staging ${deployableName}`);
172-
shell.exec(`git add ${deployableName}`);
167+
if (staged.includes(deployable.file)) {
168+
shell.echo(`Staging ${deployable.file}`);
169+
shell.exec(`git add ${deployable.file}`);
173170
}
174171
}
175172
catch (error) {

src/deployables.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -177,15 +177,13 @@ export const getAllDeployableFilesWindows = ({
177177
.join(' ') : '';
178178
const pattern =
179179
typeNames.length > 0
180-
? typeNames.map((name) => `\\<polyConfig: ${name}\\>`).join(' ')
181-
: 'polyConfig';
180+
? typeNames.map((name) => `/C:"polyConfig: ${name}"`).join(' ')
181+
: 'C/:"polyConfig"';
182182

183-
// Using two regular quotes or two smart quotes throws "The syntax of the command is incorrect".
184-
// For some reason, starting with a regular quote and leaving the end without a quote works.
185183
const excludeCommand = excludePattern
186-
? ` | findstr /V /I "${excludePattern}`
184+
? ` | findstr /V /I "${excludePattern}"`
187185
: '';
188-
const searchCommand = ` | findstr /M /I /F:/ ${pattern}`;
186+
const searchCommand = ` | findstr /M /I /S /F:/ ${pattern} *.*`;
189187

190188
let result: string[] = [];
191189
for (const dir of includeDirs) {
@@ -197,10 +195,10 @@ export const getAllDeployableFilesWindows = ({
197195
: includeFilesOrExtensions
198196
.map((f) => (f.includes('.') ? f : `${dir}*.${f}`))
199197
.join(' ');
200-
const dirCommand = `dir ${includePattern} /S /P /B`;
198+
const dirCommand = `dir ${includePattern} /S /P /B > NUL`;
201199
const fullCommand = `${dirCommand}${excludeCommand}${searchCommand}`;
202200
try {
203-
const output = shell.exec(fullCommand).toString('utf8');
201+
const output = shell.exec(fullCommand, {silent:true}).toString('utf8');
204202
result = result.concat(output.split(/\r?\n/).filter(Boolean));
205203
} catch {}
206204
}

0 commit comments

Comments
 (0)