s3build-cli 1.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.
package/README.md ADDED
@@ -0,0 +1,91 @@
1
+ # s3build-cli
2
+
3
+ CLI tool giúp build và publish các project .NET (ASP.NET, WebForms, MVC) bằng MSBuild — thay thế các file `.bat` thủ công.
4
+
5
+ ## Tính năng
6
+
7
+ - **Multi-profile** — quản lý nhiều project (WebPOS, WebAdmin, API...) qua file JSON
8
+ - **Auto-zip** — tự động nén output thành file `.zip` có gắn ngày
9
+ - **Dọn dẹp thông minh** — xóa file/folder không cần thiết trước khi zip (config, images, resources...)
10
+ - **Cross-platform** — chạy trên Windows (nơi có MSBuild)
11
+
12
+ ## Cài đặt
13
+
14
+ ```bash
15
+ npm install -g s3build-cli
16
+ ```
17
+
18
+ Yêu cầu: Node.js >= 16 và MSBuild (Visual Studio hoặc Build Tools).
19
+
20
+ ## Sử dụng
21
+
22
+ ### Khởi tạo profile mẫu
23
+
24
+ ```bash
25
+ s3build init
26
+ ```
27
+
28
+ Tạo thư mục `s3build-profiles/` trong folder hiện tại với file `example.json` mẫu.
29
+
30
+ ### Chỉnh sửa profile
31
+
32
+ ```json
33
+ {
34
+ "name": "WebPOS",
35
+ "project": "C:\\path\\to\\WebPOS.csproj",
36
+ "publishDir": "C:\\localpublish\\WebPOS",
37
+ "zipDir": "C:\\localpublish",
38
+ "zipPattern": "WebPOS_{date}.zip",
39
+ "msbuild": {
40
+ "configuration": "Release",
41
+ "deployOnBuild": true,
42
+ "webPublishMethod": "FileSystem"
43
+ },
44
+ "clean": {
45
+ "folders": ["Images", "PaymentSetting"],
46
+ "files": ["web.config", "ConnectionStrings.config"]
47
+ }
48
+ }
49
+ ```
50
+
51
+ ### Build
52
+
53
+ ```bash
54
+ # Build theo profile
55
+ s3build build webpos
56
+
57
+ # Build với ngày tùy chỉnh
58
+ s3build build webpos --date 01-07-2026
59
+ ```
60
+
61
+ ### Xem danh sách profiles
62
+
63
+ ```bash
64
+ s3build list
65
+ ```
66
+
67
+ ## Profile lookup
68
+
69
+ CLI tìm profile theo thứ tự ưu tiên:
70
+
71
+ 1. `./s3build-profiles/<name>.json` (thư mục hiện tại)
72
+ 2. Bundled profiles (cài kèm package)
73
+
74
+ Điều này cho phép mỗi team/project có bộ profile riêng mà không cần sửa package.
75
+
76
+ ## Luồng hoạt động
77
+
78
+ ```
79
+ s3build build <profile>
80
+
81
+ ├── 1. Load profile config
82
+ ├── 2. Xóa thư mục publish cũ
83
+ ├── 3. Chạy MSBuild → publish ra folder
84
+ ├── 4. Xóa folders/files theo clean config
85
+ ├── 5. Nén thành ZIP (archiver, level 9)
86
+ └── 6. Done → hiển thị đường dẫn + size
87
+ ```
88
+
89
+ ## License
90
+
91
+ MIT
@@ -0,0 +1,5 @@
1
+ export interface BuildOptions {
2
+ date?: string;
3
+ }
4
+ export declare function buildCommand(profileName: string, options: BuildOptions): Promise<void>;
5
+ //# sourceMappingURL=build.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wBAAsB,YAAY,CAChC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,IAAI,CAAC,CA+Cf"}
@@ -0,0 +1,86 @@
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.buildCommand = buildCommand;
37
+ const path = __importStar(require("path"));
38
+ const paths_1 = require("../utils/paths");
39
+ const logger = __importStar(require("../utils/logger"));
40
+ const cleaner_1 = require("../core/cleaner");
41
+ const builder_1 = require("../core/builder");
42
+ const zipper_1 = require("../core/zipper");
43
+ async function buildCommand(profileName, options) {
44
+ let profile;
45
+ try {
46
+ profile = (0, paths_1.loadProfile)(profileName);
47
+ }
48
+ catch (err) {
49
+ logger.error(err.message);
50
+ process.exit(1);
51
+ return; // unreachable, helps TS narrowing
52
+ }
53
+ const date = (0, paths_1.formatDate)(options.date);
54
+ const zipFileName = profile.zipPattern.replace("{date}", date);
55
+ const zipPath = path.join(profile.zipDir, zipFileName);
56
+ logger.header(`BUILD ${profile.name}`);
57
+ // Step 1: Clean old publish directory
58
+ logger.step("CLEAN OLD PUBLISH");
59
+ (0, cleaner_1.cleanPublishDir)(profile.publishDir);
60
+ // Step 2: Build & Publish
61
+ logger.step("BUILD & PUBLISH");
62
+ try {
63
+ await (0, builder_1.runMsbuild)(profile);
64
+ logger.success("Build completed successfully");
65
+ }
66
+ catch (err) {
67
+ logger.error(err.message);
68
+ process.exit(1);
69
+ }
70
+ // Step 3: Delete folders/files
71
+ logger.step("DELETE FOLDERS & FILES");
72
+ (0, cleaner_1.cleanAfterBuild)(profile.publishDir, profile.clean);
73
+ // Step 4: Create ZIP
74
+ logger.step("CREATE ZIP");
75
+ try {
76
+ await (0, zipper_1.createZip)(profile.publishDir, zipPath);
77
+ }
78
+ catch (err) {
79
+ logger.error(`Failed to create ZIP: ${err.message}`);
80
+ process.exit(1);
81
+ }
82
+ // Done
83
+ logger.header("DONE");
84
+ logger.success(`ZIP FILE: ${zipPath}`);
85
+ }
86
+ //# sourceMappingURL=build.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,oCAkDC;AA9DD,2CAA6B;AAE7B,0CAAyD;AACzD,wDAA0C;AAC1C,6CAAmE;AACnE,6CAA6C;AAC7C,2CAA2C;AAMpC,KAAK,UAAU,YAAY,CAChC,WAAmB,EACnB,OAAqB;IAErB,IAAI,OAAqB,CAAC;IAE1B,IAAI,CAAC;QACH,OAAO,GAAG,IAAA,mBAAW,EAAC,WAAW,CAAC,CAAC;IACrC,CAAC;IAAC,OAAO,GAAQ,EAAE,CAAC;QAClB,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC1B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAChB,OAAO,CAAC,kCAAkC;IAC5C,CAAC;IAED,MAAM,IAAI,GAAG,IAAA,kBAAU,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC,MAAM,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAC/D,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAEv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;
3
+ //# sourceMappingURL=builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../src/core/builder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGxC,wBAAgB,UAAU,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CA8B/D"}
@@ -0,0 +1,67 @@
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.runMsbuild = runMsbuild;
37
+ const child_process_1 = require("child_process");
38
+ const logger = __importStar(require("../utils/logger"));
39
+ function runMsbuild(profile) {
40
+ return new Promise((resolve, reject) => {
41
+ const args = [
42
+ profile.project,
43
+ `/p:Configuration=${profile.msbuild.configuration}`,
44
+ `/p:DeployOnBuild=${profile.msbuild.deployOnBuild}`,
45
+ `/p:DeployDefaultTarget=WebPublish`,
46
+ `/p:WebPublishMethod=${profile.msbuild.webPublishMethod}`,
47
+ `/p:PublishUrl=${profile.publishDir}`,
48
+ ];
49
+ logger.info(`msbuild ${args.join(" ")}`);
50
+ const proc = (0, child_process_1.spawn)("msbuild", args, {
51
+ stdio: "inherit",
52
+ shell: true,
53
+ });
54
+ proc.on("close", (code) => {
55
+ if (code !== 0) {
56
+ reject(new Error(`msbuild exited with code ${code}`));
57
+ }
58
+ else {
59
+ resolve();
60
+ }
61
+ });
62
+ proc.on("error", (err) => {
63
+ reject(new Error(`Failed to start msbuild: ${err.message}`));
64
+ });
65
+ });
66
+ }
67
+ //# sourceMappingURL=builder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builder.js","sourceRoot":"","sources":["../../src/core/builder.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,gCA8BC;AAlCD,iDAAsC;AAEtC,wDAA0C;AAE1C,SAAgB,UAAU,CAAC,OAAqB;IAC9C,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,IAAI,GAAG;YACX,OAAO,CAAC,OAAO;YACf,oBAAoB,OAAO,CAAC,OAAO,CAAC,aAAa,EAAE;YACnD,oBAAoB,OAAO,CAAC,OAAO,CAAC,aAAa,EAAE;YACnD,mCAAmC;YACnC,uBAAuB,OAAO,CAAC,OAAO,CAAC,gBAAgB,EAAE;YACzD,iBAAiB,OAAO,CAAC,UAAU,EAAE;SACtC,CAAC;QAEF,MAAM,CAAC,IAAI,CAAC,WAAW,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAEzC,MAAM,IAAI,GAAG,IAAA,qBAAK,EAAC,SAAS,EAAE,IAAI,EAAE;YAClC,KAAK,EAAE,SAAS;YAChB,KAAK,EAAE,IAAI;SACZ,CAAC,CAAC;QAEH,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAmB,EAAE,EAAE;YACvC,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;gBACf,MAAM,CAAC,IAAI,KAAK,CAAC,4BAA4B,IAAI,EAAE,CAAC,CAAC,CAAC;YACxD,CAAC;iBAAM,CAAC;gBACN,OAAO,EAAE,CAAC;YACZ,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAU,EAAE,EAAE;YAC9B,MAAM,CAAC,IAAI,KAAK,CAAC,4BAA4B,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QAC/D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { CleanConfig } from "../types";
2
+ export declare function cleanPublishDir(publishDir: string): void;
3
+ export declare function cleanAfterBuild(publishDir: string, config: CleanConfig): void;
4
+ //# sourceMappingURL=cleaner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cleaner.d.ts","sourceRoot":"","sources":["../../src/core/cleaner.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAGvC,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAKxD;AAED,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,IAAI,CAgB7E"}
@@ -0,0 +1,63 @@
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.cleanPublishDir = cleanPublishDir;
37
+ exports.cleanAfterBuild = cleanAfterBuild;
38
+ const fs = __importStar(require("fs"));
39
+ const path = __importStar(require("path"));
40
+ const logger = __importStar(require("../utils/logger"));
41
+ function cleanPublishDir(publishDir) {
42
+ if (fs.existsSync(publishDir)) {
43
+ fs.rmSync(publishDir, { recursive: true, force: true });
44
+ logger.info(`Removed: ${publishDir}`);
45
+ }
46
+ }
47
+ function cleanAfterBuild(publishDir, config) {
48
+ for (const folder of config.folders) {
49
+ const fullPath = path.join(publishDir, folder);
50
+ if (fs.existsSync(fullPath)) {
51
+ fs.rmSync(fullPath, { recursive: true, force: true });
52
+ logger.info(`Deleted folder: ${folder}`);
53
+ }
54
+ }
55
+ for (const file of config.files) {
56
+ const fullPath = path.join(publishDir, file);
57
+ if (fs.existsSync(fullPath)) {
58
+ fs.unlinkSync(fullPath);
59
+ logger.info(`Deleted file: ${file}`);
60
+ }
61
+ }
62
+ }
63
+ //# sourceMappingURL=cleaner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cleaner.js","sourceRoot":"","sources":["../../src/core/cleaner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,0CAKC;AAED,0CAgBC;AA5BD,uCAAyB;AACzB,2CAA6B;AAE7B,wDAA0C;AAE1C,SAAgB,eAAe,CAAC,UAAkB;IAChD,IAAI,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QAC9B,EAAE,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACxD,MAAM,CAAC,IAAI,CAAC,YAAY,UAAU,EAAE,CAAC,CAAC;IACxC,CAAC;AACH,CAAC;AAED,SAAgB,eAAe,CAAC,UAAkB,EAAE,MAAmB;IACrE,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACpC,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;QAC/C,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC5B,EAAE,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;YACtD,MAAM,CAAC,IAAI,CAAC,mBAAmB,MAAM,EAAE,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;IAED,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QAChC,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QAC7C,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC5B,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;YACxB,MAAM,CAAC,IAAI,CAAC,iBAAiB,IAAI,EAAE,CAAC,CAAC;QACvC,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function createZip(sourceDir: string, zipPath: string): Promise<string>;
2
+ //# sourceMappingURL=zipper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zipper.d.ts","sourceRoot":"","sources":["../../src/core/zipper.ts"],"names":[],"mappings":"AAOA,wBAAgB,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA8B7E"}
@@ -0,0 +1,68 @@
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.createZip = createZip;
37
+ const fs = __importStar(require("fs"));
38
+ const path = __importStar(require("path"));
39
+ const logger = __importStar(require("../utils/logger"));
40
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
41
+ const archiver = require("archiver");
42
+ function createZip(sourceDir, zipPath) {
43
+ return new Promise((resolve, reject) => {
44
+ // Remove existing zip if present
45
+ if (fs.existsSync(zipPath)) {
46
+ fs.unlinkSync(zipPath);
47
+ }
48
+ // Ensure output directory exists
49
+ const zipDir = path.dirname(zipPath);
50
+ if (!fs.existsSync(zipDir)) {
51
+ fs.mkdirSync(zipDir, { recursive: true });
52
+ }
53
+ const output = fs.createWriteStream(zipPath);
54
+ const archive = archiver("zip", { zlib: { level: 9 } });
55
+ output.on("close", () => {
56
+ const sizeMB = (archive.pointer() / 1024 / 1024).toFixed(2);
57
+ logger.success(`ZIP created: ${zipPath} (${sizeMB} MB)`);
58
+ resolve(zipPath);
59
+ });
60
+ archive.on("error", (err) => {
61
+ reject(err);
62
+ });
63
+ archive.pipe(output);
64
+ archive.directory(sourceDir, false);
65
+ archive.finalize();
66
+ });
67
+ }
68
+ //# sourceMappingURL=zipper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zipper.js","sourceRoot":"","sources":["../../src/core/zipper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,8BA8BC;AArCD,uCAAyB;AACzB,2CAA6B;AAC7B,wDAA0C;AAE1C,8DAA8D;AAC9D,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAErC,SAAgB,SAAS,CAAC,SAAiB,EAAE,OAAe;IAC1D,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,iCAAiC;QACjC,IAAI,EAAE,CAAC,UAAU,CAAC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{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/dist/index.js ADDED
@@ -0,0 +1,104 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ const fs = __importStar(require("fs"));
38
+ const path = __importStar(require("path"));
39
+ const commander_1 = require("commander");
40
+ const build_1 = require("./commands/build");
41
+ const paths_1 = require("./utils/paths");
42
+ const logger = __importStar(require("./utils/logger"));
43
+ const program = new commander_1.Command();
44
+ program
45
+ .name("s3build")
46
+ .description("CLI tool for building and publishing .NET projects")
47
+ .version("1.0.0");
48
+ program
49
+ .command("build <profile>")
50
+ .description("Build and publish a project using a profile")
51
+ .option("-d, --date <date>", "Custom date for zip filename (dd-MM-yyyy)")
52
+ .action(async (profile, options) => {
53
+ await (0, build_1.buildCommand)(profile, options);
54
+ });
55
+ program
56
+ .command("list")
57
+ .description("List available build profiles")
58
+ .action(() => {
59
+ const profiles = (0, paths_1.listProfiles)();
60
+ if (profiles.length === 0) {
61
+ logger.info('No profiles found. Run "s3build init" to create a sample profile.');
62
+ return;
63
+ }
64
+ logger.header("Available Profiles");
65
+ for (const p of profiles) {
66
+ const tag = p.source === "local" ? "(local)" : "(bundled)";
67
+ logger.success(`${p.name} ${tag}`);
68
+ }
69
+ });
70
+ program
71
+ .command("init")
72
+ .description("Create a sample profile in the current directory")
73
+ .action(() => {
74
+ const profilesDir = (0, paths_1.getCwdProfilesDir)();
75
+ const samplePath = path.join(profilesDir, "example.json");
76
+ if (fs.existsSync(samplePath)) {
77
+ logger.info(`Profile already exists: ${samplePath}`);
78
+ return;
79
+ }
80
+ if (!fs.existsSync(profilesDir)) {
81
+ fs.mkdirSync(profilesDir, { recursive: true });
82
+ }
83
+ const sample = {
84
+ name: "MyProject",
85
+ project: "C:\\\\path\\\\to\\\\MyProject.csproj",
86
+ publishDir: "C:\\\\localpublish\\\\MyProject",
87
+ zipDir: "C:\\\\localpublish",
88
+ zipPattern: "MyProject_{date}.zip",
89
+ msbuild: {
90
+ configuration: "Release",
91
+ deployOnBuild: true,
92
+ webPublishMethod: "FileSystem",
93
+ },
94
+ clean: {
95
+ folders: ["Images", "Temp"],
96
+ files: ["web.config", "ConnectionStrings.config"],
97
+ },
98
+ };
99
+ fs.writeFileSync(samplePath, JSON.stringify(sample, null, 2), "utf-8");
100
+ logger.success(`Created sample profile: ${samplePath}`);
101
+ logger.info('Edit it to match your project, then run: s3build build example');
102
+ });
103
+ program.parse();
104
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],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configuration: string;
3
+ deployOnBuild: boolean;
4
+ webPublishMethod: string;
5
+ }
6
+ export interface CleanConfig {
7
+ folders: string[];
8
+ files: string[];
9
+ }
10
+ export interface BuildProfile {
11
+ name: string;
12
+ project: string;
13
+ publishDir: string;
14
+ zipDir: string;
15
+ zipPattern: string;
16
+ msbuild: MsbuildConfig;
17
+ clean: CleanConfig;
18
+ }
19
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,OAAO,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,aAAa,CAAC;IACvB,KAAK,EAAE,WAAW,CAAC;CACpB"}
package/dist/types.js ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ export declare function header(text: string): void;
2
+ export declare function step(text: string): void;
3
+ export declare function success(text: string): void;
4
+ export declare function error(text: string): void;
5
+ export declare function info(text: string): void;
6
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAEA,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAIzC;AAED,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAEvC;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAE1C;AAED,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAExC;AAED,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAEvC"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.header = header;
7
+ exports.step = step;
8
+ exports.success = success;
9
+ exports.error = error;
10
+ exports.info = info;
11
+ const chalk_1 = __importDefault(require("chalk"));
12
+ function header(text) {
13
+ console.log(chalk_1.default.cyan("\n=========================================="));
14
+ console.log(chalk_1.default.cyan.bold(` ${text}`));
15
+ console.log(chalk_1.default.cyan("==========================================\n"));
16
+ }
17
+ function step(text) {
18
+ console.log(chalk_1.default.yellow(`\n===== ${text} =====\n`));
19
+ }
20
+ function success(text) {
21
+ console.log(chalk_1.default.green(`✔ ${text}`));
22
+ }
23
+ function error(text) {
24
+ console.log(chalk_1.default.red(`✖ ${text}`));
25
+ }
26
+ function info(text) {
27
+ console.log(chalk_1.default.gray(` ${text}`));
28
+ }
29
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":";;;;;AAEA,wBAIC;AAED,oBAEC;AAED,0BAEC;AAED,sBAEC;AAED,oBAEC;AAtBD,kDAA0B;AAE1B,SAAgB,MAAM,CAAC,IAAY;IACjC,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,8CAA8C,CAAC,CAAC,CAAC;IACxE,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC;IAC1C,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,8CAA8C,CAAC,CAAC,CAAC;AAC1E,CAAC;AAED,SAAgB,IAAI,CAAC,IAAY;IAC/B,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,MAAM,CAAC,WAAW,IAAI,UAAU,CAAC,CAAC,CAAC;AACvD,CAAC;AAED,SAAgB,OAAO,CAAC,IAAY;IAClC,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC;AACxC,CAAC;AAED,SAAgB,KAAK,CAAC,IAAY;IAChC,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC;AACtC,CAAC;AAED,SAAgB,IAAI,CAAC,IAAY;IAC/B,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC;AACvC,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { BuildProfile } from "../types";
2
+ export declare function getProfilesDir(): string;
3
+ export declare function getProfilePath(name: string): string | null;
4
+ export declare function loadProfile(name: string): BuildProfile;
5
+ export declare function listProfiles(): Array<{
6
+ name: string;
7
+ source: string;
8
+ }>;
9
+ export declare function formatDate(date?: string): string;
10
+ export declare function getCwdProfilesDir(): string;
11
+ //# sourceMappingURL=paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/utils/paths.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAMxC,wBAAgB,cAAc,IAAI,MAAM,CAKvC;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAU1D;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAatD;AAED,wBAAgB,YAAY,IAAI,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CA4BtE;AAED,wBAAgB,UAAU,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAOhD;AAED,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C"}
@@ -0,0 +1,114 @@
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.getProfilesDir = getProfilesDir;
37
+ exports.getProfilePath = getProfilePath;
38
+ exports.loadProfile = loadProfile;
39
+ exports.listProfiles = listProfiles;
40
+ exports.formatDate = formatDate;
41
+ exports.getCwdProfilesDir = getCwdProfilesDir;
42
+ const path = __importStar(require("path"));
43
+ const fs = __importStar(require("fs"));
44
+ // Priority: CWD profiles > bundled profiles
45
+ const CWD_PROFILES_DIR = path.join(process.cwd(), "s3build-profiles");
46
+ const BUNDLED_PROFILES_DIR = path.join(__dirname, "..", "..", "profiles");
47
+ function getProfilesDir() {
48
+ if (fs.existsSync(CWD_PROFILES_DIR)) {
49
+ return CWD_PROFILES_DIR;
50
+ }
51
+ return BUNDLED_PROFILES_DIR;
52
+ }
53
+ function getProfilePath(name) {
54
+ // Check CWD first
55
+ const cwdPath = path.join(CWD_PROFILES_DIR, `${name}.json`);
56
+ if (fs.existsSync(cwdPath))
57
+ return cwdPath;
58
+ // Fallback to bundled
59
+ const bundledPath = path.join(BUNDLED_PROFILES_DIR, `${name}.json`);
60
+ if (fs.existsSync(bundledPath))
61
+ return bundledPath;
62
+ return null;
63
+ }
64
+ function loadProfile(name) {
65
+ const profilePath = getProfilePath(name);
66
+ if (!profilePath) {
67
+ throw new Error(`Profile "${name}" not found.\n` +
68
+ ` Looked in:\n` +
69
+ ` - ${CWD_PROFILES_DIR}\n` +
70
+ ` - ${BUNDLED_PROFILES_DIR}\n` +
71
+ ` Run "s3build init" to create a sample profile.`);
72
+ }
73
+ const content = fs.readFileSync(profilePath, "utf-8");
74
+ return JSON.parse(content);
75
+ }
76
+ function listProfiles() {
77
+ const results = [];
78
+ const seen = new Set();
79
+ // CWD profiles (higher priority)
80
+ if (fs.existsSync(CWD_PROFILES_DIR)) {
81
+ for (const f of fs.readdirSync(CWD_PROFILES_DIR)) {
82
+ if (f.endsWith(".json")) {
83
+ const name = f.replace(".json", "");
84
+ results.push({ name, source: "local" });
85
+ seen.add(name);
86
+ }
87
+ }
88
+ }
89
+ // Bundled profiles
90
+ if (fs.existsSync(BUNDLED_PROFILES_DIR)) {
91
+ for (const f of fs.readdirSync(BUNDLED_PROFILES_DIR)) {
92
+ if (f.endsWith(".json")) {
93
+ const name = f.replace(".json", "");
94
+ if (!seen.has(name)) {
95
+ results.push({ name, source: "bundled" });
96
+ }
97
+ }
98
+ }
99
+ }
100
+ return results;
101
+ }
102
+ function formatDate(date) {
103
+ if (date)
104
+ return date;
105
+ const now = new Date();
106
+ const dd = String(now.getDate()).padStart(2, "0");
107
+ const mm = String(now.getMonth() + 1).padStart(2, "0");
108
+ const yyyy = now.getFullYear();
109
+ return `${dd}-${mm}-${yyyy}`;
110
+ }
111
+ function getCwdProfilesDir() {
112
+ return CWD_PROFILES_DIR;
113
+ }
114
+ //# sourceMappingURL=paths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/utils/paths.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,wCAKC;AAED,wCAUC;AAED,kCAaC;AAED,oCA4BC;AAED,gCAOC;AAED,8CAEC;AAnFD,2CAA6B;AAC7B,uCAAyB;AAGzB,4CAA4C;AAC5C,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,kBAAkB,CAAC,CAAC;AACtE,MAAM,oBAAoB,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;AAE1E,SAAgB,cAAc;IAC5B,IAAI,EAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE,CAAC;QACpC,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IACD,OAAO,oBAAoB,CAAC;AAC9B,CAAC;AAED,SAAgB,cAAc,CAAC,IAAY;IACzC,kBAAkB;IAClB,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,GAAG,IAAI,OAAO,CAAC,CAAC;IAC5D,IAAI,EAAE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AC;YACjB,CAAC;QACH,CAAC;IACH,CAAC;IAED,mBAAmB;IACnB,IAAI,EAAE,CAAC,UAAU,CAAC,oBAAoB,CAAC,EAAE,CAAC;QACxC,KAAK,MAAM,CAAC,IAAI,EAAE,CAAC,WAAW,CAAC,oBAAoB,CAAC,EAAE,CAAC;YACrD,IAAI,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;gBACxB,MAAM,IAAI,GAAG,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;gBACpC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;oBACpB,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;gBAC5C,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAgB,UAAU,CAAC,IAAa;IACtC,IAAI,IAAI;QAAE,OAAO,IAAI,CAAC;IACtB,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;IACvB,MAAM,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAClD,MAAM,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACvD,MAAM,IAAI,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;IAC/B,OAAO,GAAG,EAAE,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC;AAC/B,CAAC;AAED,SAAgB,iBAAiB;IAC/B,OAAO,gBAAgB,CAAC;AAC1B,CAAC"}
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "s3build-cli",
3
+ "version": "1.0.0",
4
+ "description": "CLI tool for building and publishing .NET projects with MSBuild. Supports multiple project profiles, auto-zip, and customizable clean rules.",
5
+ "main": "dist/index.js",
6
+ "bin": {
7
+ "s3build": "dist/index.js"
8
+ },
9
+ "files": [
10
+ "dist/",
11
+ "profiles/",
12
+ "README.md"
13
+ ],
14
+ "scripts": {
15
+ "build": "tsc",
16
+ "dev": "tsc --watch",
17
+ "start": "node dist/index.js",
18
+ "prepublishOnly": "npm run build"
19
+ },
20
+ "keywords": [
21
+ "cli",
22
+ "build",
23
+ "msbuild",
24
+ "dotnet",
25
+ "publish",
26
+ "zip",
27
+ "deploy",
28
+ "aspnet"
29
+ ],
30
+ "author": "",
31
+ "license": "MIT",
32
+ "repository": {
33
+ "type": "git",
34
+ "url": ""
35
+ },
36
+ "engines": {
37
+ "node": ">=16"
38
+ },
39
+ "dependencies": {
40
+ "archiver": "^8.0.0",
41
+ "chalk": "^4.1.2",
42
+ "commander": "^15.0.0",
43
+ "glob": "^13.0.6"
44
+ },
45
+ "devDependencies": {
46
+ "@types/archiver": "^8.0.0",
47
+ "@types/glob": "^8.1.0",
48
+ "@types/node": "^26.0.1",
49
+ "typescript": "^6.0.3"
50
+ }
51
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "WebPOS",
3
+ "project": "C:\\Users\\DAT\\Desktop\\CongViec\\S3_S9\\11_08\\S3\\Websites\\WebPOS\\WebPOS.csproj",
4
+ "publishDir": "C:\\localpublish\\WebPOS",
5
+ "zipDir": "C:\\localpublish",
6
+ "zipPattern": "WebPOS_{date}.zip",
7
+ "msbuild": {
8
+ "configuration": "Release",
9
+ "deployOnBuild": true,
10
+ "webPublishMethod": "FileSystem"
11
+ },
12
+ "clean": {
13
+ "folders": ["Images", "PaymentSetting", "App_GlobalResources"],
14
+ "files": ["ConnectionStrings.config", "web.config", "favicon.ico", "MBBank.json"]
15
+ }
16
+ }