From 0d94acb4ee781407d4ef5f589aeec198382bc16e Mon Sep 17 00:00:00 2001 From: Sharjeel Yunus <61178058+sharjeelyunus@users.noreply.github.com> Date: Tue, 31 Dec 2024 05:07:23 +0500 Subject: [PATCH] refactor: reorganize common parameters and scripts into utility_scripts module --- starter/src/dart_runner.ts | 2 +- .../src/{modules.ts => modules_scripts.ts} | 47 +------------------ starter/src/utility_scripts.ts | 46 ++++++++++++++++++ starter/src/utils.ts | 3 +- 4 files changed, 50 insertions(+), 48 deletions(-) rename starter/src/{modules.ts => modules_scripts.ts} (86%) create mode 100644 starter/src/utility_scripts.ts diff --git a/starter/src/dart_runner.ts b/starter/src/dart_runner.ts index 53b5021bd..279762192 100644 --- a/starter/src/dart_runner.ts +++ b/starter/src/dart_runner.ts @@ -1,5 +1,4 @@ import { exec } from 'child_process'; -import { commonParameters } from './modules'; import { ArgumentParseResult, Script } from './interfaces'; import { checkAndAskForMissingArgs, @@ -7,6 +6,7 @@ import { logError, selectModules, } from './utils'; +import { commonParameters } from './utility_scripts'; const parseArguments = (args: string[]): ArgumentParseResult => { const scripts: string[] = []; diff --git a/starter/src/modules.ts b/starter/src/modules_scripts.ts similarity index 86% rename from starter/src/modules.ts rename to starter/src/modules_scripts.ts index f55895c60..27d4207d5 100644 --- a/starter/src/modules.ts +++ b/starter/src/modules_scripts.ts @@ -3,24 +3,7 @@ import { firebaseIOSParameters, firebaseWebParameters, } from './common-params'; -import { Parameter, Script } from './interfaces'; - -// Common parameters available across scripts and modules -export const commonParameters: Parameter[] = [ - { - key: 'platform', - question: 'Which platform(s) are you targeting?', - type: 'select', - choices: ['ios', 'android', 'web'], - platform: ['android', 'ios', 'web'], - }, - { - key: 'ensemble_version', - question: 'Which version of ensemble are you using?', - type: 'text', - platform: ['android', 'ios', 'web'], - }, -]; +import { Script } from './interfaces'; // Modules (called with `enable` command) export const modules: Script[] = [ @@ -299,31 +282,3 @@ export const modules: Script[] = [ ], }, ]; - -// Custom Scripts (standalone Dart scripts) -export const scripts: Script[] = [ - { - name: 'generateKeystore', - path: 'scripts/generate_keystore.dart', - parameters: [ - { - key: 'storePassword', - question: 'Please provide the store password: ', - platform: ['android'], - type: 'text', - }, - { - key: 'keyPassword', - question: 'Please provide the key password: ', - platform: ['android'], - type: 'text', - }, - { - key: 'keyAlias', - question: 'Please provide the key alias: ', - platform: ['android'], - type: 'text', - }, - ], - }, -]; diff --git a/starter/src/utility_scripts.ts b/starter/src/utility_scripts.ts new file mode 100644 index 000000000..6227d911f --- /dev/null +++ b/starter/src/utility_scripts.ts @@ -0,0 +1,46 @@ +import { Parameter, Script } from './interfaces'; + +// Common parameters available across scripts and modules +export const commonParameters: Parameter[] = [ + { + key: 'platform', + question: 'Which platform(s) are you targeting?', + type: 'select', + choices: ['ios', 'android', 'web'], + platform: ['android', 'ios', 'web'], + }, + { + key: 'ensemble_version', + question: 'Which version of ensemble are you using?', + type: 'text', + platform: ['android', 'ios', 'web'], + }, +]; + +// Custom Scripts (standalone Dart scripts) +export const scripts: Script[] = [ + { + name: 'generateKeystore', + path: 'scripts/generate_keystore.dart', + parameters: [ + { + key: 'storePassword', + question: 'Please provide the store password: ', + platform: ['android'], + type: 'text', + }, + { + key: 'keyPassword', + question: 'Please provide the key password: ', + platform: ['android'], + type: 'text', + }, + { + key: 'keyAlias', + question: 'Please provide the key alias: ', + platform: ['android'], + type: 'text', + }, + ], + }, +]; diff --git a/starter/src/utils.ts b/starter/src/utils.ts index b181c19a5..528d99953 100644 --- a/starter/src/utils.ts +++ b/starter/src/utils.ts @@ -1,6 +1,7 @@ import prompts from 'prompts'; import { Parameter, Platform, Script } from './interfaces'; -import { commonParameters, modules, scripts } from './modules'; +import { commonParameters, scripts } from './utility_scripts'; +import { modules } from './modules_scripts'; export const findScript = (name: string): Script => { const script =