create-powerapps-project 0.21.1 → 0.21.2

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/lib/index.js CHANGED
@@ -1,18 +1,13 @@
1
1
  #!/usr/bin/env node
2
- "use strict";
3
- var __importDefault = (this && this.__importDefault) || function (mod) {
4
- return (mod && mod.__esModule) ? mod : { "default": mod };
5
- };
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- const node_path_1 = __importDefault(require("node:path"));
8
- const plop_1 = require("plop");
9
- plop_1.Plop.launch({
2
+ import path from 'node:path';
3
+ import { Plop, run } from 'plop';
4
+ Plop.launch({
10
5
  cwd: process.cwd(),
11
- configPath: node_path_1.default.join(__dirname, 'plopfile.js')
6
+ configPath: path.join(__dirname, 'plopfile.js')
12
7
  }, env => {
13
8
  const options = {
14
9
  ...env,
15
10
  dest: process.cwd() // this will make the destination path to be based on the cwd when calling the wrapper
16
11
  };
17
- return (0, plop_1.run)(options, undefined, true);
12
+ return run(options, undefined, true);
18
13
  });
package/lib/nuget.js CHANGED
@@ -1,14 +1,8 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.install = exports.getNugetPackageVersions = void 0;
7
- const https_1 = __importDefault(require("https"));
8
- const child_process_1 = require("child_process");
9
- const getNugetPackageVersions = (name) => {
1
+ import https from 'https';
2
+ import { spawnSync } from 'child_process';
3
+ export const getNugetPackageVersions = (name) => {
10
4
  return new Promise((resolve, reject) => {
11
- https_1.default.get(`https://azuresearch-usnc.nuget.org/query?q=packageid:${name}`, (response) => {
5
+ https.get(`https://azuresearch-usnc.nuget.org/query?q=packageid:${name}`, (response) => {
12
6
  let body = '';
13
7
  response.on('data', (d) => {
14
8
  body += d;
@@ -25,32 +19,30 @@ const getNugetPackageVersions = (name) => {
25
19
  });
26
20
  });
27
21
  };
28
- exports.getNugetPackageVersions = getNugetPackageVersions;
29
- const install = (project, sdkVersion, xrmVersion) => {
22
+ export const install = (project, sdkVersion, xrmVersion) => {
30
23
  // Add solution
31
- (0, child_process_1.spawnSync)('dotnet', ['new', 'sln', '-n', project], {
24
+ spawnSync('dotnet', ['new', 'sln', '-n', project], {
32
25
  cwd: process.cwd(),
33
26
  stdio: 'inherit'
34
27
  });
35
- (0, child_process_1.spawnSync)('dotnet', ['sln', 'add', `${project}.csproj`], {
28
+ spawnSync('dotnet', ['sln', 'add', `${project}.csproj`], {
36
29
  cwd: process.cwd(),
37
30
  stdio: 'inherit'
38
31
  });
39
32
  // Install nuget packages
40
- (0, child_process_1.spawnSync)('dotnet', ['add', 'package', 'Microsoft.CrmSdk.Workflow', '-v', sdkVersion, '-n'], {
33
+ spawnSync('dotnet', ['add', 'package', 'Microsoft.CrmSdk.Workflow', '-v', sdkVersion, '-n'], {
41
34
  cwd: process.cwd(),
42
35
  stdio: 'inherit'
43
36
  });
44
- (0, child_process_1.spawnSync)('dotnet', ['add', 'package', 'JourneyTeam.Xrm', '-v', xrmVersion, '-n'], {
37
+ spawnSync('dotnet', ['add', 'package', 'JourneyTeam.Xrm', '-v', xrmVersion, '-n'], {
45
38
  cwd: process.cwd(),
46
39
  stdio: 'inherit'
47
40
  });
48
41
  if (process.env.JEST_WORKER_ID !== undefined) {
49
42
  return;
50
43
  }
51
- (0, child_process_1.spawnSync)('dotnet', ['restore'], {
44
+ spawnSync('dotnet', ['restore'], {
52
45
  cwd: process.cwd(),
53
46
  stdio: 'inherit'
54
47
  });
55
48
  };
56
- exports.install = install;
@@ -1,24 +1,20 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.install = void 0;
4
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
5
- const child_process_1 = require("child_process");
6
- const install = (cwd, type, packageManager) => {
2
+ import { spawnSync } from 'child_process';
3
+ export const install = (cwd, type, packageManager) => {
7
4
  if (process.env.JEST_WORKER_ID != undefined) {
8
5
  return;
9
6
  }
10
7
  if (type === 'pcf') {
11
- (0, child_process_1.spawnSync)(packageManager, ['install'], { stdio: 'inherit', shell: true });
8
+ spawnSync(packageManager, ['install'], { stdio: 'inherit', shell: true });
12
9
  }
13
10
  else {
14
11
  const packages = getPackages(type);
15
- (0, child_process_1.spawnSync)(packageManager, ['add', ...packages.devDependencies], { stdio: 'inherit', shell: true });
12
+ spawnSync(packageManager, ['add', ...packages.devDependencies], { stdio: 'inherit', shell: true });
16
13
  if (packages.dependencies) {
17
- (0, child_process_1.spawnSync)(packageManager, ['add', ...packages.dependencies], { stdio: 'inherit', shell: true });
14
+ spawnSync(packageManager, ['add', ...packages.dependencies], { stdio: 'inherit', shell: true });
18
15
  }
19
16
  }
20
17
  };
21
- exports.install = install;
22
18
  function getPackages(type) {
23
19
  const packages = {
24
20
  devDependencies: [
package/lib/plopfile.js CHANGED
@@ -1,41 +1,13 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- const path_1 = __importDefault(require("path"));
30
- const child_process_1 = require("child_process");
31
- const fs_1 = __importDefault(require("fs"));
32
- const nuget = __importStar(require("./nuget"));
33
- const pkg = __importStar(require("./packageManager"));
1
+ import path from 'path';
2
+ import { spawn } from 'child_process';
3
+ import fs from 'fs';
4
+ import * as nuget from './nuget';
5
+ import * as pkg from './packageManager';
34
6
  const didSucceed = (code) => `${code}` === '0';
35
7
  // eslint-disable-next-line @typescript-eslint/no-var-requires
36
8
  const version = require('../package').version;
37
9
  /* eslint-disable @typescript-eslint/no-explicit-any */
38
- exports.default = (plop) => {
10
+ export default (plop) => {
39
11
  plop.setWelcomeMessage(`Creating new Dataverse project using create-powerapps-project v${version}. Please choose type of project to create.`);
40
12
  const packageQuestion = {
41
13
  type: 'list',
@@ -67,11 +39,11 @@ exports.default = (plop) => {
67
39
  }
68
40
  ];
69
41
  plop.setActionType('addScript', async (answers) => {
70
- const packagePath = path_1.default.resolve(process.cwd(), 'package.json');
42
+ const packagePath = path.resolve(process.cwd(), 'package.json');
71
43
  // eslint-disable-next-line @typescript-eslint/no-var-requires
72
44
  const packageJson = require(packagePath);
73
45
  packageJson.scripts[answers.scriptKey] = answers.scriptValue;
74
- await fs_1.default.promises.writeFile(packagePath, JSON.stringify(packageJson, null, 4), 'utf8');
46
+ await fs.promises.writeFile(packagePath, JSON.stringify(packageJson, null, 4), 'utf8');
75
47
  return `added ${answers.scriptKey} script to package.json`;
76
48
  });
77
49
  plop.setActionType('npmInstall', (answers) => {
@@ -131,7 +103,7 @@ exports.default = (plop) => {
131
103
  {
132
104
  type: 'add',
133
105
  templateFile: '../plop-templates/assembly/assembly.csproj.hbs',
134
- path: path_1.default.resolve(process.cwd(), '{{name}}.csproj'),
106
+ path: path.resolve(process.cwd(), '{{name}}.csproj'),
135
107
  },
136
108
  {
137
109
  type: 'addMany',
@@ -149,13 +121,13 @@ exports.default = (plop) => {
149
121
  force: true
150
122
  },
151
123
  (answers) => {
152
- const keyPath = path_1.default.resolve(process.cwd(), `${answers.name}.snk`);
124
+ const keyPath = path.resolve(process.cwd(), `${answers.name}.snk`);
153
125
  return new Promise((resolve, reject) => {
154
126
  if (process.env.JEST_WORKER_ID !== undefined) {
155
127
  resolve('Testing so no need to sign');
156
128
  }
157
129
  else {
158
- const sign = (0, child_process_1.spawn)(path_1.default.resolve(__dirname, '..', 'bin', 'sn.exe'), ['-q', '-k', keyPath], { stdio: 'inherit' });
130
+ const sign = spawn(path.resolve(__dirname, '..', 'bin', 'sn.exe'), ['-q', '-k', keyPath], { stdio: 'inherit' });
159
131
  sign.on('close', (code) => {
160
132
  if (didSucceed(code)) {
161
133
  resolve('signed assembly');
@@ -227,7 +199,7 @@ exports.default = (plop) => {
227
199
  args.push('-npm', 'true');
228
200
  }
229
201
  return new Promise((resolve, reject) => {
230
- const pac = (0, child_process_1.spawn)('pac', args, { stdio: 'inherit' });
202
+ const pac = spawn('pac', args, { stdio: 'inherit' });
231
203
  pac.on('close', (code) => {
232
204
  if (didSucceed(code)) {
233
205
  resolve('pcf project created');
@@ -244,7 +216,7 @@ exports.default = (plop) => {
244
216
  {
245
217
  type: 'add',
246
218
  templateFile: '../plop-templates/pcf/tsconfig.json',
247
- path: path_1.default.resolve(process.cwd(), 'tsconfig.json'),
219
+ path: path.resolve(process.cwd(), 'tsconfig.json'),
248
220
  force: true
249
221
  },
250
222
  {
@@ -288,7 +260,7 @@ exports.default = (plop) => {
288
260
  }
289
261
  },
290
262
  async (answers) => {
291
- await fs_1.default.promises.rm(path_1.default.resolve(process.cwd(), answers.name, 'HelloWorld.tsx'));
263
+ await fs.promises.rm(path.resolve(process.cwd(), answers.name, 'HelloWorld.tsx'));
292
264
  return 'removed HelloWorld component';
293
265
  },
294
266
  {
@@ -311,7 +283,7 @@ exports.default = (plop) => {
311
283
  type: 'input',
312
284
  name: 'name',
313
285
  message: 'project name',
314
- default: path_1.default.basename(process.cwd())
286
+ default: path.basename(process.cwd())
315
287
  },
316
288
  {
317
289
  type: 'input',
package/package.json CHANGED
@@ -1,9 +1,8 @@
1
1
  {
2
2
  "name": "create-powerapps-project",
3
3
  "description": "💧 plop generator for Dataverse development",
4
- "version": "0.21.1",
4
+ "version": "0.21.2",
5
5
  "license": "MIT",
6
- "type": "commonjs",
7
6
  "main": "lib/index.js",
8
7
  "bin": {
9
8
  "create-powerapps-project": "lib/index.js"
@@ -26,7 +25,6 @@
26
25
  "plop": "^2.7.6"
27
26
  },
28
27
  "devDependencies": {
29
- "@types/node": "^14.14.21",
30
- "node-plop": "^0.26.3"
28
+ "@types/node": "^14.14.21"
31
29
  }
32
30
  }
@@ -3,6 +3,7 @@ module.exports = {
3
3
  parser: '@typescript-eslint/parser',
4
4
  plugins: [
5
5
  '@typescript-eslint',
6
+ "@microsoft/power-apps"
6
7
  ],
7
8
  extends: [
8
9
  'eslint:recommended',