0.0.95 • Published 1 year ago

@gluestack-framework-v3/framework v0.0.95

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

Framework Plugin

This Plugin provides a Plugin Manager and a BasePlugin class for managing and installing plugins in a project. The Plugin consists of two main files:

  1. BasePlugin.ts

    The BasePlugin class is an abstract class that serves as the base for both client and server plugins. It defines various methods for copying directories, merging dependencies, updating configuration files, and more. Subclasses must implement abstract methods such as install, update, and uninstall.

  2. PluginManager.ts

    The PluginManager class is responsible for managing the installation of plugins. It provides methods for loading plugin classes, installing dependencies, and copying plugin Plugins based on the generation type (template or example).

BasePlugin Class

Properties

  • pluginName: Name of the plugin.
  • sourcePath: Path to the source directory.
  • projectName: Name of the project.
  • generateFrom: Generation type, either 'template' or 'example'.

Methods

Common Methods (Used by both client and server plugins)

  • copyDirectories(): Copy multiple directories from source to destination.
  • copyDirectory(): Copy a single directory from source to destination.
  • mergeDependencies(): Merge dependencies, devDependencies, scripts, etc. from the plugin to the project's package.json.
  • mergeTSconfigPaths(): Merge tsconfig paths from the plugin to the project's tsconfig.json.
  • updatePluginJson(): Merge plugin-specific JSON to the project JSON.
  • updateProjectNameInPackageJson(): Update the project name in package.json.

client Plugin Methods

  • deleteDirectories(): Delete multiple directories from the destination.
  • mergeAppJson(): Merge app.json from the plugin to the project, with specific keys for iOS, Android, and web.
  • replaceMainLayout(): Replace the main layout from the plugin to the project.

server Plugin Methods

  • mergeAppModule(): Merge app Plugin from the plugin to the project.
  • copyDockerComposeForDB(): Copy docker-compose.yml from the plugin to the project.

Abstract Methods

  • install(): Abstract method to install the plugin.
  • update(): Abstract method to update the plugin.
  • uninstall(): Abstract method to uninstall the plugin.

PluginManager Class

Properties

  • baseDir: Base directory for the project.
  • projectName: Name of the project.
  • generateFrom: Generation type, either 'template' or 'example'.
  • generationType: Type of generation, either 'project' or 'example'.

Methods

  • updateGenerationFrom(generationFrom: 'template' | 'example'): PluginManager: Update the generation type of the PluginManager instance.

  • installPlugin(pluginName: string, pluginType: 'server' | 'client'): Promise<void>: Install a plugin by copying its Plugin, installing dependencies, and initializing the plugin class.

Usage

To use the Plugin Manager, create an instance of the PluginManager class, configure it, and then call the installPlugin method to install individual plugins.

// Example usage
const pluginManager = new PluginManager('/path/to/project', 'myProject', 'template', 'project');
await pluginManager.installPlugin('myPlugin', 'client');

Note: You can use these methods in various plugins and call in the install function of any plugin.

Logs

Please use logger instead of console.logging. Logs from logger doesn't show in production. If you want to manage logs in development env, you can set ENABLE_LOGGING=false/true in .env.

0.0.95-alpha.0

1 year ago

0.0.95-alpha.3

1 year ago

0.0.95-alpha.1

1 year ago

0.0.95

1 year ago

0.0.94

1 year ago

0.0.91-alpha.1

1 year ago

0.0.91

1 year ago

0.0.92

1 year ago

0.0.93

1 year ago

0.0.88

1 year ago

0.0.89

1 year ago

0.0.90

1 year ago

0.0.84

1 year ago

0.0.85

1 year ago

0.0.86

1 year ago

0.0.87

1 year ago

0.0.82

1 year ago

0.0.83

1 year ago

0.0.81

1 year ago

0.0.80

1 year ago

0.0.73

1 year ago

0.0.74

1 year ago

0.0.75

1 year ago

0.0.76

1 year ago

0.0.77

1 year ago

0.0.78

1 year ago

0.0.79

1 year ago

0.0.72

1 year ago

0.0.40

1 year ago

0.0.42

1 year ago

0.0.43

1 year ago

0.0.44

1 year ago

0.0.45

1 year ago

0.0.46

1 year ago

0.0.47

1 year ago

0.0.39

1 year ago

0.0.70

1 year ago

0.0.71

1 year ago

0.0.62

1 year ago

0.0.63

1 year ago

0.0.64

1 year ago

0.0.65

1 year ago

0.0.66

1 year ago

0.0.67

1 year ago

0.0.68

1 year ago

0.0.69

1 year ago

0.0.60

1 year ago

0.0.61

1 year ago

0.0.59

1 year ago

0.0.51

1 year ago

0.0.52

1 year ago

0.0.53

1 year ago

0.0.54

1 year ago

0.0.55

1 year ago

0.0.56

1 year ago

0.0.57

1 year ago

0.0.58

1 year ago

0.0.50

1 year ago

0.0.48

1 year ago

0.0.49

1 year ago

0.0.20

1 year ago

0.0.21

1 year ago

0.0.22

1 year ago

0.0.23

1 year ago

0.0.24

1 year ago

0.0.25

1 year ago

0.0.37

1 year ago

0.0.15

1 year ago

0.0.38

1 year ago

0.0.16

1 year ago

0.0.17

1 year ago

0.0.18

1 year ago

0.0.19

1 year ago

0.0.30

1 year ago

0.0.31

1 year ago

0.0.32

1 year ago

0.0.33

1 year ago

0.0.34

1 year ago

0.0.35

1 year ago

0.0.13

1 year ago

0.0.36

1 year ago

0.0.14

1 year ago

0.0.26

1 year ago

0.0.27

1 year ago

0.0.28

1 year ago

0.1.18

1 year ago

0.0.12

1 year ago

0.0.11

1 year ago

0.0.10

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago