https://github.com/ruochuan12/update-notifier-analysis
update-notifier-analysis
https://github.com/ruochuan12/update-notifier-analysis
Last synced: 7 months ago
JSON representation
update-notifier-analysis
- Host: GitHub
- URL: https://github.com/ruochuan12/update-notifier-analysis
- Owner: ruochuan12
- Created: 2021-09-12T16:17:34.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2021-09-16T11:46:16.000Z (about 4 years ago)
- Last Synced: 2025-01-18T10:11:41.866Z (9 months ago)
- Language: JavaScript
- Size: 184 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# update-notifier-analysis
update-notifier-analysis
## 前言
## 环境准备
## 源码
```js
'use strict';
const {spawn} = require('child_process');
const path = require('path');
const {format} = require('util');
const importLazy = require('import-lazy')(require);const configstore = importLazy('configstore');
const chalk = importLazy('chalk');
const semver = importLazy('semver');
const semverDiff = importLazy('semver-diff');
const latestVersion = importLazy('latest-version');
const isNpm = importLazy('is-npm');
const isInstalledGlobally = importLazy('is-installed-globally');
const isYarnGlobal = importLazy('is-yarn-global');
const hasYarn = importLazy('has-yarn');
const boxen = importLazy('boxen');
const xdgBasedir = importLazy('xdg-basedir');
const isCi = importLazy('is-ci');
const pupa = importLazy('pupa');
```### 源码概览
一个 `UpdateNotifier` 类构造函数
三个方法- check
- fetchInfo
- notify导出一个函数 `` 和 `UpdateNotifier` 类
```js
class UpdateNotifier {
constructor(options = {}) {
}
check(){}
async fetchInfo(){}
notify(options){}
}module.exports = options => {
const updateNotifier = new UpdateNotifier(options);
updateNotifier.check();
return updateNotifier;
};module.exports.UpdateNotifier = UpdateNotifier;
```## 总结