test-bdk-cli 0.1.14 → 0.1.16

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/README.md CHANGED
@@ -1,3 +1,3 @@
1
- # React template
1
+ # App template
2
2
 
3
- This is a minimal React template for BoldDesk apps. Use `bdk create my-app --template react` to scaffold.
3
+ This is a minimal template for apps. Use `bdk apps:new my-app` to scaffold.
@@ -17,7 +17,7 @@ function registerCreate(program) {
17
17
  program
18
18
  .command('apps:new [appDirectories...]')
19
19
  .description('Scaffold one or more new app projects (usage: apps:new ./appName)')
20
- .option('--template <template>', 'template name', 'react')
20
+ .option('--template <template>', 'template name', 'default')
21
21
  .option('--path <dir>', 'base path for created directories', '.')
22
22
  .option('--force', 'overwrite if exists', false)
23
23
  .option('--git', 'initialize a git repository', false)
@@ -55,7 +55,7 @@ function registerCreate(program) {
55
55
  }
56
56
  appDirectories = collected.length ? collected : ['.'];
57
57
  }
58
- const template = opts.template || 'react';
58
+ const template = opts.template || 'default';
59
59
  const basePath = path_1.default.resolve(opts.path || '.');
60
60
  // flatten nested array if commander wrapped variadic into single array
61
61
  if (Array.isArray(appDirectories) && appDirectories.length === 1 && Array.isArray(appDirectories[0])) {
@@ -160,8 +160,22 @@ function registerCreate(program) {
160
160
  if (!fs_1.default.existsSync(manifestPath)) {
161
161
  const defaultManifest = {
162
162
  name: appName,
163
- version: '0.1.0',
164
- author: '',
163
+ author: {
164
+ name: '',
165
+ email: ''
166
+ },
167
+ defaultLocale: 'en',
168
+ private: true,
169
+ location: {
170
+ support: {
171
+ ticket_sidebar: {
172
+ url: 'assets/iframe.html',
173
+ flexible: true
174
+ }
175
+ }
176
+ },
177
+ version: '1.0.0',
178
+ frameworkVersion: '2.0',
165
179
  description: '',
166
180
  main: 'dist/index.html',
167
181
  permissions: []
@@ -10,10 +10,17 @@ function registerTest(program) {
10
10
  .option('--watch', 're-run tests on file changes', false)
11
11
  .option('--coverage', 'generate coverage report', false)
12
12
  .action((sourceArg, opts) => {
13
- const cwd = require('path').resolve(process.cwd(), sourceArg || '.');
13
+ const path = require('path');
14
+ const fs = require('fs');
15
+ const cwd = path.resolve(process.cwd(), sourceArg || '.');
16
+ // Check if package.json exists and has test script
17
+ const pkgPath = path.join(cwd, 'package.json');
14
18
  const hasPkg = (() => {
15
19
  try {
16
- const p = require(cwd + '/package.json');
20
+ if (!fs.existsSync(pkgPath)) {
21
+ return false;
22
+ }
23
+ const p = require(pkgPath);
17
24
  return !!p.scripts && (p.scripts.test || p.scripts['test:watch']);
18
25
  }
19
26
  catch (e) {
@@ -28,7 +35,7 @@ function registerTest(program) {
28
35
  // prefer npm run test -- --watch if available
29
36
  try {
30
37
  console.log('Running tests in watch mode...');
31
- const child = (0, child_process_1.spawn)('npm', ['run', 'test', '--', '--watch'], { stdio: 'inherit', cwd: process.cwd(), shell: true });
38
+ const child = (0, child_process_1.spawn)('npm', ['run', 'test', '--', '--watch'], { stdio: 'inherit', cwd: cwd, shell: true });
32
39
  child.on('exit', (code) => process.exit(code || 0));
33
40
  }
34
41
  catch (e) {
@@ -44,7 +51,7 @@ function registerTest(program) {
44
51
  args.push('--', '--coverage');
45
52
  }
46
53
  console.log('Running tests...');
47
- (0, child_process_1.execSync)('npm ' + args.join(' '), { stdio: 'inherit', cwd: process.cwd() });
54
+ (0, child_process_1.execSync)('npm ' + args.join(' '), { stdio: 'inherit', cwd: cwd });
48
55
  }
49
56
  catch (e) {
50
57
  console.error('Tests failed.');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "test-bdk-cli",
3
- "version": "0.1.14",
3
+ "version": "0.1.16",
4
4
  "description": "test CLI",
5
5
  "author": "@raisulaslam",
6
6
  "bin": {
@@ -0,0 +1,14 @@
1
+ # App name
2
+
3
+ [brief description of the app]
4
+
5
+ ### The following information is displayed:
6
+
7
+ * info1
8
+ * info2
9
+ * info3
10
+
11
+ Please submit bug reports to [Insert Link](). Pull requests are welcome.
12
+
13
+ ### Screenshot(s):
14
+ [put your screenshots down here.]
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "sample-react-app",
2
+ "name": "sample-app",
3
3
  "author": {
4
4
  "name": "Your Name",
5
5
  "email": ""
@@ -16,7 +16,7 @@
16
16
  },
17
17
  "version": "1.0.0",
18
18
  "frameworkVersion": "2.0",
19
- "description": "A sample React BoldDesk app",
19
+ "description": "A sample Node.js BoldDesk app",
20
20
  "main": "dist/index.html",
21
21
  "permissions": []
22
22
  }
@@ -1,7 +1,7 @@
1
1
  {
2
- "name": "sample-react-app",
2
+ "name": "sample-app",
3
3
  "version": "0.1.0",
4
- "description": "Sample React app scaffolded by bdk",
4
+ "description": "Sample app scaffolded by bdk",
5
5
  "scripts": {
6
6
  "start": "echo \"No start script defined\" && exit 0",
7
7
  "build": "echo \"No build script defined\" && exit 0",
Binary file
@@ -1,3 +0,0 @@
1
- # React template
2
-
3
- This is a minimal sample React template for `bdk apps:new --template react`.
File without changes
File without changes