File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change 1
1
module . exports = function ( __dirname ) {
2
2
return {
3
+ /**
4
+ * The `npm i` in `nativescript-dev-*` modules installs locally hooks.
5
+ * This property can be used to check if the plugin is actually installed in a project.
6
+ * - **true** - The plugin is installed in an app.
7
+ * - **false** - The plugin is installing locally its own devDependencies.
8
+ *
9
+ * ```
10
+ * const hooks = require("nativescript-hook");
11
+ * const { isInstalledInProject, postinstall } = hooks(__dirname);
12
+ *
13
+ * if (isInstalledInProject) {
14
+ * postinstall();
15
+ * // Copy files, configure, etc.
16
+ * }
17
+ * ```
18
+ */
19
+ get isInstalledInProject ( ) {
20
+ return findProjectDir ( __dirname ) != __dirname ;
21
+ } ,
3
22
findProjectDir : function ( ) {
4
23
return findProjectDir ( __dirname ) ;
5
24
} ,
You can’t perform that action at this time.
0 commit comments