-
Notifications
You must be signed in to change notification settings - Fork 653
Use isolated transpilation for local projects. #5202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
d275ca4
e9343b0
84483b6
3dea2ed
35858ac
5cc11d6
4822ed5
d033f3e
025ef9c
b960928
0660d4c
24e869f
6725a74
0280496
27bb6e1
287504c
75e0707
dc24246
71033b9
1c371fa
058984e
580975f
ac30465
39ab90c
2c47b74
6f19abe
aa27f9d
5c4a4f7
83722aa
9a12b06
49659fb
e5fc93f
675592c
1757fd7
85e965a
26b77fa
8a68050
f1ee546
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,4 +33,4 @@ | |
|
|
||
| !/includes/** | ||
| !UPGRADING.md | ||
|
|
||
| lib-*/root-lib/ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| #!/usr/bin/env node | ||
| require('../lib/startWithVersionSelector.js'); | ||
| require('../lib-commonjs/startWithVersionSelector.js'); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| /** | ||
| * Defines configuration used by core Heft. | ||
| */ | ||
| { | ||
| "$schema": "https://developer.microsoft.com/json-schemas/heft/v0/heft.schema.json", | ||
|
|
||
| /** | ||
| * Optionally specifies another JSON config file that this file extends from. This provides a way for standard | ||
| * settings to be shared across multiple projects. | ||
| * | ||
| * To delete an inherited setting, set it to `null` in this file. | ||
| */ | ||
| "extends": "decoupled-local-node-rig/profiles/default/config/heft.json", | ||
|
|
||
| "phasesByName": { | ||
| "build": { | ||
| "tasksByName": { | ||
| "copy-lib-start": { | ||
| "taskDependencies": ["transpile"], | ||
| "taskPlugin": { | ||
| "pluginPackage": "@rushstack/heft", | ||
| "pluginName": "copy-files-plugin", | ||
| "options": { | ||
| "copyOperations": [ | ||
| { | ||
| "sourcePath": "lib-commonjs/root-lib", | ||
| "destinationFolders": ["lib"], | ||
| "fileExtensions": [".js", ".map"] | ||
|
Comment on lines
+26
to
+28
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this some back-compat chicanery? |
||
| } | ||
| ] | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,17 +6,17 @@ | |
| "taskPlugins": [ | ||
| { | ||
| "pluginName": "copy-files-plugin", | ||
| "entryPoint": "./lib/plugins/CopyFilesPlugin", | ||
| "optionsSchema": "./lib/schemas/copy-files-options.schema.json" | ||
| "entryPoint": "./lib-commonjs/plugins/CopyFilesPlugin", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should really add the |
||
| "optionsSchema": "./lib-commonjs/schemas/copy-files-options.schema.json" | ||
| }, | ||
| { | ||
| "pluginName": "delete-files-plugin", | ||
| "entryPoint": "./lib/plugins/DeleteFilesPlugin", | ||
| "optionsSchema": "./lib/schemas/delete-files-options.schema.json" | ||
| "entryPoint": "./lib-commonjs/plugins/DeleteFilesPlugin", | ||
| "optionsSchema": "./lib-commonjs/schemas/delete-files-options.schema.json" | ||
| }, | ||
| { | ||
| "pluginName": "node-service-plugin", | ||
| "entryPoint": "./lib/plugins/NodeServicePlugin", | ||
| "entryPoint": "./lib-commonjs/plugins/NodeServicePlugin", | ||
| "parameterScope": "node-service", | ||
| "parameters": [ | ||
| { | ||
|
|
@@ -28,13 +28,13 @@ | |
| }, | ||
| { | ||
| "pluginName": "run-script-plugin", | ||
| "entryPoint": "./lib/plugins/RunScriptPlugin", | ||
| "optionsSchema": "./lib/schemas/run-script-options.schema.json" | ||
| "entryPoint": "./lib-commonjs/plugins/RunScriptPlugin", | ||
| "optionsSchema": "./lib-commonjs/schemas/run-script-options.schema.json" | ||
| }, | ||
| { | ||
| "entryPoint": "./lib/plugins/SetEnvironmentVariablesPlugin", | ||
| "entryPoint": "./lib-commonjs/plugins/SetEnvironmentVariablesPlugin", | ||
| "pluginName": "set-environment-variables-plugin", | ||
| "optionsSchema": "./lib/schemas/set-environment-variables-plugin.schema.json" | ||
| "optionsSchema": "./lib-commonjs/schemas/set-environment-variables-plugin.schema.json" | ||
| } | ||
| ] | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
| // See LICENSE in the project root for license information. | ||
|
|
||
| // For compatibility globally-installed copies of Heft have the `startWithVersionSelector.js` script that points | ||
| // at 'lib/start.js' | ||
|
|
||
| require('../lib-commonjs/start'); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,7 +20,7 @@ function tryGetPackageFolderFor(resolvedFileOrFolderPath: string): string | unde | |
| // } | ||
|
|
||
| // Is resolvedFileOrFolderPath itself a folder with a package.json file? If so, return it. | ||
| if (fs.existsSync(path.join(resolvedFileOrFolderPath, 'package.json'))) { | ||
| if (fs.existsSync(`${resolvedFileOrFolderPath}/package.json`)) { | ||
| // this._packageFolderCache.set(resolvedFileOrFolderPath, resolvedFileOrFolderPath); | ||
| return resolvedFileOrFolderPath; | ||
| } | ||
|
|
@@ -69,7 +69,7 @@ function tryStartLocalHeft(): boolean { | |
| if (projectFolder) { | ||
| let heftEntryPoint: string; | ||
| try { | ||
| const packageJsonPath: string = path.join(projectFolder, 'package.json'); | ||
| const packageJsonPath: string = `${projectFolder}/package.json`; | ||
| const packageJsonContent: string = fs.readFileSync(packageJsonPath).toString(); | ||
| let packageJson: IPackageJson; | ||
| try { | ||
|
|
@@ -89,9 +89,9 @@ function tryStartLocalHeft(): boolean { | |
|
|
||
| // To avoid a loading the "resolve" NPM package, let's assume that the Heft dependency must be | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Both the CJS and the ESM resolvers that Node uses can be invoked externally without npm packages. |
||
| // installed as "<projectFolder>/node_modules/@rushstack/heft". | ||
| const heftFolder: string = path.join(projectFolder, 'node_modules', Constants.heftPackageName); | ||
| const heftFolder: string = `${projectFolder}/node_modules/${Constants.heftPackageName}`; | ||
|
|
||
| heftEntryPoint = path.join(heftFolder, 'lib', 'start.js'); | ||
| heftEntryPoint = `${heftFolder}/lib-commonjs/start.js`; | ||
| if (!fs.existsSync(heftEntryPoint)) { | ||
| throw new Error('Unable to find Heft entry point: ' + heftEntryPoint); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file accepts comments, so put a file about what the heck this pattern is matching