create-powerapps-project 0.16.2 → 0.16.3

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/CHANGELOG.json CHANGED
@@ -2,7 +2,22 @@
2
2
  "name": "create-powerapps-project",
3
3
  "entries": [
4
4
  {
5
- "date": "Tue, 08 Feb 2022 18:47:00 GMT",
5
+ "date": "Wed, 09 Feb 2022 16:18:47 GMT",
6
+ "tag": "create-powerapps-project_v0.16.3",
7
+ "version": "0.16.3",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "derek.finlinson@journeyteam.com",
12
+ "package": "create-powerapps-project",
13
+ "commit": "cdab4698564ece9f40c5a45327a38270a6d1c16d",
14
+ "comment": "Catch errors on commands"
15
+ }
16
+ ]
17
+ }
18
+ },
19
+ {
20
+ "date": "Tue, 08 Feb 2022 18:47:13 GMT",
6
21
  "tag": "create-powerapps-project_v0.16.2",
7
22
  "version": "0.16.2",
8
23
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,17 +1,25 @@
1
1
  # Change Log - create-powerapps-project
2
2
 
3
- This log was last generated on Tue, 08 Feb 2022 18:47:00 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 09 Feb 2022 16:18:47 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
- ## 0.16.2
7
+ ## 0.16.3
8
8
 
9
- Tue, 08 Feb 2022 18:47:00 GMT
9
+ Wed, 09 Feb 2022 16:18:47 GMT
10
10
 
11
11
  ### Patches
12
12
 
13
- - Update symbols (derek.finlinson@journeyteam.com)
13
+ - Catch errors on commands (derek.finlinson@journeyteam.com)
14
14
 
15
+ ## 0.16.2
16
+
17
+ Tue, 08 Feb 2022 18:47:13 GMT
18
+
19
+ ### Patches
20
+
21
+ - Update symbols (derek.finlinson@journeyteam.com)
22
+
15
23
  ## 0.16.1
16
24
 
17
25
  Tue, 08 Feb 2022 18:13:53 GMT
@@ -54,10 +54,18 @@ exports.default = async (type) => {
54
54
  const xrmVersions = await (0, nuget_1.getNugetPackageVersions)('JourneyTeam.Xrm');
55
55
  config.xrmVersion = xrmVersions.shift();
56
56
  }
57
- logger_1.logger.info('get plop generator');
57
+ else if (type === 'webresource') {
58
+ config.name = name;
59
+ }
58
60
  const generator = await (0, plop_1.getGenerator)(type, name);
59
61
  logger_1.logger.info(`run powerapps-project-${type} code generator`);
60
- await (0, plop_1.runGenerator)(generator, config);
62
+ try {
63
+ await (0, plop_1.runGenerator)(generator, config);
64
+ }
65
+ catch (ex) {
66
+ logger_1.logger.error(ex.message);
67
+ return;
68
+ }
61
69
  logger_1.logger.info('initialize project');
62
70
  if (type !== 'pcf' || config.react) {
63
71
  pkg.install(process.cwd(), type);
package/lib/logger.js CHANGED
@@ -30,7 +30,7 @@ exports.logger = {
30
30
  },
31
31
  done(...args) {
32
32
  if (!isTest) {
33
- console.info(exports.icons.info, ...args);
33
+ console.info(exports.icons.done, ...args);
34
34
  }
35
35
  },
36
36
  };
package/lib/plop.js CHANGED
@@ -21,11 +21,11 @@ exports.getGenerator = getGenerator;
21
21
  const runGenerator = async (generator, args) => {
22
22
  const results = await generator.runActions(args, {
23
23
  onComment: (comment) => {
24
- logger_1.logger.done(comment);
24
+ logger_1.logger.info(comment);
25
25
  }
26
26
  });
27
27
  if (results.failures && results.failures.length > 0) {
28
- throw new Error('Error: ' + results.failures[0].error);
28
+ throw new Error(results.failures[0].error);
29
29
  }
30
30
  // do something after the actions have run
31
31
  for (const change of results.changes) {
package/lib/plopfile.js CHANGED
@@ -6,13 +6,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const path_1 = __importDefault(require("path"));
7
7
  const child_process_1 = require("child_process");
8
8
  const fs_1 = __importDefault(require("fs"));
9
+ const didSucceed = (code) => `${code}` === '0';
9
10
  /* eslint-disable @typescript-eslint/no-explicit-any */
10
11
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
11
12
  exports.default = (plop) => {
12
13
  plop.setActionType('signAssembly', (answers) => {
13
14
  const keyPath = path_1.default.resolve(process.cwd(), `${answers.name}.snk`);
14
- (0, child_process_1.spawnSync)(path_1.default.resolve(__dirname, '../', 'bin', 'sn.exe'), ['-q', '-k', keyPath], { stdio: 'inherit' });
15
- return 'signed assembly';
15
+ return new Promise((resolve, reject) => {
16
+ if (process.env.JEST_WORKER_ID !== undefined) {
17
+ resolve('Testing so no need to sign');
18
+ }
19
+ const sign = (0, child_process_1.spawn)(path_1.default.resolve(__dirname, '../', 'bin', 'sn.exe'), ['-q', '-k', keyPath], { stdio: 'inherit' });
20
+ sign.on('close', (code) => {
21
+ if (didSucceed(code)) {
22
+ resolve('signed assembly');
23
+ }
24
+ else {
25
+ reject('Failed to sign assembly');
26
+ }
27
+ });
28
+ });
16
29
  });
17
30
  plop.setActionType('runPcf', (answers) => {
18
31
  const args = ['pcf', 'init', '-ns', answers.namespace, '-n', answers.name, '-t', answers.template];
@@ -23,15 +36,24 @@ exports.default = (plop) => {
23
36
  if (process.env.JEST_WORKER_ID !== undefined) {
24
37
  args.push('-npm', 'false');
25
38
  }
26
- (0, child_process_1.spawnSync)('pac', args, { stdio: 'inherit' });
27
- return 'pcf project created';
39
+ return new Promise((resolve, reject) => {
40
+ const pac = (0, child_process_1.spawn)('pac', args, { stdio: 'inherit' });
41
+ pac.on('close', (code) => {
42
+ if (didSucceed(code)) {
43
+ resolve('pcf project created');
44
+ }
45
+ else {
46
+ reject('Ensure the Power Platform CLI is installed. Command must be run from within VS Code if using the Power Platform Extension');
47
+ }
48
+ });
49
+ });
28
50
  });
29
- plop.setActionType('addGenScript', () => {
51
+ plop.setActionType('addGenScript', async () => {
30
52
  const packagePath = path_1.default.resolve(process.cwd(), 'package.json');
31
53
  // eslint-disable-next-line @typescript-eslint/no-var-requires
32
54
  const packageJson = require(packagePath);
33
55
  packageJson.scripts.gen = 'plop';
34
- fs_1.default.writeFileSync(packagePath, JSON.stringify(packageJson, null, 4), 'utf8');
56
+ await fs_1.default.promises.writeFile(packagePath, JSON.stringify(packageJson, null, 4), 'utf8');
35
57
  return 'added plop script to package.json';
36
58
  });
37
59
  plop.setGenerator('webresource', {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-powerapps-project",
3
3
  "description": "💧 plop generator for Dataverse development",
4
- "version": "0.16.2",
4
+ "version": "0.16.3",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",
7
7
  "bin": {