Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: replace update-notifier with simple-update-notifier #20266

Merged
merged 1 commit into from Dec 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 2 additions & 4 deletions code/lib/cli/package.json
Expand Up @@ -71,9 +71,9 @@
"read-pkg-up": "^7.0.1",
"semver": "^7.3.7",
"shelljs": "^0.8.5",
"simple-update-notifier": "^1.0.0",
"strip-json-comments": "^3.0.1",
"ts-dedent": "^2.0.0",
"update-notifier": "^6.0.2",
"util-deprecate": "^1.0.2"
},
"devDependencies": {
Expand All @@ -83,11 +83,9 @@
"@types/puppeteer-core": "^2.1.0",
"@types/semver": "^7.3.4",
"@types/shelljs": "^0.8.7",
"@types/update-notifier": "^6.0.1",
"@types/util-deprecate": "^1.0.0",
"strip-json-comments": "^3.1.1",
"typescript": "~4.9.3",
"update-notifier": "^6.0.2"
"typescript": "~4.9.3"
},
"publishConfig": {
"access": "public"
Expand Down
14 changes: 7 additions & 7 deletions code/lib/cli/src/initiate.ts
@@ -1,4 +1,4 @@
import type { Package } from 'update-notifier';
import type { PackageJson } from 'read-pkg-up';
import chalk from 'chalk';
import prompts from 'prompts';
import { telemetry } from '@storybook/telemetry';
Expand Down Expand Up @@ -265,7 +265,7 @@ const projectTypeInquirer = async (
return Promise.resolve();
};

async function doInitiate(options: CommandOptions, pkg: Package): Promise<void> {
async function doInitiate(options: CommandOptions, pkg: PackageJson): Promise<void> {
const { useNpm, packageManager: pkgMgr } = options;
if (useNpm) {
useNpmWarning();
Expand All @@ -275,11 +275,11 @@ async function doInitiate(options: CommandOptions, pkg: Package): Promise<void>
logger.log(chalk.inverse(`\n ${welcomeMessage} \n`));

// Update notify code.
const { default: updateNotifier } = await import('update-notifier');
updateNotifier({
pkg,
const { default: updateNotifier } = await import('simple-update-notifier');
await updateNotifier({
pkg: pkg as any,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updateCheckInterval: 1000 * 60 * 60, // every hour (we could increase this later on.)
}).notify();
});

let projectType;
const projectTypeProvided = options.type;
Expand Down Expand Up @@ -349,6 +349,6 @@ async function doInitiate(options: CommandOptions, pkg: Package): Promise<void>
logger.log();
}

export async function initiate(options: CommandOptions, pkg: Package): Promise<void> {
export async function initiate(options: CommandOptions, pkg: PackageJson): Promise<void> {
await withTelemetry('init', { cliOptions: options }, () => doInitiate(options, pkg));
}