regressify 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.js +9 -0
- package/package.json +1 -1
- package/update-package.js +5 -0
package/cli.js
CHANGED
|
@@ -52,6 +52,7 @@ let commandBase = `tsx ${getLibraryPath()}/src/index.ts`;
|
|
|
52
52
|
if (command === 'init') {
|
|
53
53
|
const __filename = fileURLToPath(import.meta.url);
|
|
54
54
|
const __dirname = dirname(__filename);
|
|
55
|
+
|
|
55
56
|
const postInstallPath = pathToFileURL(path.join(__dirname, 'generate_tests.js'));
|
|
56
57
|
if (fs.existsSync(postInstallPath)) {
|
|
57
58
|
console.log(chalk.yellow('generate folder visual_tests ...'));
|
|
@@ -59,6 +60,14 @@ if (command === 'init') {
|
|
|
59
60
|
} else {
|
|
60
61
|
console.log(chalk.red('generate_tests.js not found!'));
|
|
61
62
|
}
|
|
63
|
+
|
|
64
|
+
const updatePackageJsonPath = pathToFileURL(path.join(__dirname, 'update-package.js'));
|
|
65
|
+
if (fs.existsSync(updatePackageJsonPath)) {
|
|
66
|
+
console.log(chalk.yellow('update package.json ...'));
|
|
67
|
+
await import(updatePackageJsonPath);
|
|
68
|
+
} else {
|
|
69
|
+
console.log(chalk.red('update-package.js not found!'));
|
|
70
|
+
}
|
|
62
71
|
} else if (command === 'ref') {
|
|
63
72
|
const command = `${commandBase} --command test --ref ${args.slice(1).join(' ')}`;
|
|
64
73
|
console.log(chalk.yellow(`Running command: ${command}`));
|
package/package.json
CHANGED
package/update-package.js
CHANGED
|
@@ -4,6 +4,11 @@ import { fileURLToPath } from 'url';
|
|
|
4
4
|
|
|
5
5
|
async function updatePackageJson() {
|
|
6
6
|
const packageJsonPath = path.join(path.dirname(fileURLToPath(import.meta.url)), 'package.json');
|
|
7
|
+
if (!fs.existsSync(packageJsonPath)) {
|
|
8
|
+
console.log(chalk.red("package.json file doesn't exists"), err);
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
|
|
7
12
|
const packageJsonText = fs.readFileSync(packageJsonPath, 'utf8');
|
|
8
13
|
const packageJson = JSON.parse(packageJsonText);
|
|
9
14
|
|