-
Notifications
You must be signed in to change notification settings - Fork 631
[rush] rush-sdk try to load from global folder before install-and-run rush #3878
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
Merged
octogonz
merged 16 commits into
microsoft:main
from
chengcyber:feat-rush-sdk-load-from-global-folder
Jun 29, 2024
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
a9d4568
feat: load rush-lib from rush global folder
chengcyber 64a0288
chore: rush change
chengcyber c916052
Apply suggestions from code review
chengcyber 85016a2
chore: changes according to code review
chengcyber bfb61b9
Merge remote-tracking branch 'origin/main' into feat-rush-sdk-load-fr…
chengcyber dd7c635
chore: update
chengcyber 71c1ae2
fix: fallback to use commonjs
chengcyber b79e3c6
fix: rush-sdk deep import type
chengcyber 99ff29b
chore: rush change
chengcyber b19fb2f
chore: merge main branch
chengcyber 41f5882
Merge remote-tracking branch 'origin/main' into feat-rush-sdk-load-fr…
chengcyber f03c880
Merge remote-tracking branch 'origin/main' into feat-rush-sdk-load-fr…
chengcyber c5f0bd4
chore: merge main
chengcyber a521076
Merge remote-tracking branch 'remotes/origin/main' into feat-rush-sdk…
octogonz 87523b8
prepare to release a MINOR version of Rush
octogonz 1de1d12
rush update
octogonz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
common/changes/@microsoft/rush/feat-rush-sdk-load-from-global-folder_2024-06-08-08-34.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"changes": [ | ||
{ | ||
"packageName": "@microsoft/rush", | ||
"comment": "Improve `@rushtack/rush-sdk` and make it reuse `@microsoft/rush-lib` from rush global folder", | ||
"type": "none" | ||
} | ||
], | ||
"packageName": "@microsoft/rush" | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"$schema": "https://developer.microsoft.com/json-schemas/heft/v0/typescript.schema.json", | ||
|
||
"extends": "local-node-rig/profiles/default/config/typescript.json", | ||
|
||
"additionalModuleKindsToEmit": [ | ||
{ | ||
"moduleKind": "esnext", | ||
"outFolderName": "lib-esnext" | ||
} | ||
] | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* eslint-env es6 */ | ||
octogonz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
'use strict'; | ||
|
||
const webpack = require('webpack'); | ||
const { PackageJsonLookup } = require('@rushstack/node-core-library'); | ||
const { PreserveDynamicRequireWebpackPlugin } = require('@rushstack/webpack-preserve-dynamic-require-plugin'); | ||
|
||
module.exports = () => { | ||
const packageJson = PackageJsonLookup.loadOwnPackageJson(__dirname); | ||
|
||
const externalDependencyNames = new Set([...Object.keys(packageJson.dependencies || {})]); | ||
|
||
// Explicitly exclude @microsoft/rush-lib | ||
externalDependencyNames.delete('@microsoft/rush-lib'); | ||
|
||
return { | ||
context: __dirname, | ||
mode: 'development', // So the output isn't minified | ||
devtool: 'source-map', | ||
entry: { | ||
index: `${__dirname}/lib-commonjs/index.js`, | ||
loader: `${__dirname}/lib-commonjs/loader.js` | ||
}, | ||
output: { | ||
path: `${__dirname}/lib-shim`, | ||
filename: '[name].js', | ||
chunkFilename: 'chunks/[name].js', | ||
library: { | ||
type: 'commonjs2' | ||
} | ||
}, | ||
target: 'node', | ||
plugins: [new PreserveDynamicRequireWebpackPlugin()], | ||
externals: [ | ||
({ request }, callback) => { | ||
chengcyber marked this conversation as resolved.
Show resolved
Hide resolved
|
||
let packageName; | ||
let firstSlashIndex = request.indexOf('/'); | ||
if (firstSlashIndex === -1) { | ||
packageName = request; | ||
} else if (request.startsWith('@')) { | ||
let secondSlash = request.indexOf('/', firstSlashIndex + 1); | ||
if (secondSlash === -1) { | ||
packageName = request; | ||
} else { | ||
packageName = request.substring(0, secondSlash); | ||
} | ||
} else { | ||
packageName = request.substring(0, firstSlashIndex); | ||
} | ||
|
||
if (externalDependencyNames.has(packageName)) { | ||
callback(null, `commonjs ${request}`); | ||
} else { | ||
callback(); | ||
} | ||
} | ||
], | ||
optimization: { | ||
splitChunks: { | ||
chunks: 'all', | ||
minChunks: 1, | ||
cacheGroups: { | ||
commons: { | ||
name: 'commons', | ||
chunks: 'initial' | ||
} | ||
} | ||
} | ||
} | ||
}; | ||
}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.