Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1062278

Browse files
Find and replace on upgrade
1 parent d3a9af2 commit 1062278

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

‎sample/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"@angular/common": "^12.0.0",
1818
"@angular/compiler": "^12.0.0",
1919
"@angular/core": "^12.0.0",
20-
"@angular/fire": "7.0.0-canary.32f57c2",
20+
"@angular/fire": "7.0.0-canary.d3a9af2",
2121
"@angular/forms": "^12.0.0",
2222
"@angular/platform-browser": "^12.0.0",
2323
"@angular/platform-browser-dynamic": "^12.0.0",

‎sample/yarn.lock‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,10 @@
216216
dependencies:
217217
tslib "^2.2.0"
218218

219-
"@angular/fire@7.0.0-canary.32f57c2":
220-
version "7.0.0-canary.32f57c2"
221-
resolved "https://registry.yarnpkg.com/@angular/fire/-/fire-7.0.0-canary.32f57c2.tgz#f22a08f8ab74968cf1d7ad3899c8172b58be6225"
222-
integrity sha512-LniVulI209Z8GLa0rgrr43kJYW6dDIcaxhlRpq8/sv4x2eOKbwDGqnrnDPZkGwLbp7F19B61hLyMSO5aA7+IpA==
219+
"@angular/fire@7.0.0-canary.d3a9af2":
220+
version "7.0.0-canary.d3a9af2"
221+
resolved "https://registry.yarnpkg.com/@angular/fire/-/fire-7.0.0-canary.d3a9af2.tgz#28050f12da5e9310d209ca0a4e2bc3e0a20ab0d4"
222+
integrity sha512-Jrnen55L0xuhGLEGlbtB7kbzN1ZKE/LQN0aASAxlZ/FnD1CRDmlZlYr4Clz1/ZJH6yMu7sMw72NlI7vk/dJoBA==
223223
dependencies:
224224
tslib "^2.0.0"
225225

‎src/schematics/update/v7/index.ts‎

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,22 @@ export const ngUpdate = (): Rule => (
3434
overwriteIfExists(host, 'package.json', stringifyFormatted(packageJson));
3535

3636
host.visit(filePath => {
37-
if (!filePath.endsWith('.ts')) {
37+
if (
38+
!filePath.endsWith('.ts') ||
39+
filePath.endsWith('.d.ts') ||
40+
filePath.startsWith('/node_modules')
41+
) {
3842
return;
3943
}
40-
const content = host.read(filePath);
44+
const content = host.read(filePath)?.toString();
4145
if (!content) {
4246
return;
4347
}
44-
// rewrite imports from `@angular/fire/*` to `@angular/fire/compat/*`
45-
// rewrite imports from `firebase/*` to `firebase/compat/*`
46-
// rewrite imports from `@firebase/*` to `@firebase/compat/*`
48+
// TODO clean this up
49+
content.replace(/(?<key>import|export)\s+(?:(?<alias>[\w,{}\s\*]+)\s+from)?\s*(?:(["'])?firebase\/(?<ref>[@\w\s\\\/.-]+)3円?)\s*;/, "1ドル 2ドル from 3ドルfirebase/compat/4ドル3ドル;");
50+
content.replace(/(?<key>import|export)\s+(?:(?<alias>[\w,{}\s\*]+)\s+from)?\s*(?:(["'])?@firebase\/(?<ref>[@\w\s\\\/.-]+)3円?)\s*;/, "1ドル 2ドル from 3ドル@firebase/compat/4ドル3ドル;");
51+
content.replace(/(?<key>import|export)\s+(?:(?<alias>[\w,{}\s\*]+)\s+from)?\s*(?:(["'])?@angular\/fire\/(?<ref>[@\w\s\\\/.-]+)3円?)\s*;/, "1ドル 2ドル from 3ドル@angular/fire/compat/4ドル3ドル;");
52+
host.overwrite(filePath, content);
4753
console.log(filePath);
4854
});
4955

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /