@@ -6,6 +6,7 @@ const path = require('path');
66const chalk = require ( 'chalk' ) ;
77const EventEmitter = require ( 'events' ) . EventEmitter ;
88const hasYarn = require ( 'has-yarn' ) ;
9+ const { resolveFileInPackage } = require ( '@pattern-lab/core/src/lib/resolver' ) ;
910
1011/**
1112 * @name log
@@ -182,30 +183,6 @@ const writeJsonAsync = (filePath, data) =>
182183 yield fs . outputJSON ( filePath , data , { spaces : 2 } ) ;
183184 } ) ;
184185
185- /**
186- * @func resolveFileInPackage
187- * Resolves a file inside a package
188- */
189- const resolveFileInPackage = ( packageName , ...pathElements ) => {
190- return require . resolve ( path . join ( packageName , ...pathElements ) ) ;
191- } ;
192-
193- /**
194- * @func resolveDirInPackage
195- * Resolves a file inside a package
196- */
197- const resolveDirInPackage = ( packageName , ...pathElements ) => {
198- return path . dirname ( resolveFileInPackage ( packageName , pathElements ) ) ;
199- } ;
200-
201- /**
202- * @func resolvePackageFolder
203- * Resolves the location of a package on disc
204- */
205- const resolvePackageFolder = packageName => {
206- return path . dirname ( resolveDirInPackage ( packageName , 'package.json' ) ) ;
207- } ;
208-
209186/**
210187 * @func getJSONKey
211188 * Installs package, then returns the value for the given JSON file's key within
@@ -237,7 +214,4 @@ module.exports = {
237214 checkAndInstallPackage,
238215 noop,
239216 getJSONKey,
240- resolveFileInPackage,
241- resolveDirInPackage,
242- resolvePackageFolder,
243217} ;
0 commit comments