Skip to content

Commit

Permalink
Merge pull request #698 from LedgerHQ/support/clean-bash-scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
valpinkman authored Aug 16, 2022
2 parents 0c02ee6 + 0805187 commit 0cff80c
Show file tree
Hide file tree
Showing 53 changed files with 2,020 additions and 3,522 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-mobile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -229,4 +229,4 @@ jobs:
with:
ruby-version: 2.7
- name: install dependencies
run: pnpm i --filter="live-mobile..." --no-frozen-lockfile --unsafe-perm
run: pnpm i --filter="live-mobile..." --filter="ledger-live" --no-frozen-lockfile --unsafe-perm
2 changes: 1 addition & 1 deletion apps/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"lib"
],
"scripts": {
"prebuild": "./scripts/gen.sh",
"prebuild": "zx ./scripts/gen.mjs",
"build": "tsc --project src/tsconfig.json",
"prepublishOnly": "rm -rf lib && tsc --project src/tsconfig.json",
"watch": "tsc --watch --project src/tsconfig.json",
Expand Down
30 changes: 30 additions & 0 deletions apps/cli/scripts/gen.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env zx
import "zx/globals";

const src = path.join(__dirname, "..", "src");
const subfolder = "commands";
const p = path.join(src, subfolder);
async function gen() {
let imports = ``;
let exprts = `export default {`;
for (const file of await fs.promises.readdir(p)) {
const clean = file.replace(".ts", "");
imports += `import ${clean} from "./${subfolder}/${clean}";
`;
exprts += `
${clean},`;
}

exprts = exprts.substring(0, exprts.length - 1);
exprts += `
};
`;

const str = `${imports}
${exprts}`;

return str;
}

const str = await gen();
await fs.promises.writeFile(path.join(src, "commands-index.ts"), str, "utf8");
23 changes: 0 additions & 23 deletions apps/cli/scripts/gen.sh

This file was deleted.

2 changes: 1 addition & 1 deletion apps/cli/src/commands-index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,5 @@ export default {
testGetTrustedInputFromTxHash,
user,
version,
walletconnect,
walletconnect
};
20 changes: 0 additions & 20 deletions apps/ledger-live-desktop/scripts/cp-wording.sh

This file was deleted.

57 changes: 0 additions & 57 deletions apps/ledger-live-desktop/scripts/create-release-shasums.sh

This file was deleted.

20 changes: 0 additions & 20 deletions apps/ledger-live-desktop/scripts/mv-wording.sh

This file was deleted.

2 changes: 1 addition & 1 deletion apps/ledger-live-desktop/scripts/post-install.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ async function main() {

// when running inside the test electron container, there is no src.
if (fs.existsSync("src")) {
child_process.exec("bash ./scripts/sync-families-dispatch.sh");
child_process.exec("zx ./scripts/sync-families-dispatch.mjs");
}
}

Expand Down
62 changes: 62 additions & 0 deletions apps/ledger-live-desktop/scripts/sync-families-dispatch.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/usr/bin/env zx
import "zx/globals";
import rimraf from "rimraf";

const basePath = path.join(__dirname, "..");
const rendererPath = path.join(basePath, "src", "renderer");
const generatedPath = path.join(rendererPath, "generated");

await rimraf(generatedPath, async e => {
if (!!e) return echo(chalk.red(e));
await fs.promises.mkdir(generatedPath);
});

const families = await fs.readdir(path.join(rendererPath, "families"));
const targets = [
"operationDetails.jsx",
"operationDetails.js",
"accountActions.jsx",
"TransactionConfirmFields.jsx",
"AccountBodyHeader.js",
"AccountSubHeader.jsx",
"SendAmountFields.jsx",
"SendRecipientFields.jsx",
"SendWarning.js",
"ReceiveWarning.jsx",
"AccountBalanceSummaryFooter.jsx",
"TokenList.jsx",
"AccountHeaderManageActions.js",
"StepReceiveFunds.jsx",
"NoAssociatedAccounts.jsx",
];

async function genTarget(target) {
let imports = `// @flow`;
let exprts = `export default {`;
const outpath = path.join(generatedPath, target);

for (const family of families) {
try {
await fs.promises.access(
path.join(rendererPath, "families", family, target),
fs.constants.R_OK,
);
imports += `
import ${family} from "../families/${family}/${target}";`;
exprts += `
${family},`;
} catch (error) {}
}

exprts += `
};
`;

const str = `${imports}
${exprts}`;

await fs.promises.writeFile(outpath, str, "utf8");
}

targets.map(genTarget);
69 changes: 0 additions & 69 deletions apps/ledger-live-desktop/scripts/sync-families-dispatch.sh

This file was deleted.

31 changes: 0 additions & 31 deletions apps/ledger-live-mobile/changes.patch

This file was deleted.

8 changes: 4 additions & 4 deletions apps/ledger-live-mobile/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ DEPENDENCIES:
- "react-native-adjust (from `../../../node_modules/.pnpm/react-native-adjust@4.29.6/node_modules/react-native-adjust`)"
- "react-native-ble-plx (from `../../../node_modules/.pnpm/react-native-ble-plx@2.0.3/node_modules/react-native-ble-plx`)"
- "react-native-config (from `../../../node_modules/.pnpm/react-native-config@1.4.4/node_modules/react-native-config`)"
- "react-native-fast-crypto (from `../../../node_modules/.pnpm/react-native-fast-crypto@2.2.0_react-native@0.68.2/node_modules/react-native-fast-crypto`)"
- "react-native-fast-crypto (from `../../../node_modules/.pnpm/react-native-fast-crypto@2.2.0_jdmv3zyvsaug2f6l23zgrmwdli_react-native@0.68.2/node_modules/react-native-fast-crypto`)"
- "react-native-fingerprint-scanner (from `../../../node_modules/.pnpm/github.com+hieuvp+react-native-fingerprint-scanner@f1d136f605412d58e4de9e7e155d6f818ba24731_react-native@0.68.2/node_modules/react-native-fingerprint-scanner`)"
- "react-native-flipper-performance-plugin (from `../../../node_modules/.pnpm/react-native-flipper-performance-plugin@0.2.1/node_modules/react-native-flipper-performance-plugin`)"
- "react-native-netinfo (from `../../../node_modules/.pnpm/@react-native-community+netinfo@6.2.1_react-native@0.68.2/node_modules/@react-native-community/netinfo`)"
Expand All @@ -685,7 +685,7 @@ DEPENDENCIES:
- "react-native-text-input-mask (from `../../../node_modules/.pnpm/react-native-text-input-mask@3.1.4_react-native@0.68.2/node_modules/react-native-text-input-mask`)"
- "react-native-udp (from `../../../node_modules/.pnpm/react-native-udp@4.1.5/node_modules/react-native-udp`)"
- "react-native-version-number (from `../../../node_modules/.pnpm/react-native-version-number@0.3.6/node_modules/react-native-version-number`)"
- "react-native-video (from `../../../node_modules/.pnpm/react-native-video@5.2.0/node_modules/react-native-video`)"
- "react-native-video (from `../../../node_modules/.pnpm/react-native-video@5.2.0_lojvl6twgoj4rxeqeytmq4uduq/node_modules/react-native-video`)"
- "react-native-webview (from `../../../node_modules/.pnpm/react-native-webview@11.18.2_zqxy7fpkavjkgz5xll7ed4r6rq/node_modules/react-native-webview`)"
- "React-perflogger (from `../../../node_modules/.pnpm/react-native@0.68.2_shn3lkepuadv4od4dudas6ijbq/node_modules/react-native/ReactCommon/reactperflogger`)"
- "React-RCTActionSheet (from `../../../node_modules/.pnpm/react-native@0.68.2_shn3lkepuadv4od4dudas6ijbq/node_modules/react-native/Libraries/ActionSheetIOS`)"
Expand Down Expand Up @@ -826,7 +826,7 @@ EXTERNAL SOURCES:
react-native-config:
:path: "../../../node_modules/.pnpm/react-native-config@1.4.4/node_modules/react-native-config"
react-native-fast-crypto:
:path: "../../../node_modules/.pnpm/react-native-fast-crypto@2.2.0_react-native@0.68.2/node_modules/react-native-fast-crypto"
:path: "../../../node_modules/.pnpm/react-native-fast-crypto@2.2.0_jdmv3zyvsaug2f6l23zgrmwdli_react-native@0.68.2/node_modules/react-native-fast-crypto"
react-native-fingerprint-scanner:
:path: "../../../node_modules/.pnpm/github.com+hieuvp+react-native-fingerprint-scanner@f1d136f605412d58e4de9e7e155d6f818ba24731_react-native@0.68.2/node_modules/react-native-fingerprint-scanner"
react-native-flipper-performance-plugin:
Expand All @@ -848,7 +848,7 @@ EXTERNAL SOURCES:
react-native-version-number:
:path: "../../../node_modules/.pnpm/react-native-version-number@0.3.6/node_modules/react-native-version-number"
react-native-video:
:path: "../../../node_modules/.pnpm/react-native-video@5.2.0/node_modules/react-native-video"
:path: "../../../node_modules/.pnpm/react-native-video@5.2.0_lojvl6twgoj4rxeqeytmq4uduq/node_modules/react-native-video"
react-native-webview:
:path: "../../../node_modules/.pnpm/react-native-webview@11.18.2_zqxy7fpkavjkgz5xll7ed4r6rq/node_modules/react-native-webview"
React-perflogger:
Expand Down
Loading

0 comments on commit 0cff80c

Please sign in to comment.