Use the wrokspace name to determine the circuit name.

pull/4512/head
Evan Sangaline 9 months ago committed by Aniket
parent b461723aae
commit 7a6e89e60b
  1. 15
      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, '-')

Loading…
Cancel
Save