Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.

Commit 0184ff0

Browse files
author
Chris McConnell
authored
Hash line ending agnostic and import exclusion bug (#1095)
* Make hashing line ending agnostic. Fix bug where imports were not excluded properly. Added obj to exclusions. * Add missing wildcard. Co-authored-by: Chris McConnell <chrimc>
1 parent 7decc06 commit 0184ff0

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

packages/dialog/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ _See code: [src/commands/dialog/index.ts](https://github.com/microsoft/botframew
3636

3737
## `bf dialog:merge PATTERNS`
3838

39-
Merge `<kind>.schema` and `<kind>[.<locale>].uischema` definitions from a project and its dependencies into a single .schema for describing .dialog files and a per locale .uischema for describing how Composer shows them. If a dependent package has an "exported" directory it is copied to /<package> in the --imports directory.
39+
Merge `<kind>.schema` and `<kind>[.<locale>].uischema` definitions from a project and its dependencies into a single .schema for describing .dialog files and a per locale .uischema for describing how Composer shows them. If a dependent package has an "exported" directory it is copied to /<package> in the --imports directory. You can make use of negative patterns like !**/generated/** to exclude particular directories or files, although some directories like bin, obj and node_modules are automatically excluded.
4040

4141
```
4242
USAGE

packages/dialog/src/commands/dialog/merge.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { Command, flags } from '@microsoft/bf-cli-command'
77
import { SchemaMerger } from '../../library/schemaMerger'
88

99
export default class DialogMerge extends Command {
10-
static description = 'Merge `<kind>.schema` and `<kind>[.<locale>].uischema` definitions from a project and its dependencies into a single .schema for describing .dialog files and a per locale .uischema for describing how Composer shows them. If a dependent package has an "exported" directory it is copied to /<package> in the --imports directory.'
10+
static description = 'Merge `<kind>.schema` and `<kind>[.<locale>].uischema` definitions from a project and its dependencies into a single .schema for describing .dialog files and a per locale .uischema for describing how Composer shows them. If a dependent package has an "exported" directory it is copied to /<package> in the --imports directory. You can make use of negative patterns like !**/generated/** to exclude particular directories or files, although some directories like bin, obj and node_modules are automatically excluded.'
1111

1212
static args = [
1313
{ name: 'patterns', required: true, description: 'Any number of glob regex patterns to match .csproj, .nuspec or package.json files.' },

packages/dialog/src/library/hash.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ import * as os from 'os'
99
import * as ppath from 'path'
1010

1111
export function computeHash(val: string): string {
12-
return crypto.createHash('md5').update(val).digest('hex')
12+
// We write out OS.EOL, but want hash independent of endings
13+
return crypto.createHash('md5').update(val.replace(/\r/, '')).digest('hex')
1314
}
1415

1516
// Normalize to OS line endings

packages/dialog/src/library/schemaMerger.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,9 @@ class ComponentNode {
153153
patterns.push(`!${ppath.join(root, 'node_modules', '**')}`)
154154
} else if (this.metadata.path.endsWith('.csproj')) {
155155
patterns.push(`!${ppath.join(root, 'bin', '**')}`)
156+
patterns.push(`!${ppath.join(root, 'obj', '**')}`)
156157
}
157-
patterns.push(`!${imports}`)
158+
patterns.push(`!${ppath.join(ppath.resolve(imports), '**')}`)
158159
patterns.push(`!${ppath.join(root, 'test', '**')}`)
159160
patterns.push(`!${ppath.join(root, 'tests', '**')}`)
160161
patterns = [...patterns, ...negativePatterns]

0 commit comments

Comments
 (0)