create-powerapps-project 0.14.6 → 0.14.7

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