File tree Expand file tree Collapse file tree 3 files changed +35
-1
lines changed
packages/@vue/cli-ui/src/graphql-api Expand file tree Collapse file tree 3 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -1236,6 +1236,22 @@ Retrieve the current working directory.
1236
1236
api .getCwd ()
1237
1237
```
1238
1238
1239
+ ### resolve
1240
+
1241
+ Resolves a file within the current project.
1242
+
1243
+ ``` js
1244
+ api .resolve (' src/main.js' )
1245
+ ```
1246
+
1247
+ ### getProject
1248
+
1249
+ Get currently open project.
1250
+
1251
+ ``` js
1252
+ api .getProject ()
1253
+ ```
1254
+
1239
1255
## Public static files
1240
1256
1241
1257
You may need to expose some static files over the cli-ui builtin HTTP server (typically if you want to specify an icon to a custom view).
Original file line number Diff line number Diff line change
1
+ const path = require ( 'path' )
1
2
// Connectors
2
3
const logs = require ( '../connectors/logs' )
3
4
const sharedData = require ( '../connectors/shared-data' )
@@ -10,6 +11,7 @@ const progress = require('../connectors/progress')
10
11
const ipc = require ( '../utils/ipc' )
11
12
const { notify } = require ( '../utils/notification' )
12
13
const { matchesPluginId } = require ( '@vue/cli-shared-utils' )
14
+ const { log } = require ( '../utils/logger' )
13
15
// Validators
14
16
const { validateConfiguration } = require ( './configuration' )
15
17
const { validateDescribeTask, validateAddTask } = require ( './task' )
@@ -403,6 +405,21 @@ class PluginApi {
403
405
return cwd . get ( )
404
406
}
405
407
408
+ /**
409
+ * Resolves a file relative to current working directory
410
+ * @param {string } file Path to file relative to project
411
+ */
412
+ resolve ( file ) {
413
+ return path . resolve ( cwd . get ( ) , file )
414
+ }
415
+
416
+ /**
417
+ * Get currently open project
418
+ */
419
+ getProject ( ) {
420
+ return this . project
421
+ }
422
+
406
423
/* Namespaced */
407
424
408
425
/**
@@ -498,6 +515,7 @@ class PluginApi {
498
515
* @param {any } value Value to be stored (must be serializable in JSON)
499
516
*/
500
517
storageSet ( id , value ) {
518
+ log ( 'Storage set' , id , value )
501
519
this . db . set ( id , value ) . write ( )
502
520
}
503
521
Original file line number Diff line number Diff line change @@ -122,8 +122,8 @@ function resetPluginApi (context) {
122
122
if ( ! project ) return
123
123
if ( projectId !== project . id ) {
124
124
projectId = project . id
125
- callHook ( 'projectOpen' , [ project , projects . getLast ( context ) ] , context )
126
125
pluginApi . project = project
126
+ callHook ( 'projectOpen' , [ project , projects . getLast ( context ) ] , context )
127
127
} else {
128
128
callHook ( 'pluginReload' , [ project ] , context )
129
129
You can’t perform that action at this time.
0 commit comments