Skip to content

Commit dda6729

Browse files
authored
Merge pull request #64 from LambdaTest/revert-55-DOT-1554
Revert "add screenshot config command"
2 parents 80d5a7a + b9cd519 commit dda6729

File tree

5 files changed

+4
-61
lines changed

5 files changed

+4
-61
lines changed

commands/capture.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
const { fetchDOM, upload } = require('./utils/dom')
2-
const { cleanup } = require('./utils/cleanup')
32

43

54
async function capture(screenshots, options) {
65
await fetchDOM(screenshots,options);
76
await upload(screenshots, options);
8-
cleanup();
97
}
108

119

commands/config.js

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const path = require('path');
22
const fs = require('fs');
3-
const { defaultSmartUIConfig, defaultScreenshotConfig } = require('./utils/config');
3+
const { defaultSmartUIConfig } = require('./utils/config');
44
var { constants } = require('./utils/constants');
55

66
function createConfig(filepath) {
@@ -26,27 +26,4 @@ function createConfig(filepath) {
2626
console.log(`[smartui] Created LambdaTest SmartUI config: ${filepath}`);
2727
};
2828

29-
function createScreenshotConfig(filepath) {
30-
// default filepath
31-
filepath = filepath || 'screenshot.json';
32-
let filetype = path.extname(filepath);
33-
if (filetype != '.json') {
34-
console.log(`[smartui] Error: Config file must have .json extension`);
35-
process.exitCode = constants.ERROR_CATCHALL;
36-
return
37-
}
38-
39-
// verify the file does not already exist
40-
if (fs.existsSync(filepath)) {
41-
console.log(`[smartui] Error: Screenshot config already exists: ${filepath}`);
42-
process.exitCode = constants.ERROR_CATCHALL;
43-
return
44-
}
45-
46-
// write stringified default config options to the filepath
47-
fs.mkdirSync(path.dirname(filepath), { recursive: true });
48-
fs.writeFileSync(filepath, JSON.stringify(defaultScreenshotConfig, null, 2) + '\n');
49-
console.log(`[smartui] Created Screenshot config: ${filepath}`);
50-
};
51-
52-
module.exports = { createConfig, createScreenshotConfig };
29+
module.exports = { createConfig };

commands/utils/cleanup.js

Lines changed: 0 additions & 12 deletions
This file was deleted.

commands/utils/config.js

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,4 @@ const defaultSmartUIConfig = {
1515
}
1616
};
1717

18-
const defaultScreenshotConfig = [
19-
{
20-
"name": "lambdatest-home-page",
21-
"url": "https://www.lambdatest.com"
22-
},
23-
{
24-
"name": "example-page",
25-
"url": "https://example.com/"
26-
}
27-
]
28-
29-
module.exports = { defaultSmartUIConfig, defaultScreenshotConfig }
18+
module.exports = { defaultSmartUIConfig }

index.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const { Command, Option } = require('commander');
44
const program = new Command();
55
const { storybook } = require('./commands/storybook');
66
const { validateProjectToken, validateLatestBuild, validateConfig, isJSONFile, parse, validateScreenshotConfig } = require('./commands/utils/validate');
7-
const { createConfig, createScreenshotConfig } = require('./commands/config');
7+
const { createConfig } = require('./commands/config');
88
const { version } = require('./package.json');
99
const { checkUpdate } = require('./commands/utils/package');
1010
const fs = require('fs');
@@ -33,15 +33,6 @@ configCommand.command('create')
3333
createConfig(filepath);
3434
});
3535

36-
configCommand.command('screenshot')
37-
.description('Create Screenshot config file')
38-
.argument('[filepath]', 'Optional config filepath')
39-
.action(async function(filepath, options) {
40-
console.log('SmartUI Storybook CLI v' + version);
41-
console.log('\n');
42-
createScreenshotConfig(filepath);
43-
});
44-
4536
program.command('storybook')
4637
.description('Snapshot Storybook stories')
4738
.argument('<url|directory>', 'Storybook url or static build directory')

0 commit comments

Comments
 (0)