create-powerapps-project 0.14.5 → 0.14.6

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.
@@ -1,41 +1,17 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
- Object.defineProperty(o, "default", { enumerable: true, value: v });
11
- }) : function(o, v) {
12
- o["default"] = v;
13
- });
14
- var __importStar = (this && this.__importStar) || function (mod) {
15
- if (mod && mod.__esModule) return mod;
16
- var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
- __setModuleDefault(result, mod);
19
- return result;
20
- };
21
- var __importDefault = (this && this.__importDefault) || function (mod) {
22
- return (mod && mod.__esModule) ? mod : { "default": mod };
23
- };
24
- Object.defineProperty(exports, "__esModule", { value: true });
25
- const prompts_1 = __importDefault(require("prompts"));
26
- const nuget_1 = require("./nuget");
27
- const path_1 = __importDefault(require("path"));
28
- const plop_1 = require("./plop");
29
- const pkg = __importStar(require("./packageManager"));
30
- const just_scripts_utils_1 = require("just-scripts-utils");
31
- const getEnvInfo_1 = require("./getEnvInfo");
32
- async function create(argv) {
33
- await (0, getEnvInfo_1.initialize)();
34
- argv.name = path_1.default.basename(process.cwd());
1
+ import prompts from 'prompts';
2
+ import { getNugetPackageVersions, install } from './nuget';
3
+ import path from 'path';
4
+ import { getGenerator, runGenerator } from './plop';
5
+ import * as pkg from './packageManager';
6
+ import { logger, prettyPrintMarkdown } from 'just-scripts-utils';
7
+ import { initialize } from './getEnvInfo';
8
+ export default async function create(argv) {
9
+ await initialize();
10
+ argv.name = path.basename(process.cwd());
35
11
  if (!argv.type || (argv.type !== 'webresource' && argv.type !== 'assembly')) {
36
12
  const invalid = argv.type !== undefined && argv.type !== 'webresource' && argv.type !== 'assembly';
37
13
  const invalidMessage = invalid ? `${argv.type} is not a valid project type.` : '';
38
- const { type } = await (0, prompts_1.default)({
14
+ const { type } = await prompts({
39
15
  type: 'select',
40
16
  name: 'type',
41
17
  message: `${invalidMessage} Select dataverse project to create?`,
@@ -47,24 +23,23 @@ async function create(argv) {
47
23
  argv.type = type;
48
24
  }
49
25
  const questions = await getAnswers(argv.type);
50
- const config = (await (0, prompts_1.default)(questions));
26
+ const config = (await prompts(questions));
51
27
  if (argv.type === 'assembly') {
52
- const xrmVersions = await (0, nuget_1.getNugetPackageVersions)('JourneyTeam.Xrm');
28
+ const xrmVersions = await getNugetPackageVersions('JourneyTeam.Xrm');
53
29
  config.xrmVersion = xrmVersions.shift();
54
30
  }
55
- just_scripts_utils_1.logger.info('get plop generator');
56
- const generator = await (0, plop_1.getGenerator)(argv);
57
- just_scripts_utils_1.logger.info(`run powerapps-project-${argv.type} code generator`);
58
- await (0, plop_1.runGenerator)(generator, config);
59
- just_scripts_utils_1.logger.info('initialize project');
31
+ logger.info('get plop generator');
32
+ const generator = await getGenerator(argv);
33
+ logger.info(`run powerapps-project-${argv.type} code generator`);
34
+ await runGenerator(generator, config);
35
+ logger.info('initialize project');
60
36
  pkg.install(process.cwd(), argv.type);
61
37
  if (argv.type === 'assembly') {
62
- just_scripts_utils_1.logger.info('add nuget packages');
63
- (0, nuget_1.install)(config.name, config.sdkVersion, config.xrmVersion);
38
+ logger.info('add nuget packages');
39
+ install(config.name, config.sdkVersion, config.xrmVersion);
64
40
  }
65
41
  done(argv);
66
42
  }
67
- exports.default = create;
68
43
  async function getAnswers(type) {
69
44
  let questions = [];
70
45
  if (type === 'webresource') {
@@ -75,7 +50,7 @@ async function getAnswers(type) {
75
50
  });
76
51
  }
77
52
  else {
78
- const versions = await (0, nuget_1.getNugetPackageVersions)('Microsoft.CrmSdk.Workflow');
53
+ const versions = await getNugetPackageVersions('Microsoft.CrmSdk.Workflow');
79
54
  questions = [
80
55
  {
81
56
  type: 'select',
@@ -148,5 +123,5 @@ function done(argv) {
148
123
  run code generator with this command:
149
124
  ${pkg.getYarn() ? 'yarn' : 'npm run'} gen
150
125
  `;
151
- just_scripts_utils_1.logger.info((0, just_scripts_utils_1.prettyPrintMarkdown)(message));
126
+ logger.info(prettyPrintMarkdown(message));
152
127
  }
package/lib/getEnvInfo.js CHANGED
@@ -1,20 +1,13 @@
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.initialize = exports.getEnvInfo = void 0;
7
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
8
- const envinfo_1 = __importDefault(require("envinfo"));
9
- const os_1 = __importDefault(require("os"));
10
- const path_1 = __importDefault(require("path"));
2
+ import envinfo from 'envinfo';
3
+ import os from 'os';
4
+ import path from 'path';
11
5
  let envInfoCache;
12
- const getEnvInfo = () => {
6
+ export const getEnvInfo = () => {
13
7
  return envInfoCache;
14
8
  };
15
- exports.getEnvInfo = getEnvInfo;
16
- const initialize = async () => {
17
- envInfoCache = JSON.parse(await envinfo_1.default.run({
9
+ export const initialize = async () => {
10
+ envInfoCache = JSON.parse(await envinfo.run({
18
11
  Binaries: ['Yarn', 'npm']
19
12
  }, { json: true, showNotFound: false }));
20
13
  if (envInfoCache.Binaries.Yarn) {
@@ -25,10 +18,9 @@ const initialize = async () => {
25
18
  }
26
19
  return envInfoCache;
27
20
  };
28
- exports.initialize = initialize;
29
21
  const expandHome = (pathString) => {
30
- if (pathString.startsWith('~' + path_1.default.sep)) {
31
- return pathString.replace('~', os_1.default.homedir());
22
+ if (pathString.startsWith('~' + path.sep)) {
23
+ return pathString.replace('~', os.homedir());
32
24
  }
33
25
  return pathString;
34
26
  };
package/lib/index.js CHANGED
@@ -1,16 +1,11 @@
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 yargs_1 = require("yargs");
8
- const createDataverseProject_1 = __importDefault(require("./createDataverseProject"));
2
+ import { command } from 'yargs';
3
+ import create from './createDataverseProject';
9
4
  const options = {
10
5
  aliases: '*',
11
6
  command: 'init',
12
7
  builder: yargs => yargs.option('type', { describe: 'Type of project to generate', alias: ['t'] }),
13
8
  describe: 'Create new dataverse project',
14
- handler: createDataverseProject_1.default
9
+ handler: create
15
10
  };
16
- (0, yargs_1.command)(options).help().argv;
11
+ command(options).help().argv;
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,31 +19,29 @@ 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
33
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
41
- (0, child_process_1.spawnSync)('dotnet', ['add', 'package', 'Microsoft.CrmSdk.Workflow', '-v', sdkVersion, '-n'], {
34
+ spawnSync('dotnet', ['add', 'package', 'Microsoft.CrmSdk.Workflow', '-v', sdkVersion, '-n'], {
42
35
  cwd: process.cwd(),
43
36
  stdio: 'inherit'
44
37
  });
45
38
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
46
- (0, child_process_1.spawnSync)('dotnet', ['add', 'package', 'JourneyTeam.Xrm', '-v', xrmVersion, '-n'], {
39
+ spawnSync('dotnet', ['add', 'package', 'JourneyTeam.Xrm', '-v', xrmVersion, '-n'], {
47
40
  cwd: process.cwd(),
48
41
  stdio: 'inherit'
49
42
  });
50
- (0, child_process_1.spawnSync)('dotnet', ['restore'], {
43
+ spawnSync('dotnet', ['restore'], {
51
44
  cwd: process.cwd(),
52
45
  stdio: 'inherit'
53
46
  });
54
47
  };
55
- exports.install = install;
@@ -1,38 +1,32 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.install = exports.getYarn = void 0;
4
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
5
- const child_process_1 = require("child_process");
6
- const getEnvInfo_1 = require("./getEnvInfo");
7
- const getYarn = () => {
8
- const yarnInfo = (0, getEnvInfo_1.getEnvInfo)().Binaries.Yarn;
2
+ import { spawnSync } from 'child_process';
3
+ import { getEnvInfo } from './getEnvInfo';
4
+ export const getYarn = () => {
5
+ const yarnInfo = getEnvInfo().Binaries.Yarn;
9
6
  return yarnInfo && yarnInfo.path;
10
7
  };
11
- exports.getYarn = getYarn;
12
8
  const getNpm = () => {
13
- const npmInfo = (0, getEnvInfo_1.getEnvInfo)().Binaries.npm;
9
+ const npmInfo = getEnvInfo().Binaries.npm;
14
10
  return npmInfo && npmInfo.path;
15
11
  };
16
- const install = (cwd, type) => {
12
+ export const install = (cwd, type) => {
17
13
  const packages = getPackages(type);
18
- if ((0, exports.getYarn)()) {
19
- (0, child_process_1.spawnSync)((0, exports.getYarn)(), ['add', ...packages.devDependencies], { stdio: 'inherit', cwd });
14
+ if (getYarn()) {
15
+ spawnSync(getYarn(), ['add', ...packages.devDependencies], { stdio: 'inherit', cwd });
20
16
  if (packages.dependencies) {
21
- (0, child_process_1.spawnSync)((0, exports.getYarn)(), ['add', ...packages.dependencies], { stdio: 'inherit', cwd });
17
+ spawnSync(getYarn(), ['add', ...packages.dependencies], { stdio: 'inherit', cwd });
22
18
  }
23
19
  }
24
20
  else {
25
- (0, child_process_1.spawnSync)(getNpm(), ['add', ...packages.devDependencies], { stdio: 'inherit', cwd });
21
+ spawnSync(getNpm(), ['add', ...packages.devDependencies], { stdio: 'inherit', cwd });
26
22
  if (packages.dependencies) {
27
- (0, child_process_1.spawnSync)(getNpm(), ['add', ...packages.dependencies], { stdio: 'inherit', cwd });
23
+ spawnSync(getNpm(), ['add', ...packages.dependencies], { stdio: 'inherit', cwd });
28
24
  }
29
25
  }
30
26
  };
31
- exports.install = install;
32
27
  function getPackages(type) {
33
28
  const packages = {
34
29
  devDependencies: [
35
- 'plop',
36
30
  `powerapps-project-${type}`,
37
31
  'dataverse-utils'
38
32
  ]
package/lib/plop.js CHANGED
@@ -1,24 +1,17 @@
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.runGenerator = exports.getGenerator = void 0;
7
- const node_plop_1 = __importDefault(require("node-plop"));
8
- const path_1 = __importDefault(require("path"));
9
- const just_scripts_utils_1 = require("just-scripts-utils");
1
+ import nodePlop from 'node-plop';
2
+ import path from 'path';
3
+ import { logger } from 'just-scripts-utils';
10
4
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
- const getGenerator = async (argv) => {
12
- const plopFile = path_1.default.resolve(__dirname, 'plopfile.js');
13
- const plop = await (0, node_plop_1.default)(plopFile, { destBasePath: argv.destination, force: false });
5
+ export const getGenerator = async (argv) => {
6
+ const plopFile = path.resolve(__dirname, 'plopfile.js');
7
+ const plop = await nodePlop(plopFile, { destBasePath: argv.destination, force: false });
14
8
  const generator = plop.getGenerator(argv.type);
15
9
  return generator;
16
10
  };
17
- exports.getGenerator = getGenerator;
18
- const runGenerator = async (generator, args) => {
11
+ export const runGenerator = async (generator, args) => {
19
12
  const results = await generator.runActions(args, {
20
13
  onComment: (comment) => {
21
- just_scripts_utils_1.logger.info(comment);
14
+ logger.info(comment);
22
15
  }
23
16
  });
24
17
  if (results.failures && results.failures.length > 0) {
@@ -27,8 +20,7 @@ const runGenerator = async (generator, args) => {
27
20
  // do something after the actions have run
28
21
  for (const change of results.changes) {
29
22
  if (change.path) {
30
- just_scripts_utils_1.logger.info(change.path);
23
+ logger.info(change.path);
31
24
  }
32
25
  }
33
26
  };
34
- exports.runGenerator = runGenerator;
package/lib/plopfile.js CHANGED
@@ -1,16 +1,11 @@
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 child_process_1 = require("child_process");
1
+ import path from 'path';
2
+ import { spawnSync } from 'child_process';
8
3
  /* eslint-disable @typescript-eslint/no-explicit-any */
9
4
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
10
- exports.default = (plop) => {
5
+ export default (plop) => {
11
6
  plop.setActionType('signAssembly', (answers) => {
12
- const keyPath = path_1.default.resolve(process.cwd(), `${answers.name}.snk`);
13
- (0, child_process_1.spawnSync)(path_1.default.resolve(__dirname, '../', 'bin', 'sn.exe'), ['-q', '-k', keyPath], { stdio: 'inherit' });
7
+ const keyPath = path.resolve(process.cwd(), `${answers.name}.snk`);
8
+ spawnSync(path.resolve(__dirname, '../', 'bin', 'sn.exe'), ['-q', '-k', keyPath], { stdio: 'inherit' });
14
9
  return 'signed assembly';
15
10
  });
16
11
  plop.setGenerator('webresource', {
@@ -29,7 +24,7 @@ exports.default = (plop) => {
29
24
  {
30
25
  type: 'add',
31
26
  templateFile: '../plop-templates/assembly/assembly.csproj.hbs',
32
- path: path_1.default.resolve(process.cwd(), '{{name}}.csproj'),
27
+ path: path.resolve(process.cwd(), '{{name}}.csproj'),
33
28
  },
34
29
  {
35
30
  type: 'addMany',
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "create-powerapps-project",
3
- "version": "0.14.5",
3
+ "description": "Project generator for Dataverse development",
4
+ "version": "0.14.6",
4
5
  "license": "MIT",
5
6
  "main": "lib/index.js",
6
7
  "bin": {
@@ -22,7 +23,7 @@
22
23
  },
23
24
  "dependencies": {
24
25
  "envinfo": "^7.8.1",
25
- "node-plop": "^0.30.0",
26
+ "node-plop": "^0.26.2",
26
27
  "prompts": "^2.4.2",
27
28
  "just-scripts-utils": "^1.1.4",
28
29
  "yargs": "^17.3.0"
@@ -2,7 +2,6 @@
2
2
  "version": "1.0.0",
3
3
  "name": "{{kebabCase name}}",
4
4
  "private": true,
5
- "type": "commonjs",
6
5
  "scripts": {
7
6
  "gen": "plop",
8
7
  "deploy": "dataverse-utils deploy assembly"
@@ -1,3 +1,3 @@
1
- export default function (plop) {
1
+ module.exports = function (plop) {
2
2
  plop.load('powerapps-project-assembly');
3
- }
3
+ };
@@ -2,7 +2,6 @@
2
2
  "version": "1.0.0",
3
3
  "name": "{{kebabCase name}}",
4
4
  "private": true,
5
- "type": "commonjs",
6
5
  "scripts": {
7
6
  "build": "webpack --mode=production",
8
7
  "start": "webpack --mode=development --watch",
@@ -1,3 +1,3 @@
1
- export default function (plop) {
1
+ module.exports = function (plop) {
2
2
  plop.load('powerapps-project-webresource');
3
- }
3
+ };