Skip to content

Commit f0e29e9

Browse files
authored
refactor: removed unused and unnecessary dependencies (#1396)
* refactor: removed unused dependency sanitize-filename * refactor: removed obsolete dependency out of this package * refactor: replace path-exists by fs-extra * refactor: removed unused eslint plugin and config
1 parent 1b48c0f commit f0e29e9

File tree

9 files changed

+593
-761
lines changed

9 files changed

+593
-761
lines changed

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@
1616
"auto": "^9.40.5",
1717
"babel-eslint": "^10.0.2",
1818
"eslint": "^6.1.0",
19-
"eslint-config-airbnb-base": "^14.0.0",
2019
"eslint-config-prettier": "^6.0.0",
21-
"eslint-plugin-import": "^2.18.2",
2220
"eslint-plugin-prettier": "^3.1.0",
2321
"lerna": "4.0.0",
2422
"prettier": "^2.2.1",

packages/cli/bin/resolve-config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
'use strict';
2-
const exists = require('path-exists');
2+
const fs = require('fs-extra');
33
const path = require('path');
44
const error = require('./utils').error;
55
const readJsonAsync = require('./utils').readJsonAsync;
@@ -19,7 +19,7 @@ function resolveConfig(configPath) {
1919
);
2020
return false;
2121
}
22-
if (!exists.sync(configPath)) {
22+
if (!fs.existsSync(configPath)) {
2323
error(`resolveConfig: configPath ${configPath} does not exists`);
2424
return false;
2525
}

packages/cli/package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
},
1111
"dependencies": {
1212
"@pattern-lab/core": "^5.15.5",
13-
"@pattern-lab/live-server": "^5.15.5",
1413
"archiver": "2.1.1",
1514
"chalk": "4.1.0",
1615
"commander": "2.15.1",
@@ -21,9 +20,7 @@
2120
"has-yarn": "1.0.0",
2221
"inquirer": "5.1.0",
2322
"lodash": "4.17.21",
24-
"ora": "2.1.0",
25-
"path-exists": "3.0.0",
26-
"sanitize-filename": "1.6.3"
23+
"ora": "2.1.0"
2724
},
2825
"devDependencies": {
2926
"@pattern-lab/starterkit-mustache-base": "3.0.3",

packages/cli/test/cli-build.test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const exists = require('path-exists');
1+
const fs = require('fs-extra');
22
const getUniqueProjectPath = require('./utils/getUniqueProjectPath');
33
const path = require('path');
44
const spawnCmd = require('./utils/spawnCmd');
@@ -25,23 +25,23 @@ tap.test('Init and build ->', (t) =>
2525
`${projectRoot}/patternlab-config.json`,
2626
]);
2727
t.ok(
28-
exists.sync(path.resolve(projectRoot, 'public')),
28+
fs.existsSync(path.resolve(projectRoot, 'public')),
2929
'should build all files into public dir'
3030
);
3131
t.ok(
32-
exists.sync(path.resolve(projectRoot, 'public', 'annotations')),
32+
fs.existsSync(path.resolve(projectRoot, 'public', 'annotations')),
3333
'with an annotations dir'
3434
);
3535
t.ok(
36-
exists.sync(path.resolve(projectRoot, 'public', 'css')),
36+
fs.existsSync(path.resolve(projectRoot, 'public', 'css')),
3737
'with a css dir'
3838
);
3939
t.ok(
40-
exists.sync(path.resolve(projectRoot, 'public', 'images')),
40+
fs.existsSync(path.resolve(projectRoot, 'public', 'images')),
4141
'with a images dir'
4242
);
4343
t.ok(
44-
exists.sync(path.resolve(projectRoot, 'public', 'styleguide')),
44+
fs.existsSync(path.resolve(projectRoot, 'public', 'styleguide')),
4545
'with a styleguide dir'
4646
);
4747
t.end();

packages/cli/test/cli-export.test.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const exists = require('path-exists');
1+
const fs = require('fs-extra');
22
const getUniqueProjectPath = require('./utils/getUniqueProjectPath');
33
const path = require('path');
44
const spawnCmd = require('./utils/spawnCmd');
@@ -25,7 +25,9 @@ tap.test('Init and export ->', (t) =>
2525
`${projectRoot}/patternlab-config.json`,
2626
]);
2727
t.ok(
28-
exists.sync(path.resolve(projectRoot, 'pattern_exports', 'patterns.zip')),
28+
fs.existsSync(
29+
path.resolve(projectRoot, 'pattern_exports', 'patterns.zip')
30+
),
2931
' should create patterns.zip'
3032
);
3133
t.end();

packages/cli/test/cli-init.test.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const exists = require('path-exists');
1+
const fs = require('fs-extra');
22
const getUniqueProjectPath = require('./utils/getUniqueProjectPath');
33
const path = require('path');
44
const spawnCmd = require('./utils/spawnCmd');
@@ -20,17 +20,23 @@ tap.test('Init ->', (t) =>
2020
'@pattern-lab/starterkit-mustache-base',
2121
]);
2222
t.ok(
23-
exists.sync(path.resolve(projectRoot)),
23+
fs.existsSync(path.resolve(projectRoot)),
2424
'should initialize a Pattern Lab project'
2525
);
26-
t.ok(exists.sync(path.resolve(projectRoot, 'source')), 'with a source dir');
27-
t.ok(exists.sync(path.resolve(projectRoot, 'public')), 'with a public dir');
2826
t.ok(
29-
exists.sync(path.resolve(projectRoot, 'pattern_exports')),
27+
fs.existsSync(path.resolve(projectRoot, 'source')),
28+
'with a source dir'
29+
);
30+
t.ok(
31+
fs.existsSync(path.resolve(projectRoot, 'public')),
32+
'with a public dir'
33+
);
34+
t.ok(
35+
fs.existsSync(path.resolve(projectRoot, 'pattern_exports')),
3036
'with a pattern_exports dir'
3137
);
3238
t.ok(
33-
exists.sync(path.resolve(projectRoot, 'patternlab-config.json')),
39+
fs.existsSync(path.resolve(projectRoot, 'patternlab-config.json')),
3440
'with a pattern_exports dir'
3541
);
3642
t.end();

packages/cli/test/scaffold.test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const tap = require('tap');
22
const path = require('path');
3-
const exists = require('path-exists');
3+
const fs = require('fs-extra');
44
const scaffold = require('../bin/scaffold');
55
const getUniqueProjectPath = require('./utils/getUniqueProjectPath');
66
const wrapAsync = require('../bin/utils').wrapAsync;
@@ -13,17 +13,17 @@ const exportDir = 'patterns_export';
1313
tap.test('Scaffold ->', (t) =>
1414
wrapAsync(function* () {
1515
yield scaffold(projectDir, sourceDir, publicDir, exportDir);
16-
t.ok(exists.sync(path.resolve(projectDir)), 'should create project dir');
16+
t.ok(fs.existsSync(path.resolve(projectDir)), 'should create project dir');
1717
t.ok(
18-
exists.sync(path.resolve(projectDir, sourceDir)),
18+
fs.existsSync(path.resolve(projectDir, sourceDir)),
1919
'should create source dir'
2020
);
2121
t.ok(
22-
exists.sync(path.resolve(projectDir, publicDir)),
22+
fs.existsSync(path.resolve(projectDir, publicDir)),
2323
'should create public dir'
2424
);
2525
t.ok(
26-
exists.sync(path.resolve(projectDir, exportDir)),
26+
fs.existsSync(path.resolve(projectDir, exportDir)),
2727
'should create export dir'
2828
);
2929
t.end();

packages/core/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@
2626
"@babel/plugin-syntax-jsx": "^7.12.13",
2727
"babel-eslint": "^10.0.2",
2828
"eslint": "^6.1.0",
29-
"eslint-config-airbnb-base": "^14.0.0",
3029
"eslint-config-prettier": "^6.0.0",
31-
"eslint-plugin-import": "^2.18.2",
3230
"eslint-plugin-prettier": "^3.1.0",
3331
"jsdoc-to-markdown": "5.0.1",
3432
"prettier": "^2.2.1",

0 commit comments

Comments
 (0)