create-powerapps-project 0.21.2 → 0.23.0

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,13 +1,27 @@
1
1
  #!/usr/bin/env node
2
- import path from 'node:path';
3
- import { Plop, run } from 'plop';
4
- Plop.launch({
5
- cwd: process.cwd(),
6
- configPath: path.join(__dirname, 'plopfile.js')
7
- }, env => {
8
- const options = {
9
- ...env,
10
- dest: process.cwd() // this will make the destination path to be based on the cwd when calling the wrapper
11
- };
12
- return run(options, undefined, true);
13
- });
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
+ const minimist_1 = __importDefault(require("minimist"));
10
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
11
+ const packageJson = require('../package.json');
12
+ const argv = (0, minimist_1.default)(process.argv.slice(2));
13
+ if (argv.version || argv.v) {
14
+ console.log(`${packageJson.version}`);
15
+ }
16
+ else {
17
+ plop_1.Plop.launch({
18
+ cwd: process.cwd(),
19
+ configPath: node_path_1.default.join(__dirname, 'plopfile.js')
20
+ }, env => {
21
+ const options = {
22
+ ...env,
23
+ dest: process.cwd()
24
+ };
25
+ return (0, plop_1.run)(options, undefined, true);
26
+ });
27
+ }
package/lib/nuget.js CHANGED
@@ -1,48 +1,41 @@
1
- import https from 'https';
2
- import { spawnSync } from 'child_process';
3
- export const getNugetPackageVersions = (name) => {
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.nugetRestore = exports.getNugetPackageVersions = void 0;
7
+ const https_1 = __importDefault(require("https"));
8
+ const child_process_1 = require("child_process");
9
+ const getNugetPackageVersions = (name) => {
4
10
  return new Promise((resolve, reject) => {
5
- https.get(`https://azuresearch-usnc.nuget.org/query?q=packageid:${name}`, (response) => {
11
+ https_1.default.get(`https://azuresearch-usnc.nuget.org/query?q=packageid:${name}`, (response) => {
6
12
  let body = '';
7
13
  response.on('data', (d) => {
8
14
  body += d;
9
15
  });
10
16
  response.on('end', () => {
11
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
12
- const versions = JSON.parse(body).data[0].versions.map((v) => {
13
- return v.version;
14
- }).reverse();
15
- resolve(versions);
17
+ const result = JSON.parse(body);
18
+ if (result.data.length > 0) {
19
+ const versions = result.data[0].versions.map((v) => {
20
+ return v.version;
21
+ }).reverse();
22
+ resolve(versions);
23
+ }
24
+ else {
25
+ reject(`package ${name} not found`);
26
+ }
16
27
  });
17
28
  }).on('error', (e) => {
18
29
  reject(e);
19
30
  });
20
31
  });
21
32
  };
22
- export const install = (project, sdkVersion, xrmVersion) => {
23
- // Add solution
24
- spawnSync('dotnet', ['new', 'sln', '-n', project], {
25
- cwd: process.cwd(),
26
- stdio: 'inherit'
27
- });
28
- spawnSync('dotnet', ['sln', 'add', `${project}.csproj`], {
29
- cwd: process.cwd(),
30
- stdio: 'inherit'
31
- });
33
+ exports.getNugetPackageVersions = getNugetPackageVersions;
34
+ const nugetRestore = async () => {
32
35
  // Install nuget packages
33
- spawnSync('dotnet', ['add', 'package', 'Microsoft.CrmSdk.Workflow', '-v', sdkVersion, '-n'], {
34
- cwd: process.cwd(),
35
- stdio: 'inherit'
36
- });
37
- spawnSync('dotnet', ['add', 'package', 'JourneyTeam.Xrm', '-v', xrmVersion, '-n'], {
38
- cwd: process.cwd(),
39
- stdio: 'inherit'
40
- });
41
36
  if (process.env.JEST_WORKER_ID !== undefined) {
42
37
  return;
43
38
  }
44
- spawnSync('dotnet', ['restore'], {
45
- cwd: process.cwd(),
46
- stdio: 'inherit'
47
- });
39
+ (0, child_process_1.spawnSync)('dotnet', ['restore'], { cwd: process.cwd(), stdio: 'inherit' });
48
40
  };
41
+ exports.nugetRestore = nugetRestore;
@@ -1,51 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.install = void 0;
1
4
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
- import { spawnSync } from 'child_process';
3
- export const install = (cwd, type, packageManager) => {
5
+ const child_process_1 = require("child_process");
6
+ const install = async (packageManager, packages) => {
4
7
  if (process.env.JEST_WORKER_ID != undefined) {
5
8
  return;
6
9
  }
7
- if (type === 'pcf') {
8
- spawnSync(packageManager, ['install'], { stdio: 'inherit', shell: true });
9
- }
10
- else {
11
- const packages = getPackages(type);
12
- spawnSync(packageManager, ['add', ...packages.devDependencies], { stdio: 'inherit', shell: true });
10
+ if (packages) {
11
+ if (packages.devDependencies) {
12
+ (0, child_process_1.spawnSync)(packageManager, ['add', ...packages.devDependencies], { stdio: 'inherit', shell: true });
13
+ }
13
14
  if (packages.dependencies) {
14
- spawnSync(packageManager, ['add', ...packages.dependencies], { stdio: 'inherit', shell: true });
15
+ (0, child_process_1.spawnSync)(packageManager, ['add', ...packages.dependencies], { stdio: 'inherit', shell: true });
15
16
  }
16
17
  }
17
- };
18
- function getPackages(type) {
19
- const packages = {
20
- devDependencies: [
21
- `powerapps-project-${type}`,
22
- 'dataverse-utils'
23
- ]
24
- };
25
- if (type === 'webresource') {
26
- packages.devDependencies = [
27
- ...packages.devDependencies,
28
- '@types/xrm',
29
- 'typescript',
30
- 'eslint',
31
- '@typescript-eslint/eslint-plugin',
32
- '@typescript-eslint/parser',
33
- 'webpack-event-plugin',
34
- 'clean-webpack-plugin',
35
- 'source-map-loader',
36
- 'babel-loader',
37
- 'ts-loader',
38
- '@babel/core',
39
- '@babel/preset-env',
40
- '@babel/preset-typescript',
41
- 'xrm-mock',
42
- 'webpack',
43
- 'webpack-cli',
44
- 'cross-spawn',
45
- 'ts-node',
46
- '-D'
47
- ];
48
- packages.dependencies = ['core-js', 'regenerator-runtime', 'powerapps-common', 'dataverse-webapi'];
18
+ else {
19
+ (0, child_process_1.spawnSync)(packageManager, ['install'], { stdio: 'inherit', shell: true });
49
20
  }
50
- return packages;
51
- }
21
+ };
22
+ exports.install = install;
@@ -0,0 +1,108 @@
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"));
34
+ const didSucceed = (code) => `${code}` === '0';
35
+ exports.default = (plop) => {
36
+ plop.setDefaultInclude({ actionTypes: true });
37
+ plop.setActionType('addSolution', async (answers) => {
38
+ // Add solution
39
+ (0, child_process_1.spawnSync)('dotnet', ['new', 'sln', '-n', answers.name], { cwd: process.cwd(), stdio: 'inherit' });
40
+ (0, child_process_1.spawnSync)('dotnet', ['sln', 'add', `${answers.name}.csproj`], { cwd: process.cwd(), stdio: 'inherit' });
41
+ return 'added dotnet solution';
42
+ });
43
+ plop.setActionType('addScript', async (answers) => {
44
+ const packagePath = path_1.default.resolve(process.cwd(), 'package.json');
45
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
46
+ const packageJson = require(packagePath);
47
+ packageJson.scripts[answers.scriptKey] = answers.scriptValue;
48
+ await fs_1.default.promises.writeFile(packagePath, JSON.stringify(packageJson, null, 4), 'utf8');
49
+ return `added ${answers.scriptKey} script to package.json`;
50
+ });
51
+ plop.setActionType('npmInstall', async (answers) => {
52
+ await pkg.install(answers.package, answers.packages);
53
+ return 'installed npm packages';
54
+ });
55
+ plop.setActionType('nugetRestore', async () => {
56
+ await nuget.nugetRestore();
57
+ return 'restored nuget packages';
58
+ });
59
+ plop.setActionType('signAssembly', async (answers) => {
60
+ const keyPath = path_1.default.resolve(process.cwd(), `${answers.name}.snk`);
61
+ return new Promise((resolve, reject) => {
62
+ if (process.env.JEST_WORKER_ID !== undefined) {
63
+ resolve('Testing so no need to sign');
64
+ }
65
+ else {
66
+ const sign = (0, child_process_1.spawn)(path_1.default.resolve(__dirname, '..', 'bin', 'sn.exe'), ['-q', '-k', keyPath], { stdio: 'inherit' });
67
+ sign.on('close', (code) => {
68
+ if (didSucceed(code)) {
69
+ resolve('signed assembly');
70
+ }
71
+ else {
72
+ reject('failed to sign assembly');
73
+ }
74
+ });
75
+ sign.on('error', () => {
76
+ reject('failed to sign assembly');
77
+ });
78
+ }
79
+ });
80
+ });
81
+ plop.setActionType('runPcf', async (answers) => {
82
+ const args = ['pcf', 'init', '-ns', answers.namespace, '-n', answers.name, '-t', answers.template];
83
+ // Set framework to React if selected
84
+ if (answers.react) {
85
+ args.push('-fw', 'react');
86
+ }
87
+ if (process.env.JEST_WORKER_ID !== undefined || answers.package !== 'npm') {
88
+ args.push('-npm', 'false');
89
+ }
90
+ else {
91
+ args.push('-npm', 'true');
92
+ }
93
+ return new Promise((resolve, reject) => {
94
+ const pac = (0, child_process_1.spawn)('pac', args, { stdio: 'inherit' });
95
+ pac.on('close', (code) => {
96
+ if (didSucceed(code)) {
97
+ resolve('pcf project created');
98
+ }
99
+ else {
100
+ reject('Ensure the Power Platform CLI is installed. Command must be run from within Visual Studio Code if using the Power Platform Extension');
101
+ }
102
+ });
103
+ pac.on('error', () => {
104
+ reject('Ensure the Power Platform CLI is installed. Command must be run from within Visual Studio Code if using the Power Platform Extension');
105
+ });
106
+ });
107
+ });
108
+ };
package/lib/plopfile.js CHANGED
@@ -1,14 +1,17 @@
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';
6
- const didSucceed = (code) => `${code}` === '0';
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
+ const path_1 = __importDefault(require("path"));
7
+ const fs_1 = __importDefault(require("fs"));
8
+ const nuget_1 = require("./nuget");
7
9
  // eslint-disable-next-line @typescript-eslint/no-var-requires
8
10
  const version = require('../package').version;
9
11
  /* eslint-disable @typescript-eslint/no-explicit-any */
10
- export default (plop) => {
12
+ exports.default = (plop) => {
11
13
  plop.setWelcomeMessage(`Creating new Dataverse project using create-powerapps-project v${version}. Please choose type of project to create.`);
14
+ plop.load('./plopActions');
12
15
  const packageQuestion = {
13
16
  type: 'list',
14
17
  name: 'package',
@@ -24,7 +27,19 @@ export default (plop) => {
24
27
  {
25
28
  type: 'input',
26
29
  name: 'server',
27
- message: 'enter dataverse url (https://org.crm.dynamics.com):'
30
+ message: 'enter dataverse url (https://org.crm.dynamics.com):',
31
+ validate: (server) => {
32
+ try {
33
+ const url = new URL(server);
34
+ if (url.protocol !== 'https:') {
35
+ return 'server should begin with https';
36
+ }
37
+ return true;
38
+ }
39
+ catch (ex) {
40
+ return 'enter a valid URL';
41
+ }
42
+ }
28
43
  },
29
44
  {
30
45
  type: 'input',
@@ -38,28 +53,49 @@ export default (plop) => {
38
53
  message: 'dataverse solution unique name:'
39
54
  }
40
55
  ];
41
- plop.setActionType('addScript', async (answers) => {
42
- const packagePath = path.resolve(process.cwd(), 'package.json');
43
- // eslint-disable-next-line @typescript-eslint/no-var-requires
44
- const packageJson = require(packagePath);
45
- packageJson.scripts[answers.scriptKey] = answers.scriptValue;
46
- await fs.promises.writeFile(packagePath, JSON.stringify(packageJson, null, 4), 'utf8');
47
- return `added ${answers.scriptKey} script to package.json`;
48
- });
49
- plop.setActionType('npmInstall', (answers) => {
50
- pkg.install(process.cwd(), answers.projectType, answers.package);
51
- return 'installed npm packages';
52
- });
53
56
  plop.setGenerator('assembly', {
54
- description: 'generate dataverse assembly project',
57
+ description: 'generate dataverse plugin or workflow activity project',
55
58
  prompts: [
59
+ {
60
+ type: 'confirm',
61
+ name: 'pluginPackage',
62
+ message: 'use plugin package (preview)?'
63
+ },
64
+ {
65
+ type: 'input',
66
+ name: 'prefix',
67
+ message: 'publisher prefix (no underscore):',
68
+ validate: (prefix) => {
69
+ if (prefix.slice(-1) === '_') {
70
+ return 'enter publisher prefix without the underscore';
71
+ }
72
+ return true;
73
+ },
74
+ when: (answers) => answers.pluginPackage
75
+ },
76
+ {
77
+ type: 'input',
78
+ name: 'author',
79
+ message: 'package author:',
80
+ when: (answers) => answers.pluginPackage
81
+ },
82
+ {
83
+ type: 'input',
84
+ name: 'company',
85
+ message: 'package company:',
86
+ when: (answers) => answers.pluginPackage
87
+ },
56
88
  {
57
89
  type: 'list',
58
90
  name: 'sdkVersion',
59
- message: 'select sdk version',
60
- choices: async () => {
61
- const versions = await nuget.getNugetPackageVersions('Microsoft.CrmSdk.Workflow');
62
- return versions.map(v => ({ name: v, value: v }));
91
+ message: (answers) => {
92
+ const crmPackage = answers.pluginPackage ? 'Microsoft.CrmSdk.CoreAssemblies' : 'Microsoft.CrmSdk.Workflow';
93
+ return `select ${crmPackage} version`;
94
+ },
95
+ choices: async (answers) => {
96
+ const crmPackage = answers.pluginPackage ? 'Microsoft.CrmSdk.CoreAssemblies' : 'Microsoft.CrmSdk.Workflow';
97
+ const versions = await (0, nuget_1.getNugetPackageVersions)(crmPackage);
98
+ return versions;
63
99
  }
64
100
  },
65
101
  {
@@ -100,58 +136,92 @@ export default (plop) => {
100
136
  ...sharedQuestions,
101
137
  ],
102
138
  actions: [
139
+ async (answers) => {
140
+ const xrmVersions = await (0, nuget_1.getNugetPackageVersions)('JourneyTeam.Xrm');
141
+ answers.xrmVersion = xrmVersions.shift();
142
+ return `retrieved latest JourneyTeam.Xrm version ${answers.xrmVersion}`;
143
+ },
103
144
  {
104
145
  type: 'add',
105
146
  templateFile: '../plop-templates/assembly/assembly.csproj.hbs',
106
- path: path.resolve(process.cwd(), '{{name}}.csproj'),
147
+ path: path_1.default.resolve(process.cwd(), '{{name}}.csproj'),
148
+ skip: (answers) => {
149
+ if (answers.pluginPackage) {
150
+ return 'generating plugin package';
151
+ }
152
+ else {
153
+ return;
154
+ }
155
+ }
156
+ },
157
+ {
158
+ type: 'add',
159
+ templateFile: '../plop-templates/assembly/package.csproj.hbs',
160
+ path: path_1.default.resolve(process.cwd(), '{{name}}.csproj'),
161
+ skip: (answers) => {
162
+ if (!answers.pluginPackage) {
163
+ return 'generating regular assembly';
164
+ }
165
+ else {
166
+ return;
167
+ }
168
+ }
169
+ },
170
+ {
171
+ type: 'add',
172
+ templateFile: '../plop-templates/assembly/dataverse.config.json.hbs',
173
+ path: path_1.default.resolve(process.cwd(), 'dataverse.config.json'),
174
+ skip: (answers) => {
175
+ if (answers.pluginPackage) {
176
+ return 'generating plugin package';
177
+ }
178
+ else {
179
+ return;
180
+ }
181
+ }
182
+ },
183
+ {
184
+ type: 'add',
185
+ templateFile: '../plop-templates/assembly/dataverse.package.config.json.hbs',
186
+ path: path_1.default.resolve(process.cwd(), 'dataverse.config.json'),
187
+ skip: (answers) => {
188
+ if (!answers.pluginPackage) {
189
+ return 'generating regular assembly';
190
+ }
191
+ else {
192
+ return;
193
+ }
194
+ }
107
195
  },
108
196
  {
109
197
  type: 'addMany',
110
198
  templateFiles: [
111
- '../plop-templates/assembly/*.json.hbs',
112
- '../plop-templates/assembly/*.js',
113
- '../plop-templates/assembly/*.ts.hbs',
199
+ '../plop-templates/assembly/package.json.hbs',
200
+ '../plop-templates/assembly/plopfile.js',
114
201
  '../plop-templates/assembly/.gitignore',
115
202
  '../plop-templates/assembly/Entities/EarlyBoundGenerator.xml',
116
- '../plop-templates/assembly/.vscode/tasks.json',
203
+ '../plop-templates/assembly/.vscode/tasks.json.hbs',
117
204
  '../plop-templates/assembly/.editorconfig'
118
205
  ],
119
206
  base: '../plop-templates/assembly',
120
207
  destination: process.cwd(),
121
208
  force: true
122
209
  },
123
- (answers) => {
124
- const keyPath = path.resolve(process.cwd(), `${answers.name}.snk`);
125
- return new Promise((resolve, reject) => {
126
- if (process.env.JEST_WORKER_ID !== undefined) {
127
- resolve('Testing so no need to sign');
128
- }
129
- else {
130
- const sign = spawn(path.resolve(__dirname, '..', 'bin', 'sn.exe'), ['-q', '-k', keyPath], { stdio: 'inherit' });
131
- sign.on('close', (code) => {
132
- if (didSucceed(code)) {
133
- resolve('signed assembly');
134
- }
135
- else {
136
- reject('failed to sign assembly');
137
- }
138
- });
139
- sign.on('error', () => {
140
- reject('failed to sign assembly');
141
- });
142
- }
143
- });
210
+ {
211
+ type: 'signAssembly'
144
212
  },
145
- async (answers) => {
146
- const xrmVersions = await nuget.getNugetPackageVersions('JourneyTeam.Xrm');
147
- const xrmVersion = xrmVersions.shift();
148
- nuget.install(answers.name, answers.sdkVersion, xrmVersion);
149
- return 'installed nuget packages';
213
+ {
214
+ type: 'nugetRestore'
150
215
  },
151
216
  {
152
217
  type: 'npmInstall',
153
218
  data: {
154
- projectType: 'assembly'
219
+ packages: {
220
+ devDependencies: [
221
+ 'powerapps-project-assembly',
222
+ 'dataverse-utils'
223
+ ]
224
+ }
155
225
  }
156
226
  }
157
227
  ]
@@ -186,37 +256,13 @@ export default (plop) => {
186
256
  packageQuestion
187
257
  ],
188
258
  actions: [
189
- (answers) => {
190
- const args = ['pcf', 'init', '-ns', answers.namespace, '-n', answers.name, '-t', answers.template];
191
- // Set framework to React if selected
192
- if (answers.react) {
193
- args.push('-fw', 'react');
194
- }
195
- if (process.env.JEST_WORKER_ID !== undefined || answers.package !== 'npm') {
196
- args.push('-npm', 'false');
197
- }
198
- else {
199
- args.push('-npm', 'true');
200
- }
201
- return new Promise((resolve, reject) => {
202
- const pac = spawn('pac', args, { stdio: 'inherit' });
203
- pac.on('close', (code) => {
204
- if (didSucceed(code)) {
205
- resolve('pcf project created');
206
- }
207
- else {
208
- reject('Ensure the Power Platform CLI is installed. Command must be run from within Visual Studio Code if using the Power Platform Extension');
209
- }
210
- });
211
- pac.on('error', () => {
212
- reject('Ensure the Power Platform CLI is installed. Command must be run from within Visual Studio Code if using the Power Platform Extension');
213
- });
214
- });
259
+ {
260
+ type: 'runPcf'
215
261
  },
216
262
  {
217
263
  type: 'add',
218
264
  templateFile: '../plop-templates/pcf/tsconfig.json',
219
- path: path.resolve(process.cwd(), 'tsconfig.json'),
265
+ path: path_1.default.resolve(process.cwd(), 'tsconfig.json'),
220
266
  force: true
221
267
  },
222
268
  {
@@ -260,14 +306,11 @@ export default (plop) => {
260
306
  }
261
307
  },
262
308
  async (answers) => {
263
- await fs.promises.rm(path.resolve(process.cwd(), answers.name, 'HelloWorld.tsx'));
309
+ await fs_1.default.promises.rm(path_1.default.resolve(process.cwd(), answers.name, 'HelloWorld.tsx'));
264
310
  return 'removed HelloWorld component';
265
311
  },
266
312
  {
267
313
  type: 'npmInstall',
268
- data: {
269
- projectType: 'pcf'
270
- },
271
314
  skip: (answers) => {
272
315
  if (answers.package === 'npm') {
273
316
  return 'npm packages already installed';
@@ -283,7 +326,7 @@ export default (plop) => {
283
326
  type: 'input',
284
327
  name: 'name',
285
328
  message: 'project name',
286
- default: path.basename(process.cwd())
329
+ default: path_1.default.basename(process.cwd())
287
330
  },
288
331
  {
289
332
  type: 'input',
@@ -304,7 +347,38 @@ export default (plop) => {
304
347
  {
305
348
  type: 'npmInstall',
306
349
  data: {
307
- projectType: 'webresource'
350
+ packages: {
351
+ devDependencies: [
352
+ 'powerapps-project-webresource',
353
+ 'dataverse-utils',
354
+ '@types/xrm',
355
+ 'typescript',
356
+ 'eslint',
357
+ '@typescript-eslint/eslint-plugin',
358
+ '@typescript-eslint/parser',
359
+ 'webpack-event-plugin',
360
+ 'clean-webpack-plugin',
361
+ 'source-map-loader',
362
+ 'babel-loader',
363
+ 'ts-loader',
364
+ '@babel/core',
365
+ '@babel/preset-env',
366
+ '@babel/preset-typescript',
367
+ 'xrm-mock',
368
+ 'webpack',
369
+ 'webpack-cli',
370
+ 'cross-spawn',
371
+ 'ts-node',
372
+ '@microsoft/eslint-plugin-power-apps',
373
+ '-D'
374
+ ],
375
+ dependencies: [
376
+ 'core-js',
377
+ 'regenerator-runtime',
378
+ 'powerapps-common',
379
+ 'dataverse-webapi'
380
+ ]
381
+ }
308
382
  }
309
383
  }
310
384
  ]
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.21.2",
4
+ "version": "0.23.0",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",
7
7
  "bin": {
@@ -22,9 +22,11 @@
22
22
  "clean": "rimraf lib"
23
23
  },
24
24
  "dependencies": {
25
- "plop": "^2.7.6"
25
+ "plop": "^2.7.6",
26
+ "minimist": "^1.2.6"
26
27
  },
27
28
  "devDependencies": {
29
+ "@types/minimist": "^1.2.2",
28
30
  "@types/node": "^14.14.21"
29
31
  }
30
32
  }
@@ -0,0 +1,36 @@
1
+ {
2
+ "version": "2.0.0",
3
+ "tasks": [
4
+ {
5
+ "label": "build",
6
+ "command": "dotnet",
7
+ "type": "process",
8
+ "args": [
9
+ "build",
10
+ "${workspaceFolder}/{{name}}.csproj",
11
+ "/property:GenerateFullPaths=true",
12
+ "/consoleloggerparameters:NoSummary"
13
+ ],
14
+ "problemMatcher": "$msCompile"
15
+ },
16
+ {
17
+ "label": "watch",
18
+ "command": "dotnet",
19
+ "type": "process",
20
+ "args": [
21
+ "watch",
22
+ "run",
23
+ "${workspaceFolder}/{{name}}.csproj",
24
+ "/property:GenerateFullPaths=true",
25
+ "/consoleloggerparameters:NoSummary"
26
+ ],
27
+ "problemMatcher": "$msCompile"
28
+ }
29
+ {
30
+ "label": "deploy",
31
+ "type":"npm",
32
+ "script": "deploy",
33
+ "dependsOn": ["build"]
34
+ }
35
+ ]
36
+ }
@@ -1,10 +1,12 @@
1
1
  <Project Sdk="Microsoft.NET.Sdk">
2
2
  <PropertyGroup>
3
3
  <TargetFramework>net462</TargetFramework>
4
- </PropertyGroup>
5
-
6
- <PropertyGroup>
7
4
  <SignAssembly>true</SignAssembly>
8
5
  <AssemblyOriginatorKeyFile>{{name}}.snk</AssemblyOriginatorKeyFile>
9
6
  </PropertyGroup>
7
+
8
+ <ItemGroup>
9
+ <PackageReference Include="JourneyTeam.Xrm" Version="{{xrmVersion}}" />
10
+ <PackageReference Include="Microsoft.CrmSdk.Workflow" Version="{{sdkVersion}}" />
11
+ </ItemGroup>
10
12
  </Project>
@@ -0,0 +1,17 @@
1
+ {
2
+ "connection": {
3
+ "server": "{{server}}",
4
+ "solution": "{{solution}}",
5
+ "tenant": "{{tenant}}"
6
+ },
7
+ "name": "{{name}}",
8
+ "prefix": "{{prefix}}",
9
+ "version": "1.0.0.0",
10
+ "assembly": {
11
+ "name": "{{name}}",
12
+ "isolationmode": "{{isolation}}",
13
+ "version": "1.0.0.0",
14
+ "publickeytoken": "{{name}}.snk",
15
+ "types": []
16
+ }
17
+ }
@@ -0,0 +1,30 @@
1
+ <Project Sdk="Microsoft.NET.Sdk">
2
+ <PropertyGroup>
3
+ <TargetFramework>net462</TargetFramework>
4
+ <PowerAppsTargetsPath>$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\PowerApps</PowerAppsTargetsPath>
5
+ <SignAssembly>true</SignAssembly>
6
+ <AssemblyOriginatorKeyFile>{{name}}.snk</AssemblyOriginatorKeyFile>
7
+ <AssemblyVersion>1.0.0.0</AssemblyVersion>
8
+ <FileVersion>1.0.0.0</FileVersion>
9
+ <ProjectTypeGuids>{4C25E9B5-9FA6-436c-8E19-B395D2A65FAF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
10
+ </PropertyGroup>
11
+
12
+ <Import Project="$(PowerAppsTargetsPath)\Microsoft.PowerApps.VisualStudio.Plugin.props" Condition="Exists('$(PowerAppsTargetsPath)\Microsoft.PowerApps.VisualStudio.Plugin.props')" />
13
+
14
+ <PropertyGroup>
15
+ <PackageId>{{name}}</PackageId>
16
+ <Version>$(FileVersion)</Version>
17
+ <Authors>{{author}}</Authors>
18
+ <Company>{{company}}</Company>
19
+ <Description></Description>
20
+ </PropertyGroup>
21
+
22
+ <ItemGroup>
23
+ <PackageReference Include="JourneyTeam.Xrm" Version="{{xrmVersion}}" PrivateAssets="All" />
24
+ <PackageReference Include="Microsoft.CrmSdk.CoreAssemblies" Version="{{sdkVersion}}" PrivateAssets="All" />
25
+ <PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="*" PrivateAssets="All" />
26
+ <PackageReference Include="Microsoft.PowerApps.MSBuild.Plugin" Version="*" PrivateAssets="All" />
27
+ </ItemGroup>
28
+
29
+ <Import Project="$(PowerAppsTargetsPath)\Microsoft.PowerApps.VisualStudio.Plugin.targets" Condition="Exists('$(PowerAppsTargetsPath)\Microsoft.PowerApps.VisualStudio.Plugin.targets')" />
30
+ </Project>
@@ -9,4 +9,27 @@ module.exports = {
9
9
  'eslint:recommended',
10
10
  'plugin:@typescript-eslint/recommended',
11
11
  ],
12
+ rules: {
13
+ "@microsoft/power-apps/avoid-2011-api": "error",
14
+ "@microsoft/power-apps/avoid-browser-specific-api": "error",
15
+ "@microsoft/power-apps/avoid-crm2011-service-odata": "warn",
16
+ "@microsoft/power-apps/avoid-crm2011-service-soap": "warn",
17
+ "@microsoft/power-apps/avoid-dom-form-event": "warn",
18
+ "@microsoft/power-apps/avoid-dom-form": "warn",
19
+ "@microsoft/power-apps/avoid-isactivitytype": "warn",
20
+ "@microsoft/power-apps/avoid-modals": "warn",
21
+ "@microsoft/power-apps/avoid-unpub-api": "warn",
22
+ "@microsoft/power-apps/avoid-window-top": "warn",
23
+ "@microsoft/power-apps/do-not-make-parent-assumption": "warn",
24
+ "@microsoft/power-apps/use-async": "error",
25
+ "@microsoft/power-apps/use-cached-webresource": "warn",
26
+ "@microsoft/power-apps/use-client-context": "warn",
27
+ "@microsoft/power-apps/use-global-context": "error",
28
+ "@microsoft/power-apps/use-grid-api": "warn",
29
+ "@microsoft/power-apps/use-navigation-api": "warn",
30
+ "@microsoft/power-apps/use-offline": "warn",
31
+ "@microsoft/power-apps/use-org-setting": "error",
32
+ "@microsoft/power-apps/use-relative-uri": "warn",
33
+ "@microsoft/power-apps/use-utility-dialogs": "warn"
34
+ }
12
35
  };
@@ -1,31 +0,0 @@
1
- {
2
- // See https://go.microsoft.com/fwlink/?LinkId=733558
3
- // for the documentation about the tasks.json format
4
- "version": "2.0.0",
5
- "tasks": [
6
- {
7
- "label": "build",
8
- "command": "dotnet",
9
- "type": "shell",
10
- "args": [
11
- "build",
12
- "/property:GenerateFullPaths=true",
13
- "/consoleloggerparameters:NoSummary"
14
- ],
15
- "group": {
16
- "kind": "build",
17
- "isDefault": true
18
- },
19
- "presentation": {
20
- "reveal": "silent"
21
- },
22
- "problemMatcher": "$msCompile"
23
- },
24
- {
25
- "label": "deploy",
26
- "type":"npm",
27
- "script": "deploy",
28
- "dependsOn": ["build"]
29
- }
30
- ]
31
- }