From 7a6e89e60b790c3aa6317ede1dd7e0f79d12ce50 Mon Sep 17 00:00:00 2001 From: Evan Sangaline Date: Wed, 14 Feb 2024 15:28:55 -0600 Subject: [PATCH] Use the wrokspace name to determine the circuit name. --- .../src/script-templates/sindri/index.ts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/libs/remix-ws-templates/src/script-templates/sindri/index.ts b/libs/remix-ws-templates/src/script-templates/sindri/index.ts index 8ffe1b1298..a15f1c3438 100644 --- a/libs/remix-ws-templates/src/script-templates/sindri/index.ts +++ b/libs/remix-ws-templates/src/script-templates/sindri/index.ts @@ -68,18 +68,17 @@ export const sindriScripts = async (plugin: any) => { return a.path.localeCompare(b.path) }) .map(({path}) => path)[0] || './circuit.circom' - - // Use the basename of the circuit path as the circuit name. - const circomCircuitName = - circomCircuitPath - .split('/') - .pop() - .replace(/\.circom$/i, '') || 'my-circom-circuit' - sindriManifest.name = circomCircuitName sindriManifest.circuitPath = circomCircuitPath break } + const {name: workspaceName} = await plugin.call('filePanel', 'getCurrentWorkspace') + sindriManifest.name = + workspaceName + .replace(/\s*-+\s*\d*$/, '') + .replace(/[^a-zA-Z0-9]+/g, '-') + .replace(/^[^a-zA-Z]+/, '') || `my-${sindriManifest.circuitType}-circuit` + // Remove any unsupported characters from the circuit name. sindriManifest.name = (sindriManifest.name || '').replace(/[^-a-zA-Z0-9_]+/g, '-')