Skip to content

Commit

Permalink
Merge branch 'next' into fix-copy-function
Browse files Browse the repository at this point in the history
  • Loading branch information
ndelangen committed Aug 22, 2022
2 parents 3848377 + 9bd3bbf commit 35520d7
Show file tree
Hide file tree
Showing 18 changed files with 42 additions and 197 deletions.
20 changes: 10 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,13 @@ jobs:
name: running local registry
command: |
cd code
yarn local-registry --port 6000 --open
yarn local-registry --port 6001 --open
background: true
- run:
name: Wait for registry
command: |
cd code
yarn wait-on http://localhost:6000
yarn wait-on http://localhost:6001
- run:
name: Run E2E (extended) tests
command: |
Expand All @@ -225,13 +225,13 @@ jobs:
name: Running local registry
command: |
cd code
yarn local-registry --port 6000 --open
yarn local-registry --port 6001 --open
background: true
- run:
name: Wait for registry
command: |
cd code
yarn wait-on http://localhost:6000
yarn wait-on http://localhost:6001
- run:
name: Run E2E (core) tests
# Do not test CRA here because it's done in PnP part
Expand Down Expand Up @@ -265,11 +265,11 @@ jobs:
# at: .
# - run:
# name: Running local registry
# command: yarn local-registry --port 6000 --open
# command: yarn local-registry --port 6001 --open
# background: true
# - run:
# name: Wait for registry
# command: yarn wait-on http://localhost:6000
# command: yarn wait-on http://localhost:6001
# - run:
# name: Run smoke tests
# command: yarn test:e2e-framework angular_modern_inline_rendering --test-runner --docs-mode
Expand All @@ -293,13 +293,13 @@ jobs:
name: Running local registry
command: |
cd code
yarn local-registry --port 6000 --open
yarn local-registry --port 6001 --open
background: true
- run:
name: Wait for registry
command: |
cd code
yarn wait-on http://localhost:6000
yarn wait-on http://localhost:6001
- run:
name: set up cra repro, skip tests
command: |
Expand All @@ -324,13 +324,13 @@ jobs:
name: Running local registry
command: |
cd code
yarn local-registry --port 6000 --open
yarn local-registry --port 6001 --open
background: true
- run:
name: Wait for registry
command: |
cd code
yarn wait-on http://localhost:6000
yarn wait-on http://localhost:6001
- run:
name: run e2e tests cra
command: |
Expand Down
15 changes: 13 additions & 2 deletions code/lib/cli/src/js-package-manager/JsPackageManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,20 @@ export abstract class JsPackageManager {

public abstract getRunCommand(command: string): string;

public abstract setRegistryURL(url: string): void;
// NOTE: for some reason yarn prefers the npm registry in
// local development, so always use npm
setRegistryURL(url: string) {
if (url) {
this.executeCommand('npm', ['config', 'set', 'registry', url]);
} else {
this.executeCommand('npm', ['config', 'delete', 'registry']);
}
}

public abstract getRegistryURL(): string;
getRegistryURL() {
const url = this.executeCommand('npm', ['config', 'get', 'registry']).trim();
return url === 'undefined' ? undefined : url;
}

public readonly cwd?: string;

Expand Down
13 changes: 0 additions & 13 deletions code/lib/cli/src/js-package-manager/NPMProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,6 @@ export class NPMProxy extends JsPackageManager {
return this.uninstallArgs;
}

setRegistryURL(url: string) {
if (url) {
this.executeCommand('npm', ['config', 'set', 'registry', url]);
} else {
this.executeCommand('npm', ['config', 'delete', 'registry']);
}
}

getRegistryURL() {
const url = this.executeCommand('npm', ['config', 'get', 'registry']).trim();
return url === 'undefined' ? undefined : url;
}

protected getResolutions(packageJson: PackageJson, versions: Record<string, string>) {
return {
overrides: {
Expand Down
4 changes: 2 additions & 2 deletions code/lib/cli/src/js-package-manager/Yarn1Proxy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ describe('Yarn 1 Proxy', () => {

yarn1Proxy.setRegistryURL('https://foo.bar');

expect(executeCommandSpy).toHaveBeenCalledWith('yarn', [
expect(executeCommandSpy).toHaveBeenCalledWith('npm', [
'config',
'set',
'npmRegistryServer',
'registry',
'https://foo.bar',
]);
});
Expand Down
13 changes: 0 additions & 13 deletions code/lib/cli/src/js-package-manager/Yarn1Proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,6 @@ export class Yarn1Proxy extends JsPackageManager {
return `yarn ${command}`;
}

setRegistryURL(url: string) {
if (url) {
this.executeCommand('yarn', ['config', 'set', 'npmRegistryServer', url]);
} else {
this.executeCommand('yarn', ['config', 'delete', 'npmRegistryServer']);
}
}

getRegistryURL() {
const url = this.executeCommand('yarn', ['config', 'get', 'npmRegistryServer']).trim();
return url === 'undefined' ? undefined : url;
}

protected getResolutions(packageJson: PackageJson, versions: Record<string, string>) {
return {
resolutions: {
Expand Down
4 changes: 2 additions & 2 deletions code/lib/cli/src/js-package-manager/Yarn2Proxy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ describe('Yarn 2 Proxy', () => {

yarn2Proxy.setRegistryURL('https://foo.bar');

expect(executeCommandSpy).toHaveBeenCalledWith('yarn', [
expect(executeCommandSpy).toHaveBeenCalledWith('npm', [
'config',
'set',
'npmRegistryServer',
'registry',
'https://foo.bar',
]);
});
Expand Down
13 changes: 0 additions & 13 deletions code/lib/cli/src/js-package-manager/Yarn2Proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,6 @@ export class Yarn2Proxy extends JsPackageManager {
return `yarn ${command}`;
}

setRegistryURL(url: string) {
if (url) {
this.executeCommand('yarn', ['config', 'set', 'npmRegistryServer', url]);
} else {
this.executeCommand('yarn', ['config', 'delete', 'npmRegistryServer']);
}
}

getRegistryURL() {
const url = this.executeCommand('yarn', ['config', 'get', 'npmRegistryServer']).trim();
return url === 'undefined' ? undefined : url;
}

protected getResolutions(packageJson: PackageJson, versions: Record<string, string>) {
return {
resolutions: {
Expand Down
2 changes: 1 addition & 1 deletion code/lib/cli/src/repro-generators/scripts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ const installYarn2 = async ({ cwd, pnp, name }: Options) => {
const configureYarn2ForE2E = async ({ cwd }: Options) => {
const command = [
// ⚠️ Need to set registry because Yarn 2 is not using the conf of Yarn 1 (URL is hardcoded in CircleCI config.yml)
`yarn config set npmScopes --json '{ "storybook": { "npmRegistryServer": "http://localhost:6000/" } }'`,
`yarn config set npmScopes --json '{ "storybook": { "npmRegistryServer": "http://localhost:6001/" } }'`,
// Some required magic to be able to fetch deps from local registry
`yarn config set unsafeHttpWhitelist --json '["localhost"]'`,
// Disable fallback mode to make sure everything is required correctly
Expand Down
4 changes: 1 addition & 3 deletions code/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
"changelog": "pr-log --sloppy --cherry-pick",
"changelog:next": "pr-log --sloppy --since-prerelease",
"check": "NODE_ENV=production node ../scripts/check-package.js",
"clean:dist": "del **/dist",
"coverage": "codecov",
"create-built-sandboxes-index": "ts-node ../scripts/create-built-sandboxes-index",
"danger": "danger",
Expand All @@ -75,7 +74,7 @@
"lint:md": "remark -q .",
"lint:other": "prettier --write '**/*.{css,html,json,md,yml}'",
"lint:package": "sort-package-json",
"local-registry": "ts-node --project=../scripts/tsconfig.json ../scripts/run-registry.ts --port 6000",
"local-registry": "ts-node --project=../scripts/tsconfig.json ../scripts/run-registry.ts --port 6001",
"publish-repros": "ts-node ../scripts/next-repro-generators/publish.ts",
"publish:debug": "npm run publish:latest -- --npm-tag=debug --no-push",
"publish:latest": "lerna publish --exact --concurrency 1 --force-publish",
Expand Down Expand Up @@ -276,7 +275,6 @@
"core-js": "^3.21.1",
"cross-env": "^7.0.3",
"danger": "^10.6.2",
"del-cli": "^4.0.1",
"detect-port": "^1.3.0",
"dts-bundle-generator": "^6.2.0",
"ejs-lint": "^1.2.2",
Expand Down
Loading

0 comments on commit 35520d7

Please sign in to comment.