Skip to content

Commit af440e0

Browse files
Windows glide duplicate deployables fix (#22)
* Changed windows command for finding deployables to ensure that the same file is not found multiple times * Added replace to remove file paths in glide prepare * version * version
1 parent c618ecc commit af440e0

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
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.6",
3+
"version": "0.24.7",
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: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,16 @@ export const prepareDeployables = async (
162162
);
163163
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', '');
165167
for (const deployable of dirtyDeployables) {
166168
try{
167-
if (staged.includes(deployable.file)) {
168-
shell.echo(`Staging ${deployable.file}`);
169-
shell.exec(`git add ${deployable.file}`);
169+
const deployableName = deployable.file.replace(`${rootPath}/`, '');
170+
if (staged.includes(deployableName)) {
171+
shell.echo(`Staging ${deployableName}`);
172+
shell.exec(`git add ${deployableName}`);
170173
}
171-
}
174+
}
172175
catch (error) {
173176
console.warn(error);
174177
}

src/deployables.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ export const getAllDeployableFilesWindows = ({
183183
const excludeCommand = excludePattern
184184
? ` | findstr /V /I "${excludePattern}"`
185185
: '';
186-
const searchCommand = ` | findstr /M /I /S /F:/ ${pattern} *.*`;
186+
const searchCommand = ` | findstr /M /I /F:/ ${pattern}`;
187187

188188
let result: string[] = [];
189189
for (const dir of includeDirs) {
@@ -195,7 +195,7 @@ export const getAllDeployableFilesWindows = ({
195195
: includeFilesOrExtensions
196196
.map((f) => (f.includes('.') ? f : `${dir}*.${f}`))
197197
.join(' ');
198-
const dirCommand = `dir ${includePattern} /S /P /B > NUL`;
198+
const dirCommand = `dir ${includePattern} /S /P /B `;
199199
const fullCommand = `${dirCommand}${excludeCommand}${searchCommand}`;
200200
try {
201201
const output = shell.exec(fullCommand, {silent:true}).toString('utf8');

0 commit comments

Comments
 (0)