@proteinjs/build 1.0.29 → 1.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/CHANGELOG.md +11 -0
- package/dist/src/runWorkspacePackageCommand.d.ts +3 -0
- package/dist/src/runWorkspacePackageCommand.d.ts.map +1 -0
- package/dist/src/runWorkspacePackageCommand.js +6 -0
- package/dist/src/runWorkspacePackageCommand.js.map +1 -0
- package/dist/src/workspacePackageCommand.d.ts +8 -0
- package/dist/src/workspacePackageCommand.d.ts.map +1 -0
- package/dist/src/workspacePackageCommand.js +102 -0
- package/dist/src/workspacePackageCommand.js.map +1 -0
- package/package.json +4 -3
- package/src/runWorkspacePackageCommand.ts +5 -0
- package/src/workspacePackageCommand.ts +26 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [1.1.0](https://github.com/proteinjs/build/compare/@proteinjs/build@1.0.29...@proteinjs/build@1.1.0) (2024-04-24)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* added `workspace-package` to run commands from the workspace root in specific package directories. If a npm command is run, it re-symlinks the package dependencies ([a4da175](https://github.com/proteinjs/build/commit/a4da17549759ca4fd332c611c0e85a6f6e138f6d))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [1.0.29](https://github.com/proteinjs/build/compare/@proteinjs/build@1.0.28...@proteinjs/build@1.0.29) (2024-04-24)
|
|
7
18
|
|
|
8
19
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runWorkspacePackageCommand.d.ts","sourceRoot":"","sources":["../../src/runWorkspacePackageCommand.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
var workspacePackageCommand_1 = require("./workspacePackageCommand");
|
|
5
|
+
(0, workspacePackageCommand_1.workspacePackageCommand)();
|
|
6
|
+
//# sourceMappingURL=runWorkspacePackageCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runWorkspacePackageCommand.js","sourceRoot":"","sources":["../../src/runWorkspacePackageCommand.ts"],"names":[],"mappings":";;;AAEA,qEAAmE;AAEnE,IAAA,iDAAuB,GAAE,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run a command in the directory of the specified package.
|
|
3
|
+
* If running an npm command, this utility re-symlinks dependencies afterwards.
|
|
4
|
+
*
|
|
5
|
+
* ie: `npx workspace-package @my/package npm i react`
|
|
6
|
+
*/
|
|
7
|
+
export declare const workspacePackageCommand: () => Promise<void>;
|
|
8
|
+
//# sourceMappingURL=workspacePackageCommand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspacePackageCommand.d.ts","sourceRoot":"","sources":["../../src/workspacePackageCommand.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,qBAenC,CAAA"}
|
|
@@ -0,0 +1,102 @@
|
|
|
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 (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
35
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
36
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
37
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
38
|
+
function step(op) {
|
|
39
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
40
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
41
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
42
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
43
|
+
switch (op[0]) {
|
|
44
|
+
case 0: case 1: t = op; break;
|
|
45
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
46
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
47
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
48
|
+
default:
|
|
49
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
50
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
51
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
52
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
53
|
+
if (t[2]) _.ops.pop();
|
|
54
|
+
_.trys.pop(); continue;
|
|
55
|
+
}
|
|
56
|
+
op = body.call(thisArg, _);
|
|
57
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
58
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
62
|
+
exports.workspacePackageCommand = void 0;
|
|
63
|
+
var path = __importStar(require("path"));
|
|
64
|
+
var util_node_1 = require("@proteinjs/util-node");
|
|
65
|
+
var util_1 = require("@proteinjs/util");
|
|
66
|
+
/**
|
|
67
|
+
* Run a command in the directory of the specified package.
|
|
68
|
+
* If running an npm command, this utility re-symlinks dependencies afterwards.
|
|
69
|
+
*
|
|
70
|
+
* ie: `npx workspace-package @my/package npm i react`
|
|
71
|
+
*/
|
|
72
|
+
var workspacePackageCommand = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
73
|
+
var packageName, command, args, logger, workspacePath, packageMap, localPackage, packageDir;
|
|
74
|
+
return __generator(this, function (_a) {
|
|
75
|
+
switch (_a.label) {
|
|
76
|
+
case 0:
|
|
77
|
+
packageName = process.argv[2];
|
|
78
|
+
command = process.argv[3];
|
|
79
|
+
args = process.argv.slice(4);
|
|
80
|
+
logger = new util_1.Logger("workspace-package(".concat(packageName, "):").concat(command));
|
|
81
|
+
workspacePath = process.cwd();
|
|
82
|
+
return [4 /*yield*/, util_node_1.PackageUtil.getWorkspaceMetadata(workspacePath)];
|
|
83
|
+
case 1:
|
|
84
|
+
packageMap = (_a.sent()).packageMap;
|
|
85
|
+
localPackage = packageMap[packageName];
|
|
86
|
+
if (!localPackage)
|
|
87
|
+
throw new Error("Package (".concat(packageName, ") does not exist in workspace: ").concat(workspacePath));
|
|
88
|
+
packageDir = path.dirname(localPackage.filePath);
|
|
89
|
+
return [4 /*yield*/, (0, util_node_1.cmd)(command, args, { cwd: packageDir }, { logPrefix: "[".concat(packageName, "] ") })];
|
|
90
|
+
case 2:
|
|
91
|
+
_a.sent();
|
|
92
|
+
if (!(command === 'npm')) return [3 /*break*/, 4];
|
|
93
|
+
return [4 /*yield*/, util_node_1.PackageUtil.symlinkDependencies(localPackage, packageMap, logger)];
|
|
94
|
+
case 3:
|
|
95
|
+
_a.sent();
|
|
96
|
+
_a.label = 4;
|
|
97
|
+
case 4: return [2 /*return*/];
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}); };
|
|
101
|
+
exports.workspacePackageCommand = workspacePackageCommand;
|
|
102
|
+
//# sourceMappingURL=workspacePackageCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspacePackageCommand.js","sourceRoot":"","sources":["../../src/workspacePackageCommand.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA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"1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Workspace build tools",
|
|
5
5
|
"main": "./dist/generated/index.js",
|
|
6
6
|
"types": "./dist/generated/index.d.ts",
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
"test-workspace": "dist/src/runTestWorkspace.js",
|
|
11
11
|
"watch-workspace": "dist/src/runWatchWorkspace.js",
|
|
12
12
|
"workspace": "dist/src/runWorkspaceCommand.js",
|
|
13
|
-
"version-workspace": "dist/src/runVersionWorkspace.js"
|
|
13
|
+
"version-workspace": "dist/src/runVersionWorkspace.js",
|
|
14
|
+
"workspace-package": "dist/src/runWorkspacePackageCommand.js"
|
|
14
15
|
},
|
|
15
16
|
"publishConfig": {
|
|
16
17
|
"access": "public"
|
|
@@ -48,5 +49,5 @@
|
|
|
48
49
|
"webpack": "5.90.0",
|
|
49
50
|
"webpack-cli": "5.1.4"
|
|
50
51
|
},
|
|
51
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "442d6bc5688c96bdbc516edd5ab8266d6e27beb4"
|
|
52
53
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as path from 'path'
|
|
2
|
+
import { PackageUtil, cmd } from '@proteinjs/util-node'
|
|
3
|
+
import { Logger } from '@proteinjs/util'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Run a command in the directory of the specified package.
|
|
7
|
+
* If running an npm command, this utility re-symlinks dependencies afterwards.
|
|
8
|
+
*
|
|
9
|
+
* ie: `npx workspace-package @my/package npm i react`
|
|
10
|
+
*/
|
|
11
|
+
export const workspacePackageCommand = async () => {
|
|
12
|
+
const packageName = process.argv[2]
|
|
13
|
+
const command = process.argv[3];
|
|
14
|
+
const args = process.argv.slice(4);
|
|
15
|
+
const logger = new Logger(`workspace-package(${packageName}):${command}`);
|
|
16
|
+
const workspacePath = process.cwd();
|
|
17
|
+
const { packageMap } = await PackageUtil.getWorkspaceMetadata(workspacePath);
|
|
18
|
+
const localPackage = packageMap[packageName];
|
|
19
|
+
if (!localPackage)
|
|
20
|
+
throw new Error(`Package (${packageName}) does not exist in workspace: ${workspacePath}`)
|
|
21
|
+
|
|
22
|
+
const packageDir = path.dirname(localPackage.filePath);
|
|
23
|
+
await cmd(command, args, { cwd: packageDir }, { logPrefix: `[${packageName}] ` });
|
|
24
|
+
if (command === 'npm')
|
|
25
|
+
await PackageUtil.symlinkDependencies(localPackage, packageMap, logger);
|
|
26
|
+
}
|