Skip to content
This repository was archived by the owner on Jan 8, 2025. It is now read-only.

Commit bd310fb

Browse files
committed
remove fs-plus
1 parent 4fc60bd commit bd310fb

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

lib/snippet-body-parser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ try {
33
parser = require('./snippet-body')
44
} catch (error) {
55
const {allowUnsafeEval} = require('loophole')
6-
const fs = require('fs-plus')
6+
const fs = require('fs')
77
const PEG = require('pegjs')
88

99
const grammarSrc = fs.readFileSync(require.resolve('./snippet-body.pegjs'), 'utf8')

lib/snippets.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const {Emitter, Disposable, CompositeDisposable, File} = require('atom')
33
const _ = require('underscore-plus')
44
const async = require('async')
55
const CSON = require('season')
6-
const fs = require('fs-plus')
6+
const fs = require('fs')
77
const ScopedPropertyStore = require('scoped-property-store')
88

99
const Snippet = require('./snippet')
@@ -273,8 +273,9 @@ module.exports = {
273273
},
274274

275275
loadSnippetsDirectory (snippetsDirPath, callback) {
276-
fs.isDirectory(snippetsDirPath, isDirectory => {
277-
if (!isDirectory) { return callback(null, {}) }
276+
fs.stat(snippetsDirPath, (error, stat) => {
277+
if (error) return callback(null, {});
278+
if (!stat.isDirectory()) return callback(null, {});
278279

279280
fs.readdir(snippetsDirPath, (error, entries) => {
280281
if (error) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
"dependencies": {
1212
"async": "~0.2.6",
1313
"atom-select-list": "^0.7.0",
14-
"fs-plus": "^3.0.0",
1514
"loophole": "^1",
15+
"mkdirp": "~0.5.1",
1616
"pegjs": "~0.8.0",
1717
"scoped-property-store": "^0.17.0",
1818
"season": "^6.0.2",

spec/snippet-loading-spec.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const path = require('path');
2-
const fs = require('fs-plus');
2+
const fs = require('fs');
3+
const mkdirp = require('mkdirp');
34
const temp = require('temp').track();
45

56
describe("Snippet Loading", () => {
@@ -126,6 +127,7 @@ describe("Snippet Loading", () => {
126127

127128
describe("when ~/.atom/snippets.json exists", () => {
128129
beforeEach(() => {
130+
mkdirp.sync(configDirPath);
129131
fs.writeFileSync(path.join(configDirPath, 'snippets.json'), `\
130132
{
131133
".foo": {
@@ -154,6 +156,7 @@ describe("Snippet Loading", () => {
154156

155157
describe("when that file changes", () => {
156158
it("reloads the snippets", () => {
159+
mkdirp.sync(configDirPath);
157160
fs.writeFileSync(path.join(configDirPath, 'snippets.json'), `\
158161
{
159162
".foo": {
@@ -172,6 +175,7 @@ describe("Snippet Loading", () => {
172175
});
173176

174177
runs(() => {
178+
mkdirp.sync(configDirPath);
175179
fs.writeFileSync(path.join(configDirPath, 'snippets.json'), "");
176180
});
177181

@@ -182,6 +186,7 @@ describe("Snippet Loading", () => {
182186

183187
describe("when ~/.atom/snippets.cson exists", () => {
184188
beforeEach(() => {
189+
mkdirp.sync(configDirPath);
185190
fs.writeFileSync(path.join(configDirPath, 'snippets.cson'), `\
186191
".foo":
187192
"foo snippet":
@@ -206,6 +211,7 @@ describe("Snippet Loading", () => {
206211

207212
describe("when that file changes", () => {
208213
it("reloads the snippets", () => {
214+
mkdirp.sync(configDirPath);
209215
fs.writeFileSync(path.join(configDirPath, 'snippets.cson'), `\
210216
".foo":
211217
"foo snippet":
@@ -220,6 +226,7 @@ describe("Snippet Loading", () => {
220226
});
221227

222228
runs(() => {
229+
mkdirp.sync(configDirPath);
223230
fs.writeFileSync(path.join(configDirPath, 'snippets.cson'), "");
224231
});
225232

0 commit comments

Comments
 (0)