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 3d86b18 commit 50cce66
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 11 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.2",
"npm-package-arg": "6.1.0",
"opn": "5.4.0",
"open": "6.0.0",
"pacote": "9.5.0",
"semver": "6.0.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 @@ -28,7 +28,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
10 changes: 5 additions & 5 deletions packages/angular_devkit/build_angular/src/dev-server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import {
import { Schema as BrowserBuilderSchema } from '../browser/schema';
import { normalizeOptimization } from '../utils';
import { Schema } from './schema';
const opn = require('opn');
const open = require('open');

export type DevServerBuilderSchema = Schema & json.JsonObject;

Expand Down Expand Up @@ -83,7 +83,7 @@ export function serveWebpackBrowser(
const browserTarget = targetFromTargetString(options.browserTarget);
const root = context.workspaceRoot;
let first = true;
let opnAddress: string;
let openAddress: string;
const host = new NodeJsSyncHost();

const loggingFn = transforms.logging
Expand Down Expand Up @@ -202,18 +202,18 @@ export function serveWebpackBrowser(
**
`);

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

return runWebpackDevServer(webpackConfig, context, { logging: loggingFn });
}),
map(buildEvent => {
if (first && options.open) {
first = false;
opn(opnAddress);
open(openAddress);
}

return { ...buildEvent, baseUrl: opnAddress } as DevServerBuilderOutput;
return { ...buildEvent, baseUrl: openAddress } as DevServerBuilderOutput;
}),
);
}
Expand Down
9 changes: 8 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6587,12 +6587,19 @@ onetime@^2.0.0:
dependencies:
mimic-fn "^1.0.0"

[email protected]:
version "6.0.0"
resolved "https://registry.yarnpkg.com/open/-/open-6.0.0.tgz#cae5e2c1a3a1bfaee0d0acc8c4b7609374750346"
integrity sha512-/yb5mVZBz7mHLySMiSj2DcLtMBbFPJk5JBKEkHVZFxZAPzeg3L026O0T+lbdz1B2nyDnkClRSwRQJdeVUIF7zw==
dependencies:
is-wsl "^1.1.0"

opencollective-postinstall@^2.0.1:
version "2.0.2"
resolved "https://registry.yarnpkg.com/opencollective-postinstall/-/opencollective-postinstall-2.0.2.tgz#5657f1bede69b6e33a45939b061eb53d3c6c3a89"
integrity sha512-pVOEP16TrAO2/fjej1IdOyupJY8KDUM1CvsaScRbw6oddvpQoOfGk4ywha0HKKVAD6RkW4x6Q+tNBwhf3Bgpuw==

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

0 comments on commit 50cce66

Please sign in to comment.