test-bdk-cli 0.1.10 → 0.1.13

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.
@@ -30,11 +30,13 @@ function registerPack(program) {
30
30
  if (fs_1.default.existsSync(schemaPath)) {
31
31
  const manifest = JSON.parse(fs_1.default.readFileSync(manifestPath, 'utf8'));
32
32
  const schema = JSON.parse(fs_1.default.readFileSync(schemaPath, 'utf8'));
33
- const ajv = new ajv_1.default({ allowUnionTypes: true });
33
+ const ajv = new ajv_1.default({ allowUnionTypes: true, allErrors: true });
34
34
  const validate = ajv.compile(schema);
35
35
  const valid = validate(manifest);
36
36
  if (!valid) {
37
- console.error('Manifest validation failed:', validate.errors);
37
+ const errs = (validate.errors || []).map((e) => `${(e === null || e === void 0 ? void 0 : e.instancePath) || '/'}: ${e === null || e === void 0 ? void 0 : e.message}`).join('\n');
38
+ console.error(`Manifest validation failed for ${manifestPath}:\n${errs}`);
39
+ console.error(`Suggestions: ensure 'version' is a valid semver (e.g. 0.1.0), or run 'bdk apps:version <source> --set 0.1.0'. To skip validation: use '--no-validate'.`);
38
40
  process.exit(2);
39
41
  }
40
42
  }
@@ -4,15 +4,16 @@ exports.registerTest = registerTest;
4
4
  const child_process_1 = require("child_process");
5
5
  function registerTest(program) {
6
6
  program
7
- .command('test')
7
+ .command('test [source]')
8
8
  .alias('apps:test')
9
9
  .description('Run unit and integration tests')
10
10
  .option('--watch', 're-run tests on file changes', false)
11
11
  .option('--coverage', 'generate coverage report', false)
12
- .action((opts) => {
12
+ .action((sourceArg, opts) => {
13
+ const cwd = require('path').resolve(process.cwd(), sourceArg || '.');
13
14
  const hasPkg = (() => {
14
15
  try {
15
- const p = require(process.cwd() + '/package.json');
16
+ const p = require(cwd + '/package.json');
16
17
  return !!p.scripts && (p.scripts.test || p.scripts['test:watch']);
17
18
  }
18
19
  catch (e) {
@@ -25,15 +25,15 @@ function bumpVersion(v, level) {
25
25
  }
26
26
  function registerVersion(program) {
27
27
  program
28
- .command('version')
28
+ .command('version [source]')
29
29
  .alias('apps:version')
30
30
  .description('Show or bump app version')
31
31
  .option('--bump <level>', 'patch|minor|major')
32
32
  .option('--set <version>', 'set exact version')
33
- .action((opts) => {
34
- const manifestPath = path_1.default.resolve(process.cwd(), 'manifest.json');
33
+ .action((sourceArg, opts) => {
34
+ const manifestPath = path_1.default.resolve(process.cwd(), sourceArg || '.', 'manifest.json');
35
35
  if (!fs_1.default.existsSync(manifestPath)) {
36
- console.error('manifest.json not found in current directory.');
36
+ console.error('manifest.json not found at', manifestPath);
37
37
  process.exit(1);
38
38
  }
39
39
  const manifest = JSON.parse(fs_1.default.readFileSync(manifestPath, 'utf8'));
@@ -38,6 +38,6 @@ async function validatePkg(appPath) {
38
38
  const valid = validate(manifest);
39
39
  if (!valid) {
40
40
  const errs = (validate.errors || []).map((e) => `${(e === null || e === void 0 ? void 0 : e.instancePath) || '/'}: ${e === null || e === void 0 ? void 0 : e.message}`).join('\n');
41
- throw new Error(`Validation errors:\n${errs}`);
41
+ throw new Error(`Validation errors in ${manifestPath}:\n${errs}`);
42
42
  }
43
43
  }
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "test-bdk-cli",
3
- "version": "0.1.10",
3
+ "version": "0.1.13",
4
4
  "description": "test CLI",
5
5
  "author": "@raisulaslam",
6
6
  "bin": {
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "sample-react-app",
3
+ "version": "0.1.0",
4
+ "description": "Sample React app scaffolded by bdk",
5
+ "scripts": {
6
+ "start": "echo \"No start script defined\" && exit 0",
7
+ "build": "echo \"No build script defined\" && exit 0",
8
+ "test": "echo \"No tests defined\" && exit 0"
9
+ },
10
+ "author": "",
11
+ "license": "MIT"
12
+ }