@astral/pack 1.6.0 → 1.7.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 (28) hide show
  1. package/bin.js +1 -1
  2. package/cli/parseArgs/parseArgs.d.ts +1 -1
  3. package/cli/types.d.ts +1 -1
  4. package/commands/build/build.d.ts +1 -1
  5. package/commands/build/build.js +4 -4
  6. package/commands/compileJs/compileJs.d.ts +1 -1
  7. package/commands/compileJs/compileJs.js +1 -1
  8. package/commands/compileTs/compileTs.d.ts +1 -1
  9. package/commands/compileTs/compileTs.js +1 -1
  10. package/commands/copyDoc/copyDoc.d.ts +1 -1
  11. package/commands/copyDoc/copyDoc.js +1 -1
  12. package/commands/copyStatic/copyStatic.d.ts +1 -1
  13. package/commands/generatePackageJson/generatePackageJson.d.ts +1 -1
  14. package/commands/generatePackageJson/generatePackageJson.js +3 -2
  15. package/commands/semanticRelease/checkPackageVersion/checkPackageVersion.d.ts +1 -1
  16. package/commands/semanticRelease/checkPackageVersion/checkPackageVersion.js +1 -1
  17. package/commands/semanticRelease/createRelease/createRelease.d.ts +1 -1
  18. package/commands/telegram/sendTelegramFailRelease/sendTelegramFailRelease.d.ts +1 -1
  19. package/commands/telegram/sendTelegramSuccessRelease/sendTelegramSuccessRelease.d.ts +1 -1
  20. package/commands/telegram/sendTelegramSuccessRelease/sendTelegramSuccessRelease.js +1 -1
  21. package/config/ConfigService/ConfigService.d.ts +1 -1
  22. package/config/ConfigService/ConfigService.js +4 -4
  23. package/config/defineConfig/defineConfig.d.ts +1 -1
  24. package/package.json +1 -1
  25. package/services/SemanticRelease/SemanticRelease.d.ts +1 -1
  26. package/services/SemanticRelease/SemanticRelease.js +2 -2
  27. package/services/Telegram/Telegram.d.ts +1 -1
  28. package/services/Telegram/Telegram.js +1 -1
package/bin.js CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
+ const cli_1 = require("./cli");
4
5
  const commands_1 = require("./commands");
5
6
  const config_1 = require("./config");
6
- const cli_1 = require("./cli");
7
7
  const start = async () => {
8
8
  const { command, packageVersion, telegram } = (0, cli_1.parseArgs)();
9
9
  let configService;
@@ -1,2 +1,2 @@
1
- import { CLIArgs } from '../types';
1
+ import { type CLIArgs } from '../types';
2
2
  export declare const parseArgs: () => CLIArgs;
package/cli/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { CLICommand } from './enums';
1
+ import { type CLICommand } from './enums';
2
2
  export type CLIArgs = {
3
3
  command: CLICommand;
4
4
  packageVersion?: string;
@@ -1,4 +1,4 @@
1
- import { ConfigService } from '../../config';
1
+ import { type ConfigService } from '../../config';
2
2
  type Params = {
3
3
  packageVersion?: string;
4
4
  };
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.build = void 0;
4
+ const services_1 = require("../../services");
4
5
  const compileJs_1 = require("../compileJs");
5
- const generatePackageJson_1 = require("../generatePackageJson");
6
6
  const compileTs_1 = require("../compileTs");
7
- const services_1 = require("../../services");
8
- const rmDist_1 = require("../rmDist");
9
- const copyStatic_1 = require("../copyStatic");
10
7
  const copyDoc_1 = require("../copyDoc");
8
+ const copyStatic_1 = require("../copyStatic");
9
+ const generatePackageJson_1 = require("../generatePackageJson");
10
+ const rmDist_1 = require("../rmDist");
11
11
  const build = async (params, config) => {
12
12
  let newPackageVersion = '';
13
13
  if (params.packageVersion) {
@@ -1,4 +1,4 @@
1
- import { ConfigService, PackageJson } from '../../config';
1
+ import { type ConfigService, type PackageJson } from '../../config';
2
2
  type Params = {
3
3
  originPackageJson: PackageJson;
4
4
  };
@@ -5,8 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.compileJs = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
- const copyStatic_1 = require("../copyStatic");
9
8
  const services_1 = require("../../services");
9
+ const copyStatic_1 = require("../copyStatic");
10
10
  const compileJs = async ({ originPackageJson }, config) => {
11
11
  const { main } = originPackageJson;
12
12
  const srcDir = path_1.default.dirname(main).replace('./', '').replace('.', '') || 'src';
@@ -1,2 +1,2 @@
1
- import { ConfigService } from '../../config';
1
+ import { type ConfigService } from '../../config';
2
2
  export declare const compileTs: (config: ConfigService) => Promise<void>;
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.compileTs = void 0;
7
- const path_1 = __importDefault(require("path"));
8
7
  const node_child_process_1 = require("node:child_process");
8
+ const path_1 = __importDefault(require("path"));
9
9
  const services_1 = require("../../services");
10
10
  const compileTs = (config) => {
11
11
  const { tsConfigName, format, projectPath, distPath } = config;
@@ -1,4 +1,4 @@
1
- import { ConfigService } from '../../config';
1
+ import { type ConfigService } from '../../config';
2
2
  /**
3
3
  * Копирует README и license
4
4
  */
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.copyDoc = void 0;
4
- const copyStatic_1 = require("../copyStatic");
5
4
  const services_1 = require("../../services");
5
+ const copyStatic_1 = require("../copyStatic");
6
6
  /**
7
7
  * Копирует README и license
8
8
  */
@@ -1,4 +1,4 @@
1
- import { ConfigService } from '../../config';
1
+ import { type ConfigService } from '../../config';
2
2
  type Params = {
3
3
  filter: string[];
4
4
  ignoreSrc?: boolean;
@@ -1,4 +1,4 @@
1
- import { ConfigService, PackageJson } from '../../config';
1
+ import { type ConfigService, type PackageJson } from '../../config';
2
2
  type Params = {
3
3
  packageVersion: string;
4
4
  originPackageJson: PackageJson;
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.generatePackageJson = void 0;
7
- const path_1 = __importDefault(require("path"));
8
7
  const fs_1 = __importDefault(require("fs"));
8
+ const path_1 = __importDefault(require("path"));
9
9
  const services_1 = require("../../services");
10
10
  const initOmitProps = ({ omitPackageJsonProps = [] }) => (originPackageJson) => {
11
11
  const devProps = [
@@ -41,7 +41,6 @@ const initUpdatingReleaseGroup = (config, packageVersion) => (originPackageJson)
41
41
  };
42
42
  const initExportsGenerator = ({ packageExports, format, lang }) => (originPackageJson) => {
43
43
  if (format.length === 1 && format.includes('cjs')) {
44
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
45
44
  const { exports, ...packageJson } = originPackageJson;
46
45
  return packageJson;
47
46
  }
@@ -62,6 +61,8 @@ const initExportsGenerator = ({ packageExports, format, lang }) => (originPackag
62
61
  ...originPackageJson,
63
62
  exports: {
64
63
  '.': rootExports,
64
+ default: './index.js',
65
+ import: './index.js',
65
66
  ...packageExports,
66
67
  },
67
68
  };
@@ -1,2 +1,2 @@
1
- import { ConfigService } from '../../../config';
1
+ import { type ConfigService } from '../../../config';
2
2
  export declare const checkPackageVersion: (config: ConfigService) => Promise<void>;
@@ -37,7 +37,7 @@ const checkPackageVersion = async (config) => {
37
37
  throw err;
38
38
  }
39
39
  if (versions.currentVersion === versions.nextVersion) {
40
- throw Error('Версии пакетов совпадают');
40
+ throw new Error('Версии пакетов совпадают');
41
41
  }
42
42
  const { projectPath, packPrivateDirName, semanticRelease: semanticReleaseConfig, } = config;
43
43
  const versionFilePath = path_1.default.join(projectPath, packPrivateDirName, semanticReleaseConfig.versionsFileName);
@@ -1,2 +1,2 @@
1
- import { ConfigService } from '../../../config';
1
+ import { type ConfigService } from '../../../config';
2
2
  export declare const createRelease: (config: ConfigService) => Promise<void>;
@@ -1,4 +1,4 @@
1
- import { ConfigService } from '../../../config';
1
+ import { type ConfigService } from '../../../config';
2
2
  type Params = {
3
3
  chatId?: string;
4
4
  botToken?: string;
@@ -1,4 +1,4 @@
1
- import { ConfigService } from '../../../config';
1
+ import { type ConfigService } from '../../../config';
2
2
  type Params = {
3
3
  chatId?: string;
4
4
  botToken?: string;
@@ -8,7 +8,7 @@ const sendTelegramSuccessRelease = async ({ chatId, packageName, botToken }, con
8
8
  if (!chatId || !botToken) {
9
9
  const errorMessage = 'Не указан chatId или botToken для Telegram';
10
10
  services_1.logger.error(errorMessage);
11
- throw Error(errorMessage);
11
+ throw new Error(errorMessage);
12
12
  }
13
13
  const semanticRelease = (0, services_1.createSemanticRelease)(config);
14
14
  const newPackageVersion = semanticRelease.parseVersions().nextVersion;
@@ -1,4 +1,4 @@
1
- import { CopyStaticFilesConfig, Lang, PackConfig } from '../types';
1
+ import { type CopyStaticFilesConfig, type Lang, type PackConfig } from '../types';
2
2
  export type PackageJson = {
3
3
  main: string;
4
4
  name: string;
@@ -37,9 +37,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.ConfigService = void 0;
40
- const path_1 = __importDefault(require("path"));
41
- const fs_1 = __importDefault(require("fs"));
42
40
  const v = __importStar(require("@astral/validations"));
41
+ const fs_1 = __importDefault(require("fs"));
42
+ const path_1 = __importDefault(require("path"));
43
43
  const services_1 = require("../../services");
44
44
  const validation_1 = require("./validation");
45
45
  class ConfigService {
@@ -112,9 +112,9 @@ class ConfigService {
112
112
  const configPath = path_1.default.join(this.projectPath, this.configName);
113
113
  if (!fs_1.default.existsSync(configPath)) {
114
114
  this.logger.error('pack.config.js не найден');
115
- throw Error('pack.config.js не найден');
115
+ throw new Error('pack.config.js не найден');
116
116
  }
117
- // eslint-disable-next-line @typescript-eslint/no-var-requires
117
+ // biome-ignore lint/style/noCommonJs: <>
118
118
  const config = require(configPath);
119
119
  const validationError = (0, validation_1.validateConfig)(config);
120
120
  if (validationError) {
@@ -1,2 +1,2 @@
1
- import { PackConfig } from '../types';
1
+ import { type PackConfig } from '../types';
2
2
  export declare const defineConfig: (config: PackConfig) => PackConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astral/pack",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "main": "./index.js",
5
5
  "bin": {
6
6
  "pack": "bin.js"
@@ -1,4 +1,4 @@
1
- import { ConfigService } from '../../config';
1
+ import { type ConfigService } from '../../config';
2
2
  export declare class SemanticRelease {
3
3
  private readonly _config;
4
4
  constructor(_config: ConfigService);
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.createSemanticRelease = exports.SemanticRelease = void 0;
7
- const path_1 = __importDefault(require("path"));
8
7
  const fs_1 = __importDefault(require("fs"));
8
+ const path_1 = __importDefault(require("path"));
9
9
  const Logger_1 = require("../Logger");
10
10
  class SemanticRelease {
11
11
  _config;
@@ -16,7 +16,7 @@ class SemanticRelease {
16
16
  const { semanticRelease } = this._config;
17
17
  const versionsFilePath = path_1.default.join(this.getVersionsDirPath(), semanticRelease.versionsFileName);
18
18
  if (!fs_1.default.existsSync(versionsFilePath)) {
19
- throw Error('Файл с версиями не найден');
19
+ throw new Error('Файл с версиями не найден');
20
20
  }
21
21
  const { currentVersion, nextVersion } = JSON.parse(fs_1.default.readFileSync(versionsFilePath, 'utf8'));
22
22
  const versions = {
@@ -1,4 +1,4 @@
1
- import { Logger } from '../Logger';
1
+ import { type Logger } from '../Logger';
2
2
  type Params = {
3
3
  chatId?: string;
4
4
  botToken?: string;
@@ -13,7 +13,7 @@ class Telegram {
13
13
  if (!params.chatId || !params.botToken) {
14
14
  const errorMessage = 'Не указан chatId или botToken для Telegram';
15
15
  Logger_1.logger.error(errorMessage);
16
- throw Error(errorMessage);
16
+ throw new Error(errorMessage);
17
17
  }
18
18
  this._params = params;
19
19
  }