Skip to content

nativescript-hook plugin cannot be used in some cases #1573

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

Closed
rosen-vladimirov opened this issue Mar 7, 2016 · 1 comment
Closed

nativescript-hook plugin cannot be used in some cases #1573

rosen-vladimirov opened this issue Mar 7, 2016 · 1 comment
Labels

Comments

@rosen-vladimirov
Copy link
Contributor

In some cases nativescript-hook cannot be used. This plugin is used by developers to easily create and maintain hooks for their plugins. As it has to execute some work on postinstall of the plugin, it has to be defined as dependency, not devDependency. However defining it as dependency is including it in the real application, that's installed on the device. But in case you define it as devDependency of the plugin, it will not be installed when calling npm install --save <my plugin> and the postinstall will fail.

Idea:

  • Always use nativescript-hook as devDependency of the plugin. On postintall of the nativescript-hook or prepublish of the plugin, create postinstall.js and preuninstall.js which should not depend on nativescript-hook, but should do the same as it would do.
    Workflow in such case:
    1. Create plugin
    2. Add info in the package.json for required hooks
    3. Add nativescript-hook as dependency - this should add prepublish step to your package.json
    4. Executing npm pack will call prepublish step. This step will call nativescript-hook, which should read plugin's package.json and create postinstall.js and preuninstall.js with correct content. The content should execute the following code: https://github.com/NativeScript/nativescript-hook/blob/master/index.js#L74

Related issue: #1572

@tsonevn tsonevn added this to the 2.6.0 (TBD) milestone Dec 5, 2016
@pkoleva pkoleva modified the milestone: 2.6.0 (TBD) Jan 26, 2017
@Plamen5kov Plamen5kov assigned Plamen5kov and unassigned Plamen5kov Feb 1, 2017
@etabakov etabakov added this to the 3.1.0 milestone Apr 27, 2017
@pkoleva pkoleva removed this from the 3.1.0 milestone Jun 6, 2017
@rosen-vladimirov
Copy link
Contributor Author

Closing this issue as it does not contain enough information what are the use-cases when nativescript-hook cannot be used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants