This commit is contained in:
Ian Clanton-Thuon 2024-03-26 12:58:48 -04:00
Родитель 17d119ef4d
Коммит 4c7b7ccbe2
35 изменённых файлов: 1123 добавлений и 282 удалений

Просмотреть файл

@ -0,0 +1,7 @@
// This is a workaround for https://github.com/eslint/eslint/issues/3458
require('@rushstack/eslint-config/patch/modern-module-resolution');
module.exports = {
extends: ['@rushstack/eslint-config/profile/node', '@rushstack/eslint-config/mixins/friendly-locals'],
parserOptions: { tsconfigRootDir: __dirname }
};

Просмотреть файл

@ -0,0 +1,8 @@
{
"operationSettings": [
{
"operationName": "build",
"outputFolderNames": ["lib", "dist"]
}
]
}

Просмотреть файл

@ -0,0 +1,9 @@
'use strict';
const build = require('@microsoft/node-library-build');
// This project doesn't have unit tests and GCB's Mocha doesn't play nice with Node 14, so disable Mocha
build.mocha.enabled = false;
build.instrument.enabled = false;
build.initialize(require('gulp'));

Просмотреть файл

@ -0,0 +1,19 @@
{
"name": "rush-stack-compiler-5.3-library-test",
"version": "1.0.0",
"description": "",
"main": "lib/index.js",
"license": "MIT",
"private": true,
"scripts": {
"build": "gulp test --clean"
},
"devDependencies": {
"@microsoft/node-library-build": "workspace:*",
"@microsoft/rush-stack-compiler-5.3": "workspace:*",
"@rushstack/eslint-config": "~2.6.2",
"@types/node": "10.17.13",
"eslint": "~7.12.1",
"gulp": "~4.0.2"
}
}

Просмотреть файл

@ -0,0 +1,4 @@
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
export class TestClass {}

Просмотреть файл

@ -0,0 +1,3 @@
{
"extends": "./node_modules/@microsoft/rush-stack-compiler-5.3/includes/tsconfig-node.json"
}

Просмотреть файл

@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@microsoft/rush-stack-compiler-5.3",
"comment": "Initial package creation.",
"type": "minor"
}
],
"packageName": "@microsoft/rush-stack-compiler-5.3"
}

Просмотреть файл

@ -1,5 +1,10 @@
// DO NOT ADD COMMENTS IN THIS FILE. They will be lost when the Rush tool resaves it. // DO NOT ADD COMMENTS IN THIS FILE. They will be lost when the Rush tool resaves it.
{ {
"$schema": "https://developer.microsoft.com/json-schemas/rush/v5/approved-packages.schema.json", "$schema": "https://developer.microsoft.com/json-schemas/rush/v5/approved-packages.schema.json",
"packages": [] "packages": [
{
"name": "@microsoft/rush-stack-compiler-5.3",
"allowedCategories": [ "tests" ]
}
]
} }

Просмотреть файл

@ -28,7 +28,7 @@
// From the allowedAlternativeVersions list below, this should be the TypeScript version that's used to // From the allowedAlternativeVersions list below, this should be the TypeScript version that's used to
// build most of the projects in the repo. Preferring it avoids errors for indirect dependencies // build most of the projects in the repo. Preferring it avoids errors for indirect dependencies
// that request it as a peer dependency. // that request it as a peer dependency.
"typescript": "~3.9.7", "typescript": "~5.3.3",
// Workaround for https://github.com/microsoft/rushstack/issues/1466 // Workaround for https://github.com/microsoft/rushstack/issues/1466
"eslint": "~7.12.1" "eslint": "~7.12.1"
@ -71,6 +71,7 @@
"~3.0.3", "~3.0.3",
"~3.1.6", "~3.1.6",
"~3.2.4", "~3.2.4",
"~3.3.3",
"~3.4.3", "~3.4.3",
"~3.5.3", "~3.5.3",
"~3.6.4", "~3.6.4",

Просмотреть файл

@ -337,6 +337,22 @@ importers:
eslint: 7.12.1 eslint: 7.12.1
gulp: 4.0.2 gulp: 4.0.2
../../build-tests/rush-stack-compiler-5.3-library-test:
specifiers:
'@microsoft/node-library-build': workspace:*
'@microsoft/rush-stack-compiler-5.3': workspace:*
'@rushstack/eslint-config': ~2.6.2
'@types/node': 10.17.13
eslint: ~7.12.1
gulp: ~4.0.2
devDependencies:
'@microsoft/node-library-build': link:../../core-build/node-library-build
'@microsoft/rush-stack-compiler-5.3': link:../../stack/rush-stack-compiler-5.3
'@rushstack/eslint-config': 2.6.2_eslint@7.12.1
'@types/node': 10.17.13
eslint: 7.12.1
gulp: 4.0.2
../../build-tests/web-library-build-test: ../../build-tests/web-library-build-test:
specifiers: specifiers:
'@microsoft/load-themed-styles': ~1.10.172 '@microsoft/load-themed-styles': ~1.10.172
@ -1274,6 +1290,31 @@ importers:
'@rushstack/heft': 0.48.0 '@rushstack/heft': 0.48.0
'@rushstack/heft-node-rig': 1.11.0_@rushstack+heft@0.48.0 '@rushstack/heft-node-rig': 1.11.0_@rushstack+heft@0.48.0
../../stack/rush-stack-compiler-5.3:
specifiers:
'@microsoft/api-extractor': ~7.15.2
'@microsoft/rush-stack-compiler-4.7': workspace:*
'@microsoft/rush-stack-compiler-shared': workspace:*
'@rushstack/eslint-config': ~2.6.2
'@rushstack/heft': 0.48.0
'@rushstack/heft-node-rig': 1.11.0
'@rushstack/node-core-library': ~3.53.0
'@types/node': 10.17.13
import-lazy: ~4.0.0
typescript: ~5.3.3
dependencies:
'@microsoft/api-extractor': 7.15.2
'@rushstack/eslint-config': 2.6.2
'@rushstack/node-core-library': 3.53.0
'@types/node': 10.17.13
import-lazy: 4.0.0
typescript: 5.3.3
devDependencies:
'@microsoft/rush-stack-compiler-4.7': link:../rush-stack-compiler-4.7
'@microsoft/rush-stack-compiler-shared': link:../rush-stack-compiler-shared
'@rushstack/heft': 0.48.0
'@rushstack/heft-node-rig': 1.11.0_@rushstack+heft@0.48.0
../../stack/rush-stack-compiler-shared: ../../stack/rush-stack-compiler-shared:
specifiers: {} specifiers: {}
@ -3258,12 +3299,12 @@ packages:
dependencies: dependencies:
acorn: 7.4.1 acorn: 7.4.1
/acorn-jsx/5.3.2_acorn@8.7.1: /acorn-jsx/5.3.2_acorn@8.11.3:
resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==}
peerDependencies: peerDependencies:
acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 acorn: ^6.0.0 || ^7.0.0 || ^8.0.0
dependencies: dependencies:
acorn: 8.7.1 acorn: 8.11.3
dev: true dev: true
/acorn-walk/6.2.0: /acorn-walk/6.2.0:
@ -3294,12 +3335,12 @@ packages:
resolution: {integrity: sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==} resolution: {integrity: sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==}
engines: {node: '>=0.4.0'} engines: {node: '>=0.4.0'}
hasBin: true hasBin: true
dev: false
/acorn/8.7.1: /acorn/8.7.1:
resolution: {integrity: sha512-Xx54uLJQZ19lKygFXOWsscKUbsBZW0CPykPhVQdhIeIwrbPmJzqeASDInc8nKBnp/JT6igTs82qPXz069H8I/A==} resolution: {integrity: sha512-Xx54uLJQZ19lKygFXOWsscKUbsBZW0CPykPhVQdhIeIwrbPmJzqeASDInc8nKBnp/JT6igTs82qPXz069H8I/A==}
engines: {node: '>=0.4.0'} engines: {node: '>=0.4.0'}
hasBin: true hasBin: true
dev: false
/agent-base/6.0.2: /agent-base/6.0.2:
resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==} resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==}
@ -4511,6 +4552,7 @@ packages:
/domexception/2.0.1: /domexception/2.0.1:
resolution: {integrity: sha512-yxJ2mFy/sibVQlu5qHjOkf9J3K6zgmCxgJ94u2EdvDOV09H+32LtRswEcUsmUWN72pVLOEnTSRaIVVzVQgS0dg==} resolution: {integrity: sha512-yxJ2mFy/sibVQlu5qHjOkf9J3K6zgmCxgJ94u2EdvDOV09H+32LtRswEcUsmUWN72pVLOEnTSRaIVVzVQgS0dg==}
engines: {node: '>=8'} engines: {node: '>=8'}
deprecated: Use your platform's native DOMException instead
dependencies: dependencies:
webidl-conversions: 5.0.0 webidl-conversions: 5.0.0
dev: true dev: true
@ -4962,8 +5004,8 @@ packages:
resolution: {integrity: sha512-D211tC7ZwouTIuY5x9XnS0E9sWNChB7IYKX/Xp5eQj3nFXhqmiUDB9q27y76oFl8jTg3pXcQx/bpxMfs3CIZbA==} resolution: {integrity: sha512-D211tC7ZwouTIuY5x9XnS0E9sWNChB7IYKX/Xp5eQj3nFXhqmiUDB9q27y76oFl8jTg3pXcQx/bpxMfs3CIZbA==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
dependencies: dependencies:
acorn: 8.7.1 acorn: 8.11.3
acorn-jsx: 5.3.2_acorn@8.7.1 acorn-jsx: 5.3.2_acorn@8.11.3
eslint-visitor-keys: 3.3.0 eslint-visitor-keys: 3.3.0
dev: true dev: true
@ -7163,7 +7205,7 @@ packages:
jest-runtime: 27.5.1 jest-runtime: 27.5.1
jest-util: 27.5.1 jest-util: 27.5.1
jest-worker: 27.5.1 jest-worker: 27.5.1
source-map-support: 0.5.19 source-map-support: 0.5.21
throat: 6.0.1 throat: 6.0.1
transitivePeerDependencies: transitivePeerDependencies:
- bufferutil - bufferutil
@ -7533,7 +7575,7 @@ packages:
optional: true optional: true
dependencies: dependencies:
abab: 2.0.5 abab: 2.0.5
acorn: 8.7.1 acorn: 8.11.3
acorn-globals: 6.0.0 acorn-globals: 6.0.0
cssom: 0.4.4 cssom: 0.4.4
cssstyle: 2.3.0 cssstyle: 2.3.0
@ -9439,7 +9481,6 @@ packages:
dependencies: dependencies:
buffer-from: 1.1.1 buffer-from: 1.1.1
source-map: 0.6.1 source-map: 0.6.1
dev: false
/source-map-url/0.4.1: /source-map-url/0.4.1:
resolution: {integrity: sha512-cPiFOTLUKvJFIg4SKVScy4ilPPW6rFgMgfuZJPNoDuMs3nC1HbMUycBoJw77xFIp6z1UJQJOfx6C9GMH80DiTw==} resolution: {integrity: sha512-cPiFOTLUKvJFIg4SKVScy4ilPPW6rFgMgfuZJPNoDuMs3nC1HbMUycBoJw77xFIp6z1UJQJOfx6C9GMH80DiTw==}
@ -10891,6 +10932,12 @@ packages:
engines: {node: '>=4.2.0'} engines: {node: '>=4.2.0'}
hasBin: true hasBin: true
/typescript/5.3.3:
resolution: {integrity: sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==}
engines: {node: '>=14.17'}
hasBin: true
dev: false
/uglify-js/3.13.7: /uglify-js/3.13.7:
resolution: {integrity: sha512-1Psi2MmnZJbnEsgJJIlfnd7tFlJfitusmR7zDI8lXlFI0ACD4/Rm/xdrU8bh6zF0i74aiVoBtkRiFulkrmh3AA==} resolution: {integrity: sha512-1Psi2MmnZJbnEsgJJIlfnd7tFlJfitusmR7zDI8lXlFI0ACD4/Rm/xdrU8bh6zF0i74aiVoBtkRiFulkrmh3AA==}
engines: {node: '>=0.8.0'} engines: {node: '>=0.8.0'}

Просмотреть файл

@ -1,5 +1,5 @@
// DO NOT MODIFY THIS FILE MANUALLY BUT DO COMMIT IT. It is generated and used by Rush. // DO NOT MODIFY THIS FILE MANUALLY BUT DO COMMIT IT. It is generated and used by Rush.
{ {
"pnpmShrinkwrapHash": "5222b83155bac93bc27dafd5bf79bec38e1aa1ae", "pnpmShrinkwrapHash": "94d69624f95398eba7cdf1e70cfc3b39facef814",
"preferredVersionsHash": "6a96c5550f3ce50aa19e8d1141c6c5d4176953ff" "preferredVersionsHash": "453ceee7444450f90086a91682f4c595da77c70a"
} }

0
common/git-hooks/pre-commit Normal file → Executable file
Просмотреть файл

Просмотреть файл

@ -0,0 +1,121 @@
## API Report File for "@microsoft/rush-stack-compiler-5.3"
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts
import * as ApiExtractor from '@microsoft/api-extractor';
import { IPackageJson } from '@rushstack/node-core-library';
import { ITerminalProvider } from '@rushstack/node-core-library';
import { Terminal } from '@rushstack/node-core-library';
import * as Typescript from 'typescript';
export { ApiExtractor }
// @beta
export class ApiExtractorRunner extends RushStackCompilerBase {
constructor(extractorConfig: ApiExtractor.ExtractorConfig, extractorOptions: ApiExtractor.IExtractorInvokeOptions, rootPath: string, terminalProvider: ITerminalProvider);
constructor(options: IRushStackCompilerBaseOptions, extractorConfig: ApiExtractor.ExtractorConfig, extractorOptions: ApiExtractor.IExtractorInvokeOptions, rootPath: string, terminalProvider: ITerminalProvider);
// (undocumented)
invoke(): Promise<void>;
}
// @public (undocumented)
export interface ILintRunnerConfig extends IRushStackCompilerBaseOptions {
displayAsError?: boolean;
}
// @public (undocumented)
export interface IRushStackCompilerBaseOptions {
// (undocumented)
fileError: WriteFileIssueFunction;
// (undocumented)
fileWarning: WriteFileIssueFunction;
}
// @public (undocumented)
export interface ITslintRunnerConfig extends ILintRunnerConfig {
}
// @beta (undocumented)
export interface ITypescriptCompilerOptions extends IRushStackCompilerBaseOptions {
customArgs?: string[];
}
// @beta (undocumented)
export class LintRunner extends RushStackCompilerBase<ILintRunnerConfig> {
constructor(taskOptions: ILintRunnerConfig, rootPath: string, terminalProvider: ITerminalProvider);
// (undocumented)
invoke(): Promise<void>;
}
// @beta (undocumented)
export abstract class RushStackCompilerBase<TOptions extends IRushStackCompilerBaseOptions = IRushStackCompilerBaseOptions> {
constructor(taskOptions: TOptions, rootPath: string, terminalProvider: ITerminalProvider);
// (undocumented)
protected _fileError: WriteFileIssueFunction;
// (undocumented)
protected _fileWarning: WriteFileIssueFunction;
// (undocumented)
protected _standardBuildFolders: StandardBuildFolders;
// (undocumented)
protected _taskOptions: TOptions;
// (undocumented)
protected _terminal: Terminal;
}
// @beta (undocumented)
export class StandardBuildFolders {
constructor(projectFolderPath: string);
// (undocumented)
get distFolderPath(): string;
// (undocumented)
get libFolderPath(): string;
// (undocumented)
get projectFolderPath(): string;
// (undocumented)
get srcFolderPath(): string;
// (undocumented)
get tempFolderPath(): string;
}
// @beta (undocumented)
export class ToolPaths {
// (undocumented)
static get apiExtractorPackageJson(): IPackageJson;
// (undocumented)
static get apiExtractorPackagePath(): string;
// (undocumented)
static get eslintPackageJson(): IPackageJson;
// (undocumented)
static get eslintPackagePath(): string;
// (undocumented)
static get tslintPackageJson(): IPackageJson;
// (undocumented)
static get tslintPackagePath(): string;
// (undocumented)
static get typescriptPackageJson(): IPackageJson;
// (undocumented)
static get typescriptPackagePath(): string;
}
// @beta (undocumented)
export class TslintRunner extends RushStackCompilerBase<ITslintRunnerConfig> {
// (undocumented)
invoke(): Promise<void>;
}
export { Typescript }
// @beta (undocumented)
export class TypescriptCompiler extends RushStackCompilerBase<ITypescriptCompilerOptions> {
constructor(rootPath: string, terminalProvider: ITerminalProvider);
constructor(taskOptions: ITypescriptCompilerOptions, rootPath: string, terminalProvider: ITerminalProvider);
// (undocumented)
invoke(): Promise<void>;
}
// @public (undocumented)
export type WriteFileIssueFunction = (filePath: string, line: number, column: number, errorCode: string, message: string) => void;
```

Просмотреть файл

@ -0,0 +1,28 @@
// THIS FILE WAS GENERATED BY A TOOL. ANY MANUAL MODIFICATIONS WILL GET OVERWRITTEN WHENEVER RUSH IS UPGRADED.
//
// This script is intended for usage in an automated build environment where the Rush command may not have
// been preinstalled, or may have an unpredictable version. This script will automatically install the version of Rush
// specified in the rush.json configuration file (if not already installed), and then pass a command-line to the
// rush-pnpm command.
//
// An example usage would be:
//
// node common/scripts/install-run-rush-pnpm.js pnpm-command
//
// For more information, see: https://rushjs.io/pages/maintainer/setup_new_repo/
/******/ (() => { // webpackBootstrap
/******/ "use strict";
var __webpack_exports__ = {};
/*!*****************************************************!*\
!*** ./lib-esnext/scripts/install-run-rush-pnpm.js ***!
\*****************************************************/
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
require('./install-run-rush');
//# sourceMappingURL=install-run-rush-pnpm.js.map
module.exports = __webpack_exports__;
/******/ })()
;
//# sourceMappingURL=install-run-rush-pnpm.js.map

Просмотреть файл

@ -1,30 +1,3 @@
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See the @microsoft/rush package's LICENSE file for license information.
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
// THIS FILE WAS GENERATED BY A TOOL. ANY MANUAL MODIFICATIONS WILL GET OVERWRITTEN WHENEVER RUSH IS UPGRADED. // THIS FILE WAS GENERATED BY A TOOL. ANY MANUAL MODIFICATIONS WILL GET OVERWRITTEN WHENEVER RUSH IS UPGRADED.
// //
// This script is intended for usage in an automated build environment where the Rush command may not have // This script is intended for usage in an automated build environment where the Rush command may not have
@ -35,38 +8,156 @@ Object.defineProperty(exports, "__esModule", { value: true });
// node common/scripts/install-run-rush.js install // node common/scripts/install-run-rush.js install
// //
// For more information, see: https://rushjs.io/pages/maintainer/setup_new_repo/ // For more information, see: https://rushjs.io/pages/maintainer/setup_new_repo/
const path = __importStar(require("path"));
const fs = __importStar(require("fs")); /******/ (() => { // webpackBootstrap
const install_run_1 = require("./install-run"); /******/ "use strict";
/******/ var __webpack_modules__ = ({
/***/ 657147:
/*!*********************!*\
!*** external "fs" ***!
\*********************/
/***/ ((module) => {
module.exports = require("fs");
/***/ }),
/***/ 371017:
/*!***********************!*\
!*** external "path" ***!
\***********************/
/***/ ((module) => {
module.exports = require("path");
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
(() => {
/*!************************************************!*\
!*** ./lib-esnext/scripts/install-run-rush.js ***!
\************************************************/
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! path */ 371017);
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! fs */ 657147);
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_1__);
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
/* eslint-disable no-console */
const { installAndRun, findRushJsonFolder, RUSH_JSON_FILENAME, runWithErrorAndStatusCode } = require('./install-run');
const PACKAGE_NAME = '@microsoft/rush'; const PACKAGE_NAME = '@microsoft/rush';
const RUSH_PREVIEW_VERSION = 'RUSH_PREVIEW_VERSION'; const RUSH_PREVIEW_VERSION = 'RUSH_PREVIEW_VERSION';
const INSTALL_RUN_RUSH_LOCKFILE_PATH_VARIABLE = 'INSTALL_RUN_RUSH_LOCKFILE_PATH';
function _getRushVersion(logger) { function _getRushVersion(logger) {
const rushPreviewVersion = process.env[RUSH_PREVIEW_VERSION]; const rushPreviewVersion = process.env[RUSH_PREVIEW_VERSION];
if (rushPreviewVersion !== undefined) { if (rushPreviewVersion !== undefined) {
logger.info(`Using Rush version from environment variable ${RUSH_PREVIEW_VERSION}=${rushPreviewVersion}`); logger.info(`Using Rush version from environment variable ${RUSH_PREVIEW_VERSION}=${rushPreviewVersion}`);
return rushPreviewVersion; return rushPreviewVersion;
} }
const rushJsonFolder = (0, install_run_1.findRushJsonFolder)(); const rushJsonFolder = findRushJsonFolder();
const rushJsonPath = path.join(rushJsonFolder, install_run_1.RUSH_JSON_FILENAME); const rushJsonPath = path__WEBPACK_IMPORTED_MODULE_0__.join(rushJsonFolder, RUSH_JSON_FILENAME);
try { try {
const rushJsonContents = fs.readFileSync(rushJsonPath, 'utf-8'); const rushJsonContents = fs__WEBPACK_IMPORTED_MODULE_1__.readFileSync(rushJsonPath, 'utf-8');
// Use a regular expression to parse out the rushVersion value because rush.json supports comments, // Use a regular expression to parse out the rushVersion value because rush.json supports comments,
// but JSON.parse does not and we don't want to pull in more dependencies than we need to in this script. // but JSON.parse does not and we don't want to pull in more dependencies than we need to in this script.
const rushJsonMatches = rushJsonContents.match(/\"rushVersion\"\s*\:\s*\"([0-9a-zA-Z.+\-]+)\"/); const rushJsonMatches = rushJsonContents.match(/\"rushVersion\"\s*\:\s*\"([0-9a-zA-Z.+\-]+)\"/);
return rushJsonMatches[1]; return rushJsonMatches[1];
} }
catch (e) { catch (e) {
throw new Error(`Unable to determine the required version of Rush from rush.json (${rushJsonFolder}). ` + throw new Error(`Unable to determine the required version of Rush from ${RUSH_JSON_FILENAME} (${rushJsonFolder}). ` +
"The 'rushVersion' field is either not assigned in rush.json or was specified " + `The 'rushVersion' field is either not assigned in ${RUSH_JSON_FILENAME} or was specified ` +
'using an unexpected syntax.'); 'using an unexpected syntax.');
} }
} }
function _getBin(scriptName) {
switch (scriptName.toLowerCase()) {
case 'install-run-rush-pnpm.js':
return 'rush-pnpm';
case 'install-run-rushx.js':
return 'rushx';
default:
return 'rush';
}
}
function _run() { function _run() {
const [nodePath /* Ex: /bin/node */, scriptPath /* /repo/common/scripts/install-run-rush.js */, ...packageBinArgs /* [build, --to, myproject] */] = process.argv; const [nodePath /* Ex: /bin/node */, scriptPath /* /repo/common/scripts/install-run-rush.js */, ...packageBinArgs /* [build, --to, myproject] */] = process.argv;
// Detect if this script was directly invoked, or if the install-run-rushx script was invokved to select the // Detect if this script was directly invoked, or if the install-run-rushx script was invokved to select the
// appropriate binary inside the rush package to run // appropriate binary inside the rush package to run
const scriptName = path.basename(scriptPath); const scriptName = path__WEBPACK_IMPORTED_MODULE_0__.basename(scriptPath);
const bin = scriptName.toLowerCase() === 'install-run-rushx.js' ? 'rushx' : 'rush'; const bin = _getBin(scriptName);
if (!nodePath || !scriptPath) { if (!nodePath || !scriptPath) {
throw new Error('Unexpected exception: could not detect node path or script path'); throw new Error('Unexpected exception: could not detect node path or script path');
} }
@ -93,7 +184,10 @@ function _run() {
} }
if (!commandFound) { if (!commandFound) {
console.log(`Usage: ${scriptName} <command> [args...]`); console.log(`Usage: ${scriptName} <command> [args...]`);
if (scriptName === 'install-run-rush.js') { if (scriptName === 'install-run-rush-pnpm.js') {
console.log(`Example: ${scriptName} pnpm-command`);
}
else if (scriptName === 'install-run-rush.js') {
console.log(`Example: ${scriptName} build --to myproject`); console.log(`Example: ${scriptName} build --to myproject`);
} }
else { else {
@ -101,11 +195,21 @@ function _run() {
} }
process.exit(1); process.exit(1);
} }
(0, install_run_1.runWithErrorAndStatusCode)(logger, () => { runWithErrorAndStatusCode(logger, () => {
const version = _getRushVersion(logger); const version = _getRushVersion(logger);
logger.info(`The rush.json configuration requests Rush version ${version}`); logger.info(`The ${RUSH_JSON_FILENAME} configuration requests Rush version ${version}`);
return (0, install_run_1.installAndRun)(logger, PACKAGE_NAME, version, bin, packageBinArgs); const lockFilePath = process.env[INSTALL_RUN_RUSH_LOCKFILE_PATH_VARIABLE];
if (lockFilePath) {
logger.info(`Found ${INSTALL_RUN_RUSH_LOCKFILE_PATH_VARIABLE}="${lockFilePath}", installing with lockfile.`);
}
return installAndRun(logger, PACKAGE_NAME, version, bin, packageBinArgs, lockFilePath);
}); });
} }
_run(); _run();
//# sourceMappingURL=install-run-rush.js.map //# sourceMappingURL=install-run-rush.js.map
})();
module.exports = __webpack_exports__;
/******/ })()
;
//# sourceMappingURL=install-run-rush.js.map

Просмотреть файл

@ -1,7 +1,3 @@
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See the @microsoft/rush package's LICENSE file for license information.
Object.defineProperty(exports, "__esModule", { value: true });
// THIS FILE WAS GENERATED BY A TOOL. ANY MANUAL MODIFICATIONS WILL GET OVERWRITTEN WHENEVER RUSH IS UPGRADED. // THIS FILE WAS GENERATED BY A TOOL. ANY MANUAL MODIFICATIONS WILL GET OVERWRITTEN WHENEVER RUSH IS UPGRADED.
// //
// This script is intended for usage in an automated build environment where the Rush command may not have // This script is intended for usage in an automated build environment where the Rush command may not have
@ -14,5 +10,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
// node common/scripts/install-run-rushx.js custom-command // node common/scripts/install-run-rushx.js custom-command
// //
// For more information, see: https://rushjs.io/pages/maintainer/setup_new_repo/ // For more information, see: https://rushjs.io/pages/maintainer/setup_new_repo/
require("./install-run-rush");
/******/ (() => { // webpackBootstrap
/******/ "use strict";
var __webpack_exports__ = {};
/*!*************************************************!*\
!*** ./lib-esnext/scripts/install-run-rushx.js ***!
\*************************************************/
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
require('./install-run-rush');
//# sourceMappingURL=install-run-rushx.js.map
module.exports = __webpack_exports__;
/******/ })()
;
//# sourceMappingURL=install-run-rushx.js.map //# sourceMappingURL=install-run-rushx.js.map

Просмотреть файл

@ -1,31 +1,3 @@
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See the @microsoft/rush package's LICENSE file for license information.
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.runWithErrorAndStatusCode = exports.installAndRun = exports.findRushJsonFolder = exports.getNpmPath = exports.RUSH_JSON_FILENAME = void 0;
// THIS FILE WAS GENERATED BY A TOOL. ANY MANUAL MODIFICATIONS WILL GET OVERWRITTEN WHENEVER RUSH IS UPGRADED. // THIS FILE WAS GENERATED BY A TOOL. ANY MANUAL MODIFICATIONS WILL GET OVERWRITTEN WHENEVER RUSH IS UPGRADED.
// //
// This script is intended for usage in an automated build environment where a Node tool may not have // This script is intended for usage in an automated build environment where a Node tool may not have
@ -36,12 +8,301 @@ exports.runWithErrorAndStatusCode = exports.installAndRun = exports.findRushJson
// node common/scripts/install-run.js qrcode@1.2.2 qrcode https://rushjs.io // node common/scripts/install-run.js qrcode@1.2.2 qrcode https://rushjs.io
// //
// For more information, see: https://rushjs.io/pages/maintainer/setup_new_repo/ // For more information, see: https://rushjs.io/pages/maintainer/setup_new_repo/
const childProcess = __importStar(require("child_process"));
const fs = __importStar(require("fs")); /******/ (() => { // webpackBootstrap
const os = __importStar(require("os")); /******/ "use strict";
const path = __importStar(require("path")); /******/ var __webpack_modules__ = ({
exports.RUSH_JSON_FILENAME = 'rush.json';
/***/ 679877:
/*!************************************************!*\
!*** ./lib-esnext/utilities/npmrcUtilities.js ***!
\************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "isVariableSetInNpmrcFile": () => (/* binding */ isVariableSetInNpmrcFile),
/* harmony export */ "syncNpmrc": () => (/* binding */ syncNpmrc)
/* harmony export */ });
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fs */ 657147);
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! path */ 371017);
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
// IMPORTANT - do not use any non-built-in libraries in this file
/**
* This function reads the content for given .npmrc file path, and also trims
* unusable lines from the .npmrc file.
*
* @returns
* The text of the the .npmrc.
*/
// create a global _combinedNpmrc for cache purpose
const _combinedNpmrcMap = new Map();
function _trimNpmrcFile(options) {
const { sourceNpmrcPath, linesToPrepend, linesToAppend } = options;
const combinedNpmrcFromCache = _combinedNpmrcMap.get(sourceNpmrcPath);
if (combinedNpmrcFromCache !== undefined) {
return combinedNpmrcFromCache;
}
let npmrcFileLines = [];
if (linesToPrepend) {
npmrcFileLines.push(...linesToPrepend);
}
if (fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(sourceNpmrcPath)) {
npmrcFileLines.push(...fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync(sourceNpmrcPath).toString().split('\n'));
}
if (linesToAppend) {
npmrcFileLines.push(...linesToAppend);
}
npmrcFileLines = npmrcFileLines.map((line) => (line || '').trim());
const resultLines = [];
// This finds environment variable tokens that look like "${VAR_NAME}"
const expansionRegExp = /\$\{([^\}]+)\}/g;
// Comment lines start with "#" or ";"
const commentRegExp = /^\s*[#;]/;
// Trim out lines that reference environment variables that aren't defined
for (let line of npmrcFileLines) {
let lineShouldBeTrimmed = false;
//remove spaces before or after key and value
line = line
.split('=')
.map((lineToTrim) => lineToTrim.trim())
.join('=');
// Ignore comment lines
if (!commentRegExp.test(line)) {
const environmentVariables = line.match(expansionRegExp);
if (environmentVariables) {
for (const token of environmentVariables) {
// Remove the leading "${" and the trailing "}" from the token
const environmentVariableName = token.substring(2, token.length - 1);
// Is the environment variable defined?
if (!process.env[environmentVariableName]) {
// No, so trim this line
lineShouldBeTrimmed = true;
break;
}
}
}
}
if (lineShouldBeTrimmed) {
// Example output:
// "; MISSING ENVIRONMENT VARIABLE: //my-registry.com/npm/:_authToken=${MY_AUTH_TOKEN}"
resultLines.push('; MISSING ENVIRONMENT VARIABLE: ' + line);
}
else {
resultLines.push(line);
}
}
const combinedNpmrc = resultLines.join('\n');
//save the cache
_combinedNpmrcMap.set(sourceNpmrcPath, combinedNpmrc);
return combinedNpmrc;
}
function _copyAndTrimNpmrcFile(options) {
const { logger, sourceNpmrcPath, targetNpmrcPath, linesToPrepend, linesToAppend } = options;
logger.info(`Transforming ${sourceNpmrcPath}`); // Verbose
logger.info(` --> "${targetNpmrcPath}"`);
const combinedNpmrc = _trimNpmrcFile({
sourceNpmrcPath,
linesToPrepend,
linesToAppend
});
fs__WEBPACK_IMPORTED_MODULE_0__.writeFileSync(targetNpmrcPath, combinedNpmrc);
return combinedNpmrc;
}
function syncNpmrc(options) {
const { sourceNpmrcFolder, targetNpmrcFolder, useNpmrcPublish, logger = {
// eslint-disable-next-line no-console
info: console.log,
// eslint-disable-next-line no-console
error: console.error
}, createIfMissing = false, linesToAppend, linesToPrepend } = options;
const sourceNpmrcPath = path__WEBPACK_IMPORTED_MODULE_1__.join(sourceNpmrcFolder, !useNpmrcPublish ? '.npmrc' : '.npmrc-publish');
const targetNpmrcPath = path__WEBPACK_IMPORTED_MODULE_1__.join(targetNpmrcFolder, '.npmrc');
try {
if (fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(sourceNpmrcPath) || createIfMissing) {
// Ensure the target folder exists
if (!fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(targetNpmrcFolder)) {
fs__WEBPACK_IMPORTED_MODULE_0__.mkdirSync(targetNpmrcFolder, { recursive: true });
}
return _copyAndTrimNpmrcFile({
sourceNpmrcPath,
targetNpmrcPath,
logger,
linesToAppend,
linesToPrepend
});
}
else if (fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(targetNpmrcPath)) {
// If the source .npmrc doesn't exist and there is one in the target, delete the one in the target
logger.info(`Deleting ${targetNpmrcPath}`); // Verbose
fs__WEBPACK_IMPORTED_MODULE_0__.unlinkSync(targetNpmrcPath);
}
}
catch (e) {
throw new Error(`Error syncing .npmrc file: ${e}`);
}
}
function isVariableSetInNpmrcFile(sourceNpmrcFolder, variableKey) {
const sourceNpmrcPath = `${sourceNpmrcFolder}/.npmrc`;
//if .npmrc file does not exist, return false directly
if (!fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(sourceNpmrcPath)) {
return false;
}
const trimmedNpmrcFile = _trimNpmrcFile({ sourceNpmrcPath });
const variableKeyRegExp = new RegExp(`^${variableKey}=`, 'm');
return trimmedNpmrcFile.match(variableKeyRegExp) !== null;
}
//# sourceMappingURL=npmrcUtilities.js.map
/***/ }),
/***/ 532081:
/*!********************************!*\
!*** external "child_process" ***!
\********************************/
/***/ ((module) => {
module.exports = require("child_process");
/***/ }),
/***/ 657147:
/*!*********************!*\
!*** external "fs" ***!
\*********************/
/***/ ((module) => {
module.exports = require("fs");
/***/ }),
/***/ 822037:
/*!*********************!*\
!*** external "os" ***!
\*********************/
/***/ ((module) => {
module.exports = require("os");
/***/ }),
/***/ 371017:
/*!***********************!*\
!*** external "path" ***!
\***********************/
/***/ ((module) => {
module.exports = require("path");
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
(() => {
/*!*******************************************!*\
!*** ./lib-esnext/scripts/install-run.js ***!
\*******************************************/
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "RUSH_JSON_FILENAME": () => (/* binding */ RUSH_JSON_FILENAME),
/* harmony export */ "findRushJsonFolder": () => (/* binding */ findRushJsonFolder),
/* harmony export */ "getNpmPath": () => (/* binding */ getNpmPath),
/* harmony export */ "installAndRun": () => (/* binding */ installAndRun),
/* harmony export */ "runWithErrorAndStatusCode": () => (/* binding */ runWithErrorAndStatusCode)
/* harmony export */ });
/* harmony import */ var child_process__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! child_process */ 532081);
/* harmony import */ var child_process__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(child_process__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! fs */ 657147);
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var os__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! os */ 822037);
/* harmony import */ var os__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(os__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! path */ 371017);
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _utilities_npmrcUtilities__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../utilities/npmrcUtilities */ 679877);
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
/* eslint-disable no-console */
const RUSH_JSON_FILENAME = 'rush.json';
const RUSH_TEMP_FOLDER_ENV_VARIABLE_NAME = 'RUSH_TEMP_FOLDER'; const RUSH_TEMP_FOLDER_ENV_VARIABLE_NAME = 'RUSH_TEMP_FOLDER';
const INSTALL_RUN_LOCKFILE_PATH_VARIABLE = 'INSTALL_RUN_LOCKFILE_PATH';
const INSTALLED_FLAG_FILENAME = 'installed.flag'; const INSTALLED_FLAG_FILENAME = 'installed.flag';
const NODE_MODULES_FOLDER_NAME = 'node_modules'; const NODE_MODULES_FOLDER_NAME = 'node_modules';
const PACKAGE_JSON_FILENAME = 'package.json'; const PACKAGE_JSON_FILENAME = 'package.json';
@ -70,82 +331,6 @@ function _parsePackageSpecifier(rawPackageSpecifier) {
} }
return { name, version }; return { name, version };
} }
/**
* As a workaround, copyAndTrimNpmrcFile() copies the .npmrc file to the target folder, and also trims
* unusable lines from the .npmrc file.
*
* Why are we trimming the .npmrc lines? NPM allows environment variables to be specified in
* the .npmrc file to provide different authentication tokens for different registry.
* However, if the environment variable is undefined, it expands to an empty string, which
* produces a valid-looking mapping with an invalid URL that causes an error. Instead,
* we'd prefer to skip that line and continue looking in other places such as the user's
* home directory.
*
* IMPORTANT: THIS CODE SHOULD BE KEPT UP TO DATE WITH Utilities.copyAndTrimNpmrcFile()
*/
function _copyAndTrimNpmrcFile(logger, sourceNpmrcPath, targetNpmrcPath) {
logger.info(`Transforming ${sourceNpmrcPath}`); // Verbose
logger.info(` --> "${targetNpmrcPath}"`);
let npmrcFileLines = fs.readFileSync(sourceNpmrcPath).toString().split('\n');
npmrcFileLines = npmrcFileLines.map((line) => (line || '').trim());
const resultLines = [];
// This finds environment variable tokens that look like "${VAR_NAME}"
const expansionRegExp = /\$\{([^\}]+)\}/g;
// Comment lines start with "#" or ";"
const commentRegExp = /^\s*[#;]/;
// Trim out lines that reference environment variables that aren't defined
for (const line of npmrcFileLines) {
let lineShouldBeTrimmed = false;
// Ignore comment lines
if (!commentRegExp.test(line)) {
const environmentVariables = line.match(expansionRegExp);
if (environmentVariables) {
for (const token of environmentVariables) {
// Remove the leading "${" and the trailing "}" from the token
const environmentVariableName = token.substring(2, token.length - 1);
// Is the environment variable defined?
if (!process.env[environmentVariableName]) {
// No, so trim this line
lineShouldBeTrimmed = true;
break;
}
}
}
}
if (lineShouldBeTrimmed) {
// Example output:
// "; MISSING ENVIRONMENT VARIABLE: //my-registry.com/npm/:_authToken=${MY_AUTH_TOKEN}"
resultLines.push('; MISSING ENVIRONMENT VARIABLE: ' + line);
}
else {
resultLines.push(line);
}
}
fs.writeFileSync(targetNpmrcPath, resultLines.join(os.EOL));
}
/**
* syncNpmrc() copies the .npmrc file to the target folder, and also trims unusable lines from the .npmrc file.
* If the source .npmrc file not exist, then syncNpmrc() will delete an .npmrc that is found in the target folder.
*
* IMPORTANT: THIS CODE SHOULD BE KEPT UP TO DATE WITH Utilities._syncNpmrc()
*/
function _syncNpmrc(logger, sourceNpmrcFolder, targetNpmrcFolder, useNpmrcPublish) {
const sourceNpmrcPath = path.join(sourceNpmrcFolder, !useNpmrcPublish ? '.npmrc' : '.npmrc-publish');
const targetNpmrcPath = path.join(targetNpmrcFolder, '.npmrc');
try {
if (fs.existsSync(sourceNpmrcPath)) {
_copyAndTrimNpmrcFile(logger, sourceNpmrcPath, targetNpmrcPath);
}
else if (fs.existsSync(targetNpmrcPath)) {
// If the source .npmrc doesn't exist and there is one in the target, delete the one in the target
logger.info(`Deleting ${targetNpmrcPath}`); // Verbose
fs.unlinkSync(targetNpmrcPath);
}
}
catch (e) {
throw new Error(`Error syncing .npmrc file: ${e}`);
}
}
let _npmPath = undefined; let _npmPath = undefined;
/** /**
* Get the absolute path to the npm executable * Get the absolute path to the npm executable
@ -153,35 +338,34 @@ let _npmPath = undefined;
function getNpmPath() { function getNpmPath() {
if (!_npmPath) { if (!_npmPath) {
try { try {
if (os.platform() === 'win32') { if (os__WEBPACK_IMPORTED_MODULE_2__.platform() === 'win32') {
// We're on Windows // We're on Windows
const whereOutput = childProcess.execSync('where npm', { stdio: [] }).toString(); const whereOutput = child_process__WEBPACK_IMPORTED_MODULE_0__.execSync('where npm', { stdio: [] }).toString();
const lines = whereOutput.split(os.EOL).filter((line) => !!line); const lines = whereOutput.split(os__WEBPACK_IMPORTED_MODULE_2__.EOL).filter((line) => !!line);
// take the last result, we are looking for a .cmd command // take the last result, we are looking for a .cmd command
// see https://github.com/microsoft/rushstack/issues/759 // see https://github.com/microsoft/rushstack/issues/759
_npmPath = lines[lines.length - 1]; _npmPath = lines[lines.length - 1];
} }
else { else {
// We aren't on Windows - assume we're on *NIX or Darwin // We aren't on Windows - assume we're on *NIX or Darwin
_npmPath = childProcess.execSync('command -v npm', { stdio: [] }).toString(); _npmPath = child_process__WEBPACK_IMPORTED_MODULE_0__.execSync('command -v npm', { stdio: [] }).toString();
} }
} }
catch (e) { catch (e) {
throw new Error(`Unable to determine the path to the NPM tool: ${e}`); throw new Error(`Unable to determine the path to the NPM tool: ${e}`);
} }
_npmPath = _npmPath.trim(); _npmPath = _npmPath.trim();
if (!fs.existsSync(_npmPath)) { if (!fs__WEBPACK_IMPORTED_MODULE_1__.existsSync(_npmPath)) {
throw new Error('The NPM executable does not exist'); throw new Error('The NPM executable does not exist');
} }
} }
return _npmPath; return _npmPath;
} }
exports.getNpmPath = getNpmPath;
function _ensureFolder(folderPath) { function _ensureFolder(folderPath) {
if (!fs.existsSync(folderPath)) { if (!fs__WEBPACK_IMPORTED_MODULE_1__.existsSync(folderPath)) {
const parentDir = path.dirname(folderPath); const parentDir = path__WEBPACK_IMPORTED_MODULE_3__.dirname(folderPath);
_ensureFolder(parentDir); _ensureFolder(parentDir);
fs.mkdirSync(folderPath); fs__WEBPACK_IMPORTED_MODULE_1__.mkdirSync(folderPath);
} }
} }
/** /**
@ -195,14 +379,14 @@ function _ensureAndJoinPath(baseFolder, ...pathSegments) {
try { try {
for (let pathSegment of pathSegments) { for (let pathSegment of pathSegments) {
pathSegment = pathSegment.replace(/[\\\/]/g, '+'); pathSegment = pathSegment.replace(/[\\\/]/g, '+');
joinedPath = path.join(joinedPath, pathSegment); joinedPath = path__WEBPACK_IMPORTED_MODULE_3__.join(joinedPath, pathSegment);
if (!fs.existsSync(joinedPath)) { if (!fs__WEBPACK_IMPORTED_MODULE_1__.existsSync(joinedPath)) {
fs.mkdirSync(joinedPath); fs__WEBPACK_IMPORTED_MODULE_1__.mkdirSync(joinedPath);
} }
} }
} }
catch (e) { catch (e) {
throw new Error(`Error building local installation folder (${path.join(baseFolder, ...pathSegments)}): ${e}`); throw new Error(`Error building local installation folder (${path__WEBPACK_IMPORTED_MODULE_3__.join(baseFolder, ...pathSegments)}): ${e}`);
} }
return joinedPath; return joinedPath;
} }
@ -216,6 +400,23 @@ function _getRushTempFolder(rushCommonFolder) {
return _ensureAndJoinPath(rushCommonFolder, 'temp'); return _ensureAndJoinPath(rushCommonFolder, 'temp');
} }
} }
/**
* Compare version strings according to semantic versioning.
* Returns a positive integer if "a" is a later version than "b",
* a negative integer if "b" is later than "a",
* and 0 otherwise.
*/
function _compareVersionStrings(a, b) {
const aParts = a.split(/[.-]/);
const bParts = b.split(/[.-]/);
const numberOfParts = Math.max(aParts.length, bParts.length);
for (let i = 0; i < numberOfParts; i++) {
if (aParts[i] !== bParts[i]) {
return (Number(aParts[i]) || 0) - (Number(bParts[i]) || 0);
}
}
return 0;
}
/** /**
* Resolve a package specifier to a static version * Resolve a package specifier to a static version
*/ */
@ -232,16 +433,31 @@ function _resolvePackageVersion(logger, rushCommonFolder, { name, version }) {
// version resolves to // version resolves to
try { try {
const rushTempFolder = _getRushTempFolder(rushCommonFolder); const rushTempFolder = _getRushTempFolder(rushCommonFolder);
const sourceNpmrcFolder = path.join(rushCommonFolder, 'config', 'rush'); const sourceNpmrcFolder = path__WEBPACK_IMPORTED_MODULE_3__.join(rushCommonFolder, 'config', 'rush');
_syncNpmrc(logger, sourceNpmrcFolder, rushTempFolder); (0,_utilities_npmrcUtilities__WEBPACK_IMPORTED_MODULE_4__.syncNpmrc)({
sourceNpmrcFolder,
targetNpmrcFolder: rushTempFolder,
logger
});
const npmPath = getNpmPath(); const npmPath = getNpmPath();
// This returns something that looks like: // This returns something that looks like:
// @microsoft/rush@3.0.0 '3.0.0' // ```
// @microsoft/rush@3.0.1 '3.0.1' // [
// "3.0.0",
// "3.0.1",
// ... // ...
// @microsoft/rush@3.0.20 '3.0.20' // "3.0.20"
// <blank line> // ]
const npmVersionSpawnResult = childProcess.spawnSync(npmPath, ['view', `${name}@${version}`, 'version', '--no-update-notifier'], { // ```
//
// if multiple versions match the selector, or
//
// ```
// "3.0.0"
// ```
//
// if only a single version matches.
const npmVersionSpawnResult = child_process__WEBPACK_IMPORTED_MODULE_0__.spawnSync(npmPath, ['view', `${name}@${version}`, 'version', '--no-update-notifier', '--json'], {
cwd: rushTempFolder, cwd: rushTempFolder,
stdio: [] stdio: []
}); });
@ -249,16 +465,21 @@ function _resolvePackageVersion(logger, rushCommonFolder, { name, version }) {
throw new Error(`"npm view" returned error code ${npmVersionSpawnResult.status}`); throw new Error(`"npm view" returned error code ${npmVersionSpawnResult.status}`);
} }
const npmViewVersionOutput = npmVersionSpawnResult.stdout.toString(); const npmViewVersionOutput = npmVersionSpawnResult.stdout.toString();
const versionLines = npmViewVersionOutput.split('\n').filter((line) => !!line); const parsedVersionOutput = JSON.parse(npmViewVersionOutput);
const latestVersion = versionLines[versionLines.length - 1]; const versions = Array.isArray(parsedVersionOutput)
? parsedVersionOutput
: [parsedVersionOutput];
let latestVersion = versions[0];
for (let i = 1; i < versions.length; i++) {
const latestVersionCandidate = versions[i];
if (_compareVersionStrings(latestVersionCandidate, latestVersion) > 0) {
latestVersion = latestVersionCandidate;
}
}
if (!latestVersion) { if (!latestVersion) {
throw new Error('No versions found for the specified version range.'); throw new Error('No versions found for the specified version range.');
} }
const versionMatches = latestVersion.match(/^.+\s\'(.+)\'$/); return latestVersion;
if (!versionMatches) {
throw new Error(`Invalid npm output ${latestVersion}`);
}
return versionMatches[1];
} }
catch (e) { catch (e) {
throw new Error(`Unable to resolve version ${version} of package ${name}: ${e}`); throw new Error(`Unable to resolve version ${version} of package ${name}: ${e}`);
@ -274,58 +495,72 @@ function findRushJsonFolder() {
let basePath = __dirname; let basePath = __dirname;
let tempPath = __dirname; let tempPath = __dirname;
do { do {
const testRushJsonPath = path.join(basePath, exports.RUSH_JSON_FILENAME); const testRushJsonPath = path__WEBPACK_IMPORTED_MODULE_3__.join(basePath, RUSH_JSON_FILENAME);
if (fs.existsSync(testRushJsonPath)) { if (fs__WEBPACK_IMPORTED_MODULE_1__.existsSync(testRushJsonPath)) {
_rushJsonFolder = basePath; _rushJsonFolder = basePath;
break; break;
} }
else { else {
basePath = tempPath; basePath = tempPath;
} }
} while (basePath !== (tempPath = path.dirname(basePath))); // Exit the loop when we hit the disk root } while (basePath !== (tempPath = path__WEBPACK_IMPORTED_MODULE_3__.dirname(basePath))); // Exit the loop when we hit the disk root
if (!_rushJsonFolder) { if (!_rushJsonFolder) {
throw new Error('Unable to find rush.json.'); throw new Error(`Unable to find ${RUSH_JSON_FILENAME}.`);
} }
} }
return _rushJsonFolder; return _rushJsonFolder;
} }
exports.findRushJsonFolder = findRushJsonFolder;
/** /**
* Detects if the package in the specified directory is installed * Detects if the package in the specified directory is installed
*/ */
function _isPackageAlreadyInstalled(packageInstallFolder) { function _isPackageAlreadyInstalled(packageInstallFolder) {
try { try {
const flagFilePath = path.join(packageInstallFolder, INSTALLED_FLAG_FILENAME); const flagFilePath = path__WEBPACK_IMPORTED_MODULE_3__.join(packageInstallFolder, INSTALLED_FLAG_FILENAME);
if (!fs.existsSync(flagFilePath)) { if (!fs__WEBPACK_IMPORTED_MODULE_1__.existsSync(flagFilePath)) {
return false; return false;
} }
const fileContents = fs.readFileSync(flagFilePath).toString(); const fileContents = fs__WEBPACK_IMPORTED_MODULE_1__.readFileSync(flagFilePath).toString();
return fileContents.trim() === process.version; return fileContents.trim() === process.version;
} }
catch (e) { catch (e) {
return false; return false;
} }
} }
/**
* Delete a file. Fail silently if it does not exist.
*/
function _deleteFile(file) {
try {
fs__WEBPACK_IMPORTED_MODULE_1__.unlinkSync(file);
}
catch (err) {
if (err.code !== 'ENOENT' && err.code !== 'ENOTDIR') {
throw err;
}
}
}
/** /**
* Removes the following files and directories under the specified folder path: * Removes the following files and directories under the specified folder path:
* - installed.flag * - installed.flag
* - * -
* - node_modules * - node_modules
*/ */
function _cleanInstallFolder(rushTempFolder, packageInstallFolder) { function _cleanInstallFolder(rushTempFolder, packageInstallFolder, lockFilePath) {
try { try {
const flagFile = path.resolve(packageInstallFolder, INSTALLED_FLAG_FILENAME); const flagFile = path__WEBPACK_IMPORTED_MODULE_3__.resolve(packageInstallFolder, INSTALLED_FLAG_FILENAME);
if (fs.existsSync(flagFile)) { _deleteFile(flagFile);
fs.unlinkSync(flagFile); const packageLockFile = path__WEBPACK_IMPORTED_MODULE_3__.resolve(packageInstallFolder, 'package-lock.json');
if (lockFilePath) {
fs__WEBPACK_IMPORTED_MODULE_1__.copyFileSync(lockFilePath, packageLockFile);
} }
const packageLockFile = path.resolve(packageInstallFolder, 'package-lock.json'); else {
if (fs.existsSync(packageLockFile)) { // Not running `npm ci`, so need to cleanup
fs.unlinkSync(packageLockFile); _deleteFile(packageLockFile);
} const nodeModulesFolder = path__WEBPACK_IMPORTED_MODULE_3__.resolve(packageInstallFolder, NODE_MODULES_FOLDER_NAME);
const nodeModulesFolder = path.resolve(packageInstallFolder, NODE_MODULES_FOLDER_NAME); if (fs__WEBPACK_IMPORTED_MODULE_1__.existsSync(nodeModulesFolder)) {
if (fs.existsSync(nodeModulesFolder)) {
const rushRecyclerFolder = _ensureAndJoinPath(rushTempFolder, 'rush-recycler'); const rushRecyclerFolder = _ensureAndJoinPath(rushTempFolder, 'rush-recycler');
fs.renameSync(nodeModulesFolder, path.join(rushRecyclerFolder, `install-run-${Date.now().toString()}`)); fs__WEBPACK_IMPORTED_MODULE_1__.renameSync(nodeModulesFolder, path__WEBPACK_IMPORTED_MODULE_3__.join(rushRecyclerFolder, `install-run-${Date.now().toString()}`));
}
} }
} }
catch (e) { catch (e) {
@ -344,8 +579,8 @@ function _createPackageJson(packageInstallFolder, name, version) {
repository: "DON'T WARN", repository: "DON'T WARN",
license: 'MIT' license: 'MIT'
}; };
const packageJsonPath = path.join(packageInstallFolder, PACKAGE_JSON_FILENAME); const packageJsonPath = path__WEBPACK_IMPORTED_MODULE_3__.join(packageInstallFolder, PACKAGE_JSON_FILENAME);
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJsonContents, undefined, 2)); fs__WEBPACK_IMPORTED_MODULE_1__.writeFileSync(packageJsonPath, JSON.stringify(packageJsonContents, undefined, 2));
} }
catch (e) { catch (e) {
throw new Error(`Unable to create package.json: ${e}`); throw new Error(`Unable to create package.json: ${e}`);
@ -354,17 +589,17 @@ function _createPackageJson(packageInstallFolder, name, version) {
/** /**
* Run "npm install" in the package install folder. * Run "npm install" in the package install folder.
*/ */
function _installPackage(logger, packageInstallFolder, name, version) { function _installPackage(logger, packageInstallFolder, name, version, command) {
try { try {
logger.info(`Installing ${name}...`); logger.info(`Installing ${name}...`);
const npmPath = getNpmPath(); const npmPath = getNpmPath();
const result = childProcess.spawnSync(npmPath, ['install'], { const result = child_process__WEBPACK_IMPORTED_MODULE_0__.spawnSync(npmPath, [command], {
stdio: 'inherit', stdio: 'inherit',
cwd: packageInstallFolder, cwd: packageInstallFolder,
env: process.env env: process.env
}); });
if (result.status !== 0) { if (result.status !== 0) {
throw new Error('"npm install" encountered an error'); throw new Error(`"npm ${command}" encountered an error`);
} }
logger.info(`Successfully installed ${name}@${version}`); logger.info(`Successfully installed ${name}@${version}`);
} }
@ -376,41 +611,46 @@ function _installPackage(logger, packageInstallFolder, name, version) {
* Get the ".bin" path for the package. * Get the ".bin" path for the package.
*/ */
function _getBinPath(packageInstallFolder, binName) { function _getBinPath(packageInstallFolder, binName) {
const binFolderPath = path.resolve(packageInstallFolder, NODE_MODULES_FOLDER_NAME, '.bin'); const binFolderPath = path__WEBPACK_IMPORTED_MODULE_3__.resolve(packageInstallFolder, NODE_MODULES_FOLDER_NAME, '.bin');
const resolvedBinName = os.platform() === 'win32' ? `${binName}.cmd` : binName; const resolvedBinName = os__WEBPACK_IMPORTED_MODULE_2__.platform() === 'win32' ? `${binName}.cmd` : binName;
return path.resolve(binFolderPath, resolvedBinName); return path__WEBPACK_IMPORTED_MODULE_3__.resolve(binFolderPath, resolvedBinName);
} }
/** /**
* Write a flag file to the package's install directory, signifying that the install was successful. * Write a flag file to the package's install directory, signifying that the install was successful.
*/ */
function _writeFlagFile(packageInstallFolder) { function _writeFlagFile(packageInstallFolder) {
try { try {
const flagFilePath = path.join(packageInstallFolder, INSTALLED_FLAG_FILENAME); const flagFilePath = path__WEBPACK_IMPORTED_MODULE_3__.join(packageInstallFolder, INSTALLED_FLAG_FILENAME);
fs.writeFileSync(flagFilePath, process.version); fs__WEBPACK_IMPORTED_MODULE_1__.writeFileSync(flagFilePath, process.version);
} }
catch (e) { catch (e) {
throw new Error(`Unable to create installed.flag file in ${packageInstallFolder}`); throw new Error(`Unable to create installed.flag file in ${packageInstallFolder}`);
} }
} }
function installAndRun(logger, packageName, packageVersion, packageBinName, packageBinArgs) { function installAndRun(logger, packageName, packageVersion, packageBinName, packageBinArgs, lockFilePath = process.env[INSTALL_RUN_LOCKFILE_PATH_VARIABLE]) {
const rushJsonFolder = findRushJsonFolder(); const rushJsonFolder = findRushJsonFolder();
const rushCommonFolder = path.join(rushJsonFolder, 'common'); const rushCommonFolder = path__WEBPACK_IMPORTED_MODULE_3__.join(rushJsonFolder, 'common');
const rushTempFolder = _getRushTempFolder(rushCommonFolder); const rushTempFolder = _getRushTempFolder(rushCommonFolder);
const packageInstallFolder = _ensureAndJoinPath(rushTempFolder, 'install-run', `${packageName}@${packageVersion}`); const packageInstallFolder = _ensureAndJoinPath(rushTempFolder, 'install-run', `${packageName}@${packageVersion}`);
if (!_isPackageAlreadyInstalled(packageInstallFolder)) { if (!_isPackageAlreadyInstalled(packageInstallFolder)) {
// The package isn't already installed // The package isn't already installed
_cleanInstallFolder(rushTempFolder, packageInstallFolder); _cleanInstallFolder(rushTempFolder, packageInstallFolder, lockFilePath);
const sourceNpmrcFolder = path.join(rushCommonFolder, 'config', 'rush'); const sourceNpmrcFolder = path__WEBPACK_IMPORTED_MODULE_3__.join(rushCommonFolder, 'config', 'rush');
_syncNpmrc(logger, sourceNpmrcFolder, packageInstallFolder); (0,_utilities_npmrcUtilities__WEBPACK_IMPORTED_MODULE_4__.syncNpmrc)({
sourceNpmrcFolder,
targetNpmrcFolder: packageInstallFolder,
logger
});
_createPackageJson(packageInstallFolder, packageName, packageVersion); _createPackageJson(packageInstallFolder, packageName, packageVersion);
_installPackage(logger, packageInstallFolder, packageName, packageVersion); const command = lockFilePath ? 'ci' : 'install';
_installPackage(logger, packageInstallFolder, packageName, packageVersion, command);
_writeFlagFile(packageInstallFolder); _writeFlagFile(packageInstallFolder);
} }
const statusMessage = `Invoking "${packageBinName} ${packageBinArgs.join(' ')}"`; const statusMessage = `Invoking "${packageBinName} ${packageBinArgs.join(' ')}"`;
const statusMessageLine = new Array(statusMessage.length + 1).join('-'); const statusMessageLine = new Array(statusMessage.length + 1).join('-');
logger.info(os.EOL + statusMessage + os.EOL + statusMessageLine + os.EOL); logger.info('\n' + statusMessage + '\n' + statusMessageLine + '\n');
const binPath = _getBinPath(packageInstallFolder, packageBinName); const binPath = _getBinPath(packageInstallFolder, packageBinName);
const binFolderPath = path.resolve(packageInstallFolder, NODE_MODULES_FOLDER_NAME, '.bin'); const binFolderPath = path__WEBPACK_IMPORTED_MODULE_3__.resolve(packageInstallFolder, NODE_MODULES_FOLDER_NAME, '.bin');
// Windows environment variables are case-insensitive. Instead of using SpawnSyncOptions.env, we need to // Windows environment variables are case-insensitive. Instead of using SpawnSyncOptions.env, we need to
// assign via the process.env proxy to ensure that we append to the right PATH key. // assign via the process.env proxy to ensure that we append to the right PATH key.
const originalEnvPath = process.env.PATH || ''; const originalEnvPath = process.env.PATH || '';
@ -418,10 +658,10 @@ function installAndRun(logger, packageName, packageVersion, packageBinName, pack
try { try {
// Node.js on Windows can not spawn a file when the path has a space on it // Node.js on Windows can not spawn a file when the path has a space on it
// unless the path gets wrapped in a cmd friendly way and shell mode is used // unless the path gets wrapped in a cmd friendly way and shell mode is used
const shouldUseShell = binPath.includes(' ') && os.platform() === 'win32'; const shouldUseShell = binPath.includes(' ') && os__WEBPACK_IMPORTED_MODULE_2__.platform() === 'win32';
const platformBinPath = shouldUseShell ? `"${binPath}"` : binPath; const platformBinPath = shouldUseShell ? `"${binPath}"` : binPath;
process.env.PATH = [binFolderPath, originalEnvPath].join(path.delimiter); process.env.PATH = [binFolderPath, originalEnvPath].join(path__WEBPACK_IMPORTED_MODULE_3__.delimiter);
result = childProcess.spawnSync(platformBinPath, packageBinArgs, { result = child_process__WEBPACK_IMPORTED_MODULE_0__.spawnSync(platformBinPath, packageBinArgs, {
stdio: 'inherit', stdio: 'inherit',
windowsVerbatimArguments: false, windowsVerbatimArguments: false,
shell: shouldUseShell, shell: shouldUseShell,
@ -439,7 +679,6 @@ function installAndRun(logger, packageName, packageVersion, packageBinName, pack
throw result.error || new Error('An unknown error occurred.'); throw result.error || new Error('An unknown error occurred.');
} }
} }
exports.installAndRun = installAndRun;
function runWithErrorAndStatusCode(logger, fn) { function runWithErrorAndStatusCode(logger, fn) {
process.exitCode = 1; process.exitCode = 1;
try { try {
@ -447,16 +686,15 @@ function runWithErrorAndStatusCode(logger, fn) {
process.exitCode = exitCode; process.exitCode = exitCode;
} }
catch (e) { catch (e) {
logger.error(os.EOL + os.EOL + e.toString() + os.EOL + os.EOL); logger.error('\n\n' + e.toString() + '\n\n');
} }
} }
exports.runWithErrorAndStatusCode = runWithErrorAndStatusCode;
function _run() { function _run() {
const [nodePath /* Ex: /bin/node */, scriptPath /* /repo/common/scripts/install-run-rush.js */, rawPackageSpecifier /* qrcode@^1.2.0 */, packageBinName /* qrcode */, ...packageBinArgs /* [-f, myproject/lib] */] = process.argv; const [nodePath /* Ex: /bin/node */, scriptPath /* /repo/common/scripts/install-run-rush.js */, rawPackageSpecifier /* qrcode@^1.2.0 */, packageBinName /* qrcode */, ...packageBinArgs /* [-f, myproject/lib] */] = process.argv;
if (!nodePath) { if (!nodePath) {
throw new Error('Unexpected exception: could not detect node path'); throw new Error('Unexpected exception: could not detect node path');
} }
if (path.basename(scriptPath).toLowerCase() !== 'install-run.js') { if (path__WEBPACK_IMPORTED_MODULE_3__.basename(scriptPath).toLowerCase() !== 'install-run.js') {
// If install-run.js wasn't directly invoked, don't execute the rest of this function. Return control // If install-run.js wasn't directly invoked, don't execute the rest of this function. Return control
// to the script that (presumably) imported this file // to the script that (presumably) imported this file
return; return;
@ -481,3 +719,9 @@ function _run() {
} }
_run(); _run();
//# sourceMappingURL=install-run.js.map //# sourceMappingURL=install-run.js.map
})();
module.exports = __webpack_exports__;
/******/ })()
;
//# sourceMappingURL=install-run.js.map

Просмотреть файл

@ -16,7 +16,7 @@
* path segment in the "$schema" field for all your Rush config files. This will ensure * path segment in the "$schema" field for all your Rush config files. This will ensure
* correct error-underlining and tab-completion for editors such as VS Code. * correct error-underlining and tab-completion for editors such as VS Code.
*/ */
"rushVersion": "5.76.1", "rushVersion": "5.118.4",
/** /**
* The next field selects which package manager should be installed and determines its version. * The next field selects which package manager should be installed and determines its version.
@ -124,7 +124,7 @@
* LTS schedule: https://nodejs.org/en/about/releases/ * LTS schedule: https://nodejs.org/en/about/releases/
* LTS versions: https://nodejs.org/en/download/releases/ * LTS versions: https://nodejs.org/en/download/releases/
*/ */
"nodeSupportedVersionRange": ">=14.15.0 <15.0.0 || >=16.20.2 < 17.0.0", "nodeSupportedVersionRange": ">=18.18.2 < 19.0.0",
/** /**
* Odd-numbered major versions of Node.js are experimental. Even-numbered releases * Odd-numbered major versions of Node.js are experimental. Even-numbered releases
@ -327,37 +327,6 @@
"postRushBuild": [] "postRushBuild": []
}, },
/**
* Installation variants allow you to maintain a parallel set of configuration files that can be
* used to build the entire monorepo with an alternate set of dependencies. For example, suppose
* you upgrade all your projects to use a new release of an important framework, but during a transition period
* you intend to maintain compatibility with the old release. In this situation, you probably want your
* CI validation to build the entire repo twice: once with the old release, and once with the new release.
*
* Rush "installation variants" correspond to sets of config files located under this folder:
*
* common/config/rush/variants/<variant_name>
*
* The variant folder can contain an alternate common-versions.json file. Its "preferredVersions" field can be used
* to select older versions of dependencies (within a loose SemVer range specified in your package.json files).
* To install a variant, run "rush install --variant <variant_name>".
*
* For more details and instructions, see this article: https://rushjs.io/pages/advanced/installation_variants/
*/
"variants": [
// {
// /**
// * The folder name for this variant.
// */
// "variantName": "old-sdk",
//
// /**
// * An informative description
// */
// "description": "Build this repo using the previous release of the SDK"
// }
],
/** /**
* Rush can collect anonymous telemetry about everyday developer activity such as * Rush can collect anonymous telemetry about everyday developer activity such as
* success/failure of installs, builds, and other operations. You can use this to identify * success/failure of installs, builds, and other operations. You can use this to identify
@ -601,6 +570,12 @@
"reviewCategory": "tests", "reviewCategory": "tests",
"shouldPublish": false "shouldPublish": false
}, },
{
"packageName": "rush-stack-compiler-5.3-library-test",
"projectFolder": "build-tests/rush-stack-compiler-5.3-library-test",
"reviewCategory": "tests",
"shouldPublish": false
},
{ {
"packageName": "web-library-build-test", "packageName": "web-library-build-test",
@ -778,6 +753,12 @@
"decoupledLocalDependencies": ["@microsoft/rush-stack-compiler-4.7"], "decoupledLocalDependencies": ["@microsoft/rush-stack-compiler-4.7"],
"shouldPublish": true "shouldPublish": true
}, },
{
"packageName": "@microsoft/rush-stack-compiler-5.3",
"projectFolder": "stack/rush-stack-compiler-5.3",
"reviewCategory": "libraries",
"shouldPublish": true
},
{ {
"packageName": "@microsoft/rush-stack-compiler-shared", "packageName": "@microsoft/rush-stack-compiler-shared",
"projectFolder": "stack/rush-stack-compiler-shared", "projectFolder": "stack/rush-stack-compiler-shared",

Просмотреть файл

@ -0,0 +1,10 @@
// This is a workaround for https://github.com/eslint/eslint/issues/3458
require('@rushstack/eslint-config/patch/modern-module-resolution');
module.exports = {
extends: [
'@rushstack/eslint-config/profile/node-trusted-tool',
'@rushstack/eslint-config/mixins/friendly-locals'
],
parserOptions: { tsconfigRootDir: __dirname }
};

1
stack/rush-stack-compiler-5.3/.gitignore поставляемый Normal file
Просмотреть файл

@ -0,0 +1 @@
/src

Просмотреть файл

@ -0,0 +1,31 @@
# THIS IS A STANDARD TEMPLATE FOR .npmignore FILES IN THIS REPO.
# Ignore all files by default, to avoid accidentally publishing unintended files.
*
# Use negative patterns to bring back the specific things we want to publish.
!/bin/**
!/lib/**
!/lib-*/**
!/dist/**
!ThirdPartyNotice.txt
# Ignore certain patterns that should not get published.
/dist/*.stats.*
/lib/**/test/
/lib-*/**/test/
*.test.js
# NOTE: These don't need to be specified, because NPM includes them automatically.
#
# package.json
# README (and its variants)
# CHANGELOG (and its variants)
# LICENSE / LICENCE
#--------------------------------------------
# DO NOT MODIFY THE TEMPLATE ABOVE THIS LINE
#--------------------------------------------
# (Add your project-specific overrides here)
!/includes/**

Просмотреть файл

@ -0,0 +1,24 @@
@microsoft/rush-stack
Copyright (c) Microsoft Corporation. All rights reserved.
MIT License
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Просмотреть файл

@ -0,0 +1,11 @@
# @microsoft/rush-stack-compiler-5.3
This package is an NPM peer dependency that is used with
[@microsoft/rush-stack](https://www.npmjs.com/package/@microsoft/rush-stack)
to select a TypeScript compiler version. This variant selects TypeScript 5.3
It provides a supported set of versions for the following components:
- the TypeScript compiler
- [eslint](https://eslint.org/)
- [API Extractor](https://api-extractor.com/)

Просмотреть файл

@ -0,0 +1,2 @@
#!/usr/bin/env node
require('@microsoft/api-extractor/bin/api-extractor');

Просмотреть файл

@ -0,0 +1,2 @@
#!/usr/bin/env node
require('eslint/bin/eslint');

Просмотреть файл

@ -0,0 +1,2 @@
#!/usr/bin/env node
require('typescript/bin/tsc');

Просмотреть файл

@ -0,0 +1,18 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"mainEntryPointFilePath": "<projectFolder>/lib/index.d.ts",
"apiReport": {
"enabled": true,
"reportFolder": "../../../common/reviews/api"
},
"docModel": {
"enabled": true
},
"dtsRollup": {
"enabled": false
}
}

Просмотреть файл

@ -0,0 +1,32 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/heft/heft.schema.json",
"extends": "@rushstack/heft-node-rig/profiles/default/config/heft.json",
"eventActions": [
{
"actionKind": "deleteGlobs",
"heftEvent": "clean",
"actionId": "deleteSrc",
"globsToDelete": ["src"]
},
{
"actionKind": "copyFiles",
"heftEvent": "pre-compile",
"actionId": "copySrc",
"copyOperations": [
{
"sourceFolder": "node_modules/@microsoft/rush-stack-compiler-shared/src",
"destinationFolders": ["src"],
"includeGlobs": ["*.ts", "*.js"]
},
{
"sourceFolder": "node_modules/@microsoft/rush-stack-compiler-shared/src/v4",
"destinationFolders": ["src"],
"includeGlobs": ["*.ts", "*.js"]
}
]
}
]
}

Просмотреть файл

@ -0,0 +1,7 @@
{
// The "rig.json" file directs tools to look for their config files in an external package.
// Documentation for this system: https://www.npmjs.com/package/@rushstack/rig-package
"$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json",
"rigPackageName": "@rushstack/heft-node-rig"
}

Просмотреть файл

@ -0,0 +1,12 @@
/**
* Configures the TypeScript plugin for Heft. This plugin also manages linting.
*/
{
"$schema": "https://developer.microsoft.com/json-schemas/heft/typescript.schema.json",
"extends": "@rushstack/heft-node-rig/profiles/default/config/typescript.json",
"staticAssetsToCopy": {
"fileExtensions": [".d.ts", ".js"]
}
}

Просмотреть файл

@ -0,0 +1,21 @@
{
"$schema": "http://json.schemastore.org/tsconfig",
"compilerOptions": {
"outDir": "../../../../lib",
"rootDir": "../../../../src",
"forceConsistentCasingInFileNames": true,
"jsx": "react",
"declaration": true,
"sourceMap": true,
"declarationMap": true,
"inlineSources": true,
"experimentalDecorators": true,
"strictNullChecks": true,
"noUnusedLocals": true,
"types": []
},
"include": ["../../../../src/**/*.ts", "../../../../src/**/*.tsx"],
"exclude": ["../../../../node_modules", "../../../../lib"]
}

Просмотреть файл

@ -0,0 +1,10 @@
{
"$schema": "http://json.schemastore.org/tsconfig",
"extends": "./tsconfig-base.json",
"compilerOptions": {
"module": "commonjs",
"target": "es2017",
"lib": ["es2017"]
}
}

Просмотреть файл

@ -0,0 +1,11 @@
{
"$schema": "http://json.schemastore.org/tsconfig",
"extends": "./tsconfig-base.json",
"compilerOptions": {
"module": "esnext",
"moduleResolution": "node",
"target": "es5",
"lib": ["es5", "scripthost", "es2015.collection", "es2015.promise", "es2015.iterable", "dom"]
}
}

Просмотреть файл

@ -0,0 +1,38 @@
{
"name": "@microsoft/rush-stack-compiler-5.3",
"version": "0.1.0",
"description": "A plug-in for selecting the compiler used with the @microsoft/rush-stack toolchain. This version selects TypeScript 5.3.",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/microsoft/rushstack-legacy/tree/master/stack/rush-stack-compiler-5.3"
},
"bin": {
"rush-api-extractor": "./bin/rush-api-extractor",
"rush-eslint": "./bin/rush-eslint",
"rush-tsc": "./bin/rush-tsc"
},
"scripts": {
"build": "heft build --clean"
},
"main": "lib/index.js",
"typings": "lib/index.d.ts",
"dependencies": {
"@microsoft/api-extractor": "~7.15.2",
"@rushstack/eslint-config": "~2.6.2",
"@rushstack/node-core-library": "~3.53.0",
"@types/node": "10.17.13",
"import-lazy": "~4.0.0",
"typescript": "~5.3.3"
},
"devDependencies": {
"@microsoft/rush-stack-compiler-4.7": "workspace:*",
"@microsoft/rush-stack-compiler-shared": "workspace:*",
"@rushstack/eslint-config": "~2.6.2",
"@rushstack/heft": "0.48.0",
"@rushstack/heft-node-rig": "1.11.0"
},
"peerDependencies": {
"eslint": "^8.57.0"
}
}

Просмотреть файл

@ -0,0 +1,8 @@
{
"extends": "./node_modules/@microsoft/rush-stack-compiler-4.7/includes/tsconfig-node.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "lib"
}
}