@inglorious/capacitor 0.1.0 → 0.1.1
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inglorious/capacitor",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Configures Capacitor's native projects from package.json, and makes their icons and splash screens from one logo.",
|
|
5
5
|
"author": "Matteo Antony Mistretta <antony.mistretta@gmail.com> (https://ingloriouscoderz.it)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -128,6 +128,23 @@ describe("configure", () => {
|
|
|
128
128
|
expect(entitlements).toContain("applinks:new.example.com")
|
|
129
129
|
})
|
|
130
130
|
|
|
131
|
+
it("keeps the formatting of App Links files with the same content", async () => {
|
|
132
|
+
writePackage(root, {
|
|
133
|
+
native: {
|
|
134
|
+
appLinks: { domain: "app.example.com" },
|
|
135
|
+
android: { sha256: ["AA:BB"] },
|
|
136
|
+
},
|
|
137
|
+
})
|
|
138
|
+
await configure({ root, env: { CAPACITOR_CONFIG } })
|
|
139
|
+
const file = path.join(root, "public", ".well-known", "assetlinks.json")
|
|
140
|
+
const compact = JSON.stringify(JSON.parse(readFileSync(file, "utf8")))
|
|
141
|
+
writeFileSync(file, compact)
|
|
142
|
+
|
|
143
|
+
await configure({ root, env: { CAPACITOR_CONFIG } })
|
|
144
|
+
|
|
145
|
+
expect(readFileSync(file, "utf8")).toBe(compact)
|
|
146
|
+
})
|
|
147
|
+
|
|
131
148
|
it("turns on iOS swipe back with a view controller of its own", async () => {
|
|
132
149
|
writePackage(root, { native: { ios: { swipeBack: true } } })
|
|
133
150
|
|
package/src/configure/index.js
CHANGED
|
@@ -81,8 +81,15 @@ function writeWellKnown(settings) {
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
function writeJson(file, value) {
|
|
84
|
-
|
|
85
|
-
if (existsSync(file) && readFileSync(file, "utf8") === source) return
|
|
84
|
+
if (existsSync(file) && isSameJson(readFileSync(file, "utf8"), value)) return
|
|
86
85
|
mkdirSync(path.dirname(file), { recursive: true })
|
|
87
|
-
writeFileSync(file,
|
|
86
|
+
writeFileSync(file, JSON.stringify(value, null, INDENTATION) + EOL)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function isSameJson(source, value) {
|
|
90
|
+
try {
|
|
91
|
+
return JSON.stringify(JSON.parse(source)) === JSON.stringify(value)
|
|
92
|
+
} catch {
|
|
93
|
+
return false
|
|
94
|
+
}
|
|
88
95
|
}
|