Skip to content

Commit

Permalink
Auto-merge with master
Browse files Browse the repository at this point in the history
  • Loading branch information
yarnbot committed Aug 20, 2021
2 parents 7698499 + 2036672 commit a72fade
Show file tree
Hide file tree
Showing 15 changed files with 321 additions and 146 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/e2e-gulp-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
on:
schedule:
- cron: '0 */4 * * *'
push:
branches:
- master
pull_request:
paths:
- .github/workflows/e2e-gulp-workflow.yml
- scripts/e2e-setup-ci.sh

name: 'E2E Gulp'
jobs:
chore:
name: 'Validating Gulp'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@master

- name: 'Install Node'
uses: actions/setup-node@master
with:
node-version: 14.x

- name: 'Build the standard bundle'
run: |
node ./scripts/run-yarn.js build:cli
- name: 'Run Gulp E2E test'
run: |
source scripts/e2e-setup-ci.sh
yarn init -p
yarn add -D gulp
# Test running Gulp with a simple default task.
echo "const gulp = require('gulp'); const defaultTaskPrintCheck = (cb) => { console.log('Success: ran gulp task'); cb(); }; exports.default = defaultTaskPrintCheck;" | tee gulpfile.js
yarn gulp
# Test using the Gulp API and run public task via CLI.
echo "const gulp = require('gulp'); const testGulpAPI = (cb) => { const scriptFile = gulp.src('./gulpfile.js'); if (scriptFile) { console.log('Success: used gulp API import.'); } cb(); }; exports.testGulpAPI = testGulpAPI;" | tee gulpfile.js
yarn gulp testGulpAPI
2 changes: 1 addition & 1 deletion .github/workflows/integration-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:

- name: 'Check that the PnP hook is consistent with a fresh build (fix w/ "git merge master && yarn update:pnp:hook")'
run: |
if [[ $(git diff --name-only "$(git merge-base origin/"$TARGET_BRANCH" HEAD)" HEAD -- packages/yarnpkg-pnp/sources/hook.js | wc -l) -gt 0 ]]; then
if [[ $(git diff --name-only "$(git merge-base origin/"$TARGET_BRANCH" HEAD)" HEAD -- 'packages/yarnpkg-{fslib,libzip,pnp}/sources/**/*' | wc -l) -gt 0 ]]; then
node ./scripts/run-yarn.js build:pnp:hook
[[ $(git diff --name-only packages/yarnpkg-pnp/sources/hook.js | wc -l) -eq 0 ]]
fi
Expand Down
265 changes: 137 additions & 128 deletions .pnp.cjs

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions .yarn/versions/1aea82c9.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
releases:
"@yarnpkg/cli": patch
"@yarnpkg/nm": patch
"@yarnpkg/plugin-nm": patch
"@yarnpkg/pnpify": patch

declined:
- "@yarnpkg/plugin-compat"
- "@yarnpkg/plugin-constraints"
- "@yarnpkg/plugin-dlx"
- "@yarnpkg/plugin-essentials"
- "@yarnpkg/plugin-init"
- "@yarnpkg/plugin-interactive-tools"
- "@yarnpkg/plugin-npm-cli"
- "@yarnpkg/plugin-pack"
- "@yarnpkg/plugin-patch"
- "@yarnpkg/plugin-pnp"
- "@yarnpkg/plugin-stage"
- "@yarnpkg/plugin-typescript"
- "@yarnpkg/plugin-version"
- "@yarnpkg/plugin-workspace-tools"
- vscode-zipfs
- "@yarnpkg/builder"
- "@yarnpkg/core"
- "@yarnpkg/doctor"
23 changes: 23 additions & 0 deletions .yarn/versions/3f3739b9.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
releases:
"@yarnpkg/cli": patch
"@yarnpkg/shell": patch

declined:
- "@yarnpkg/plugin-compat"
- "@yarnpkg/plugin-constraints"
- "@yarnpkg/plugin-dlx"
- "@yarnpkg/plugin-essentials"
- "@yarnpkg/plugin-init"
- "@yarnpkg/plugin-interactive-tools"
- "@yarnpkg/plugin-nm"
- "@yarnpkg/plugin-npm-cli"
- "@yarnpkg/plugin-pack"
- "@yarnpkg/plugin-patch"
- "@yarnpkg/plugin-pnp"
- "@yarnpkg/plugin-stage"
- "@yarnpkg/plugin-typescript"
- "@yarnpkg/plugin-version"
- "@yarnpkg/plugin-workspace-tools"
- "@yarnpkg/builder"
- "@yarnpkg/core"
- "@yarnpkg/doctor"
27 changes: 27 additions & 0 deletions .yarn/versions/5691ad6e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
releases:
"@yarnpkg/cli": patch
"@yarnpkg/plugin-pnp": patch
"@yarnpkg/pnp": patch

declined:
- "@yarnpkg/esbuild-plugin-pnp"
- "@yarnpkg/plugin-compat"
- "@yarnpkg/plugin-constraints"
- "@yarnpkg/plugin-dlx"
- "@yarnpkg/plugin-essentials"
- "@yarnpkg/plugin-init"
- "@yarnpkg/plugin-interactive-tools"
- "@yarnpkg/plugin-nm"
- "@yarnpkg/plugin-npm-cli"
- "@yarnpkg/plugin-pack"
- "@yarnpkg/plugin-patch"
- "@yarnpkg/plugin-stage"
- "@yarnpkg/plugin-typescript"
- "@yarnpkg/plugin-version"
- "@yarnpkg/plugin-workspace-tools"
- "@yarnpkg/builder"
- "@yarnpkg/core"
- "@yarnpkg/doctor"
- "@yarnpkg/nm"
- "@yarnpkg/pnpify"
- "@yarnpkg/sdks"
2 changes: 2 additions & 0 deletions .yarn/versions/dd3c6000.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
releases:
"@yarnpkg/plugin-version": patch
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Yarn now accepts sponsorships! Please give a look at our [OpenCollective](https:

- Direct portal dependencies for `node_modules` install are given priority during hoisting now, to prevent cases when indirect regular dependencies take place in the install tree first and block the way for direct portal dependencies.
- Usage of `pnpify` inside directories containing spaces is now possible.
- Hoisting algorithm speedup, impacts recurrent `node_modules` installs time.

### Installs

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ On top of our classic integration tests, we also run Yarn every day against the
[![](https://github.com/yarnpkg/berry/workflows/E2E%20Angular%20over%20PnPify/badge.svg?event=schedule)](https://github.com/yarnpkg/berry/blob/master/.github/workflows/e2e-pnpify-workflow.yml)<br/>
[![](https://github.com/yarnpkg/berry/workflows/E2E%20CRA/badge.svg?event=schedule)](https://github.com/yarnpkg/berry/blob/master/.github/workflows/e2e-cra-workflow.yml)<br/>
[![](https://github.com/yarnpkg/berry/workflows/E2E%20Gatsby/badge.svg?event=schedule)](https://github.com/yarnpkg/berry/blob/master/.github/workflows/e2e-gatsby-workflow.yml)<br/>
[![](https://github.com/yarnpkg/berry/workflows/E2E%20Gulp/badge.svg?event=schedule)](https://github.com/yarnpkg/berry/blob/master/.github/workflows/e2e-gulp-workflow.yml)<br/>
[![](https://github.com/yarnpkg/berry/workflows/E2E%20Next/badge.svg?event=schedule)](https://github.com/yarnpkg/berry/blob/master/.github/workflows/e2e-next-workflow.yml)<br/>
[![](https://github.com/yarnpkg/berry/workflows/E2E%20Preact%20CLI/badge.svg?event=schedule)](https://github.com/yarnpkg/berry/blob/master/.github/workflows/e2e-preact-cli-workflow.yml)<br/>
[![](https://github.com/yarnpkg/berry/workflows/E2E%20Vue-CLI/badge.svg?event=schedule)](https://github.com/yarnpkg/berry/blob/master/.github/workflows/e2e-vue-cli-workflow.yml)<br/>
Expand Down
1 change: 1 addition & 0 deletions packages/gatsby/content/features/plugnplay.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ Many common frontend tools now support Plug'n'Play natively!
| Create-React-App | Starting from 2.0+ |
| ESLint | Some compatibility issues w/ shared configs |
| Gatsby | Supported with version ≥2.15.0, ≥3.7.0 |
| Gulp | Supported with version 4.0+ |
| Husky | Starting from 4.0.0-1+ |
| Jest | Starting from 24.1+ |
| Next.js | Starting from 9.1.2+ |
Expand Down
7 changes: 4 additions & 3 deletions packages/plugin-version/sources/commands/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,9 @@ export default class VersionCommand extends BaseCommand {
versionFile.releases.set(workspace, releaseStrategy as any);
await versionFile.saveAll();

if (!deferred) {
await this.cli.run([`version`, `apply`]);
}
if (!deferred)
return await this.cli.run([`version`, `apply`]);

return 0;
}
}
14 changes: 6 additions & 8 deletions packages/yarnpkg-nm/sources/hoist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,6 @@ const getUsedDependencies = (rootNodePath: Array<HoisterWorkTree>): Map<PackageN
const rootNode = rootNodePath[rootNodePath.length - 1];
const usedDependencies = new Map();
const seenNodes = new Set<HoisterWorkTree>();
const reachableDependencies = new Map<PackageName, HoisterWorkTree>();

for (const node of rootNodePath)
for (const dep of node.dependencies.values())
reachableDependencies.set(dep.name, dep);

const hiddenDependencies = new Set<PackageName>();
const addUsedDependencies = (node: HoisterWorkTree, hiddenDependencies: Set<PackageName>) => {
Expand All @@ -196,9 +191,12 @@ const getUsedDependencies = (rootNodePath: Array<HoisterWorkTree>): Map<PackageN

for (const dep of node.hoistedDependencies.values()) {
if (!hiddenDependencies.has(dep.name)) {
const reachableDependency = reachableDependencies.get(dep.name);
if (reachableDependency) {
usedDependencies.set(reachableDependency.name, reachableDependency);
let reachableDependency;
for (const node of rootNodePath) {
reachableDependency = node.dependencies.get(dep.name);
if (reachableDependency) {
usedDependencies.set(reachableDependency.name, reachableDependency);
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/yarnpkg-pnp/sources/hook.js

Large diffs are not rendered by default.

22 changes: 17 additions & 5 deletions packages/yarnpkg-shell/sources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -430,25 +430,37 @@ async function evaluateVariable(segment: ArgumentSegment & {type: `variable`}, o
default: {
const argIndex = parseInt(segment.name, 10);

let raw;
if (Number.isFinite(argIndex)) {
if (argIndex >= 0 && argIndex < opts.args.length) {
push(opts.args[argIndex]);
raw = opts.args[argIndex];
} else if (segment.defaultValue) {
push((await interpolateArguments(segment.defaultValue, opts, state)).join(` `));
raw = (await interpolateArguments(segment.defaultValue, opts, state)).join(` `);
} else {
throw new ShellError(`Unbound argument #${argIndex}`);
}
} else {
if (Object.prototype.hasOwnProperty.call(state.variables, segment.name)) {
push(state.variables[segment.name]);
raw = state.variables[segment.name];
} else if (Object.prototype.hasOwnProperty.call(state.environment, segment.name)) {
push(state.environment[segment.name]);
raw = state.environment[segment.name];
} else if (segment.defaultValue) {
push((await interpolateArguments(segment.defaultValue, opts, state)).join(` `));
raw = (await interpolateArguments(segment.defaultValue, opts, state)).join(` `);
} else {
throw new ShellError(`Unbound variable "${segment.name}"`);
}
}

if (segment.quoted) {
push(raw);
} else {
const parts = split(raw);

for (let t = 0; t < parts.length - 1; ++t)
pushAndClose(parts[t]);

push(parts[parts.length - 1]);
}
} break;
}
}
Expand Down
33 changes: 33 additions & 0 deletions packages/yarnpkg-shell/tests/shell.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ const bufferResult = async (command: string, args: Array<string> = [], options:
});
},

[`echo-arguments`]: async (args, opts, state) => {
return await new Promise(resolve => {
for (const arg of args)
state.stdout.write(`${JSON.stringify(arg)}\n`);

resolve(0);
});
},

[`echo-stdin`]: async (args, opts, state) => {
const stdinChunks: Array<Buffer> = [];

Expand Down Expand Up @@ -491,6 +500,30 @@ describe(`Shell`, () => {
expect(numbers.length).toBe(1);
numbers.forEach(validateRandomNumber);
});

it(`should split variables when referenced outside of quotes`, async () => {
await expect(bufferResult(
`FOO="hello world"; echo-arguments $FOO`
)).resolves.toMatchObject({
stdout: `"hello"\n"world"\n`,
});
});

it(`should keep variables unified when referenced within double quotes`, async () => {
await expect(bufferResult(
`FOO="hello world"; echo-arguments "$FOO"`
)).resolves.toMatchObject({
stdout: `"hello world"\n`,
});
});

it(`should ignore variables when referenced within single quotes`, async () => {
await expect(bufferResult(
`FOO="hello world"; echo-arguments '$FOO'`
)).resolves.toMatchObject({
stdout: `"$FOO"\n`,
});
});
});

describe(`Setting variables`, () => {
Expand Down

0 comments on commit a72fade

Please sign in to comment.