Skip to content

Commit 50cce66

Browse files
Andriy Pyvovarchukmgechev
Andriy Pyvovarchuk
authored andcommitted
refactor: replace deprecated package opn with open
1 parent 3d86b18 commit 50cce66

File tree

5 files changed

+18
-11
lines changed

5 files changed

+18
-11
lines changed

packages/angular/cli/commands/doc-impl.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { Command } from '../models/command';
1010
import { Arguments } from '../models/interface';
1111
import { Schema as DocCommandSchema } from './doc';
1212

13-
const opn = require('opn');
13+
const open = require('open');
1414

1515
export class DocCommand extends Command<DocCommandSchema> {
1616
public async run(options: DocCommandSchema & Arguments) {
@@ -24,9 +24,9 @@ export class DocCommand extends Command<DocCommandSchema> {
2424
searchUrl = `https://www.google.com/search?q=site%3Aangular.io+${options.keyword}`;
2525
}
2626

27-
// We should wrap `opn` in a new Promise because `opn` is already resolved
27+
// We should wrap `open` in a new Promise because `open` is already resolved
2828
await new Promise(() => {
29-
opn(searchUrl, {
29+
open(searchUrl, {
3030
wait: false,
3131
});
3232
});

packages/angular/cli/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"ini": "1.3.5",
3636
"inquirer": "6.2.2",
3737
"npm-package-arg": "6.1.0",
38-
"opn": "5.4.0",
38+
"open": "6.0.0",
3939
"pacote": "9.5.0",
4040
"semver": "6.0.0",
4141
"symbol-observable": "1.2.0",

packages/angular_devkit/build_angular/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"mini-css-extract-plugin": "0.5.0",
2929
"minimatch": "3.0.4",
3030
"parse5": "4.0.0",
31-
"opn": "5.4.0",
31+
"open": "6.0.0",
3232
"postcss": "7.0.14",
3333
"postcss-import": "12.0.1",
3434
"postcss-loader": "3.0.0",

packages/angular_devkit/build_angular/src/dev-server/index.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import {
3434
import { Schema as BrowserBuilderSchema } from '../browser/schema';
3535
import { normalizeOptimization } from '../utils';
3636
import { Schema } from './schema';
37-
const opn = require('opn');
37+
const open = require('open');
3838

3939
export type DevServerBuilderSchema = Schema & json.JsonObject;
4040

@@ -83,7 +83,7 @@ export function serveWebpackBrowser(
8383
const browserTarget = targetFromTargetString(options.browserTarget);
8484
const root = context.workspaceRoot;
8585
let first = true;
86-
let opnAddress: string;
86+
let openAddress: string;
8787
const host = new NodeJsSyncHost();
8888

8989
const loggingFn = transforms.logging
@@ -202,18 +202,18 @@ export function serveWebpackBrowser(
202202
**
203203
`);
204204

205-
opnAddress = serverAddress + webpackDevServerConfig.publicPath;
205+
openAddress = serverAddress + webpackDevServerConfig.publicPath;
206206
webpackConfig.devServer = webpackDevServerConfig;
207207

208208
return runWebpackDevServer(webpackConfig, context, { logging: loggingFn });
209209
}),
210210
map(buildEvent => {
211211
if (first && options.open) {
212212
first = false;
213-
opn(opnAddress);
213+
open(openAddress);
214214
}
215215

216-
return { ...buildEvent, baseUrl: opnAddress } as DevServerBuilderOutput;
216+
return { ...buildEvent, baseUrl: openAddress } as DevServerBuilderOutput;
217217
}),
218218
);
219219
}

yarn.lock

+8-1
Original file line numberDiff line numberDiff line change
@@ -6587,12 +6587,19 @@ onetime@^2.0.0:
65876587
dependencies:
65886588
mimic-fn "^1.0.0"
65896589

6590+
open@6.0.0:
6591+
version "6.0.0"
6592+
resolved "https://registry.yarnpkg.com/open/-/open-6.0.0.tgz#cae5e2c1a3a1bfaee0d0acc8c4b7609374750346"
6593+
integrity sha512-/yb5mVZBz7mHLySMiSj2DcLtMBbFPJk5JBKEkHVZFxZAPzeg3L026O0T+lbdz1B2nyDnkClRSwRQJdeVUIF7zw==
6594+
dependencies:
6595+
is-wsl "^1.1.0"
6596+
65906597
opencollective-postinstall@^2.0.1:
65916598
version "2.0.2"
65926599
resolved "https://registry.yarnpkg.com/opencollective-postinstall/-/opencollective-postinstall-2.0.2.tgz#5657f1bede69b6e33a45939b061eb53d3c6c3a89"
65936600
integrity sha512-pVOEP16TrAO2/fjej1IdOyupJY8KDUM1CvsaScRbw6oddvpQoOfGk4ywha0HKKVAD6RkW4x6Q+tNBwhf3Bgpuw==
65946601

6595-
opn@5.4.0, opn@^5.1.0:
6602+
opn@^5.1.0:
65966603
version "5.4.0"
65976604
resolved "https://registry.yarnpkg.com/opn/-/opn-5.4.0.tgz#cb545e7aab78562beb11aa3bfabc7042e1761035"
65986605
integrity sha512-YF9MNdVy/0qvJvDtunAOzFw9iasOQHpVthTCvGzxt61Il64AYSGdK+rYwld7NAfk9qJ7dt+hymBNSc9LNYS+Sw==

0 commit comments

Comments
 (0)