Skip to content

Commit

Permalink
refactor: replace deprecated package opn with open
Browse files Browse the repository at this point in the history
  • Loading branch information
Andriy Pyvovarchuk authored and mgechev committed Apr 1, 2019
1 parent 21202f4 commit 8a0fefe
Show file tree
Hide file tree
Showing 5 changed files with 1,035 additions and 1,458 deletions.
6 changes: 3 additions & 3 deletions packages/angular/cli/commands/doc-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Command } from '../models/command';
import { Arguments } from '../models/interface';
import { Schema as DocCommandSchema } from './doc';

const opn = require('opn');
const open = require('open');

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

// We should wrap `opn` in a new Promise because `opn` is already resolved
// We should wrap `open` in a new Promise because `open` is already resolved
await new Promise(() => {
opn(searchUrl, {
open(searchUrl, {
wait: false,
});
});
Expand Down
2 changes: 1 addition & 1 deletion packages/angular/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"ini": "1.3.5",
"inquirer": "6.2.1",
"npm-package-arg": "6.1.0",
"opn": "5.4.0",
"open": "6.0.0",
"pacote": "9.4.0",
"semver": "5.6.0",
"symbol-observable": "1.2.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/angular_devkit/build_angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"mini-css-extract-plugin": "0.5.0",
"minimatch": "3.0.4",
"parse5": "4.0.0",
"opn": "5.4.0",
"open": "6.0.0",
"postcss": "7.0.14",
"postcss-import": "12.0.1",
"postcss-loader": "3.0.0",
Expand Down
8 changes: 4 additions & 4 deletions packages/angular_devkit/build_angular/src/dev-server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { checkPort } from '../angular-cli-files/utilities/check-port';
import { BrowserBuilder, getBrowserLoggingCb } from '../browser';
import { BrowserBuilderSchema, NormalizedBrowserBuilderSchema } from '../browser/schema';
import { normalizeBuilderSchema } from '../utils';
const opn = require('opn');
const open = require('open');


export interface DevServerBuilderOptions extends Pick<BrowserBuilderSchema,
Expand Down Expand Up @@ -65,7 +65,7 @@ export class DevServerBuilder implements Builder<DevServerBuilderOptions> {
const webpackDevServerBuilder = new WebpackDevServerBuilder({ ...this.context, host });
let browserOptions: NormalizedBrowserBuilderSchema;
let first = true;
let opnAddress: string;
let openAddress: string;

return from(checkPort(options.port || 0, options.host || 'localhost', 4200)).pipe(
tap((port) => options.port = port),
Expand Down Expand Up @@ -145,7 +145,7 @@ export class DevServerBuilder implements Builder<DevServerBuilderOptions> {
**
`);

opnAddress = serverAddress + webpackDevServerConfig.publicPath;
openAddress = serverAddress + webpackDevServerConfig.publicPath;
webpackConfig.devServer = webpackDevServerConfig;

return webpackDevServerBuilder.runWebpackDevServer(
Expand All @@ -155,7 +155,7 @@ export class DevServerBuilder implements Builder<DevServerBuilderOptions> {
map(buildEvent => {
if (first && options.open) {
first = false;
opn(opnAddress);
open(openAddress);
}

return buildEvent;
Expand Down
Loading

0 comments on commit 8a0fefe

Please sign in to comment.