Skip to content

Commit b592149

Browse files
committed
fix: make getPackagesDirectory a free function
1 parent d1061a2 commit b592149

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

lib/minimap-plugin-generator-element.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class MinimapPluginGeneratorElement {
6363
setPathText (placeholderName, rangeToSelect) {
6464
if (!rangeToSelect) { rangeToSelect = [0, placeholderName.length] }
6565

66-
const packagesDirectory = this.getPackagesDirectory()
66+
const packagesDirectory = getPackagesDirectory()
6767

6868
this.editor.setText(path.join(packagesDirectory, placeholderName))
6969

@@ -112,12 +112,6 @@ class MinimapPluginGeneratorElement {
112112
return path.join(path.dirname(packagePath), packageName)
113113
}
114114

115-
getPackagesDirectory () {
116-
return atom.config.get('core.projectHome') ||
117-
process.env.ATOM_REPOS_HOME ||
118-
path.join(getHomeDirectory(), 'github')
119-
}
120-
121115
validPackagePath () {
122116
if (existsSync(this.getPackagePath())) {
123117
this.error.textContent = `Path already exists at '${this.getPackagePath()}'`
@@ -167,6 +161,12 @@ class MinimapPluginGeneratorElement {
167161
const minimapPluginGeneratorElement = MinimapPluginGeneratorElement.initClass()
168162
export default minimapPluginGeneratorElement
169163

164+
function getPackagesDirectory () {
165+
return atom.config.get('core.projectHome') ||
166+
process.env.ATOM_REPOS_HOME ||
167+
path.join(getHomeDirectory(), 'github')
168+
}
169+
170170
function isStoredInDotAtom (packagePath) {
171171
const packagesPath = path.join(atom.getConfigDirPath(), 'packages', path.sep)
172172
if (packagePath.indexOf(packagesPath) === 0) { return true }

0 commit comments

Comments
 (0)