powerbi-visuals-tools 4.3.2 → 5.0.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.
Files changed (69) hide show
  1. package/Changelog.md +7 -0
  2. package/README.md +1 -1
  3. package/bin/pbiviz.js +55 -36
  4. package/certs/PowerBICustomVisualTest_private.key +26 -26
  5. package/certs/PowerBICustomVisualTest_public.crt +17 -17
  6. package/config.json +27 -34
  7. package/lib/CertificateTools.js +119 -143
  8. package/lib/CommandManager.js +52 -0
  9. package/lib/ConsoleWriter.js +63 -85
  10. package/lib/TemplateFetcher.js +23 -30
  11. package/lib/VisualGenerator.js +42 -56
  12. package/lib/VisualManager.js +193 -0
  13. package/lib/WebPackWrap.js +96 -145
  14. package/lib/utils.js +21 -13
  15. package/lib/webpack.config.js +47 -56
  16. package/package.json +34 -26
  17. package/spec/clean-tests.js +1 -1
  18. package/spec/e2e/pbivizCertSpec.js +14 -13
  19. package/spec/e2e/pbivizInfoSpec.js +7 -10
  20. package/spec/e2e/pbivizNewSpec.js +53 -65
  21. package/spec/e2e/pbivizPackageSpec.js +86 -90
  22. package/spec/e2e/pbivizStartSpec.js +6 -7
  23. package/spec/e2e/pbivizWebpackVerSpec.js +14 -16
  24. package/spec/e2e/{utils.js → testUtils.js} +9 -12
  25. package/spec/helpers/FileSystem.js +18 -18
  26. package/spec/jasmine-runner.js +5 -5
  27. package/src/CertificateTools.ts +431 -0
  28. package/src/CommandManager.ts +78 -0
  29. package/src/ConsoleWriter.ts +206 -0
  30. package/src/TemplateFetcher.ts +122 -0
  31. package/src/VisualGenerator.ts +236 -0
  32. package/src/VisualManager.ts +220 -0
  33. package/src/WebPackWrap.ts +299 -0
  34. package/src/utils.ts +41 -0
  35. package/src/webpack.config.ts +144 -0
  36. package/templates/pbiviz-json-template.js +2 -2
  37. package/templates/pbiviz.json.template +1 -1
  38. package/templates/plugin-ts-template.js +1 -1
  39. package/templates/visuals/default/.eslintignore +5 -0
  40. package/templates/visuals/default/.eslintrc.js +20 -0
  41. package/templates/visuals/default/package.json +9 -8
  42. package/templates/visuals/default/pbiviz.json +3 -2
  43. package/templates/visuals/default/tsconfig.json +2 -2
  44. package/templates/visuals/rhtml/.eslintignore +5 -0
  45. package/templates/visuals/rhtml/.eslintrc.js +20 -0
  46. package/templates/visuals/rhtml/package.json +7 -6
  47. package/templates/visuals/rhtml/pbiviz.json +2 -1
  48. package/templates/visuals/rvisual/.eslintignore +5 -0
  49. package/templates/visuals/rvisual/.eslintrc.js +20 -0
  50. package/templates/visuals/rvisual/package.json +5 -4
  51. package/templates/visuals/slicer/.eslintignore +5 -0
  52. package/templates/visuals/slicer/.eslintrc.js +20 -0
  53. package/templates/visuals/slicer/package.json +8 -7
  54. package/templates/visuals/table/.eslintignore +5 -0
  55. package/templates/visuals/table/.eslintrc.js +20 -0
  56. package/templates/visuals/table/package.json +8 -7
  57. package/templates/visuals/table/tsconfig.json +4 -0
  58. package/tsconfig.json +22 -0
  59. package/bin/pbiviz-info.js +0 -54
  60. package/bin/pbiviz-new.js +0 -82
  61. package/bin/pbiviz-package.js +0 -122
  62. package/bin/pbiviz-start.js +0 -142
  63. package/lib/CommandHelpManager.js +0 -51
  64. package/lib/VisualPackage.js +0 -118
  65. package/templates/visuals/default/tslint.json +0 -9
  66. package/templates/visuals/rhtml/tslint.json +0 -9
  67. package/templates/visuals/rvisual/tslint.json +0 -9
  68. package/templates/visuals/slicer/tslint.json +0 -9
  69. package/templates/visuals/table/tslint.json +0 -9
@@ -0,0 +1,144 @@
1
+
2
+ import { getRootPath, readJsonFromRoot } from './utils.js';
3
+ import { LocalizationLoader } from "powerbi-visuals-webpack-plugin";
4
+ import MiniCssExtractPlugin from "mini-css-extract-plugin";
5
+ import TerserPlugin from "terser-webpack-plugin";
6
+ import path from "path";
7
+ import webpack from "webpack";
8
+
9
+ const config = readJsonFromRoot("/config.json");
10
+
11
+ const webpackConfig = {
12
+ entry: {
13
+ 'visual.js': ['./src/visual.ts']
14
+ },
15
+ target: 'web',
16
+ devtool: false,
17
+ mode: "production",
18
+ optimization: {
19
+ minimizer: [
20
+ new TerserPlugin({
21
+ parallel: true,
22
+ terserOptions: {}
23
+ })
24
+ ],
25
+ minimize: false,
26
+ concatenateModules: false
27
+ },
28
+ performance: {
29
+ maxEntrypointSize: 1024000,
30
+ maxAssetSize: 1024000,
31
+ hints: false
32
+ },
33
+ module: {
34
+ rules: [
35
+ {
36
+ parser: {
37
+ amd: false
38
+ }
39
+ },
40
+ {
41
+ test: /\.json$/,
42
+ loader: 'json-loader',
43
+ type: "javascript/auto"
44
+ },
45
+ {
46
+ test: /(\.less)|(\.css)$/,
47
+ use: [
48
+ {
49
+ loader: MiniCssExtractPlugin.loader
50
+ },
51
+ {
52
+ loader: 'css-loader'
53
+ },
54
+ {
55
+ loader: 'less-loader',
56
+ options: {
57
+ lessOptions: {
58
+ paths: [path.resolve(getRootPath(), 'node_modules')]
59
+ }
60
+ }
61
+ }
62
+ ]
63
+ },
64
+ {
65
+ test: /\.(woff|ttf|ico|woff2|jpg|jpeg|png|webp|gif|svg|eot)$/i,
66
+ type: 'asset/inline'
67
+ },
68
+ {
69
+ test: /powerbiGlobalizeLocales\.js$/,
70
+ loader: LocalizationLoader
71
+ }
72
+ ]
73
+ },
74
+ externals: {
75
+ "powerbi-visuals-api": 'null'
76
+ },
77
+ resolve: {
78
+ extensions: ['.tsx', '.ts', '.jsx', '.js', '.css'],
79
+ fallback: {
80
+ assert: path.resolve("../node-modules/assert/"),
81
+ buffer: path.resolve("../node-modules/buffer/"),
82
+ console: path.resolve("../node-modules/console-browserify/"),
83
+ constants: path.resolve("../node-modules/constants-browserify/"),
84
+ crypto: path.resolve("../node-modules/crypto-browserify/"),
85
+ domain: path.resolve("../node-modules/domain-browser/"),
86
+ events: path.resolve("../node-modules/events/"),
87
+ http: path.resolve("../node-modules/stream-http/"),
88
+ https: path.resolve("../node-modules/https-browserify/"),
89
+ os: path.resolve("../node-modules/os-browserify/"),
90
+ path: path.resolve("../node-modules/path-browserify/"),
91
+ punycode: path.resolve("../node-modules/punycode/"),
92
+ process: path.resolve("../node-modules/process/"),
93
+ querystring: path.resolve("../node-modules/querystring-es3/"),
94
+ stream: path.resolve("../node-modules/stream-browserify/"),
95
+ _stream_duplex: path.resolve("../node-modules/readable-stream/"),
96
+ _stream_passthrough: path.resolve("../node-modules/readable-stream/"),
97
+ _stream_readable: path.resolve("../node-modules/readable-stream/"),
98
+ _stream_transform: path.resolve("../node-modules/readable-stream/"),
99
+ _stream_writable: path.resolve("../node-modules/readable-stream/"),
100
+ string_decoder: path.resolve("../node-modules/string_decoder/"),
101
+ sys: path.resolve("../node-modules/util/"),
102
+ timers: path.resolve("../node-modules/timers-browserify/"),
103
+ tty: path.resolve("../node-modules/tty-browserify/"),
104
+ url: path.resolve("../node-modules/url/"),
105
+ util: path.resolve("../node-modules/util/"),
106
+ vm: path.resolve("../node-modules/vm-browserify/"),
107
+ zlib: path.resolve("../node-modules/browserify-zlib/")
108
+ }
109
+ },
110
+ output: {
111
+ path: null,
112
+ publicPath: 'assets',
113
+ filename: "[name]"
114
+ },
115
+ devServer: {
116
+ allowedHosts: "all",
117
+ static: {
118
+ directory: null
119
+ },
120
+ compress: true,
121
+ port: 8080,
122
+ hot: false,
123
+ server: 'https',
124
+ headers: {
125
+ "access-control-allow-origin": "*",
126
+ "cache-control": "public, max-age=0"
127
+ }
128
+ },
129
+ watchOptions: {
130
+ ignored: ['node_modules/**']
131
+ },
132
+ plugins: [
133
+ new webpack.ProvidePlugin({
134
+ Buffer: ["buffer", "Buffer"],
135
+ process: "process/browser"
136
+ }),
137
+ new MiniCssExtractPlugin({
138
+ filename: config.build.css,
139
+ chunkFilename: "[id].css"
140
+ })
141
+ ]
142
+ };
143
+
144
+ export default webpackConfig;
@@ -1,11 +1,11 @@
1
- module.exports = function (options) {
1
+ export default function (options) {
2
2
  return `{
3
3
  "visual": {
4
4
  "name": "${options.name}",
5
5
  "displayName": "${options.displayName}",
6
6
  "guid": "${options.guid}",
7
7
  "visualClassName": "${options.visualClassName}",
8
- "version": "1.0.0",
8
+ "version": "1.0.0.0",
9
9
  "description": "",
10
10
  "supportUrl": "",
11
11
  "gitHubUrl": ""
@@ -4,7 +4,7 @@
4
4
  "displayName": "<%= displayName %>",
5
5
  "guid": "<%= guid %>",
6
6
  "visualClassName": "<%= visualClassName %>",
7
- "version": "1.0.0",
7
+ "version": "1.0.0.0",
8
8
  "description": "",
9
9
  "supportUrl": "",
10
10
  "gitHubUrl": ""
@@ -1,4 +1,4 @@
1
- module.exports = function (options) {
1
+ export default function (options) {
2
2
  return `declare var powerbi;
3
3
  powerbi.visuals = powerbi.visuals || {};
4
4
  powerbi.visuals.plugins = powerbi.visuals.plugins || {};
@@ -0,0 +1,5 @@
1
+ assets
2
+ style
3
+ dist
4
+ node_modules
5
+ .eslintrc.js
@@ -0,0 +1,20 @@
1
+ module.exports = {
2
+ env: {
3
+ "browser": true,
4
+ "es6": true,
5
+ "es2017": true
6
+ },
7
+ root: true,
8
+ parser: "@typescript-eslint/parser",
9
+ parserOptions: {
10
+ project: "tsconfig.json",
11
+ tsconfigRootDir: ".",
12
+ },
13
+ plugins: [
14
+ "powerbi-visuals"
15
+ ],
16
+ extends: [
17
+ "plugin:powerbi-visuals/recommended"
18
+ ],
19
+ rules: {}
20
+ };
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "visual",
3
3
  "description": "default_template_value",
4
+ "version": "1.0.0.0",
4
5
  "repository": {
5
6
  "type": "default_template_value",
6
7
  "url": "default_template_value"
@@ -10,18 +11,18 @@
10
11
  "pbiviz": "pbiviz",
11
12
  "start": "pbiviz start",
12
13
  "package": "pbiviz package",
13
- "lint": "tslint -c tslint.json -p tsconfig.json"
14
+ "lint": "npx eslint . --ext .js,.jsx,.ts,.tsx"
14
15
  },
15
16
  "dependencies": {
16
- "@types/d3": "5.7.2",
17
- "d3": "5.12.0",
18
- "powerbi-visuals-api": "5.1.0",
17
+ "@types/d3": "7.4.0",
18
+ "d3": "7.8.5",
19
+ "powerbi-visuals-api": "5.4.0",
19
20
  "powerbi-visuals-utils-formattingmodel": "5.0.0"
20
21
  },
21
22
  "devDependencies": {
22
- "ts-loader": "6.1.0",
23
- "tslint": "^5.18.0",
24
- "tslint-microsoft-contrib": "^6.2.0",
25
- "typescript": "3.6.3"
23
+ "@typescript-eslint/eslint-plugin": "^5.59.11",
24
+ "eslint": "^8.42.0",
25
+ "eslint-plugin-powerbi-visuals": "^0.8.1",
26
+ "typescript": "4.9.3"
26
27
  }
27
28
  }
@@ -1,5 +1,6 @@
1
1
  {
2
- "apiVersion": "5.1.0",
2
+ "apiVersion": "5.3.0",
3
3
  "externalJS": null,
4
- "dependencies": null
4
+ "dependencies": null,
5
+ "version": "1.0.0.0"
5
6
  }
@@ -3,13 +3,13 @@
3
3
  "allowJs": false,
4
4
  "emitDecoratorMetadata": true,
5
5
  "experimentalDecorators": true,
6
- "target": "es6",
6
+ "target": "es2022",
7
7
  "sourceMap": true,
8
8
  "outDir": "./.tmp/build/",
9
9
  "moduleResolution": "node",
10
10
  "declaration": true,
11
11
  "lib": [
12
- "es2015",
12
+ "es2022",
13
13
  "dom"
14
14
  ]
15
15
  },
@@ -0,0 +1,5 @@
1
+ assets
2
+ style
3
+ dist
4
+ node_modules
5
+ .eslintrc.js
@@ -0,0 +1,20 @@
1
+ module.exports = {
2
+ env: {
3
+ "browser": true,
4
+ "es6": true,
5
+ "es2017": true
6
+ },
7
+ root: true,
8
+ parser: "@typescript-eslint/parser",
9
+ parserOptions: {
10
+ project: "tsconfig.json",
11
+ tsconfigRootDir: ".",
12
+ },
13
+ plugins: [
14
+ "powerbi-visuals"
15
+ ],
16
+ extends: [
17
+ "plugin:powerbi-visuals/recommended"
18
+ ],
19
+ rules: {}
20
+ };
@@ -4,16 +4,17 @@
4
4
  "powerbi-visuals-utils-formattingmodel": "5.0.0"
5
5
  },
6
6
  "devDependencies": {
7
- "powerbi-visuals-api": "5.1.0",
8
- "ts-loader": "6.1.0",
9
- "tslint": "^5.18.0",
10
- "tslint-microsoft-contrib": "^6.2.0",
11
- "typescript": "3.6.3"
7
+ "powerbi-visuals-api": "5.4.0",
8
+ "ts-loader": "9.4.3",
9
+ "@typescript-eslint/eslint-plugin": "^5.59.11",
10
+ "eslint": "^8.42.0",
11
+ "eslint-plugin-powerbi-visuals": "^0.8.1",
12
+ "typescript": "5.1.3"
12
13
  },
13
14
  "scripts": {
14
15
  "pbiviz": "pbiviz",
15
16
  "start": "pbiviz start",
16
17
  "package": "pbiviz package",
17
- "lint": "tslint -c tslint.json -p tsconfig.json"
18
+ "lint": "npx eslint . --ext .js,.jsx,.ts,.tsx"
18
19
  }
19
20
  }
@@ -1,4 +1,5 @@
1
1
  {
2
2
  "apiVersion": "5.1.0",
3
- "externalJS": null
3
+ "externalJS": null,
4
+ "version": "1.0.0.0"
4
5
  }
@@ -0,0 +1,5 @@
1
+ assets
2
+ style
3
+ dist
4
+ node_modules
5
+ .eslintrc.js
@@ -0,0 +1,20 @@
1
+ module.exports = {
2
+ env: {
3
+ "browser": true,
4
+ "es6": true,
5
+ "es2017": true
6
+ },
7
+ root: true,
8
+ parser: "@typescript-eslint/parser",
9
+ parserOptions: {
10
+ project: "tsconfig.json",
11
+ tsconfigRootDir: ".",
12
+ },
13
+ plugins: [
14
+ "powerbi-visuals"
15
+ ],
16
+ extends: [
17
+ "plugin:powerbi-visuals/recommended"
18
+ ],
19
+ rules: {}
20
+ };
@@ -4,10 +4,11 @@
4
4
  "powerbi-visuals-utils-formattingmodel": "5.0.0"
5
5
  },
6
6
  "devDependencies": {
7
- "powerbi-visuals-api": "5.1.0",
8
- "tslint": "^5.18.0",
9
- "tslint-microsoft-contrib": "^6.2.0",
10
- "typescript": "3.6.3"
7
+ "powerbi-visuals-api": "5.4.0",
8
+ "@typescript-eslint/eslint-plugin": "^5.59.11",
9
+ "eslint": "^8.42.0",
10
+ "eslint-plugin-powerbi-visuals": "^0.8.1",
11
+ "typescript": "4.9.3"
11
12
  },
12
13
  "scripts": {
13
14
  "pbiviz": "pbiviz",
@@ -0,0 +1,5 @@
1
+ assets
2
+ style
3
+ dist
4
+ node_modules
5
+ .eslintrc.js
@@ -0,0 +1,20 @@
1
+ module.exports = {
2
+ env: {
3
+ "browser": true,
4
+ "es6": true,
5
+ "es2017": true
6
+ },
7
+ root: true,
8
+ parser: "@typescript-eslint/parser",
9
+ parserOptions: {
10
+ project: "tsconfig.json",
11
+ tsconfigRootDir: ".",
12
+ },
13
+ plugins: [
14
+ "powerbi-visuals"
15
+ ],
16
+ extends: [
17
+ "plugin:powerbi-visuals/recommended"
18
+ ],
19
+ rules: {}
20
+ };
@@ -4,17 +4,18 @@
4
4
  "pbiviz": "pbiviz",
5
5
  "start": "pbiviz start",
6
6
  "package": "pbiviz package",
7
- "lint": "tslint -c tslint.json -p tsconfig.json"
7
+ "lint": "npx eslint . --ext .js,.jsx,.ts,.tsx"
8
8
  },
9
9
  "dependencies": {
10
- "d3": "5.10.0",
10
+ "d3": "7.8.5",
11
11
  "powerbi-visuals-utils-formattingmodel": "5.0.0"
12
12
  },
13
13
  "devDependencies": {
14
- "@types/d3": "5.7.2",
15
- "powerbi-visuals-api": "5.1.0",
16
- "tslint": "^5.18.0",
17
- "tslint-microsoft-contrib": "^6.2.0",
18
- "typescript": "3.6.3"
14
+ "@types/d3": "7.4.0",
15
+ "powerbi-visuals-api": "5.4.0",
16
+ "@typescript-eslint/eslint-plugin": "^5.59.11",
17
+ "eslint": "^8.42.0",
18
+ "eslint-plugin-powerbi-visuals": "^0.8.1",
19
+ "typescript": "4.9.3"
19
20
  }
20
21
  }
@@ -0,0 +1,5 @@
1
+ assets
2
+ style
3
+ dist
4
+ node_modules
5
+ .eslintrc.js
@@ -0,0 +1,20 @@
1
+ module.exports = {
2
+ env: {
3
+ "browser": true,
4
+ "es6": true,
5
+ "es2017": true
6
+ },
7
+ root: true,
8
+ parser: "@typescript-eslint/parser",
9
+ parserOptions: {
10
+ project: "tsconfig.json",
11
+ tsconfigRootDir: ".",
12
+ },
13
+ plugins: [
14
+ "powerbi-visuals"
15
+ ],
16
+ extends: [
17
+ "plugin:powerbi-visuals/recommended"
18
+ ],
19
+ rules: {}
20
+ };
@@ -4,17 +4,18 @@
4
4
  "pbiviz": "pbiviz",
5
5
  "start": "pbiviz start",
6
6
  "package": "pbiviz package",
7
- "lint": "tslint -c tslint.json -p tsconfig.json"
7
+ "lint": "npx eslint . --ext .js,.jsx,.ts,.tsx"
8
8
  },
9
9
  "dependencies": {
10
- "d3": "5.10.0",
10
+ "d3": "7.8.5",
11
11
  "powerbi-visuals-utils-formattingmodel": "5.0.0"
12
12
  },
13
13
  "devDependencies": {
14
- "powerbi-visuals-api": "5.1.0",
15
- "@types/d3": "5.7.2",
16
- "tslint": "^5.18.0",
17
- "tslint-microsoft-contrib": "^6.2.0",
18
- "typescript": "3.6.3"
14
+ "powerbi-visuals-api": "5.4.0",
15
+ "@types/d3": "7.4.0",
16
+ "@typescript-eslint/eslint-plugin": "^5.59.11",
17
+ "eslint": "^8.42.0",
18
+ "eslint-plugin-powerbi-visuals": "^0.8.1",
19
+ "typescript": "4.9.3"
19
20
  }
20
21
  }
@@ -15,5 +15,9 @@
15
15
  },
16
16
  "files": [
17
17
  "./src/visual.ts"
18
+ ],
19
+ "exclude": [
20
+ "node_modules",
21
+ "templates",
18
22
  ]
19
23
  }
package/tsconfig.json ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "compilerOptions": {
3
+ "allowJs": false,
4
+ "emitDecoratorMetadata": true,
5
+ "experimentalDecorators": true,
6
+ "esModuleInterop": true,
7
+ "allowSyntheticDefaultImports": true,
8
+ "declaration": false,
9
+ "sourceMap": false,
10
+ "module": "ES2022",
11
+ "moduleResolution": "node",
12
+ "target": "ES2022",
13
+ "lib": [
14
+ "ES2022",
15
+ "dom"
16
+ ],
17
+ "outDir": "lib"
18
+ },
19
+ "include": [
20
+ "src/**/*.ts"
21
+ ]
22
+ }
@@ -1,54 +0,0 @@
1
- /*
2
- * Power BI Visual CLI
3
- *
4
- * Copyright (c) Microsoft Corporation
5
- * All rights reserved.
6
- * MIT License
7
- *
8
- * Permission is hereby granted, free of charge, to any person obtaining a copy
9
- * of this software and associated documentation files (the ""Software""), to deal
10
- * in the Software without restriction, including without limitation the rights
11
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- * copies of the Software, and to permit persons to whom the Software is
13
- * furnished to do so, subject to the following conditions:
14
- *
15
- * The above copyright notice and this permission notice shall be included in
16
- * all copies or substantial portions of the Software.
17
- *
18
- * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
- * THE SOFTWARE.
25
- */
26
-
27
- "use strict";
28
-
29
- let program = require('commander');
30
- let VisualPackage = require('../lib/VisualPackage');
31
- let ConsoleWriter = require('../lib/ConsoleWriter');
32
- let CommandHelpManager = require('../lib/CommandHelpManager');
33
- let options = process.argv;
34
-
35
- if (options.some(option => option === '--help' || option === '-h')) {
36
- program.help(CommandHelpManager.createSubCommandHelpCallback(options));
37
- process.exit(0);
38
- }
39
-
40
- program.parse(options);
41
-
42
- let cwd = process.cwd();
43
-
44
- VisualPackage.loadVisualPackage(cwd).then((visualPackage) => {
45
- let info = visualPackage.config;
46
- if (info) {
47
- ConsoleWriter.infoTable(info);
48
- } else {
49
- ConsoleWriter.error('Unable to load visual info. Please ensure the package is valid.');
50
- }
51
- }).catch((e) => {
52
- ConsoleWriter.error('LOAD ERROR', e);
53
- process.exit(1);
54
- });
package/bin/pbiviz-new.js DELETED
@@ -1,82 +0,0 @@
1
- /*
2
- * Power BI Visual CLI
3
- *
4
- * Copyright (c) Microsoft Corporation
5
- * All rights reserved.
6
- * MIT License
7
- *
8
- * Permission is hereby granted, free of charge, to any person obtaining a copy
9
- * of this software and associated documentation files (the ""Software""), to deal
10
- * in the Software without restriction, including without limitation the rights
11
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- * copies of the Software, and to permit persons to whom the Software is
13
- * furnished to do so, subject to the following conditions:
14
- *
15
- * The above copyright notice and this permission notice shall be included in
16
- * all copies or substantial portions of the Software.
17
- *
18
- * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
- * THE SOFTWARE.
25
- */
26
-
27
- "use strict";
28
-
29
- const program = require('commander');
30
- const VisualPackage = require('../lib/VisualPackage');
31
- const ConsoleWriter = require('../lib/ConsoleWriter');
32
- const CommandHelpManager = require('../lib/CommandHelpManager');
33
- const TemplateFetcher = require('../lib/TemplateFetcher');
34
- const config = require('../config.json');
35
- const options = process.argv;
36
-
37
- program
38
- .option('-f, --force', 'force creation (overwrites folder if exists)')
39
- .option('-t, --template [template]', 'use a specific template (default, table, slicer, rvisual, rhtml)');
40
-
41
- if (options.some(option => option === '--help' || option === '-h')) {
42
- program.help(CommandHelpManager.createSubCommandHelpCallback(options));
43
- process.exit(0);
44
- }
45
-
46
- program.parse(options);
47
-
48
- let args = program.args;
49
-
50
- if (!args || args.length < 1) {
51
- ConsoleWriter.error("You must enter a visual name");
52
- process.exit(1);
53
- }
54
-
55
- let visualName = args.join(' ');
56
- let cwd = process.cwd();
57
-
58
- ConsoleWriter.info('Creating new visual');
59
-
60
- if (program.force) {
61
- ConsoleWriter.warn('Running with force flag. Existing files will be overwritten');
62
- }
63
-
64
- let generateOptions = {
65
- force: program.force,
66
- template: program.template
67
- };
68
-
69
- if (config.visualTemplates[generateOptions.template]) {
70
- new TemplateFetcher({
71
- force: program.force,
72
- templateName: generateOptions.template,
73
- visualName: visualName
74
- }).fetch();
75
- } else {
76
- VisualPackage.createVisualPackage(cwd, visualName, generateOptions).then(() => {
77
- ConsoleWriter.done('Visual creation complete');
78
- }).catch((e) => {
79
- ConsoleWriter.error('Unable to create visual.\n', e);
80
- process.exit(1);
81
- });
82
- }