@infomaximum/package-cli 1.4.0-rc4 → 1.4.0-rc5

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/arguments.js CHANGED
@@ -1,6 +1,8 @@
1
1
  import { runBuild } from "./scripts/widget/build.js";
2
2
  import { runDevServer } from "./scripts/widget/start.js";
3
3
  import { runInitWidget } from "./scripts/widget/init/init.js";
4
+ import { systemRequire } from "./utils.js";
5
+ const packageJson = systemRequire("../package.json");
4
6
  const registerWidgetCommands = (cli) => {
5
7
  const widgetCommand = cli.command("widget");
6
8
  const widgetBuildCommand = widgetCommand.command("build");
@@ -15,15 +17,16 @@ const registerWidgetCommands = (cli) => {
15
17
  .option("-p, --port <port>", "Порт на котором будет доступен виджет", "5555")
16
18
  .option("--host <host>", "host на котором будет доступен виджет", "0.0.0.0")
17
19
  .action((options) => runDevServer(options));
18
- const widgetInitCommand = widgetCommand.command("init <path>");
20
+ const widgetInitCommand = widgetCommand.command("init <project-directory>");
19
21
  widgetInitCommand
20
22
  .description("Создание виджета")
21
- .action((initPath) => {
22
- runInitWidget(initPath);
23
+ .action((dirName) => {
24
+ runInitWidget(dirName);
23
25
  });
24
26
  };
25
27
  export const registerCommands = (cli) => {
26
28
  cli.helpOption("-h", "Отображает помощь по командам");
27
29
  cli.name("im-package-cli");
30
+ cli.version(packageJson.version, "-v, --version", "Текущая версия библиотеки");
28
31
  registerWidgetCommands(cli);
29
32
  };
@@ -4,7 +4,7 @@ import { archiveExt, buildWidgetConfigName, widgetArchiveName, } from "./common.
4
4
  import path from "path";
5
5
  import { JsonModifyWebpackPlugin } from "@infomaximum/json-modify-webpack-plugin";
6
6
  import { systemRequire } from "../../utils.js";
7
- const packageFilename = "main";
7
+ const packageFilename = "main.js";
8
8
  export const getPackageConfig = (mode, PATHS) => {
9
9
  const widgetVersion = systemRequire(PATHS.appPackageJson).version;
10
10
  const manifestPackageName = systemRequire(PATHS.packageManifest).name;
@@ -3,8 +3,8 @@ import path from "node:path";
3
3
  import nodePlop from "node-plop";
4
4
  import { getInitWidgetGenerator } from "./generators.js";
5
5
  import { spawnCommand } from "../../../utils.js";
6
- const runInitWidget = (initPath) => __awaiter(void 0, void 0, void 0, function* () {
7
- const createPath = path.resolve(process.cwd(), initPath);
6
+ const runInitWidget = (dirName) => __awaiter(void 0, void 0, void 0, function* () {
7
+ const createPath = path.join(process.cwd(), dirName);
8
8
  const plop = yield nodePlop(undefined, {
9
9
  destBasePath: createPath,
10
10
  force: false,
@@ -1,11 +1,11 @@
1
1
  export const WIDGET_INDEX_CSS_TEMPLATE = `\
2
2
  body {
3
- margin: 0;
4
- overflow: hidden;
5
- font-family: -apple-system, BlinkMacSystemFont, "Montserrat Segoe UI",
6
- "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans",
7
- "Helvetica Neue", sans-serif;
8
- -webkit-font-smoothing: antialiased;
9
- -moz-osx-font-smoothing: grayscale;
10
- }
3
+ margin: 0;
4
+ overflow: hidden;
5
+ font-family: -apple-system, BlinkMacSystemFont, "Montserrat Segoe UI",
6
+ "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans",
7
+ "Helvetica Neue", sans-serif;
8
+ -webkit-font-smoothing: antialiased;
9
+ -moz-osx-font-smoothing: grayscale;
10
+ }
11
11
  `;
@@ -1,26 +1,26 @@
1
1
  export const WIDGET_TSCONFIG_JSON = `\
2
2
  {
3
- "compilerOptions": {
4
- "baseUrl": "./src",
5
- "target": "ES2015",
6
- "lib": ["dom", "dom.iterable", "esnext"],
7
- "allowJs": true,
8
- "skipLibCheck": true,
9
- "esModuleInterop": true,
10
- "allowSyntheticDefaultImports": true,
11
- "strict": true,
12
- "forceConsistentCasingInFileNames": true,
13
- "noFallthroughCasesInSwitch": true,
14
- "module": "esnext",
15
- "moduleResolution": "node",
16
- "resolveJsonModule": true,
17
- "isolatedModules": true,
18
- "verbatimModuleSyntax": true,
19
- "noEmit": true,
20
- "jsx": "react-jsx"
21
- },
22
- "include": ["src"]
23
- }
3
+ "compilerOptions": {
4
+ "baseUrl": "./src",
5
+ "target": "ES2015",
6
+ "lib": ["dom", "dom.iterable", "esnext"],
7
+ "allowJs": true,
8
+ "skipLibCheck": true,
9
+ "esModuleInterop": true,
10
+ "allowSyntheticDefaultImports": true,
11
+ "strict": true,
12
+ "forceConsistentCasingInFileNames": true,
13
+ "noFallthroughCasesInSwitch": true,
14
+ "module": "esnext",
15
+ "moduleResolution": "node",
16
+ "resolveJsonModule": true,
17
+ "isolatedModules": true,
18
+ "verbatimModuleSyntax": true,
19
+ "noEmit": true,
20
+ "jsx": "react-jsx"
21
+ },
22
+ "include": ["src"]
23
+ }
24
24
  `;
25
25
  export const WIDGET_BABEL_CONFIG = `\
26
26
  module.exports = {
@@ -2,18 +2,18 @@ import { randomUUID } from "node:crypto";
2
2
  import { capitalizeHelperName } from "../../scripts/widget/init/helpers.js";
3
3
  export const WIDGET_MANIFEST_TEMPLATE = `\
4
4
  {
5
- "uuid": "${randomUUID()}",
6
- "entry": "index.js",
7
- "api_version": 1,
8
- "name": {
9
- "en": "{{${capitalizeHelperName} packageName}}",
10
- "ru": "{{${capitalizeHelperName} packageName}}"
11
- },
12
- "default_size_percentage": {
13
- "width": 60,
14
- "height": 20,
15
- "min_width": 8,
16
- "min_height": 4
17
- }
5
+ "uuid": "${randomUUID()}",
6
+ "entry": "index.js",
7
+ "api_version": 1,
8
+ "name": {
9
+ "en": "{{${capitalizeHelperName} packageName}}",
10
+ "ru": "{{${capitalizeHelperName} packageName}}"
11
+ },
12
+ "default_size_percentage": {
13
+ "width": 60,
14
+ "height": 20,
15
+ "min_width": 8,
16
+ "min_height": 4
18
17
  }
18
+ }
19
19
  `;
@@ -1,43 +1,43 @@
1
1
  export const WIDGET_PACKAGE_JSON_TEMPLATE = `\
2
2
  {
3
- "name": "template_widget",
4
- "version": "1.0.0",
5
- "private": true,
6
- "main": "src/index.tsx",
7
- "scripts": {
8
- "build": "im-package-cli widget build --entry ./src/index.tsx",
9
- "start": "im-package-cli widget start --entry ./src/index.tsx",
10
- "lint": "tsc --noEmit && eslint src/ --ext .ts,.tsx --quiet",
11
- "test": "jest --passWithNoTests"
12
- },
13
- "dependencies": {
14
- "react": "18.2.0",
15
- "react-dom": "18.2.0",
16
- "@infomaximum/custom-widget": "^{{customWidgetVersion}}"
17
- },
18
- "devDependencies": {
19
- "@babel/core": "7.23.3",
20
- "@babel/preset-env": "7.23.3",
21
- "@babel/preset-react": "7.23.3",
22
- "@babel/preset-typescript": "7.23.3",
23
- "@infomaximum/package-cli": "^{{packageCliVersion}}",
24
- "@types/jest": "29.5.10",
25
- "@types/react": "18.2.39",
26
- "@types/react-dom": "18.2.17",
27
- "@typescript-eslint/eslint-plugin": "6.13.0",
28
- "@typescript-eslint/parser": "6.13.0",
29
- "eslint": "8.54.0",
30
- "eslint-plugin-react": "7.33.2",
31
- "eslint-plugin-react-hooks": "4.6.0",
32
- "jest": "29.7.0",
33
- "jest-canvas-mock": "2.5.2",
34
- "jest-environment-jsdom": "29.7.0",
35
- "jest-environment-jsdom-global": "4.0.0",
36
- "prettier": "3.1.0",
37
- "typescript": "~5.3.2"
38
- },
39
- "browserslist": [
40
- "defaults and supports es6-module"
41
- ]
42
- }
3
+ "name": "template_widget",
4
+ "version": "1.0.0",
5
+ "private": true,
6
+ "main": "src/index.tsx",
7
+ "scripts": {
8
+ "build": "im-package-cli widget build --entry ./src/index.tsx",
9
+ "start": "im-package-cli widget start --entry ./src/index.tsx",
10
+ "lint": "tsc --noEmit && eslint src/ --ext .ts,.tsx --quiet",
11
+ "test": "jest --passWithNoTests"
12
+ },
13
+ "dependencies": {
14
+ "react": "18.2.0",
15
+ "react-dom": "18.2.0",
16
+ "@infomaximum/custom-widget": "^{{customWidgetVersion}}"
17
+ },
18
+ "devDependencies": {
19
+ "@babel/core": "7.23.3",
20
+ "@babel/preset-env": "7.23.3",
21
+ "@babel/preset-react": "7.23.3",
22
+ "@babel/preset-typescript": "7.23.3",
23
+ "@infomaximum/package-cli": "^{{packageCliVersion}}",
24
+ "@types/jest": "29.5.10",
25
+ "@types/react": "18.2.39",
26
+ "@types/react-dom": "18.2.17",
27
+ "@typescript-eslint/eslint-plugin": "6.13.0",
28
+ "@typescript-eslint/parser": "6.13.0",
29
+ "eslint": "8.54.0",
30
+ "eslint-plugin-react": "7.33.2",
31
+ "eslint-plugin-react-hooks": "4.6.0",
32
+ "jest": "29.7.0",
33
+ "jest-canvas-mock": "2.5.2",
34
+ "jest-environment-jsdom": "29.7.0",
35
+ "jest-environment-jsdom-global": "4.0.0",
36
+ "prettier": "3.1.0",
37
+ "typescript": "~5.3.2"
38
+ },
39
+ "browserslist": [
40
+ "defaults and supports es6-module"
41
+ ]
42
+ }
43
43
  `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infomaximum/package-cli",
3
- "version": "1.4.0-rc4",
3
+ "version": "1.4.0-rc5",
4
4
  "exports": "./dist/index.js",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",