@steambrew/ttc 2.4.3 → 2.5.3

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/dist/index.js CHANGED
@@ -69,10 +69,18 @@ const Logger = {
69
69
  * @brief print the parameter list to the stdout
70
70
  */
71
71
  const PrintParamHelp = () => {
72
- console.log("millennium-ttc parameter list:" +
73
- "\n\t" + chalk.magenta("--help") + ": display parameter list" +
74
- "\n\t" + chalk.bold.red("--build") + ": " + chalk.bold.red("(required)") + ": build type [dev, prod] (prod minifies code)" +
75
- "\n\t" + chalk.magenta("--target") + ": path to plugin, default to cwd");
72
+ console.log('millennium-ttc parameter list:' +
73
+ '\n\t' +
74
+ chalk.magenta('--help') +
75
+ ': display parameter list' +
76
+ '\n\t' +
77
+ chalk.bold.red('--build') +
78
+ ': ' +
79
+ chalk.bold.red('(required)') +
80
+ ': build type [dev, prod] (prod minifies code)' +
81
+ '\n\t' +
82
+ chalk.magenta('--target') +
83
+ ': path to plugin, default to cwd');
76
84
  };
77
85
  var BuildType;
78
86
  (function (BuildType) {
@@ -81,24 +89,24 @@ var BuildType;
81
89
  })(BuildType || (BuildType = {}));
82
90
  const ValidateParameters = (args) => {
83
91
  let typeProp = BuildType.DevBuild, targetProp = process.cwd();
84
- if (args.includes("--help")) {
92
+ if (args.includes('--help')) {
85
93
  PrintParamHelp();
86
94
  process.exit();
87
95
  }
88
96
  // startup args are invalid
89
- if (!args.includes("--build")) {
90
- Logger.Error("Received invalid arguments...");
97
+ if (!args.includes('--build')) {
98
+ Logger.Error('Received invalid arguments...');
91
99
  PrintParamHelp();
92
100
  process.exit();
93
101
  }
94
102
  for (let i = 0; i < args.length; i++) {
95
- if (args[i] === "--build") {
103
+ if (args[i] === '--build') {
96
104
  const BuildMode = args[i + 1];
97
105
  switch (BuildMode) {
98
- case "dev":
106
+ case 'dev':
99
107
  typeProp = BuildType.DevBuild;
100
108
  break;
101
- case "prod":
109
+ case 'prod':
102
110
  typeProp = BuildType.ProdBuild;
103
111
  break;
104
112
  default: {
@@ -107,7 +115,7 @@ const ValidateParameters = (args) => {
107
115
  }
108
116
  }
109
117
  }
110
- if (args[i] == "--target") {
118
+ if (args[i] == '--target') {
111
119
  if (args[i + 1] === undefined) {
112
120
  Logger.Error('--target parameter must be preceded by system path');
113
121
  process.exit();
@@ -117,7 +125,7 @@ const ValidateParameters = (args) => {
117
125
  }
118
126
  return {
119
127
  type: typeProp,
120
- targetPlugin: targetProp
128
+ targetPlugin: targetProp,
121
129
  };
122
130
  };
123
131
 
@@ -149,13 +157,13 @@ const CheckForUpdates = async () => {
149
157
  const ValidatePlugin = (target) => {
150
158
  return new Promise((resolve, reject) => {
151
159
  if (!existsSync(target)) {
152
- console.error(chalk.red.bold(`\n[-] --target [${target}] `) + chalk.red("is not a valid system path"));
160
+ console.error(chalk.red.bold(`\n[-] --target [${target}] `) + chalk.red('is not a valid system path'));
153
161
  reject();
154
162
  return;
155
163
  }
156
- const pluginModule = path$2.join(target, "plugin.json");
164
+ const pluginModule = path$2.join(target, 'plugin.json');
157
165
  if (!existsSync(pluginModule)) {
158
- console.error(chalk.red.bold(`\n[-] --target [${target}] `) + chalk.red("is not a valid plugin (missing plugin.json)"));
166
+ console.error(chalk.red.bold(`\n[-] --target [${target}] `) + chalk.red('is not a valid plugin (missing plugin.json)'));
159
167
  reject();
160
168
  return;
161
169
  }
@@ -166,7 +174,7 @@ const ValidatePlugin = (target) => {
166
174
  return;
167
175
  }
168
176
  try {
169
- if (!("name" in JSON.parse(data))) {
177
+ if (!('name' in JSON.parse(data))) {
170
178
  console.error(chalk.red.bold(`\n[-] target plugin doesn't contain "name" in plugin.json [${pluginModule}]`));
171
179
  reject();
172
180
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steambrew/ttc",
3
- "version": "2.4.3",
3
+ "version": "2.5.3",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
package/rollup.config.js CHANGED
@@ -4,7 +4,7 @@ import json from '@rollup/plugin-json';
4
4
  import nodeResolve from '@rollup/plugin-node-resolve';
5
5
 
6
6
  export default {
7
- input: 'index.ts',
7
+ input: 'src/index.ts',
8
8
  context: 'window',
9
9
  output: {
10
10
  file: 'dist/index.js',
@@ -0,0 +1,41 @@
1
+ import chalk from 'chalk';
2
+ import path from 'path';
3
+ import { existsSync, readFile } from 'fs';
4
+
5
+ export const ValidatePlugin = (target: string): Promise<any> => {
6
+ return new Promise<any>((resolve, reject) => {
7
+ if (!existsSync(target)) {
8
+ console.error(chalk.red.bold(`\n[-] --target [${target}] `) + chalk.red('is not a valid system path'));
9
+ reject();
10
+ return;
11
+ }
12
+
13
+ const pluginModule = path.join(target, 'plugin.json');
14
+
15
+ if (!existsSync(pluginModule)) {
16
+ console.error(chalk.red.bold(`\n[-] --target [${target}] `) + chalk.red('is not a valid plugin (missing plugin.json)'));
17
+ reject();
18
+ return;
19
+ }
20
+
21
+ readFile(pluginModule, 'utf8', (err, data) => {
22
+ if (err) {
23
+ console.error(chalk.red.bold(`\n[-] couldn't read plugin.json from [${pluginModule}]`));
24
+ reject();
25
+ return;
26
+ }
27
+
28
+ try {
29
+ if (!('name' in JSON.parse(data))) {
30
+ console.error(chalk.red.bold(`\n[-] target plugin doesn't contain "name" in plugin.json [${pluginModule}]`));
31
+ reject();
32
+ } else {
33
+ resolve(JSON.parse(data));
34
+ }
35
+ } catch (parseError) {
36
+ console.error(chalk.red.bold(`\n[-] couldn't parse JSON in plugin.json from [${pluginModule}]`));
37
+ reject();
38
+ }
39
+ });
40
+ });
41
+ };
@@ -5,10 +5,10 @@
5
5
  * - typescript transpiler
6
6
  * - rollup configurator
7
7
  */
8
- import { BuildType, ValidateParameters } from './Parameters';
9
- import { CheckForUpdates } from './VersionMon';
10
- import { ValidatePlugin } from './Linter';
11
- import { TranspilerPluginComponent, TranspilerProps } from './Compiler';
8
+ import { BuildType, ValidateParameters } from './query-parser';
9
+ import { CheckForUpdates } from './version-control';
10
+ import { ValidatePlugin } from './check-health';
11
+ import { TranspilerPluginComponent, TranspilerProps } from './transpiler';
12
12
  import { performance } from 'perf_hooks';
13
13
  import chalk from 'chalk';
14
14
  // import { Logger } from './Logger'
@@ -0,0 +1,82 @@
1
+ import chalk from 'chalk';
2
+ import { Logger } from './logger';
3
+
4
+ /***
5
+ * @brief print the parameter list to the stdout
6
+ */
7
+ export const PrintParamHelp = () => {
8
+ console.log(
9
+ 'millennium-ttc parameter list:' +
10
+ '\n\t' +
11
+ chalk.magenta('--help') +
12
+ ': display parameter list' +
13
+ '\n\t' +
14
+ chalk.bold.red('--build') +
15
+ ': ' +
16
+ chalk.bold.red('(required)') +
17
+ ': build type [dev, prod] (prod minifies code)' +
18
+ '\n\t' +
19
+ chalk.magenta('--target') +
20
+ ': path to plugin, default to cwd',
21
+ );
22
+ };
23
+
24
+ export enum BuildType {
25
+ DevBuild,
26
+ ProdBuild,
27
+ }
28
+
29
+ export interface ParameterProps {
30
+ type: BuildType;
31
+ targetPlugin: string; // path
32
+ }
33
+
34
+ export const ValidateParameters = (args: Array<string>): ParameterProps => {
35
+ let typeProp: BuildType = BuildType.DevBuild,
36
+ targetProp: string = process.cwd();
37
+
38
+ if (args.includes('--help')) {
39
+ PrintParamHelp();
40
+ process.exit();
41
+ }
42
+
43
+ // startup args are invalid
44
+ if (!args.includes('--build')) {
45
+ Logger.Error('Received invalid arguments...');
46
+ PrintParamHelp();
47
+ process.exit();
48
+ }
49
+
50
+ for (let i = 0; i < args.length; i++) {
51
+ if (args[i] === '--build') {
52
+ const BuildMode: string = args[i + 1];
53
+
54
+ switch (BuildMode) {
55
+ case 'dev':
56
+ typeProp = BuildType.DevBuild;
57
+ break;
58
+ case 'prod':
59
+ typeProp = BuildType.ProdBuild;
60
+ break;
61
+ default: {
62
+ Logger.Error('--build parameter must be preceded by build type [dev, prod]');
63
+ process.exit();
64
+ }
65
+ }
66
+ }
67
+
68
+ if (args[i] == '--target') {
69
+ if (args[i + 1] === undefined) {
70
+ Logger.Error('--target parameter must be preceded by system path');
71
+ process.exit();
72
+ }
73
+
74
+ targetProp = args[i + 1];
75
+ }
76
+ }
77
+
78
+ return {
79
+ type: typeProp,
80
+ targetPlugin: targetProp,
81
+ };
82
+ };
@@ -13,13 +13,13 @@ import scss from 'rollup-plugin-scss';
13
13
  import * as sass from 'sass';
14
14
 
15
15
  import chalk from 'chalk';
16
- import { Logger } from './Logger';
16
+ import { Logger } from './logger';
17
17
  import fs from 'fs';
18
18
 
19
19
  import injectProcessEnv from 'rollup-plugin-inject-process-env';
20
20
  import dotenv from 'dotenv';
21
- import { ExecutePluginModule, InitializePlugins } from './PluginSetup';
22
- import constSysfsExpr from './StaticEmbed';
21
+ import { ExecutePluginModule, InitializePlugins } from './plugin-api';
22
+ import constSysfsExpr from './static-embed';
23
23
 
24
24
  const envConfig = dotenv.config().parsed || {};
25
25
 
@@ -2,7 +2,7 @@ import path from 'path';
2
2
  import { fileURLToPath } from 'url';
3
3
  import { readFile } from 'fs/promises';
4
4
  import { dirname } from 'path';
5
- import { Logger } from './Logger';
5
+ import { Logger } from './logger';
6
6
 
7
7
  export const CheckForUpdates = async (): Promise<boolean> => {
8
8
  return new Promise<boolean>(async (resolve) => {
package/tsconfig.json CHANGED
@@ -1,24 +1,23 @@
1
1
  {
2
- "compilerOptions": {
3
- "outDir": "dist",
4
- "module": "ESNext",
5
- "target": "ES2020",
6
- "jsx": "react",
7
- "jsxFactory": "window.SP_REACT.createElement",
8
- "declaration": false,
9
- "moduleResolution": "node",
10
- "noUnusedLocals": true,
11
- "noUnusedParameters": true,
12
- "esModuleInterop": true,
13
- "noImplicitReturns": true,
14
- "noImplicitThis": true,
15
- "noImplicitAny": true,
16
- "strict": true,
17
- "ignoreDeprecations": "5.0",
18
- "allowSyntheticDefaultImports": true,
19
- "skipLibCheck": true
20
- },
21
- "include": ["./"],
22
- "exclude": ["node_modules"]
2
+ "compilerOptions": {
3
+ "outDir": "dist",
4
+ "module": "ESNext",
5
+ "target": "ES2020",
6
+ "jsx": "react",
7
+ "jsxFactory": "window.SP_REACT.createElement",
8
+ "declaration": false,
9
+ "moduleResolution": "node",
10
+ "noUnusedLocals": true,
11
+ "noUnusedParameters": true,
12
+ "esModuleInterop": true,
13
+ "noImplicitReturns": true,
14
+ "noImplicitThis": true,
15
+ "noImplicitAny": true,
16
+ "strict": true,
17
+ "ignoreDeprecations": "5.0",
18
+ "allowSyntheticDefaultImports": true,
19
+ "skipLibCheck": true
20
+ },
21
+ "include": ["./src/**/*"],
22
+ "exclude": ["node_modules"]
23
23
  }
24
-
package/Linter.ts DELETED
@@ -1,44 +0,0 @@
1
- import chalk from 'chalk'
2
- import path from 'path'
3
- import { existsSync, readFile } from 'fs'
4
-
5
- export const ValidatePlugin = (target: string): Promise<any> => {
6
-
7
- return new Promise<any>((resolve, reject) => {
8
- if (!existsSync(target)) {
9
- console.error(chalk.red.bold(`\n[-] --target [${target}] `) + chalk.red("is not a valid system path"))
10
- reject()
11
- return
12
- }
13
-
14
- const pluginModule = path.join(target, "plugin.json")
15
-
16
- if (!existsSync(pluginModule)) {
17
- console.error(chalk.red.bold(`\n[-] --target [${target}] `) + chalk.red("is not a valid plugin (missing plugin.json)"))
18
- reject()
19
- return
20
- }
21
-
22
- readFile(pluginModule, 'utf8', (err, data) => {
23
- if (err) {
24
- console.error(chalk.red.bold(`\n[-] couldn't read plugin.json from [${pluginModule}]`))
25
- reject()
26
- return
27
- }
28
-
29
- try {
30
- if (!("name" in JSON.parse(data))) {
31
- console.error(chalk.red.bold(`\n[-] target plugin doesn't contain "name" in plugin.json [${pluginModule}]`))
32
- reject()
33
- }
34
- else {
35
- resolve(JSON.parse(data))
36
- }
37
- }
38
- catch (parseError) {
39
- console.error(chalk.red.bold(`\n[-] couldn't parse JSON in plugin.json from [${pluginModule}]`))
40
- reject()
41
- }
42
- });
43
- })
44
- }
package/Parameters.ts DELETED
@@ -1,72 +0,0 @@
1
- import chalk from 'chalk'
2
- import { Logger } from "./Logger"
3
-
4
- /***
5
- * @brief print the parameter list to the stdout
6
- */
7
- export const PrintParamHelp = () => {
8
-
9
- console.log(
10
- "millennium-ttc parameter list:" +
11
- "\n\t" + chalk.magenta("--help") + ": display parameter list" +
12
- "\n\t" + chalk.bold.red("--build") + ": " + chalk.bold.red("(required)") + ": build type [dev, prod] (prod minifies code)" +
13
- "\n\t" + chalk.magenta("--target") + ": path to plugin, default to cwd"
14
- );
15
- }
16
-
17
- export enum BuildType {
18
- DevBuild, ProdBuild
19
- }
20
-
21
- export interface ParameterProps {
22
- type: BuildType,
23
- targetPlugin: string // path
24
- }
25
-
26
- export const ValidateParameters = (args: Array<string>): ParameterProps => {
27
-
28
- let typeProp: BuildType = BuildType.DevBuild, targetProp: string = process.cwd()
29
-
30
- if (args.includes("--help")) {
31
- PrintParamHelp()
32
- process.exit();
33
- }
34
-
35
- // startup args are invalid
36
- if (!args.includes("--build")) {
37
- Logger.Error("Received invalid arguments...");
38
- PrintParamHelp();
39
- process.exit();
40
- }
41
-
42
- for (let i = 0; i < args.length; i++)
43
- {
44
- if (args[i] === "--build")
45
- {
46
- const BuildMode: string = args[i + 1]
47
-
48
- switch (BuildMode) {
49
- case "dev": typeProp = BuildType.DevBuild; break
50
- case "prod": typeProp = BuildType.ProdBuild; break
51
- default: {
52
- Logger.Error('--build parameter must be preceded by build type [dev, prod]');
53
- process.exit();
54
- }
55
- }
56
- }
57
-
58
- if (args[i] == "--target") {
59
- if (args[i + 1] === undefined) {
60
- Logger.Error('--target parameter must be preceded by system path');
61
- process.exit();
62
- }
63
-
64
- targetProp = args[i + 1]
65
- }
66
- }
67
-
68
- return {
69
- type: typeProp,
70
- targetPlugin: targetProp
71
- }
72
- }
File without changes
File without changes
File without changes