Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cli): add plugins flag to newapp command #2754

Merged
merged 10 commits into from Apr 29, 2022

Conversation

tiagoalvesdulce
Copy link
Member

@tiagoalvesdulce tiagoalvesdulce commented Apr 25, 2022

This PR aims to extend the newapp CLI to accept a plugins flag with a list of comma separated plugins to add to the app.

Todo:

  • Add plugins flag to CLI
  • Add plugins to the package.json of the newly created app
  • Create basic config template

Decided to create a basic api for plugins config file and implement template after we have a better idea how all core packages will be integrated.

Copy link
Member

@victorgcramos victorgcramos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking really good! That's such a great improvement for app creation!

I think it would be nice if the newapp command logs the config if you loaded it from a file using the --config flag.

Comment on lines +21 to +44
try {
let configFile;
const isDefaultApp = !plugins && !config;

validateAppName(appName);
validatePlugins(plugins);
validateConfig(config);
if (config) configFile = loadConfigFile(config);
const { pluginsDeps, pluginsConfig } = getPluginsDepsAndConfig({
isDefaultApp,
plugins,
configFile,
});
const appPath = createNewApp(appName);
createPackageJsonFile({
appName,
baseAppPackageJSON,
pluginsDeps,
appPath,
});
createConfigFile({ appPath, config, pluginsConfig });
createWebpackConfigFiles({ appPath, port, baseAppPath });
createTestConfigFiles({ appPath, baseAppPath });
createSrcFiles({ appPath, appName, baseAppPath });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!! 👍

```

Creating a new Proposals app

```bash
$ pgui newapp proposals
Creating a new app: proposals
Directory: /Users/victorguedes/Documents/decred/politeiagui/plugins-structure/apps/proposals
Directory: /Directory/apps/proposals
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks! 😁

Copy link
Member

@victorgcramos victorgcramos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!! Good job!

@tiagoalvesdulce tiagoalvesdulce merged commit 0d0b411 into decred:master Apr 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants