@salesforce/source-tracking 0.4.3 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,90 +2,125 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
- ### [0.4.3](https://github.com/forcedotcom/source-tracking/compare/v0.4.2...v0.4.3) (2021-11-11)
5
+ ### [0.5.2](https://github.com/forcedotcom/source-tracking/compare/v0.5.1...v0.5.2) (2022-01-05)
6
+
7
+ ### Features
8
+
9
+ - path-scoped singleton ([de46db4](https://github.com/forcedotcom/source-tracking/commit/de46db4b08a3fe087a2931936655c75b3b7cc32c))
10
+
11
+ ### Bug Fixes
12
+
13
+ - distributed .gitignore and loose pkgDir matching ([a148a36](https://github.com/forcedotcom/source-tracking/commit/a148a366739b6941f3f479b375147897103316bb))
14
+ - remove singleton behavior for localShadowRepo ([887bb68](https://github.com/forcedotcom/source-tracking/commit/887bb684528df8df07fe9b4edf1bd2f4165fe3e2))
15
+
16
+ ### [0.5.1](https://github.com/forcedotcom/source-tracking/compare/v0.5.0...v0.5.1) (2021-12-03)
17
+
18
+ ### Bug Fixes
19
+
20
+ - support addressable child types ([8251095](https://github.com/forcedotcom/source-tracking/commit/82510955ba8ffe4a2e7e5411973795da3671d01e))
21
+
22
+ ## [0.5.0](https://github.com/forcedotcom/source-tracking/compare/v0.4.4...v0.5.0) (2021-12-02)
23
+
24
+ ### ⚠ BREAKING CHANGES
6
25
 
26
+ - mpd suport (array of componentSets for localChanges)
7
27
 
8
28
  ### Features
9
29
 
10
- * emit warnings for types not pulled ([fdeabbf](https://github.com/forcedotcom/source-tracking/commit/fdeabbfb11bb4ba1fd17931adedc49f9cb5ae658))
30
+ - delete bundle member but not the bundle ([fbb81f2](https://github.com/forcedotcom/source-tracking/commit/fbb81f25af4cb9e81e3bbee93a08b072318eca10))
31
+ - delete bundle members instead of bundle ([0aedbd5](https://github.com/forcedotcom/source-tracking/commit/0aedbd56b3bf34ce9e344ec03bb258c9db2098aa))
32
+ - mpd suport (array of componentSets for localChanges) ([dd072bb](https://github.com/forcedotcom/source-tracking/commit/dd072bb86450a2e071dca3aece3cba6a2339b05a))
33
+ - trackingFiles handle deleted bundle members ([137cd39](https://github.com/forcedotcom/source-tracking/commit/137cd391f0ea8ae60b3351d7b3361ae97b890d45))
11
34
 
35
+ ### Bug Fixes
36
+
37
+ - deploy by pkgDir groupings, not all ([7f1262e](https://github.com/forcedotcom/source-tracking/commit/7f1262e1d05a57d3094849d052376b13dd7a5ec7))
38
+ - windows paths when pkgDir path has separators in it ([b0ab346](https://github.com/forcedotcom/source-tracking/commit/b0ab3468d9c54722f832fb7d27a84525d593d4f7))
39
+
40
+ ### [0.4.4](https://github.com/forcedotcom/source-tracking/compare/v0.4.3...v0.4.4) (2021-12-01)
41
+
42
+ ### Features
43
+
44
+ - update version of core and sdr ([977ab56](https://github.com/forcedotcom/source-tracking/commit/977ab56deb9fa610cb21b26bfef6d30a1f9f8f58))
45
+
46
+ ### [0.4.3](https://github.com/forcedotcom/source-tracking/compare/v0.4.2...v0.4.3) (2021-11-11)
47
+
48
+ ### Features
49
+
50
+ - emit warnings for types not pulled ([fdeabbf](https://github.com/forcedotcom/source-tracking/commit/fdeabbfb11bb4ba1fd17931adedc49f9cb5ae658))
12
51
 
13
52
  ### Bug Fixes
14
53
 
15
- * don't pull remote changes where type isn't in SDR registry ([46250ee](https://github.com/forcedotcom/source-tracking/commit/46250eef09e29dfa0d06af984bbfcc3e88765968))
16
- * don't pull things not in the registry ([38136bb](https://github.com/forcedotcom/source-tracking/commit/38136bbbf1e44c8e58bc06621957819913273b4e))
54
+ - don't pull remote changes where type isn't in SDR registry ([46250ee](https://github.com/forcedotcom/source-tracking/commit/46250eef09e29dfa0d06af984bbfcc3e88765968))
55
+ - don't pull things not in the registry ([38136bb](https://github.com/forcedotcom/source-tracking/commit/38136bbbf1e44c8e58bc06621957819913273b4e))
17
56
 
18
57
  ### [0.4.2](https://github.com/forcedotcom/source-tracking/compare/v0.4.1...v0.4.2) (2021-10-28)
19
58
 
20
59
  ### [0.4.1](https://github.com/forcedotcom/source-tracking/compare/v0.4.0...v0.4.1) (2021-10-28)
21
60
 
22
-
23
61
  ### Bug Fixes
24
62
 
25
- * better conflict handling (can match filenames or type/name) ([4441a0a](https://github.com/forcedotcom/source-tracking/commit/4441a0abd70c7f8f315e1c638b4cef7fcf3e2e68))
26
- * gitignore stashing location ([5145545](https://github.com/forcedotcom/source-tracking/commit/5145545eeee6c800986014327479d20e943143e5))
27
- * polling exclusion logic for aura meta.xml was wrong ([2d40b2e](https://github.com/forcedotcom/source-tracking/commit/2d40b2ef65ef9a3145d0c75cd4943e4325d5745c))
63
+ - better conflict handling (can match filenames or type/name) ([4441a0a](https://github.com/forcedotcom/source-tracking/commit/4441a0abd70c7f8f315e1c638b4cef7fcf3e2e68))
64
+ - gitignore stashing location ([5145545](https://github.com/forcedotcom/source-tracking/commit/5145545eeee6c800986014327479d20e943143e5))
65
+ - polling exclusion logic for aura meta.xml was wrong ([2d40b2e](https://github.com/forcedotcom/source-tracking/commit/2d40b2ef65ef9a3145d0c75cd4943e4325d5745c))
28
66
 
29
67
  ## 0.4.0 (2021-10-22)
30
68
 
31
-
32
69
  ### ⚠ BREAKING CHANGES
33
70
 
34
- * remove retrieve simplifier
71
+ - remove retrieve simplifier
35
72
 
36
73
  ### Features
37
74
 
38
- * add commitlint and sample circleci config ([43e7fa4](https://github.com/forcedotcom/source-tracking/commit/43e7fa4a44dbcb9da37d21618678687f4edda644))
39
- * add new tests and upadte readme ([6a7ad54](https://github.com/forcedotcom/source-tracking/commit/6a7ad542f42ce75275ebacc78d50ee4dc0ab6f32))
40
- * add option to get remoteChanges with filePaths, use for Conflicts ([350a0d6](https://github.com/forcedotcom/source-tracking/commit/350a0d60599cfce2c432c223f4523c25a4f53c81))
41
- * basic using isogit ([f39e6c5](https://github.com/forcedotcom/source-tracking/commit/f39e6c5e305fcb2fdb6a27b343d9dc20800202c9))
42
- * conflict detection ([3e22774](https://github.com/forcedotcom/source-tracking/commit/3e22774d8949a1aa4302e62d8580b69c4b35aab5))
43
- * consolidate conflict handling, return data in error ([45178c7](https://github.com/forcedotcom/source-tracking/commit/45178c7b13ed61e657f9a07ea5b40f49f73f651a))
44
- * delete handling public for pull ([eb87eb7](https://github.com/forcedotcom/source-tracking/commit/eb87eb7dfa81ba5256735af7f2b8bc29dfb1e16b))
45
- * finish status, add clear/reset ([c71e66f](https://github.com/forcedotcom/source-tracking/commit/c71e66f7f7a3dc20d2c965349b5e01e15edabf36))
46
- * handle status ignore marking from STL ([2ec6fad](https://github.com/forcedotcom/source-tracking/commit/2ec6fad4b4f4f2e124da7e4f53cf8e534354d342))
47
- * ignorewarnings flag for push ([b13fd05](https://github.com/forcedotcom/source-tracking/commit/b13fd0534930fb063075c39e6f75ea46ab9d3be8))
48
- * migrate messages/descriptions ([8fea6e5](https://github.com/forcedotcom/source-tracking/commit/8fea6e5242c50865dd635412d7592164ab57fec4))
49
- * most of sourceStatus logic, code cleanup ([f100cb8](https://github.com/forcedotcom/source-tracking/commit/f100cb83f220b3724284ae69301712a08b14376d))
50
- * non-delete push works ([487a20e](https://github.com/forcedotcom/source-tracking/commit/487a20e48c428a02ef315b58db24b714d2de0416))
51
- * push supporting bundle types ([639d459](https://github.com/forcedotcom/source-tracking/commit/639d459101cd4990fa217f657b99d64517611383))
52
- * remote and conflicts ([f98ecf1](https://github.com/forcedotcom/source-tracking/commit/f98ecf17fc6cbe386d8edae6994500388b7e0ed6))
53
- * remote tracknig with UT ([cb805e5](https://github.com/forcedotcom/source-tracking/commit/cb805e5745020be9a266a261f584979713e4b351))
54
- * source tracking from toolbelt ([6c2ebb4](https://github.com/forcedotcom/source-tracking/commit/6c2ebb444ce5518eaa81402b685fe00f1090e437))
55
- * sourcemember polling like toolbelt ([abdd7b3](https://github.com/forcedotcom/source-tracking/commit/abdd7b3ad275ea4739673a6e1b1a99853f1de2da))
56
- * spinners while waiting on pull ([dfe5aea](https://github.com/forcedotcom/source-tracking/commit/dfe5aeae0a5f9a30eddfe96852e0dab025972e1e))
57
- * status result sorting ([b7b109c](https://github.com/forcedotcom/source-tracking/commit/b7b109cf3e7bcad60507618099873c717ff31f61))
58
- * sync customObj when their fields sync ([3ded96d](https://github.com/forcedotcom/source-tracking/commit/3ded96dbd7a7ea45cb8f97719b98bae294905c05))
59
- * throws if "old" source files are present ([4b868d8](https://github.com/forcedotcom/source-tracking/commit/4b868d8232769eec5e227052bf823a35baedd288))
60
- * typed push ([6e76812](https://github.com/forcedotcom/source-tracking/commit/6e7681263b81d3b692d002a3ce5deb8ef00bbd13))
61
- * virtualTree for deletes ([b425d77](https://github.com/forcedotcom/source-tracking/commit/b425d77b4fca5c6fbab2faab7490e3516bf3f547))
62
-
75
+ - add commitlint and sample circleci config ([43e7fa4](https://github.com/forcedotcom/source-tracking/commit/43e7fa4a44dbcb9da37d21618678687f4edda644))
76
+ - add new tests and upadte readme ([6a7ad54](https://github.com/forcedotcom/source-tracking/commit/6a7ad542f42ce75275ebacc78d50ee4dc0ab6f32))
77
+ - add option to get remoteChanges with filePaths, use for Conflicts ([350a0d6](https://github.com/forcedotcom/source-tracking/commit/350a0d60599cfce2c432c223f4523c25a4f53c81))
78
+ - basic using isogit ([f39e6c5](https://github.com/forcedotcom/source-tracking/commit/f39e6c5e305fcb2fdb6a27b343d9dc20800202c9))
79
+ - conflict detection ([3e22774](https://github.com/forcedotcom/source-tracking/commit/3e22774d8949a1aa4302e62d8580b69c4b35aab5))
80
+ - consolidate conflict handling, return data in error ([45178c7](https://github.com/forcedotcom/source-tracking/commit/45178c7b13ed61e657f9a07ea5b40f49f73f651a))
81
+ - delete handling public for pull ([eb87eb7](https://github.com/forcedotcom/source-tracking/commit/eb87eb7dfa81ba5256735af7f2b8bc29dfb1e16b))
82
+ - finish status, add clear/reset ([c71e66f](https://github.com/forcedotcom/source-tracking/commit/c71e66f7f7a3dc20d2c965349b5e01e15edabf36))
83
+ - handle status ignore marking from STL ([2ec6fad](https://github.com/forcedotcom/source-tracking/commit/2ec6fad4b4f4f2e124da7e4f53cf8e534354d342))
84
+ - ignorewarnings flag for push ([b13fd05](https://github.com/forcedotcom/source-tracking/commit/b13fd0534930fb063075c39e6f75ea46ab9d3be8))
85
+ - migrate messages/descriptions ([8fea6e5](https://github.com/forcedotcom/source-tracking/commit/8fea6e5242c50865dd635412d7592164ab57fec4))
86
+ - most of sourceStatus logic, code cleanup ([f100cb8](https://github.com/forcedotcom/source-tracking/commit/f100cb83f220b3724284ae69301712a08b14376d))
87
+ - non-delete push works ([487a20e](https://github.com/forcedotcom/source-tracking/commit/487a20e48c428a02ef315b58db24b714d2de0416))
88
+ - push supporting bundle types ([639d459](https://github.com/forcedotcom/source-tracking/commit/639d459101cd4990fa217f657b99d64517611383))
89
+ - remote and conflicts ([f98ecf1](https://github.com/forcedotcom/source-tracking/commit/f98ecf17fc6cbe386d8edae6994500388b7e0ed6))
90
+ - remote tracknig with UT ([cb805e5](https://github.com/forcedotcom/source-tracking/commit/cb805e5745020be9a266a261f584979713e4b351))
91
+ - source tracking from toolbelt ([6c2ebb4](https://github.com/forcedotcom/source-tracking/commit/6c2ebb444ce5518eaa81402b685fe00f1090e437))
92
+ - sourcemember polling like toolbelt ([abdd7b3](https://github.com/forcedotcom/source-tracking/commit/abdd7b3ad275ea4739673a6e1b1a99853f1de2da))
93
+ - spinners while waiting on pull ([dfe5aea](https://github.com/forcedotcom/source-tracking/commit/dfe5aeae0a5f9a30eddfe96852e0dab025972e1e))
94
+ - status result sorting ([b7b109c](https://github.com/forcedotcom/source-tracking/commit/b7b109cf3e7bcad60507618099873c717ff31f61))
95
+ - sync customObj when their fields sync ([3ded96d](https://github.com/forcedotcom/source-tracking/commit/3ded96dbd7a7ea45cb8f97719b98bae294905c05))
96
+ - throws if "old" source files are present ([4b868d8](https://github.com/forcedotcom/source-tracking/commit/4b868d8232769eec5e227052bf823a35baedd288))
97
+ - typed push ([6e76812](https://github.com/forcedotcom/source-tracking/commit/6e7681263b81d3b692d002a3ce5deb8ef00bbd13))
98
+ - virtualTree for deletes ([b425d77](https://github.com/forcedotcom/source-tracking/commit/b425d77b4fca5c6fbab2faab7490e3516bf3f547))
63
99
 
64
100
  ### Bug Fixes
65
101
 
66
- * again with the promises ([ad9dec5](https://github.com/forcedotcom/source-tracking/commit/ad9dec50336c61996456d48ee489426393c62329))
67
- * another attempt at node12 support ([c8736d0](https://github.com/forcedotcom/source-tracking/commit/c8736d0bbe53756d1b5572e00402e55af94003c1))
68
- * case of empty orgId dir ([1cb6333](https://github.com/forcedotcom/source-tracking/commit/1cb6333d14cfcee02b27711b6db273d5db31fc8e))
69
- * case on formatter filename ([02adf22](https://github.com/forcedotcom/source-tracking/commit/02adf22419d2bf81fb070d7d7d90f7d996bd1ada))
70
- * casing on imports ([d4425d9](https://github.com/forcedotcom/source-tracking/commit/d4425d9ee2ad77c4e28d32333025e59a3c7e3af9))
71
- * correct statusCommand description ([b834a2f](https://github.com/forcedotcom/source-tracking/commit/b834a2fa0213fbc72dbc6dc3a563cd92f413d222))
72
- * don't commit empty changelists ([67b9772](https://github.com/forcedotcom/source-tracking/commit/67b9772eccd6d2d4850322eb80f5a6113aac18e6))
73
- * export compatibility ([c6e5f7c](https://github.com/forcedotcom/source-tracking/commit/c6e5f7cba68ed6a7739b237adb027fda2442e8c4))
74
- * fix vscode image in readme ([441c15f](https://github.com/forcedotcom/source-tracking/commit/441c15f79dbaf4a97c84d9d6ddc923eae59bca34))
75
- * handle org:create's single tracking file ([008793d](https://github.com/forcedotcom/source-tracking/commit/008793d0fa15210ffb263cc5d179a0be8dcb05ff))
76
- * handle stash failures ([09dacc9](https://github.com/forcedotcom/source-tracking/commit/09dacc9484e48f3cba4813f3d733c66d2a30cd6b))
77
- * leif .yml merge [skip-validate-pr] ([ff10f84](https://github.com/forcedotcom/source-tracking/commit/ff10f84ec15757df55657ba73cc6976c5892595c))
78
- * local ST uses graceful via core2 ([3ba883f](https://github.com/forcedotcom/source-tracking/commit/3ba883ff2b02e27b0eb01a709f6c1e03ef91bb73))
79
- * match server subfiles with forward slash ([c2489a6](https://github.com/forcedotcom/source-tracking/commit/c2489a62c244a64fe0938e0eecdc087f4529b5ad))
80
- * normalize windows paths on commit, too ([4339e46](https://github.com/forcedotcom/source-tracking/commit/4339e46a1cb9cbeb4cc652572e340b60e3b5bc68))
81
- * one more fs/promises fixed for node12 ([71bafcf](https://github.com/forcedotcom/source-tracking/commit/71bafcf7738e60d8b86150199ef8d0687167a010))
82
- * path normalizing for metadata keys ([6190590](https://github.com/forcedotcom/source-tracking/commit/6190590df2c2e7cc9a25eab0fa8891e3b8df9057))
83
- * path normalizing from iso-git ([b8cddaf](https://github.com/forcedotcom/source-tracking/commit/b8cddaf40930bedd18f3edec578a030220454627))
84
- * status output on windows uses backslash ([78ac398](https://github.com/forcedotcom/source-tracking/commit/78ac3988d3d04e956f17f35c67de4d1144062fcb))
85
- * support windows path on commits with \\ ([5712af4](https://github.com/forcedotcom/source-tracking/commit/5712af4447ee03e30d7a5a769fc5ba58f6913552))
86
- * there could be nested LWC templates ([d833981](https://github.com/forcedotcom/source-tracking/commit/d8339810bf76c0ab75824faee7aef59ff9a2d89e))
87
- * turns bundle parts of SourceMembers into real MDtypes ([5646042](https://github.com/forcedotcom/source-tracking/commit/564604269be7d56499963699b51920b81227297f))
88
- * use correct var name ([0708312](https://github.com/forcedotcom/source-tracking/commit/0708312c5b4f11cb94539416d0a10b5432850310))
89
-
90
-
91
- * remove retrieve simplifier ([bd71eef](https://github.com/forcedotcom/source-tracking/commit/bd71eef784bc7c7efd1999ba11193e632aef3d47))
102
+ - again with the promises ([ad9dec5](https://github.com/forcedotcom/source-tracking/commit/ad9dec50336c61996456d48ee489426393c62329))
103
+ - another attempt at node12 support ([c8736d0](https://github.com/forcedotcom/source-tracking/commit/c8736d0bbe53756d1b5572e00402e55af94003c1))
104
+ - case of empty orgId dir ([1cb6333](https://github.com/forcedotcom/source-tracking/commit/1cb6333d14cfcee02b27711b6db273d5db31fc8e))
105
+ - case on formatter filename ([02adf22](https://github.com/forcedotcom/source-tracking/commit/02adf22419d2bf81fb070d7d7d90f7d996bd1ada))
106
+ - casing on imports ([d4425d9](https://github.com/forcedotcom/source-tracking/commit/d4425d9ee2ad77c4e28d32333025e59a3c7e3af9))
107
+ - correct statusCommand description ([b834a2f](https://github.com/forcedotcom/source-tracking/commit/b834a2fa0213fbc72dbc6dc3a563cd92f413d222))
108
+ - don't commit empty changelists ([67b9772](https://github.com/forcedotcom/source-tracking/commit/67b9772eccd6d2d4850322eb80f5a6113aac18e6))
109
+ - export compatibility ([c6e5f7c](https://github.com/forcedotcom/source-tracking/commit/c6e5f7cba68ed6a7739b237adb027fda2442e8c4))
110
+ - fix vscode image in readme ([441c15f](https://github.com/forcedotcom/source-tracking/commit/441c15f79dbaf4a97c84d9d6ddc923eae59bca34))
111
+ - handle org:create's single tracking file ([008793d](https://github.com/forcedotcom/source-tracking/commit/008793d0fa15210ffb263cc5d179a0be8dcb05ff))
112
+ - handle stash failures ([09dacc9](https://github.com/forcedotcom/source-tracking/commit/09dacc9484e48f3cba4813f3d733c66d2a30cd6b))
113
+ - leif .yml merge [skip-validate-pr] ([ff10f84](https://github.com/forcedotcom/source-tracking/commit/ff10f84ec15757df55657ba73cc6976c5892595c))
114
+ - local ST uses graceful via core2 ([3ba883f](https://github.com/forcedotcom/source-tracking/commit/3ba883ff2b02e27b0eb01a709f6c1e03ef91bb73))
115
+ - match server subfiles with forward slash ([c2489a6](https://github.com/forcedotcom/source-tracking/commit/c2489a62c244a64fe0938e0eecdc087f4529b5ad))
116
+ - normalize windows paths on commit, too ([4339e46](https://github.com/forcedotcom/source-tracking/commit/4339e46a1cb9cbeb4cc652572e340b60e3b5bc68))
117
+ - one more fs/promises fixed for node12 ([71bafcf](https://github.com/forcedotcom/source-tracking/commit/71bafcf7738e60d8b86150199ef8d0687167a010))
118
+ - path normalizing for metadata keys ([6190590](https://github.com/forcedotcom/source-tracking/commit/6190590df2c2e7cc9a25eab0fa8891e3b8df9057))
119
+ - path normalizing from iso-git ([b8cddaf](https://github.com/forcedotcom/source-tracking/commit/b8cddaf40930bedd18f3edec578a030220454627))
120
+ - status output on windows uses backslash ([78ac398](https://github.com/forcedotcom/source-tracking/commit/78ac3988d3d04e956f17f35c67de4d1144062fcb))
121
+ - support windows path on commits with \\ ([5712af4](https://github.com/forcedotcom/source-tracking/commit/5712af4447ee03e30d7a5a769fc5ba58f6913552))
122
+ - there could be nested LWC templates ([d833981](https://github.com/forcedotcom/source-tracking/commit/d8339810bf76c0ab75824faee7aef59ff9a2d89e))
123
+ - turns bundle parts of SourceMembers into real MDtypes ([5646042](https://github.com/forcedotcom/source-tracking/commit/564604269be7d56499963699b51920b81227297f))
124
+ - use correct var name ([0708312](https://github.com/forcedotcom/source-tracking/commit/0708312c5b4f11cb94539416d0a10b5432850310))
125
+
126
+ - remove retrieve simplifier ([bd71eef](https://github.com/forcedotcom/source-tracking/commit/bd71eef784bc7c7efd1999ba11193e632aef3d47))
package/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2018, Salesforce.com, Inc.
1
+ Copyright (c) 2022, Salesforce.com, Inc.
2
2
  All rights reserved.
3
3
 
4
4
  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
@@ -1,3 +1,10 @@
1
+ import { SourceComponent } from '@salesforce/source-deploy-retrieve';
1
2
  import { RemoteChangeElement, ChangeResult } from './types';
2
3
  export declare const getMetadataKey: (metadataType: string, metadataName: string) => string;
3
4
  export declare const getKeyFromObject: (element: RemoteChangeElement | ChangeResult) => string;
5
+ export declare const isBundle: (cmp: SourceComponent) => boolean;
6
+ /**
7
+ * Verify that a filepath starts exactly with a complete parent path
8
+ * ex: '/foo/bar-extra/baz'.startsWith('foo/bar') would be true, but this function understands that they are not in the same folder
9
+ */
10
+ export declare const pathIsInFolder: (filePath: string, folder: string) => boolean;
@@ -6,7 +6,9 @@
6
6
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.getKeyFromObject = exports.getMetadataKey = void 0;
9
+ exports.pathIsInFolder = exports.isBundle = exports.getKeyFromObject = exports.getMetadataKey = void 0;
10
+ const path_1 = require("path");
11
+ const ts_types_1 = require("@salesforce/ts-types");
10
12
  const getMetadataKey = (metadataType, metadataName) => {
11
13
  return `${metadataType}__${metadataName}`;
12
14
  };
@@ -18,4 +20,21 @@ const getKeyFromObject = (element) => {
18
20
  throw new Error(`unable to complete key from ${JSON.stringify(element)}`);
19
21
  };
20
22
  exports.getKeyFromObject = getKeyFromObject;
23
+ const isBundle = (cmp) => { var _a; return ((_a = cmp.type.strategies) === null || _a === void 0 ? void 0 : _a.adapter) === 'bundle'; };
24
+ exports.isBundle = isBundle;
25
+ /**
26
+ * Verify that a filepath starts exactly with a complete parent path
27
+ * ex: '/foo/bar-extra/baz'.startsWith('foo/bar') would be true, but this function understands that they are not in the same folder
28
+ */
29
+ const pathIsInFolder = (filePath, folder) => {
30
+ const biggerStringParts = (0, path_1.normalize)(filePath).split(path_1.sep).filter(nonEmptyStringFilter);
31
+ return (0, path_1.normalize)(folder)
32
+ .split(path_1.sep)
33
+ .filter(nonEmptyStringFilter)
34
+ .every((part, index) => part === biggerStringParts[index]);
35
+ };
36
+ exports.pathIsInFolder = pathIsInFolder;
37
+ const nonEmptyStringFilter = (value) => {
38
+ return (0, ts_types_1.isString)(value) && value.length > 0;
39
+ };
21
40
  //# sourceMappingURL=functions.js.map
@@ -1,4 +1,3 @@
1
1
  import { SourceComponent, MetadataMember } from '@salesforce/source-deploy-retrieve';
2
- export declare const stringGuard: (input: string | undefined) => input is string;
3
2
  export declare const sourceComponentGuard: (input: SourceComponent | undefined) => input is SourceComponent;
4
3
  export declare const metadataMemberGuard: (input: MetadataMember | undefined) => input is MetadataMember;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.metadataMemberGuard = exports.sourceComponentGuard = exports.stringGuard = void 0;
3
+ exports.metadataMemberGuard = exports.sourceComponentGuard = void 0;
4
4
  /*
5
5
  * Copyright (c) 2020, salesforce.com, inc.
6
6
  * All rights reserved.
@@ -8,10 +8,6 @@ exports.metadataMemberGuard = exports.sourceComponentGuard = exports.stringGuard
8
8
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
9
9
  */
10
10
  const source_deploy_retrieve_1 = require("@salesforce/source-deploy-retrieve");
11
- const stringGuard = (input) => {
12
- return typeof input === 'string';
13
- };
14
- exports.stringGuard = stringGuard;
15
11
  const sourceComponentGuard = (input) => {
16
12
  return input instanceof source_deploy_retrieve_1.SourceComponent;
17
13
  };
@@ -11,12 +11,13 @@ interface CommitRequest {
11
11
  message?: string;
12
12
  }
13
13
  export declare class ShadowRepo {
14
- private static instance;
14
+ private static instanceMap;
15
15
  gitDir: string;
16
16
  projectPath: string;
17
17
  private packageDirs;
18
18
  private status;
19
19
  private logger;
20
+ private gitIgnoreLocations;
20
21
  private constructor();
21
22
  static getInstance(options: ShadowRepoOptions): Promise<ShadowRepo>;
22
23
  init(): Promise<void>;
@@ -74,6 +75,7 @@ export declare class ShadowRepo {
74
75
  * @returns sha (string)
75
76
  */
76
77
  commitChanges({ deployedFiles, deletedFiles, message, }?: CommitRequest): Promise<string>;
78
+ private locateIgnoreFiles;
77
79
  private stashIgnoreFile;
78
80
  private unStashIgnoreFile;
79
81
  }
@@ -12,6 +12,7 @@ const path = require("path");
12
12
  const os = require("os");
13
13
  const core_1 = require("@salesforce/core");
14
14
  const git = require("isomorphic-git");
15
+ const functions_1 = require("./functions");
15
16
  const gitIgnoreFileName = '.gitignore';
16
17
  const stashedGitIgnoreFileName = '.BAK.gitignore';
17
18
  /**
@@ -28,16 +29,19 @@ const HEAD = 1;
28
29
  const WORKDIR = 2;
29
30
  class ShadowRepo {
30
31
  constructor(options) {
32
+ this.gitIgnoreLocations = [];
31
33
  this.gitDir = getGitDir(options.orgId, options.projectPath);
32
34
  this.projectPath = options.projectPath;
33
35
  this.packageDirs = options.packageDirs;
34
36
  }
37
+ // think of singleton behavior but unique to the projectPath
35
38
  static async getInstance(options) {
36
- if (!ShadowRepo.instance) {
37
- ShadowRepo.instance = new ShadowRepo(options);
38
- await ShadowRepo.instance.init();
39
+ if (!ShadowRepo.instanceMap.has(options.projectPath)) {
40
+ const newInstance = new ShadowRepo(options);
41
+ await newInstance.init();
42
+ ShadowRepo.instanceMap.set(options.projectPath, newInstance);
39
43
  }
40
- return ShadowRepo.instance;
44
+ return ShadowRepo.instanceMap.get(options.projectPath);
41
45
  }
42
46
  async init() {
43
47
  this.logger = await core_1.Logger.child('ShadowRepo');
@@ -54,6 +58,7 @@ class ShadowRepo {
54
58
  async gitInit() {
55
59
  await core_1.fs.promises.mkdir(this.gitDir, { recursive: true });
56
60
  await git.init({ fs: core_1.fs, dir: this.projectPath, gitdir: this.gitDir, defaultBranch: 'main' });
61
+ await this.locateIgnoreFiles();
57
62
  }
58
63
  /**
59
64
  * Delete the local tracking files
@@ -81,18 +86,31 @@ class ShadowRepo {
81
86
  async getStatus(noCache = false) {
82
87
  if (!this.status || noCache) {
83
88
  try {
89
+ // only ask about OS once but use twice
90
+ const isWindows = os.type() === 'Windows_NT';
84
91
  await this.stashIgnoreFile();
92
+ const filepaths = isWindows
93
+ ? // iso-git uses posix paths, but packageDirs has already normalized them so we need to convert if windows
94
+ this.packageDirs.map((dir) => dir.path.split(path.sep).join(path.posix.sep))
95
+ : this.packageDirs.map((dir) => dir.path);
85
96
  // status hasn't been initalized yet
86
97
  this.status = await git.statusMatrix({
87
98
  fs: core_1.fs,
88
99
  dir: this.projectPath,
89
100
  gitdir: this.gitDir,
90
- filepaths: this.packageDirs.map((dir) => dir.path),
91
- // filter out hidden files and __tests__ patterns, regardless of gitignore
92
- filter: (f) => !f.includes(`${path.sep}.`) && !f.includes('__tests__'),
101
+ filepaths,
102
+ filter: (f) =>
103
+ // no hidden files
104
+ !f.includes(`${path.sep}.`) &&
105
+ // no lwc tests
106
+ !f.includes('__tests__') &&
107
+ // no gitignore files
108
+ ![gitIgnoreFileName, stashedGitIgnoreFileName].includes(path.basename(f)) &&
109
+ // isogit uses `startsWith` for filepaths so it's possible to get a false positive
110
+ filepaths.some((pkgDir) => (0, functions_1.pathIsInFolder)(f, pkgDir)),
93
111
  });
94
112
  // isomorphic-git stores things in unix-style tree. Convert to windows-style if necessary
95
- if (os.type() === 'Windows_NT') {
113
+ if (isWindows) {
96
114
  this.status = this.status.map((row) => [path.normalize(row[FILE]), row[HEAD], row[WORKDIR], row[3]]);
97
115
  }
98
116
  }
@@ -190,20 +208,31 @@ class ShadowRepo {
190
208
  await this.unStashIgnoreFile();
191
209
  }
192
210
  }
211
+ async locateIgnoreFiles() {
212
+ // set the gitIgnoreLocations so we only have to do it once
213
+ this.gitIgnoreLocations = (await git.walk({
214
+ fs: core_1.fs,
215
+ dir: this.projectPath,
216
+ gitdir: this.gitDir,
217
+ trees: [git.WORKDIR()],
218
+ // TODO: this can be marginally faster if we limit it to pkgDirs and toplevel project files
219
+ // eslint-disable-next-line @typescript-eslint/require-await
220
+ map: async (filepath) => filepath,
221
+ }))
222
+ .filter((filepath) => filepath.includes(gitIgnoreFileName) &&
223
+ // can be top-level like '.' (no sep) OR must be in one of the package dirs
224
+ (!filepath.includes(path.sep) || this.packageDirs.some((dir) => (0, functions_1.pathIsInFolder)(filepath, dir.name))))
225
+ .map((ignoreFile) => path.join(this.projectPath, ignoreFile));
226
+ }
193
227
  async stashIgnoreFile() {
194
- const originalLocation = path.join(this.projectPath, gitIgnoreFileName);
195
- // another process may have already stashed the file
196
- if (core_1.fs.existsSync(originalLocation)) {
197
- await core_1.fs.promises.rename(originalLocation, path.join(this.projectPath, stashedGitIgnoreFileName));
198
- }
228
+ // allSettled allows them to fail (example, the file wasn't where it was expected).
229
+ await Promise.allSettled(this.gitIgnoreLocations.map((originalLocation) => core_1.fs.promises.rename(originalLocation, originalLocation.replace(gitIgnoreFileName, stashedGitIgnoreFileName))));
199
230
  }
200
231
  async unStashIgnoreFile() {
201
- const stashedLocation = path.join(this.projectPath, stashedGitIgnoreFileName);
202
- // another process may have already un-stashed the file
203
- if (core_1.fs.existsSync(stashedLocation)) {
204
- await core_1.fs.promises.rename(stashedLocation, path.join(this.projectPath, gitIgnoreFileName));
205
- }
232
+ // allSettled allows them to fail (example, the file wasn't where it was expected).
233
+ await Promise.allSettled(this.gitIgnoreLocations.map((originalLocation) => core_1.fs.promises.rename(originalLocation.replace(gitIgnoreFileName, stashedGitIgnoreFileName), originalLocation)));
206
234
  }
207
235
  }
208
236
  exports.ShadowRepo = ShadowRepo;
237
+ ShadowRepo.instanceMap = new Map();
209
238
  //# sourceMappingURL=localShadowRepo.js.map
@@ -27,7 +27,12 @@ export declare class SourceTracking extends AsyncCreatable {
27
27
  private forceIgnore;
28
28
  constructor(options: SourceTrackingOptions);
29
29
  init(): Promise<void>;
30
- localChangesAsComponentSet(): Promise<ComponentSet>;
30
+ /**
31
+ *
32
+ * @param byPackageDir if true, returns one ComponentSet for each packageDir with changes
33
+ * @returns ComponentSet[]
34
+ */
35
+ localChangesAsComponentSet(byPackageDir?: boolean): Promise<ComponentSet[]>;
31
36
  /**
32
37
  * Does most of the work for the force:source:status command.
33
38
  * Outputs need a bit of massage since this aims to provide nice json.
@@ -102,7 +107,7 @@ export declare class SourceTracking extends AsyncCreatable {
102
107
  * uses SDR to translate remote metadata records into local file paths (which only typically have the filename).
103
108
  *
104
109
  * @input elements: ChangeResult[]
105
- * @input excludeUnresolvables: boolean Filter out components where you can't get the name and type (that is, it's probably not a valid source component)
110
+ * @input excludeUnresolvable: boolean Filter out components where you can't get the name and type (that is, it's probably not a valid source component)
106
111
  * @input resolveDeleted: constructs a virtualTree instead of the actual filesystem--useful when the files no longer exist
107
112
  * @input useFsForceIgnore: (default behavior) use forceIgnore from the filesystem. If false, uses the base forceIgnore from SDR
108
113
  */
@@ -8,7 +8,7 @@ exports.SourceTracking = void 0;
8
8
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
9
9
  */
10
10
  const fs = require("fs");
11
- const path = require("path");
11
+ const path_1 = require("path");
12
12
  const os_1 = require("os");
13
13
  const core_1 = require("@salesforce/core");
14
14
  const kit_1 = require("@salesforce/kit");
@@ -16,7 +16,6 @@ const ts_types_1 = require("@salesforce/ts-types");
16
16
  const source_deploy_retrieve_1 = require("@salesforce/source-deploy-retrieve");
17
17
  const remoteSourceTrackingService_1 = require("./shared/remoteSourceTrackingService");
18
18
  const localShadowRepo_1 = require("./shared/localShadowRepo");
19
- const filenamesToVirtualTree_1 = require("./shared/filenamesToVirtualTree");
20
19
  const guards_1 = require("./shared/guards");
21
20
  const functions_1 = require("./shared/functions");
22
21
  /**
@@ -39,43 +38,82 @@ class SourceTracking extends kit_1.AsyncCreatable {
39
38
  async init() {
40
39
  // reserved for future use
41
40
  }
42
- async localChangesAsComponentSet() {
41
+ /**
42
+ *
43
+ * @param byPackageDir if true, returns one ComponentSet for each packageDir with changes
44
+ * @returns ComponentSet[]
45
+ */
46
+ async localChangesAsComponentSet(byPackageDir = false) {
47
+ var _a;
43
48
  const [projectConfig] = await Promise.all([this.project.resolveProjectConfig(), this.ensureLocalTracking()]);
49
+ (_a = this.forceIgnore) !== null && _a !== void 0 ? _a : (this.forceIgnore = source_deploy_retrieve_1.ForceIgnore.findAndCreate(this.project.getDefaultPackage().name));
44
50
  const sourceApiVersion = (0, ts_types_1.getString)(projectConfig, 'sourceApiVersion');
45
- const componentSet = new source_deploy_retrieve_1.ComponentSet();
46
- if (sourceApiVersion) {
47
- componentSet.sourceApiVersion = sourceApiVersion;
48
- }
49
- const [nonDeletes, deletes] = await Promise.all([
50
- this.localRepo.getNonDeleteFilenames(),
51
- this.localRepo.getDeleteFilenames(),
52
- ]);
53
- if (nonDeletes.length === 0 && deletes.length === 0) {
54
- this.logger.debug('no local changes found in source tracking files');
55
- return componentSet;
56
- }
57
51
  // optimistic resolution...some files may not be possible to resolve
58
52
  const resolverForNonDeletes = new source_deploy_retrieve_1.MetadataResolver();
59
53
  // we need virtual components for the deletes.
60
54
  // TODO: could we use the same for the non-deletes?
61
- const resolverForDeletes = new source_deploy_retrieve_1.MetadataResolver(undefined, (0, filenamesToVirtualTree_1.filenamesToVirtualTree)(deletes));
62
- nonDeletes
63
- .flatMap((filename) => {
64
- try {
65
- return resolverForNonDeletes.getComponentsFromPath(filename);
66
- }
67
- catch (e) {
68
- this.logger.warn(`unable to resolve ${filename}`);
69
- return undefined;
55
+ const [allNonDeletes, allDeletes] = (await Promise.all([this.localRepo.getNonDeleteFilenames(), this.localRepo.getDeleteFilenames()]))
56
+ // remove the forceIgnored items early
57
+ .map((group) => group.filter((item) => this.forceIgnore.accepts(item)));
58
+ // it'll be easier to filter filenames and work with smaller component sets than to filter SourceComponents
59
+ const groupings = (byPackageDir
60
+ ? this.packagesDirs.map((pkgDir) => ({
61
+ path: pkgDir.name,
62
+ nonDeletes: allNonDeletes.filter((f) => (0, functions_1.pathIsInFolder)(f, pkgDir.name)),
63
+ deletes: allDeletes.filter((f) => (0, functions_1.pathIsInFolder)(f, pkgDir.name)),
64
+ }))
65
+ : [
66
+ {
67
+ nonDeletes: allNonDeletes,
68
+ deletes: allDeletes,
69
+ path: this.packagesDirs.map((dir) => dir.name).join(';'),
70
+ },
71
+ ]).filter((group) => group.deletes.length || group.nonDeletes.length);
72
+ this.logger.debug(`will build array of ${groupings.length} componentSet(s)`);
73
+ return groupings
74
+ .map((grouping) => {
75
+ this.logger.debug(`building componentSet for ${grouping.path} (deletes: ${grouping.deletes.length} nonDeletes: ${grouping.nonDeletes.length})`);
76
+ const componentSet = new source_deploy_retrieve_1.ComponentSet();
77
+ if (sourceApiVersion) {
78
+ componentSet.sourceApiVersion = sourceApiVersion;
70
79
  }
80
+ const resolverForDeletes = new source_deploy_retrieve_1.MetadataResolver(undefined, source_deploy_retrieve_1.VirtualTreeContainer.fromFilePaths(grouping.deletes));
81
+ grouping.deletes
82
+ .flatMap((filename) => resolverForDeletes.getComponentsFromPath(filename))
83
+ .filter(guards_1.sourceComponentGuard)
84
+ .map((component) => {
85
+ // if the component is a file in a bundle type AND there are files from the bundle that are not deleted, set the bundle for deploy, not for delete
86
+ if ((0, functions_1.isBundle)(component) && component.content && fs.existsSync(component.content)) {
87
+ // all bundle types have a directory name
88
+ try {
89
+ resolverForNonDeletes
90
+ .getComponentsFromPath((0, path_1.resolve)(component.content))
91
+ .filter(guards_1.sourceComponentGuard)
92
+ .map((nonDeletedComponent) => componentSet.add(nonDeletedComponent));
93
+ }
94
+ catch (e) {
95
+ this.logger.warn(`unable to find component at ${component.content}. That's ok if it was supposed to be deleted`);
96
+ }
97
+ }
98
+ else {
99
+ componentSet.add(component, source_deploy_retrieve_1.DestructiveChangesType.POST);
100
+ }
101
+ });
102
+ grouping.nonDeletes
103
+ .flatMap((filename) => {
104
+ try {
105
+ return resolverForNonDeletes.getComponentsFromPath((0, path_1.resolve)(filename));
106
+ }
107
+ catch (e) {
108
+ this.logger.warn(`unable to resolve ${filename}`);
109
+ return undefined;
110
+ }
111
+ })
112
+ .filter(guards_1.sourceComponentGuard)
113
+ .map((component) => componentSet.add(component));
114
+ return componentSet;
71
115
  })
72
- .filter(guards_1.sourceComponentGuard)
73
- .map((component) => componentSet.add(component));
74
- deletes
75
- .flatMap((filename) => resolverForDeletes.getComponentsFromPath(filename))
76
- .filter(guards_1.sourceComponentGuard)
77
- .map((component) => componentSet.add(component, source_deploy_retrieve_1.DestructiveChangesType.POST));
78
- return componentSet;
116
+ .filter((componentSet) => componentSet.size > 0);
79
117
  }
80
118
  /**
81
119
  * Does most of the work for the force:source:status command.
@@ -100,7 +138,7 @@ class SourceTracking extends kit_1.AsyncCreatable {
100
138
  }
101
139
  if (local && remote) {
102
140
  // keys like ApexClass__MyClass.cls
103
- const conflictFiles = (await this.getConflicts()).flatMap((conflict) => conflict.filenames).filter(guards_1.stringGuard);
141
+ const conflictFiles = (await this.getConflicts()).flatMap((conflict) => conflict.filenames).filter(ts_types_1.isString);
104
142
  results = results.map((row) => ({
105
143
  ...row,
106
144
  conflict: !!row.filePath && conflictFiles.includes(row.filePath),
@@ -129,7 +167,7 @@ class SourceTracking extends kit_1.AsyncCreatable {
129
167
  }
130
168
  if (options.format === 'SourceComponent') {
131
169
  const resolver = options.state === 'delete'
132
- ? new source_deploy_retrieve_1.MetadataResolver(undefined, (0, filenamesToVirtualTree_1.filenamesToVirtualTree)(filenames))
170
+ ? new source_deploy_retrieve_1.MetadataResolver(undefined, source_deploy_retrieve_1.VirtualTreeContainer.fromFilePaths(filenames))
133
171
  : new source_deploy_retrieve_1.MetadataResolver();
134
172
  return filenames
135
173
  .flatMap((filename) => {
@@ -224,9 +262,28 @@ class SourceTracking extends kit_1.AsyncCreatable {
224
262
  async updateLocalTracking(options) {
225
263
  var _a, _b;
226
264
  await this.ensureLocalTracking();
265
+ // relative paths make smaller trees AND isogit wants them relative
266
+ const relativeOptions = {
267
+ files: ((_a = options.files) !== null && _a !== void 0 ? _a : []).map((file) => this.ensureRelative(file)),
268
+ deletedFiles: ((_b = options.deletedFiles) !== null && _b !== void 0 ? _b : []).map((file) => this.ensureRelative(file)),
269
+ };
270
+ // plot twist: if you delete a member of a bundle (ex: lwc/foo/foo.css) and push, it'll not be in the fileResponses (deployedFiles) or deletedFiles
271
+ // what got deleted? Any local changes NOT in the fileResponses but part of a successfully deployed bundle
272
+ const deployedFilesAsVirtualComponentSet = source_deploy_retrieve_1.ComponentSet.fromSource({
273
+ // resolve from highest possible level. TODO: can we use [.]
274
+ fsPaths: relativeOptions.files.length ? [relativeOptions.files[0].split(path_1.sep)[0]] : [],
275
+ tree: source_deploy_retrieve_1.VirtualTreeContainer.fromFilePaths(relativeOptions.files),
276
+ });
277
+ // these are top-level bundle paths like lwc/foo
278
+ const bundlesWithDeletedFiles = (await this.getChanges({ origin: 'local', state: 'delete', format: 'SourceComponent' }))
279
+ .filter(functions_1.isBundle)
280
+ .filter((cmp) => deployedFilesAsVirtualComponentSet.has({ type: cmp.type, fullName: cmp.fullName }))
281
+ .map((cmp) => cmp.content)
282
+ .filter(ts_types_1.isString);
227
283
  await this.localRepo.commitChanges({
228
- deployedFiles: (_a = options.files) === null || _a === void 0 ? void 0 : _a.map((file) => this.ensureRelative(file)),
229
- deletedFiles: (_b = options.deletedFiles) === null || _b === void 0 ? void 0 : _b.map((file) => this.ensureRelative(file)),
284
+ deployedFiles: relativeOptions.files,
285
+ deletedFiles: relativeOptions.deletedFiles.concat((await this.localRepo.getDeleteFilenames()).filter((deployedFile) => bundlesWithDeletedFiles.some((bundlePath) => (0, functions_1.pathIsInFolder)(deployedFile, bundlePath)) &&
286
+ !relativeOptions.files.includes(deployedFile))),
230
287
  });
231
288
  }
232
289
  /**
@@ -253,7 +310,7 @@ class SourceTracking extends kit_1.AsyncCreatable {
253
310
  }
254
311
  this.localRepo = await localShadowRepo_1.ShadowRepo.getInstance({
255
312
  orgId: this.orgId,
256
- projectPath: this.projectPath,
313
+ projectPath: (0, path_1.normalize)(this.projectPath),
257
314
  packageDirs: this.packagesDirs,
258
315
  });
259
316
  // loads the status from file so that it's cached
@@ -377,7 +434,7 @@ class SourceTracking extends kit_1.AsyncCreatable {
377
434
  * uses SDR to translate remote metadata records into local file paths (which only typically have the filename).
378
435
  *
379
436
  * @input elements: ChangeResult[]
380
- * @input excludeUnresolvables: boolean Filter out components where you can't get the name and type (that is, it's probably not a valid source component)
437
+ * @input excludeUnresolvable: boolean Filter out components where you can't get the name and type (that is, it's probably not a valid source component)
381
438
  * @input resolveDeleted: constructs a virtualTree instead of the actual filesystem--useful when the files no longer exist
382
439
  * @input useFsForceIgnore: (default behavior) use forceIgnore from the filesystem. If false, uses the base forceIgnore from SDR
383
440
  */
@@ -386,9 +443,9 @@ class SourceTracking extends kit_1.AsyncCreatable {
386
443
  return [];
387
444
  }
388
445
  this.logger.debug(`populateTypesAndNames for ${elements.length} change elements`);
389
- const filenames = elements.flatMap((element) => element.filenames).filter(guards_1.stringGuard);
446
+ const filenames = elements.flatMap((element) => element.filenames).filter(ts_types_1.isString);
390
447
  // component set generated from the filenames on all local changes
391
- const resolver = new source_deploy_retrieve_1.MetadataResolver(undefined, resolveDeleted ? (0, filenamesToVirtualTree_1.filenamesToVirtualTree)(filenames) : undefined, useFsForceIgnore);
448
+ const resolver = new source_deploy_retrieve_1.MetadataResolver(undefined, resolveDeleted ? source_deploy_retrieve_1.VirtualTreeContainer.fromFilePaths(filenames) : undefined, useFsForceIgnore);
392
449
  const sourceComponents = filenames
393
450
  .flatMap((filename) => {
394
451
  try {
@@ -415,9 +472,9 @@ class SourceTracking extends kit_1.AsyncCreatable {
415
472
  if ((matchingComponent === null || matchingComponent === void 0 ? void 0 : matchingComponent.fullName) && (matchingComponent === null || matchingComponent === void 0 ? void 0 : matchingComponent.type.name)) {
416
473
  const filenamesFromMatchingComponent = [matchingComponent.xml, ...matchingComponent.walkContent()];
417
474
  // Set the ignored status at the component level so it can apply to all its files, some of which may not match the ignoreFile (ex: ApexClass)
418
- this.forceIgnore = (_a = this.forceIgnore) !== null && _a !== void 0 ? _a : source_deploy_retrieve_1.ForceIgnore.findAndCreate(this.project.getDefaultPackage().path);
475
+ (_a = this.forceIgnore) !== null && _a !== void 0 ? _a : (this.forceIgnore = source_deploy_retrieve_1.ForceIgnore.findAndCreate(this.project.getDefaultPackage().path));
419
476
  const ignored = filenamesFromMatchingComponent
420
- .filter(guards_1.stringGuard)
477
+ .filter(ts_types_1.isString)
421
478
  .filter((filename) => !filename.includes('__tests__'))
422
479
  .some((filename) => this.forceIgnore.denies(filename));
423
480
  filenamesFromMatchingComponent.map((filename) => {
@@ -461,11 +518,15 @@ class SourceTracking extends kit_1.AsyncCreatable {
461
518
  return results;
462
519
  }
463
520
  registrySupportsType(type) {
464
- if (this.registry.findType((metadataType) => metadataType.name === type)) {
521
+ try {
522
+ // this must use getTypeByName because findType doesn't support addressable child types (ex: customField!)
523
+ this.registry.getTypeByName(type);
465
524
  return true;
466
525
  }
467
- process.emitWarning(`Unable to find type ${type} in registry`);
468
- return false;
526
+ catch (e) {
527
+ process.emitWarning(`Unable to find type ${type} in registry`);
528
+ return false;
529
+ }
469
530
  }
470
531
  /**
471
532
  * uses SDR to translate remote metadata records into local file paths
@@ -522,7 +583,7 @@ class SourceTracking extends kit_1.AsyncCreatable {
522
583
  return Array.from(elementMap.values());
523
584
  }
524
585
  ensureRelative(filePath) {
525
- return path.isAbsolute(filePath) ? path.relative(this.projectPath, filePath) : filePath;
586
+ return (0, path_1.isAbsolute)(filePath) ? (0, path_1.relative)(this.projectPath, filePath) : filePath;
526
587
  }
527
588
  async getLocalChangesAsFilenames(state) {
528
589
  if (state === 'modify') {
@@ -564,7 +625,7 @@ class SourceTracking extends kit_1.AsyncCreatable {
564
625
  async remoteChangesToOutputRows(input) {
565
626
  var _a, _b, _c, _d;
566
627
  this.logger.debug('converting ChangeResult to a row', input);
567
- this.forceIgnore = (_a = this.forceIgnore) !== null && _a !== void 0 ? _a : source_deploy_retrieve_1.ForceIgnore.findAndCreate(this.project.getDefaultPackage().path);
628
+ (_a = this.forceIgnore) !== null && _a !== void 0 ? _a : (this.forceIgnore = source_deploy_retrieve_1.ForceIgnore.findAndCreate(this.project.getDefaultPackage().path));
568
629
  const baseObject = {
569
630
  type: (_b = input.type) !== null && _b !== void 0 ? _b : '',
570
631
  origin: input.origin,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@salesforce/source-tracking",
3
3
  "description": "API for tracking local and remote Salesforce metadata changes",
4
- "version": "0.4.3",
4
+ "version": "0.5.2",
5
5
  "author": "Salesforce",
6
6
  "license": "BSD-3-Clause",
7
7
  "main": "lib/index.js",
@@ -18,12 +18,14 @@
18
18
  "format": "sf-format",
19
19
  "lint": "sf-lint",
20
20
  "lint-fix": "yarn sf-lint --fix",
21
- "prepack": "sf-build",
22
21
  "postpack": "shx rm -f oclif.manifest.json",
22
+ "prepack": "sf-prepack",
23
+ "prepare": "sf-install",
23
24
  "pretest": "sf-compile-test",
24
- "test": "sf-test --require ts-node/register",
25
+ "prune:dead": "ts-prune | grep -v 'source-deploy-retrieve' | grep -v 'index.ts'",
26
+ "test": "sf-test",
25
27
  "test:nuts": "nyc mocha \"**/*.nut.ts\" --slow 4500 --timeout 600000 --parallel",
26
- "prune:dead": "ts-prune | grep -v 'source-deploy-retrieve' | grep -v 'index.ts'"
28
+ "test:nuts:local": "mocha \"**/local*.nut.ts\" --slow 4500 --timeout 600000 --parallel"
27
29
  },
28
30
  "keywords": [
29
31
  "force",
@@ -40,28 +42,20 @@
40
42
  "!lib/**/*.map",
41
43
  "/oclif.manifest.json"
42
44
  ],
43
- "husky": {
44
- "hooks": {
45
- "commit-msg": "sf-husky-commit-msg",
46
- "pre-commit": "sf-husky-pre-commit",
47
- "pre-push": "sf-husky-pre-push"
48
- }
49
- },
50
45
  "dependencies": {
51
- "@salesforce/core": "^2.28.0",
46
+ "@salesforce/core": "^2.33.1",
52
47
  "@salesforce/kit": "^1.5.17",
53
- "@salesforce/source-deploy-retrieve": "^5.1.1",
48
+ "@salesforce/source-deploy-retrieve": "^5.8.2",
54
49
  "isomorphic-git": "^1.9.2",
55
50
  "ts-retry-promise": "^0.6.0"
56
51
  },
57
52
  "devDependencies": {
58
53
  "@salesforce/cli-plugins-testkit": "^1.3.7",
59
- "@salesforce/dev-config": "^2.1.2",
60
- "@salesforce/dev-scripts": "^0.9.18",
54
+ "@salesforce/dev-config": "^3.0.0",
55
+ "@salesforce/dev-scripts": "^2.0.0",
61
56
  "@salesforce/prettier-config": "^0.0.2",
62
57
  "@salesforce/ts-sinon": "^1.3.21",
63
58
  "@types/shelljs": "^0.8.9",
64
- "@types/sinon": "^10.0.2",
65
59
  "@typescript-eslint/eslint-plugin": "^4.29.0",
66
60
  "@typescript-eslint/parser": "^4.29.0",
67
61
  "chai": "^4.3.0",
@@ -72,11 +66,11 @@
72
66
  "eslint-config-salesforce-license": "^0.1.6",
73
67
  "eslint-config-salesforce-typescript": "^0.2.7",
74
68
  "eslint-plugin-header": "^3.1.1",
75
- "eslint-plugin-import": "^2.23.4",
69
+ "eslint-plugin-import": "2.24.2",
76
70
  "eslint-plugin-jsdoc": "^37.0.1",
77
71
  "eslint-plugin-prettier": "^3.4.0",
78
- "husky": "^4.3.8",
79
- "mocha": "^9.0.3",
72
+ "husky": "^7.0.4",
73
+ "mocha": "^9.1.3",
80
74
  "nyc": "^15.1.0",
81
75
  "prettier": "^2.3.2",
82
76
  "pretty-quick": "^3.1.1",
@@ -87,33 +81,6 @@
87
81
  "ts-prune": "^0.10.0",
88
82
  "typescript": "^4.4.4"
89
83
  },
90
- "oclif": {
91
- "commands": "./lib/commands",
92
- "bin": "sfdx",
93
- "devPlugins": [
94
- "@oclif/plugin-help",
95
- "@oclif/plugin-command-snapshot",
96
- "@salesforce/plugin-command-reference"
97
- ],
98
- "topics": {
99
- "force": {
100
- "external": true,
101
- "subtopics": {
102
- "user": {
103
- "description": "commands that perform user-related admin tasks",
104
- "subtopics": {
105
- "permset": {
106
- "description": "Use to interact with permission sets assigned to a user"
107
- },
108
- "password": {
109
- "description": "Used to generate and set passwords for users"
110
- }
111
- }
112
- }
113
- }
114
- }
115
- }
116
- },
117
84
  "config": {
118
85
  "commitizen": {
119
86
  "path": "cz-conventional-changelog"
@@ -1,10 +0,0 @@
1
- import { VirtualTreeContainer } from '@salesforce/source-deploy-retrieve';
2
- /**
3
- * @deprecated this is moving to SDR
4
- * Designed for recreating virtual files from deleted files where the only information we have is the file's former location
5
- * Any use of MetadataResolver was trying to access the non-existent files and throwing
6
- *
7
- * @param filenames full paths to files
8
- * @returns VirtualTreeContainer to use with MetadataResolver
9
- */
10
- export declare const filenamesToVirtualTree: (filenames: string[]) => VirtualTreeContainer;
@@ -1,39 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.filenamesToVirtualTree = void 0;
4
- /*
5
- * Copyright (c) 2020, salesforce.com, inc.
6
- * All rights reserved.
7
- * Licensed under the BSD 3-Clause license.
8
- * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
9
- */
10
- const path = require("path");
11
- const source_deploy_retrieve_1 = require("@salesforce/source-deploy-retrieve");
12
- /**
13
- * @deprecated this is moving to SDR
14
- * Designed for recreating virtual files from deleted files where the only information we have is the file's former location
15
- * Any use of MetadataResolver was trying to access the non-existent files and throwing
16
- *
17
- * @param filenames full paths to files
18
- * @returns VirtualTreeContainer to use with MetadataResolver
19
- */
20
- const filenamesToVirtualTree = (filenames) => {
21
- // a map to reduce array iterations
22
- const virtualDirectoryByFullPath = new Map();
23
- filenames.map((filename) => {
24
- var _a;
25
- const splits = filename.split(path.sep);
26
- for (let i = 0; i < splits.length - 1; i++) {
27
- const fullPathSoFar = splits.slice(0, i + 1).join(path.sep);
28
- const existing = virtualDirectoryByFullPath.get(fullPathSoFar);
29
- virtualDirectoryByFullPath.set(fullPathSoFar, {
30
- dirPath: fullPathSoFar,
31
- // only add to children if we don't already have it
32
- children: Array.from(new Set((_a = existing === null || existing === void 0 ? void 0 : existing.children) !== null && _a !== void 0 ? _a : []).add(splits[i + 1])),
33
- });
34
- }
35
- });
36
- return new source_deploy_retrieve_1.VirtualTreeContainer(Array.from(virtualDirectoryByFullPath.values()));
37
- };
38
- exports.filenamesToVirtualTree = filenamesToVirtualTree;
39
- //# sourceMappingURL=filenamesToVirtualTree.js.map