mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-17 04:07:51 +01:00
setup: support generating flatpak sources from windows
This commit is contained in:
@@ -16,7 +16,6 @@ GNU General Public License for more details.
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import fs from "fs/promises";
|
import fs from "fs/promises";
|
||||||
import fsSync from "fs";
|
import fsSync from "fs";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
@@ -24,6 +23,7 @@ import { spawnSync } from "child_process";
|
|||||||
import { fileURLToPath } from "url";
|
import { fileURLToPath } from "url";
|
||||||
|
|
||||||
async function move(from, to) {
|
async function move(from, to) {
|
||||||
|
if (!fsSync.existsSync(from) || fsSync.existsSync(to)) return;
|
||||||
try {
|
try {
|
||||||
await fs.rename(from, to);
|
await fs.rename(from, to);
|
||||||
} catch {
|
} catch {
|
||||||
@@ -103,9 +103,22 @@ for (const lockfile of lockfiles) {
|
|||||||
|
|
||||||
console.log("writing sources");
|
console.log("writing sources");
|
||||||
|
|
||||||
|
for (const source of allSources) {
|
||||||
|
for (let key in source) {
|
||||||
|
const value = source[key];
|
||||||
|
if (typeof value === "string" && value.includes("\\"))
|
||||||
|
source[key] = source[key].replace(/\\/gm, "/");
|
||||||
|
else if (Array.isArray(value)) {
|
||||||
|
value.forEach((elem, index) => {
|
||||||
|
value[index] = elem.replace(/\\/gm, "/");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
await fs.writeFile(
|
await fs.writeFile(
|
||||||
"generated-sources.json",
|
"generated-sources.json",
|
||||||
JSON.stringify(allSources, undefined, 4)
|
JSON.stringify(allSources, undefined, 4)
|
||||||
);
|
);
|
||||||
|
|
||||||
console.log("done");
|
console.log("done");
|
||||||
|
|||||||
Reference in New Issue
Block a user