Skip to content

Commit

Permalink
feat: Notify update to Umi4 (#8434)
Browse files Browse the repository at this point in the history
  • Loading branch information
zzcan committed Jul 11, 2022
1 parent 936762c commit 43a7f3c
Show file tree
Hide file tree
Showing 15 changed files with 565 additions and 2 deletions.
9 changes: 9 additions & 0 deletions packages/deps/compiled/update-notifier/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Copyright Google

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
175 changes: 175 additions & 0 deletions packages/deps/compiled/update-notifier/boxen/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
import {LiteralUnion} from '../type-fest';
import cliBoxes, {BoxStyle} from '../cli-boxes';

declare namespace boxen {
/**
Characters used for custom border.
@example
```
// affffb
// e e
// dffffc
const border: CustomBorderStyle = {
topLeft: 'a',
topRight: 'b',
bottomRight: 'c',
bottomLeft: 'd',
vertical: 'e',
horizontal: 'f'
};
```
*/
interface CustomBorderStyle extends BoxStyle {}

/**
Spacing used for `padding` and `margin`.
*/
interface Spacing {
readonly top: number;
readonly right: number;
readonly bottom: number;
readonly left: number;
}

interface Options {
/**
Color of the box border.
*/
readonly borderColor?: LiteralUnion<
| 'black'
| 'red'
| 'green'
| 'yellow'
| 'blue'
| 'magenta'
| 'cyan'
| 'white'
| 'gray'
| 'grey'
| 'blackBright'
| 'redBright'
| 'greenBright'
| 'yellowBright'
| 'blueBright'
| 'magentaBright'
| 'cyanBright'
| 'whiteBright',
string
>;

/**
Style of the box border.
@default BorderStyle.Single
*/
readonly borderStyle?: BorderStyle | CustomBorderStyle;

/**
Reduce opacity of the border.
@default false
*/
readonly dimBorder?: boolean;

/**
Space between the text and box border.
@default 0
*/
readonly padding?: number | Spacing;

/**
Space around the box.
@default 0
*/
readonly margin?: number | Spacing;

/**
Float the box on the available terminal screen space.
@default 'left'
*/
readonly float?: 'left' | 'right' | 'center';

/**
Color of the background.
*/
readonly backgroundColor?: LiteralUnion<
| 'black'
| 'red'
| 'green'
| 'yellow'
| 'blue'
| 'magenta'
| 'cyan'
| 'white'
| 'blackBright'
| 'redBright'
| 'greenBright'
| 'yellowBright'
| 'blueBright'
| 'magentaBright'
| 'cyanBright'
| 'whiteBright',
string
>;

/**
Align the text in the box based on the widest line.
@default 'left'
*/
readonly align?: 'left' | 'right' | 'center';
}
}

declare const enum BorderStyle {
Single = 'single',
Double = 'double',
Round = 'round',
Bold = 'bold',
SingleDouble = 'singleDouble',
DoubleSingle = 'doubleSingle',
Classic = 'classic'
}

declare const boxen: {
/**
Creates a box in the terminal.
@param text - The text inside the box.
@returns The box.
@example
```
import boxen = require('../boxen');
console.log(boxen('unicorn', {padding: 1}));
// ┌─────────────┐
// │ │
// │ unicorn │
// │ │
// └─────────────┘
console.log(boxen('unicorn', {padding: 1, margin: 1, borderStyle: 'double'}));
//
// ╔═════════════╗
// ║ ║
// ║ unicorn ║
// ║ ║
// ╚═════════════╝
//
```
*/
(text: string, options?: boxen.Options): string;

/**
Border styles from [`cli-boxes`](https://github.com/sindresorhus/cli-boxes).
*/
BorderStyle: typeof BorderStyle;
};

export = boxen;
1 change: 1 addition & 0 deletions packages/deps/compiled/update-notifier/check.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions packages/deps/compiled/update-notifier/check1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/* eslint-disable unicorn/no-process-exit */
'use strict';
let updateNotifier = require('.');

const options = JSON.parse(process.argv[2]);

updateNotifier = new updateNotifier.UpdateNotifier(options);

(async () => {
// Exit process when offline
setTimeout(process.exit, 1000 * 30);

const update = await updateNotifier.fetchInfo();

// Only update the last update check time on success
updateNotifier.config.set('lastUpdateCheck', Date.now());

if (update.type && update.type !== 'latest') {
updateNotifier.config.set('update', update);
}

// Call process exit explicitly to terminate the child process,
// otherwise the child process will run forever, according to the Node.js docs
process.exit();
})().catch(error => {
console.error(error);
process.exit(1);
});
113 changes: 113 additions & 0 deletions packages/deps/compiled/update-notifier/cli-boxes/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
declare namespace cliBoxes {
/**
Style of the box border.
*/
interface BoxStyle {
readonly topLeft: string;
readonly topRight: string;
readonly bottomLeft: string;
readonly bottomRight: string;
readonly horizontal: string;
readonly vertical: string;
}

/**
All box styles.
*/
interface Boxes {
/**
@example
```
┌────┐
│ │
└────┘
```
*/
readonly single: BoxStyle;

/**
@example
```
╔════╗
║ ║
╚════╝
```
*/
readonly double: BoxStyle;

/**
@example
```
╭────╮
│ │
╰────╯
```
*/
readonly round: BoxStyle;

/**
@example
```
┏━━━━┓
┃ ┃
┗━━━━┛
```
*/
readonly bold: BoxStyle;

/**
@example
```
╓────╖
║ ║
╙────╜
```
*/
readonly singleDouble: BoxStyle;

/**
@example
```
╒════╕
│ │
╘════╛
```
*/
readonly doubleSingle: BoxStyle;

/**
@example
```
+----+
| |
+----+
```
*/
readonly classic: BoxStyle;
}
}

/**
Boxes for use in the terminal.
@example
```
import cliBoxes = require('../cli-boxes');
console.log(cliBoxes.single);
// {
// topLeft: '┌',
// topRight: '┐',
// bottomRight: '┘',
// bottomLeft: '└',
// vertical: '│',
// horizontal: '─'
// }
```
*/
declare const cliBoxes: cliBoxes.Boxes & {
// TODO: Remove this for the next major release
default: typeof cliBoxes;
};

export = cliBoxes;

0 comments on commit 43a7f3c

Please sign in to comment.