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>
This commit is contained in:
Chris McConnell 2021-01-25 15:56:10 -08:00 коммит произвёл GitHub
Родитель 7decc068f8
Коммит 0184ff09c5
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 6 добавлений и 4 удалений

Просмотреть файл

@ -36,7 +36,7 @@ _See code: [src/commands/dialog/index.ts](https://github.com/microsoft/botframew
## `bf dialog:merge PATTERNS`
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.
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.
```
USAGE

Просмотреть файл

@ -7,7 +7,7 @@ import { Command, flags } from '@microsoft/bf-cli-command'
import { SchemaMerger } from '../../library/schemaMerger'
export default class DialogMerge extends Command {
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.'
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.'
static args = [
{ name: 'patterns', required: true, description: 'Any number of glob regex patterns to match .csproj, .nuspec or package.json files.' },

Просмотреть файл

@ -9,7 +9,8 @@ import * as os from 'os'
import * as ppath from 'path'
export function computeHash(val: string): string {
return crypto.createHash('md5').update(val).digest('hex')
// We write out OS.EOL, but want hash independent of endings
return crypto.createHash('md5').update(val.replace(/\r/, '')).digest('hex')
}
// Normalize to OS line endings

Просмотреть файл

@ -153,8 +153,9 @@ class ComponentNode {
patterns.push(`!${ppath.join(root, 'node_modules', '**')}`)
} else if (this.metadata.path.endsWith('.csproj')) {
patterns.push(`!${ppath.join(root, 'bin', '**')}`)
patterns.push(`!${ppath.join(root, 'obj', '**')}`)
}
patterns.push(`!${imports}`)
patterns.push(`!${ppath.join(ppath.resolve(imports), '**')}`)
patterns.push(`!${ppath.join(root, 'test', '**')}`)
patterns.push(`!${ppath.join(root, 'tests', '**')}`)
patterns = [...patterns, ...negativePatterns]