create-powerapps-project 0.22.0 → 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/nuget.js +14 -29
- package/lib/packageManager.js +8 -42
- package/lib/plopActions.js +108 -0
- package/lib/plopfile.js +152 -106
- package/package.json +1 -1
- package/plop-templates/assembly/.vscode/tasks.json.hbs +36 -0
- package/plop-templates/assembly/assembly.csproj.hbs +5 -3
- package/plop-templates/assembly/dataverse.package.config.json.hbs +17 -0
- package/plop-templates/assembly/package.csproj.hbs +30 -0
- package/plop-templates/assembly/.vscode/tasks.json +0 -31
package/lib/nuget.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.nugetRestore = exports.getNugetPackageVersions = void 0;
|
|
7
7
|
const https_1 = __importDefault(require("https"));
|
|
8
8
|
const child_process_1 = require("child_process");
|
|
9
9
|
const getNugetPackageVersions = (name) => {
|
|
@@ -14,11 +14,16 @@ const getNugetPackageVersions = (name) => {
|
|
|
14
14
|
body += d;
|
|
15
15
|
});
|
|
16
16
|
response.on('end', () => {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
+
}
|
|
22
27
|
});
|
|
23
28
|
}).on('error', (e) => {
|
|
24
29
|
reject(e);
|
|
@@ -26,31 +31,11 @@ const getNugetPackageVersions = (name) => {
|
|
|
26
31
|
});
|
|
27
32
|
};
|
|
28
33
|
exports.getNugetPackageVersions = getNugetPackageVersions;
|
|
29
|
-
const
|
|
30
|
-
// Add solution
|
|
31
|
-
(0, child_process_1.spawnSync)('dotnet', ['new', 'sln', '-n', project], {
|
|
32
|
-
cwd: process.cwd(),
|
|
33
|
-
stdio: 'inherit'
|
|
34
|
-
});
|
|
35
|
-
(0, child_process_1.spawnSync)('dotnet', ['sln', 'add', `${project}.csproj`], {
|
|
36
|
-
cwd: process.cwd(),
|
|
37
|
-
stdio: 'inherit'
|
|
38
|
-
});
|
|
34
|
+
const nugetRestore = async () => {
|
|
39
35
|
// Install nuget packages
|
|
40
|
-
(0, child_process_1.spawnSync)('dotnet', ['add', 'package', 'Microsoft.CrmSdk.Workflow', '-v', sdkVersion, '-n'], {
|
|
41
|
-
cwd: process.cwd(),
|
|
42
|
-
stdio: 'inherit'
|
|
43
|
-
});
|
|
44
|
-
(0, child_process_1.spawnSync)('dotnet', ['add', 'package', 'JourneyTeam.Xrm', '-v', xrmVersion, '-n'], {
|
|
45
|
-
cwd: process.cwd(),
|
|
46
|
-
stdio: 'inherit'
|
|
47
|
-
});
|
|
48
36
|
if (process.env.JEST_WORKER_ID !== undefined) {
|
|
49
37
|
return;
|
|
50
38
|
}
|
|
51
|
-
(0, child_process_1.spawnSync)('dotnet', ['restore'], {
|
|
52
|
-
cwd: process.cwd(),
|
|
53
|
-
stdio: 'inherit'
|
|
54
|
-
});
|
|
39
|
+
(0, child_process_1.spawnSync)('dotnet', ['restore'], { cwd: process.cwd(), stdio: 'inherit' });
|
|
55
40
|
};
|
|
56
|
-
exports.
|
|
41
|
+
exports.nugetRestore = nugetRestore;
|
package/lib/packageManager.js
CHANGED
|
@@ -3,54 +3,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.install = void 0;
|
|
4
4
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
5
5
|
const child_process_1 = require("child_process");
|
|
6
|
-
const install = (
|
|
6
|
+
const install = async (packageManager, packages) => {
|
|
7
7
|
if (process.env.JEST_WORKER_ID != undefined) {
|
|
8
8
|
return;
|
|
9
9
|
}
|
|
10
|
-
if (
|
|
11
|
-
(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const packages = getPackages(type);
|
|
15
|
-
(0, child_process_1.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
|
+
}
|
|
16
14
|
if (packages.dependencies) {
|
|
17
15
|
(0, child_process_1.spawnSync)(packageManager, ['add', ...packages.dependencies], { stdio: 'inherit', shell: true });
|
|
18
16
|
}
|
|
19
17
|
}
|
|
18
|
+
else {
|
|
19
|
+
(0, child_process_1.spawnSync)(packageManager, ['install'], { stdio: 'inherit', shell: true });
|
|
20
|
+
}
|
|
20
21
|
};
|
|
21
22
|
exports.install = install;
|
|
22
|
-
function getPackages(type) {
|
|
23
|
-
const packages = {
|
|
24
|
-
devDependencies: [
|
|
25
|
-
`powerapps-project-${type}`,
|
|
26
|
-
'dataverse-utils'
|
|
27
|
-
]
|
|
28
|
-
};
|
|
29
|
-
if (type === 'webresource') {
|
|
30
|
-
packages.devDependencies = [
|
|
31
|
-
...packages.devDependencies,
|
|
32
|
-
'@types/xrm',
|
|
33
|
-
'typescript',
|
|
34
|
-
'eslint',
|
|
35
|
-
'@typescript-eslint/eslint-plugin',
|
|
36
|
-
'@typescript-eslint/parser',
|
|
37
|
-
'webpack-event-plugin',
|
|
38
|
-
'clean-webpack-plugin',
|
|
39
|
-
'source-map-loader',
|
|
40
|
-
'babel-loader',
|
|
41
|
-
'ts-loader',
|
|
42
|
-
'@babel/core',
|
|
43
|
-
'@babel/preset-env',
|
|
44
|
-
'@babel/preset-typescript',
|
|
45
|
-
'xrm-mock',
|
|
46
|
-
'webpack',
|
|
47
|
-
'webpack-cli',
|
|
48
|
-
'cross-spawn',
|
|
49
|
-
'ts-node',
|
|
50
|
-
'@microsoft/eslint-plugin-power-apps',
|
|
51
|
-
'-D'
|
|
52
|
-
];
|
|
53
|
-
packages.dependencies = ['core-js', 'regenerator-runtime', 'powerapps-common', 'dataverse-webapi'];
|
|
54
|
-
}
|
|
55
|
-
return packages;
|
|
56
|
-
}
|
|
@@ -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,42 +1,17 @@
|
|
|
1
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
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
4
|
};
|
|
28
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
6
|
const path_1 = __importDefault(require("path"));
|
|
30
|
-
const child_process_1 = require("child_process");
|
|
31
7
|
const fs_1 = __importDefault(require("fs"));
|
|
32
|
-
const
|
|
33
|
-
const pkg = __importStar(require("./packageManager"));
|
|
34
|
-
const didSucceed = (code) => `${code}` === '0';
|
|
8
|
+
const nuget_1 = require("./nuget");
|
|
35
9
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
36
10
|
const version = require('../package').version;
|
|
37
11
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
38
12
|
exports.default = (plop) => {
|
|
39
13
|
plop.setWelcomeMessage(`Creating new Dataverse project using create-powerapps-project v${version}. Please choose type of project to create.`);
|
|
14
|
+
plop.load('./plopActions');
|
|
40
15
|
const packageQuestion = {
|
|
41
16
|
type: 'list',
|
|
42
17
|
name: 'package',
|
|
@@ -52,7 +27,19 @@ exports.default = (plop) => {
|
|
|
52
27
|
{
|
|
53
28
|
type: 'input',
|
|
54
29
|
name: 'server',
|
|
55
|
-
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
|
+
}
|
|
56
43
|
},
|
|
57
44
|
{
|
|
58
45
|
type: 'input',
|
|
@@ -66,28 +53,49 @@ exports.default = (plop) => {
|
|
|
66
53
|
message: 'dataverse solution unique name:'
|
|
67
54
|
}
|
|
68
55
|
];
|
|
69
|
-
plop.setActionType('addScript', async (answers) => {
|
|
70
|
-
const packagePath = path_1.default.resolve(process.cwd(), 'package.json');
|
|
71
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
72
|
-
const packageJson = require(packagePath);
|
|
73
|
-
packageJson.scripts[answers.scriptKey] = answers.scriptValue;
|
|
74
|
-
await fs_1.default.promises.writeFile(packagePath, JSON.stringify(packageJson, null, 4), 'utf8');
|
|
75
|
-
return `added ${answers.scriptKey} script to package.json`;
|
|
76
|
-
});
|
|
77
|
-
plop.setActionType('npmInstall', (answers) => {
|
|
78
|
-
pkg.install(process.cwd(), answers.projectType, answers.package);
|
|
79
|
-
return 'installed npm packages';
|
|
80
|
-
});
|
|
81
56
|
plop.setGenerator('assembly', {
|
|
82
|
-
description: 'generate dataverse
|
|
57
|
+
description: 'generate dataverse plugin or workflow activity project',
|
|
83
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
|
+
},
|
|
84
88
|
{
|
|
85
89
|
type: 'list',
|
|
86
90
|
name: 'sdkVersion',
|
|
87
|
-
message:
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
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;
|
|
91
99
|
}
|
|
92
100
|
},
|
|
93
101
|
{
|
|
@@ -128,58 +136,92 @@ exports.default = (plop) => {
|
|
|
128
136
|
...sharedQuestions,
|
|
129
137
|
],
|
|
130
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
|
+
},
|
|
131
144
|
{
|
|
132
145
|
type: 'add',
|
|
133
146
|
templateFile: '../plop-templates/assembly/assembly.csproj.hbs',
|
|
134
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
|
+
}
|
|
135
195
|
},
|
|
136
196
|
{
|
|
137
197
|
type: 'addMany',
|
|
138
198
|
templateFiles: [
|
|
139
|
-
'../plop-templates/assembly
|
|
140
|
-
'../plop-templates/assembly
|
|
141
|
-
'../plop-templates/assembly/*.ts.hbs',
|
|
199
|
+
'../plop-templates/assembly/package.json.hbs',
|
|
200
|
+
'../plop-templates/assembly/plopfile.js',
|
|
142
201
|
'../plop-templates/assembly/.gitignore',
|
|
143
202
|
'../plop-templates/assembly/Entities/EarlyBoundGenerator.xml',
|
|
144
|
-
'../plop-templates/assembly/.vscode/tasks.json',
|
|
203
|
+
'../plop-templates/assembly/.vscode/tasks.json.hbs',
|
|
145
204
|
'../plop-templates/assembly/.editorconfig'
|
|
146
205
|
],
|
|
147
206
|
base: '../plop-templates/assembly',
|
|
148
207
|
destination: process.cwd(),
|
|
149
208
|
force: true
|
|
150
209
|
},
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
return new Promise((resolve, reject) => {
|
|
154
|
-
if (process.env.JEST_WORKER_ID !== undefined) {
|
|
155
|
-
resolve('Testing so no need to sign');
|
|
156
|
-
}
|
|
157
|
-
else {
|
|
158
|
-
const sign = (0, child_process_1.spawn)(path_1.default.resolve(__dirname, '..', 'bin', 'sn.exe'), ['-q', '-k', keyPath], { stdio: 'inherit' });
|
|
159
|
-
sign.on('close', (code) => {
|
|
160
|
-
if (didSucceed(code)) {
|
|
161
|
-
resolve('signed assembly');
|
|
162
|
-
}
|
|
163
|
-
else {
|
|
164
|
-
reject('failed to sign assembly');
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
|
-
sign.on('error', () => {
|
|
168
|
-
reject('failed to sign assembly');
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
});
|
|
210
|
+
{
|
|
211
|
+
type: 'signAssembly'
|
|
172
212
|
},
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
const xrmVersion = xrmVersions.shift();
|
|
176
|
-
nuget.install(answers.name, answers.sdkVersion, xrmVersion);
|
|
177
|
-
return 'installed nuget packages';
|
|
213
|
+
{
|
|
214
|
+
type: 'nugetRestore'
|
|
178
215
|
},
|
|
179
216
|
{
|
|
180
217
|
type: 'npmInstall',
|
|
181
218
|
data: {
|
|
182
|
-
|
|
219
|
+
packages: {
|
|
220
|
+
devDependencies: [
|
|
221
|
+
'powerapps-project-assembly',
|
|
222
|
+
'dataverse-utils'
|
|
223
|
+
]
|
|
224
|
+
}
|
|
183
225
|
}
|
|
184
226
|
}
|
|
185
227
|
]
|
|
@@ -214,32 +256,8 @@ exports.default = (plop) => {
|
|
|
214
256
|
packageQuestion
|
|
215
257
|
],
|
|
216
258
|
actions: [
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
// Set framework to React if selected
|
|
220
|
-
if (answers.react) {
|
|
221
|
-
args.push('-fw', 'react');
|
|
222
|
-
}
|
|
223
|
-
if (process.env.JEST_WORKER_ID !== undefined || answers.package !== 'npm') {
|
|
224
|
-
args.push('-npm', 'false');
|
|
225
|
-
}
|
|
226
|
-
else {
|
|
227
|
-
args.push('-npm', 'true');
|
|
228
|
-
}
|
|
229
|
-
return new Promise((resolve, reject) => {
|
|
230
|
-
const pac = (0, child_process_1.spawn)('pac', args, { stdio: 'inherit' });
|
|
231
|
-
pac.on('close', (code) => {
|
|
232
|
-
if (didSucceed(code)) {
|
|
233
|
-
resolve('pcf project created');
|
|
234
|
-
}
|
|
235
|
-
else {
|
|
236
|
-
reject('Ensure the Power Platform CLI is installed. Command must be run from within Visual Studio Code if using the Power Platform Extension');
|
|
237
|
-
}
|
|
238
|
-
});
|
|
239
|
-
pac.on('error', () => {
|
|
240
|
-
reject('Ensure the Power Platform CLI is installed. Command must be run from within Visual Studio Code if using the Power Platform Extension');
|
|
241
|
-
});
|
|
242
|
-
});
|
|
259
|
+
{
|
|
260
|
+
type: 'runPcf'
|
|
243
261
|
},
|
|
244
262
|
{
|
|
245
263
|
type: 'add',
|
|
@@ -293,9 +311,6 @@ exports.default = (plop) => {
|
|
|
293
311
|
},
|
|
294
312
|
{
|
|
295
313
|
type: 'npmInstall',
|
|
296
|
-
data: {
|
|
297
|
-
projectType: 'pcf'
|
|
298
|
-
},
|
|
299
314
|
skip: (answers) => {
|
|
300
315
|
if (answers.package === 'npm') {
|
|
301
316
|
return 'npm packages already installed';
|
|
@@ -332,7 +347,38 @@ exports.default = (plop) => {
|
|
|
332
347
|
{
|
|
333
348
|
type: 'npmInstall',
|
|
334
349
|
data: {
|
|
335
|
-
|
|
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
|
+
}
|
|
336
382
|
}
|
|
337
383
|
}
|
|
338
384
|
]
|
package/package.json
CHANGED
|
@@ -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>
|
|
@@ -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
|
-
}
|