@astral/pack 0.1.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.
- package/LICENSE +21 -0
- package/README.md +111 -0
- package/bin.d.ts +2 -0
- package/bin.js +28 -0
- package/cli/enums.d.ts +5 -0
- package/cli/enums.js +6 -0
- package/cli/index.d.ts +2 -0
- package/cli/index.js +2 -0
- package/cli/parseArgs/index.d.ts +1 -0
- package/cli/parseArgs/index.js +1 -0
- package/cli/parseArgs/parseArgs.d.ts +2 -0
- package/cli/parseArgs/parseArgs.js +10 -0
- package/cli/types.d.ts +5 -0
- package/cli/types.js +1 -0
- package/commands/build/build.d.ts +6 -0
- package/commands/build/build.js +48 -0
- package/commands/build/index.d.ts +1 -0
- package/commands/build/index.js +1 -0
- package/commands/compileJs/compileJs.d.ts +6 -0
- package/commands/compileJs/compileJs.js +19 -0
- package/commands/compileJs/index.d.ts +1 -0
- package/commands/compileJs/index.js +1 -0
- package/commands/compileTs/compileTs.d.ts +2 -0
- package/commands/compileTs/compileTs.js +45 -0
- package/commands/compileTs/index.d.ts +1 -0
- package/commands/compileTs/index.js +1 -0
- package/commands/copyDoc/copyDoc.d.ts +5 -0
- package/commands/copyDoc/copyDoc.js +9 -0
- package/commands/copyDoc/index.d.ts +1 -0
- package/commands/copyDoc/index.js +1 -0
- package/commands/copyStatic/copyStatic.d.ts +7 -0
- package/commands/copyStatic/copyStatic.js +17 -0
- package/commands/copyStatic/index.d.ts +1 -0
- package/commands/copyStatic/index.js +1 -0
- package/commands/generatePackageJson/generatePackageJson.d.ts +8 -0
- package/commands/generatePackageJson/generatePackageJson.js +70 -0
- package/commands/generatePackageJson/index.d.ts +1 -0
- package/commands/generatePackageJson/index.js +1 -0
- package/commands/index.d.ts +7 -0
- package/commands/index.js +7 -0
- package/commands/rmDist/index.d.ts +1 -0
- package/commands/rmDist/index.js +1 -0
- package/commands/rmDist/rmDist.d.ts +2 -0
- package/commands/rmDist/rmDist.js +17 -0
- package/commands/semanticRelease/checkPackageVersion/checkPackageVersion.d.ts +2 -0
- package/commands/semanticRelease/checkPackageVersion/checkPackageVersion.js +50 -0
- package/commands/semanticRelease/checkPackageVersion/index.d.ts +1 -0
- package/commands/semanticRelease/checkPackageVersion/index.js +1 -0
- package/commands/semanticRelease/createRelease/createRelease.d.ts +2 -0
- package/commands/semanticRelease/createRelease/createRelease.js +25 -0
- package/commands/semanticRelease/createRelease/index.d.ts +1 -0
- package/commands/semanticRelease/createRelease/index.js +1 -0
- package/commands/semanticRelease/defaultConfig.d.ts +39 -0
- package/commands/semanticRelease/defaultConfig.js +63 -0
- package/commands/semanticRelease/index.d.ts +2 -0
- package/commands/semanticRelease/index.js +2 -0
- package/config/ConfigService/ConfigService.d.ts +27 -0
- package/config/ConfigService/ConfigService.js +76 -0
- package/config/ConfigService/index.d.ts +1 -0
- package/config/ConfigService/index.js +1 -0
- package/config/ConfigService/validation.d.ts +3 -0
- package/config/ConfigService/validation.js +28 -0
- package/config/defineConfig/defineConfig.d.ts +2 -0
- package/config/defineConfig/defineConfig.js +1 -0
- package/config/defineConfig/index.d.ts +1 -0
- package/config/defineConfig/index.js +1 -0
- package/config/index.d.ts +3 -0
- package/config/index.js +3 -0
- package/config/types.d.ts +54 -0
- package/config/types.js +1 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/node/bin.d.ts +2 -0
- package/node/bin.js +30 -0
- package/node/cli/enums.d.ts +5 -0
- package/node/cli/enums.js +9 -0
- package/node/cli/index.d.ts +2 -0
- package/node/cli/index.js +18 -0
- package/node/cli/parseArgs/index.d.ts +1 -0
- package/node/cli/parseArgs/index.js +17 -0
- package/node/cli/parseArgs/parseArgs.d.ts +2 -0
- package/node/cli/parseArgs/parseArgs.js +14 -0
- package/node/cli/types.d.ts +5 -0
- package/node/cli/types.js +2 -0
- package/node/commands/build/build.d.ts +6 -0
- package/node/commands/build/build.js +55 -0
- package/node/commands/build/index.d.ts +1 -0
- package/node/commands/build/index.js +17 -0
- package/node/commands/compileJs/compileJs.d.ts +6 -0
- package/node/commands/compileJs/compileJs.js +26 -0
- package/node/commands/compileJs/index.d.ts +1 -0
- package/node/commands/compileJs/index.js +17 -0
- package/node/commands/compileTs/compileTs.d.ts +2 -0
- package/node/commands/compileTs/compileTs.js +52 -0
- package/node/commands/compileTs/index.d.ts +1 -0
- package/node/commands/compileTs/index.js +17 -0
- package/node/commands/copyDoc/copyDoc.d.ts +5 -0
- package/node/commands/copyDoc/copyDoc.js +13 -0
- package/node/commands/copyDoc/index.d.ts +1 -0
- package/node/commands/copyDoc/index.js +17 -0
- package/node/commands/copyStatic/copyStatic.d.ts +7 -0
- package/node/commands/copyStatic/copyStatic.js +24 -0
- package/node/commands/copyStatic/index.d.ts +1 -0
- package/node/commands/copyStatic/index.js +17 -0
- package/node/commands/generatePackageJson/generatePackageJson.d.ts +8 -0
- package/node/commands/generatePackageJson/generatePackageJson.js +77 -0
- package/node/commands/generatePackageJson/index.d.ts +1 -0
- package/node/commands/generatePackageJson/index.js +17 -0
- package/node/commands/index.d.ts +7 -0
- package/node/commands/index.js +23 -0
- package/node/commands/rmDist/index.d.ts +1 -0
- package/node/commands/rmDist/index.js +17 -0
- package/node/commands/rmDist/rmDist.d.ts +2 -0
- package/node/commands/rmDist/rmDist.js +24 -0
- package/node/commands/semanticRelease/checkPackageVersion/checkPackageVersion.d.ts +2 -0
- package/node/commands/semanticRelease/checkPackageVersion/checkPackageVersion.js +57 -0
- package/node/commands/semanticRelease/checkPackageVersion/index.d.ts +1 -0
- package/node/commands/semanticRelease/checkPackageVersion/index.js +17 -0
- package/node/commands/semanticRelease/createRelease/createRelease.d.ts +2 -0
- package/node/commands/semanticRelease/createRelease/createRelease.js +32 -0
- package/node/commands/semanticRelease/createRelease/index.d.ts +1 -0
- package/node/commands/semanticRelease/createRelease/index.js +17 -0
- package/node/commands/semanticRelease/defaultConfig.d.ts +39 -0
- package/node/commands/semanticRelease/defaultConfig.js +67 -0
- package/node/commands/semanticRelease/index.d.ts +2 -0
- package/node/commands/semanticRelease/index.js +18 -0
- package/node/config/ConfigService/ConfigService.d.ts +27 -0
- package/node/config/ConfigService/ConfigService.js +116 -0
- package/node/config/ConfigService/index.d.ts +1 -0
- package/node/config/ConfigService/index.js +17 -0
- package/node/config/ConfigService/validation.d.ts +3 -0
- package/node/config/ConfigService/validation.js +64 -0
- package/node/config/defineConfig/defineConfig.d.ts +2 -0
- package/node/config/defineConfig/defineConfig.js +5 -0
- package/node/config/defineConfig/index.d.ts +1 -0
- package/node/config/defineConfig/index.js +17 -0
- package/node/config/index.d.ts +3 -0
- package/node/config/index.js +19 -0
- package/node/config/types.d.ts +54 -0
- package/node/config/types.js +2 -0
- package/node/index.d.ts +1 -0
- package/node/index.js +5 -0
- package/node/services/Logger/Logger.d.ts +7 -0
- package/node/services/Logger/Logger.js +19 -0
- package/node/services/Logger/index.d.ts +1 -0
- package/node/services/Logger/index.js +17 -0
- package/node/services/index.d.ts +1 -0
- package/node/services/index.js +17 -0
- package/package.json +45 -0
- package/services/Logger/Logger.d.ts +7 -0
- package/services/Logger/Logger.js +15 -0
- package/services/Logger/index.d.ts +1 -0
- package/services/Logger/index.js +1 -0
- package/services/index.d.ts +1 -0
- package/services/index.js +1 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { CopyStaticFilesConfig, Lang, PackConfig } from '../types';
|
|
2
|
+
export declare class ConfigService {
|
|
3
|
+
readonly projectPath: string;
|
|
4
|
+
/**
|
|
5
|
+
* Директория, где хранятся приватные файлы для @astral/pack
|
|
6
|
+
*/
|
|
7
|
+
readonly packPrivateDirPath: string;
|
|
8
|
+
readonly lang: Lang;
|
|
9
|
+
private readonly configName;
|
|
10
|
+
private readonly logger;
|
|
11
|
+
private readonly config;
|
|
12
|
+
constructor();
|
|
13
|
+
get sourcePath(): string;
|
|
14
|
+
get distDirName(): string;
|
|
15
|
+
get distPath(): string;
|
|
16
|
+
get copyStaticFiles(): CopyStaticFilesConfig | undefined;
|
|
17
|
+
get format(): PackConfig['format'];
|
|
18
|
+
get tsConfigName(): string;
|
|
19
|
+
get semanticRelease(): {
|
|
20
|
+
versionsFileName: string;
|
|
21
|
+
repositoryUrl: string;
|
|
22
|
+
releaseGroup?: string[];
|
|
23
|
+
};
|
|
24
|
+
get packageExports(): import("../types").PackageExports | undefined;
|
|
25
|
+
private parseConfig;
|
|
26
|
+
private checkLanguage;
|
|
27
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.ConfigService = void 0;
|
|
40
|
+
const path_1 = __importDefault(require("path"));
|
|
41
|
+
const fs_1 = __importDefault(require("fs"));
|
|
42
|
+
const v = __importStar(require("@astral/validations"));
|
|
43
|
+
const services_1 = require("../../services");
|
|
44
|
+
const validation_1 = require("./validation");
|
|
45
|
+
class ConfigService {
|
|
46
|
+
projectPath = process.cwd();
|
|
47
|
+
/**
|
|
48
|
+
* Директория, где хранятся приватные файлы для @astral/pack
|
|
49
|
+
*/
|
|
50
|
+
packPrivateDirPath;
|
|
51
|
+
lang;
|
|
52
|
+
configName = 'pack.config.js';
|
|
53
|
+
logger = new services_1.Logger();
|
|
54
|
+
config;
|
|
55
|
+
constructor() {
|
|
56
|
+
this.config = this.parseConfig();
|
|
57
|
+
this.lang = this.checkLanguage();
|
|
58
|
+
this.packPrivateDirPath = path_1.default.join(this.projectPath, '.pack');
|
|
59
|
+
}
|
|
60
|
+
get sourcePath() {
|
|
61
|
+
if (fs_1.default.existsSync(path_1.default.join(this.projectPath, 'src'))) {
|
|
62
|
+
return path_1.default.join(this.projectPath, 'src');
|
|
63
|
+
}
|
|
64
|
+
return this.projectPath;
|
|
65
|
+
}
|
|
66
|
+
get distDirName() {
|
|
67
|
+
return this.config.distDirName || 'lib';
|
|
68
|
+
}
|
|
69
|
+
get distPath() {
|
|
70
|
+
return path_1.default.join(this.projectPath, this.distDirName);
|
|
71
|
+
}
|
|
72
|
+
get copyStaticFiles() {
|
|
73
|
+
if (!this.config.copyStaticFiles) {
|
|
74
|
+
return undefined;
|
|
75
|
+
}
|
|
76
|
+
return { ignoreSrc: true, ...this.config.copyStaticFiles };
|
|
77
|
+
}
|
|
78
|
+
get format() {
|
|
79
|
+
return this.config.format;
|
|
80
|
+
}
|
|
81
|
+
get tsConfigName() {
|
|
82
|
+
return this.config.tsConfigName || 'tsconfig.json';
|
|
83
|
+
}
|
|
84
|
+
get semanticRelease() {
|
|
85
|
+
return {
|
|
86
|
+
...this.config.semanticRelease,
|
|
87
|
+
versionsFileName: 'versions.json',
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
get packageExports() {
|
|
91
|
+
return this.config.packageExports;
|
|
92
|
+
}
|
|
93
|
+
parseConfig = () => {
|
|
94
|
+
const configPath = path_1.default.join(this.projectPath, this.configName);
|
|
95
|
+
if (!fs_1.default.existsSync(configPath)) {
|
|
96
|
+
this.logger.error('pack.config.js не найден');
|
|
97
|
+
throw Error('pack.config.js не найден');
|
|
98
|
+
}
|
|
99
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
100
|
+
const config = require(configPath);
|
|
101
|
+
const validationError = (0, validation_1.validateConfig)(config);
|
|
102
|
+
if (validationError) {
|
|
103
|
+
this.logger.error('Ошибка валидации config', v.toPrettyError(validationError));
|
|
104
|
+
throw new Error('Ошибка валидации config');
|
|
105
|
+
}
|
|
106
|
+
return config;
|
|
107
|
+
};
|
|
108
|
+
checkLanguage = () => {
|
|
109
|
+
const tsConfigPath = path_1.default.join(this.projectPath, this.tsConfigName);
|
|
110
|
+
if (fs_1.default.existsSync(tsConfigPath)) {
|
|
111
|
+
return 'ts';
|
|
112
|
+
}
|
|
113
|
+
return 'js';
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
exports.ConfigService = ConfigService;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ConfigService';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./ConfigService"), exports);
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.validateConfig = void 0;
|
|
37
|
+
const v = __importStar(require("@astral/validations"));
|
|
38
|
+
exports.validateConfig = v.object({
|
|
39
|
+
distDirName: v.optional(v.string()),
|
|
40
|
+
copyStaticFiles: v.optional(v.object({
|
|
41
|
+
filter: v.array(v.arrayItem(v.string())),
|
|
42
|
+
ignoreSrc: v.optional(v.boolean()),
|
|
43
|
+
})),
|
|
44
|
+
tsConfigName: v.optional(v.string()),
|
|
45
|
+
format: v.array(v.arrayItem(v.string())),
|
|
46
|
+
semanticRelease: v.object({
|
|
47
|
+
repositoryUrl: v.string(),
|
|
48
|
+
releaseGroup: v.optional(v.array(v.arrayItem(v.string()))),
|
|
49
|
+
}),
|
|
50
|
+
packageExports: (value) => {
|
|
51
|
+
const objectError = v.optional(v.object({}))(value);
|
|
52
|
+
if (objectError) {
|
|
53
|
+
return objectError;
|
|
54
|
+
}
|
|
55
|
+
const errors = Object.values(value)
|
|
56
|
+
.map((exportValue) => v.object({
|
|
57
|
+
require: v.string(),
|
|
58
|
+
module: v.string(),
|
|
59
|
+
types: v.string(),
|
|
60
|
+
})(exportValue))
|
|
61
|
+
.filter(Boolean);
|
|
62
|
+
return errors[0];
|
|
63
|
+
},
|
|
64
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './defineConfig';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./defineConfig"), exports);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./types"), exports);
|
|
18
|
+
__exportStar(require("./ConfigService"), exports);
|
|
19
|
+
__exportStar(require("./defineConfig"), exports);
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export type CopyStaticFilesConfig = {
|
|
2
|
+
/**
|
|
3
|
+
* Используется glob паттерн
|
|
4
|
+
* @example ['src/declarations/*d.ts']
|
|
5
|
+
*/
|
|
6
|
+
filter: string[];
|
|
7
|
+
/**
|
|
8
|
+
* Если true, то при перемещении в пакет удалит src в пути
|
|
9
|
+
* @default true
|
|
10
|
+
*/
|
|
11
|
+
ignoreSrc?: boolean;
|
|
12
|
+
};
|
|
13
|
+
export type SemanticReleaseConfig = {
|
|
14
|
+
/**
|
|
15
|
+
* @example https://git.astralnalog.ru/frontend.shared/pack
|
|
16
|
+
*/
|
|
17
|
+
repositoryUrl: string;
|
|
18
|
+
/**
|
|
19
|
+
* Имена пакетов, которые должны релизиться синхронно одной версией.
|
|
20
|
+
* Подменить версии этих пакетов в deps на текущую версию пакета
|
|
21
|
+
*/
|
|
22
|
+
releaseGroup?: string[];
|
|
23
|
+
};
|
|
24
|
+
export type PackageExportsItem = {
|
|
25
|
+
module: string;
|
|
26
|
+
require: string;
|
|
27
|
+
types: string;
|
|
28
|
+
};
|
|
29
|
+
export type PackageExports = Record<string, PackageExportsItem>;
|
|
30
|
+
export type PackConfig = {
|
|
31
|
+
/**
|
|
32
|
+
* @default берет module из tsconfig.json
|
|
33
|
+
*/
|
|
34
|
+
format: Array<'esm' | 'cjs'>;
|
|
35
|
+
/**
|
|
36
|
+
* @default lib
|
|
37
|
+
*/
|
|
38
|
+
distDirName?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Копирует статичные файлы в пакет. Используется glob паттерн
|
|
41
|
+
* @example src/declarations/*d.ts
|
|
42
|
+
*/
|
|
43
|
+
copyStaticFiles?: CopyStaticFilesConfig;
|
|
44
|
+
/**
|
|
45
|
+
* @default tsconfig.json
|
|
46
|
+
*/
|
|
47
|
+
tsConfigName?: string;
|
|
48
|
+
semanticRelease: SemanticReleaseConfig;
|
|
49
|
+
/**
|
|
50
|
+
* exports свойство package.json
|
|
51
|
+
*/
|
|
52
|
+
packageExports?: PackageExports;
|
|
53
|
+
};
|
|
54
|
+
export type Lang = 'js' | 'ts';
|
package/node/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { type PackConfig, defineConfig } from './config';
|
package/node/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defineConfig = void 0;
|
|
4
|
+
var config_1 = require("./config");
|
|
5
|
+
Object.defineProperty(exports, "defineConfig", { enumerable: true, get: function () { return config_1.defineConfig; } });
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare class Logger {
|
|
2
|
+
progress: (message: string, ...data: unknown[]) => void;
|
|
3
|
+
success: (message: string, ...data: unknown[]) => void;
|
|
4
|
+
info: (message: string, ...data: unknown[]) => void;
|
|
5
|
+
error: (message: string, ...data: unknown[]) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const logger: Logger;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.logger = exports.Logger = void 0;
|
|
4
|
+
class Logger {
|
|
5
|
+
progress = (message, ...data) => {
|
|
6
|
+
console.log(`⏳ ${message}`, ...data);
|
|
7
|
+
};
|
|
8
|
+
success = (message, ...data) => {
|
|
9
|
+
console.log(`✅ ${message}`, ...data);
|
|
10
|
+
};
|
|
11
|
+
info = (message, ...data) => {
|
|
12
|
+
console.log(`ℹ️ ${message}`, ...data);
|
|
13
|
+
};
|
|
14
|
+
error = (message, ...data) => {
|
|
15
|
+
console.error(message, ...data);
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
exports.Logger = Logger;
|
|
19
|
+
exports.logger = new Logger();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Logger';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Logger"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Logger';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Logger"), exports);
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@astral/pack",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"bin": {
|
|
5
|
+
"pack": "bin.js"
|
|
6
|
+
},
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=22"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@astral/validations": "0.1.0",
|
|
12
|
+
"recursive-copy": "^2.0.14",
|
|
13
|
+
"semantic-release": "^24.2.3",
|
|
14
|
+
"@semantic-release/changelog": "~6.0.3",
|
|
15
|
+
"@semantic-release/commit-analyzer": "~13.0.1",
|
|
16
|
+
"@semantic-release/gitlab": "~13.2.3",
|
|
17
|
+
"@semantic-release/release-notes-generator": "~14.0.3"
|
|
18
|
+
},
|
|
19
|
+
"optionalDependencies": {
|
|
20
|
+
"typescript": "*"
|
|
21
|
+
},
|
|
22
|
+
"sideEffects": false,
|
|
23
|
+
"types": "./index.d.ts",
|
|
24
|
+
"main": "./node/index.js",
|
|
25
|
+
"module": "./index.js",
|
|
26
|
+
"browser": "./index.js",
|
|
27
|
+
"author": "Astral.Soft",
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "https://git.astralnalog.ru/frontend.shared/pack"
|
|
32
|
+
},
|
|
33
|
+
"exports": {
|
|
34
|
+
".": {
|
|
35
|
+
"module": "./index.js",
|
|
36
|
+
"require": "./node/index.js",
|
|
37
|
+
"types": "./index.d.ts"
|
|
38
|
+
},
|
|
39
|
+
"./server": {
|
|
40
|
+
"module": "./server/index.js",
|
|
41
|
+
"require": "./node/server/index.js",
|
|
42
|
+
"types": "./server/index.d.ts"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare class Logger {
|
|
2
|
+
progress: (message: string, ...data: unknown[]) => void;
|
|
3
|
+
success: (message: string, ...data: unknown[]) => void;
|
|
4
|
+
info: (message: string, ...data: unknown[]) => void;
|
|
5
|
+
error: (message: string, ...data: unknown[]) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const logger: Logger;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export class Logger {
|
|
2
|
+
progress = (message, ...data) => {
|
|
3
|
+
console.log(`⏳ ${message}`, ...data);
|
|
4
|
+
};
|
|
5
|
+
success = (message, ...data) => {
|
|
6
|
+
console.log(`✅ ${message}`, ...data);
|
|
7
|
+
};
|
|
8
|
+
info = (message, ...data) => {
|
|
9
|
+
console.log(`ℹ️ ${message}`, ...data);
|
|
10
|
+
};
|
|
11
|
+
error = (message, ...data) => {
|
|
12
|
+
console.error(message, ...data);
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export const logger = new Logger();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Logger';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Logger';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Logger';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Logger';
|