Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…into steelbrain/remove-config-file
  • Loading branch information
Steel Brain committed Apr 10, 2017
2 parents 94ee139 + c5892a1 commit 50ed7f0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"homepage": "https://github.com/AtomLinter/package-deps#readme",
"dependencies": {
"atom-package-path": "^1.1.0",
"sb-config-file": "^3.0.1",
"sb-exec": "^3.0.1",
"sb-fs": "^3.0.0",
"semver": "^5.3.0",
Expand Down
11 changes: 5 additions & 6 deletions src/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import Path from 'path'
import semver from 'semver'
import tildify from 'tildify'
import { exec } from 'sb-exec'
import ConfigFile from 'sb-config-file'
import type { Dependency } from './types'

let shownStorageInfo = false
Expand Down Expand Up @@ -83,9 +82,8 @@ export async function getDependencies(packageName: string): Promise<Array<Depend
}

export async function promptUser(packageName: string, dependencies: Array<Dependency>): Promise<'Yes' | 'No' | 'Never'> {
const configPath = Path.join(atom.getConfigDirPath(), 'package-deps-state.json')
const configFile = await ConfigFile.get(configPath, { ignored: [] }, { createIfNonExistent: true })
const ignoredPackages = await configFile.get('ignored')
const configPath = atom.config.getUserConfigPath()
const ignoredPackages = atom.config.get('sb-package-deps.ignored')
if (ignoredPackages.includes(packageName)) {
return Promise.resolve('No')
}
Expand All @@ -111,12 +109,13 @@ export async function promptUser(packageName: string, dependencies: Array<Depend
}, {
text: 'Never',
onDidClick: () => {
configFile.append('ignored', packageName)
ignoredPackages.push(packageName)
atom.config.set('sb-package-deps.ignored', ignoredPackages)
if (!shownStorageInfo) {
shownStorageInfo = true
atom.notifications.addInfo('How to reset package-deps memory', {
dismissable: true,
description: `If you ever wish to change the packages package-deps never installs, please modify ${tildify(configPath)}`,
description: `If you ever wish to change the packages package-deps never installs, please modify ${tildify(configPath)}.sb-package-deps.ignored`,
})
}
resolve('Never')
Expand Down

0 comments on commit 50ed7f0

Please sign in to comment.