Skip to content

Commit 56f22cb

Browse files
jamesgeorge007ForsakenHarmony
authored andcommitted
feat(cli): Added new info command (#814)
1 parent 067b1f4 commit 56f22cb

5 files changed

Lines changed: 35 additions & 9 deletions

File tree

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@
1717

1818
**Other information**
1919

20-
<!-- Node version, npm version, CLI version, operating system, browser -->
20+
Please paste the results of `preact info` here.

.github/issue_template.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,4 @@
1515

1616
**Please mention other relevant information.**
1717

18-
- Node version
19-
- npm version
20-
- Operating system
21-
- CLI version
22-
- Browser
18+
Please paste the results of `preact info` here.

README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ Lists all the official preactjs-cli repositories
141141
$ preact list
142142
```
143143

144+
#### preact info
145+
146+
Prints debugging information concerning the local environment.
147+
144148
### Deploying
145149

146150
```sh
@@ -292,14 +296,15 @@ preact watch --template src/template.html
292296

293297
### Using CSS preprocessors
294298

295-
The default templates comes with a `.css` file for each component. You can start using CSS preprocessors at any given time during your project lifecycle by installing additional packages and then simply replacing those `.css` files.
299+
The default templates comes with a `.css` file for each component. You can start using CSS preprocessors at any given time during your project lifecycle by installing additional packages and then simply replacing those `.css` files.
296300

297301
#### [SASS]
298302

299303
- `npm install --save-dev node-sass sass-loader` (inside your preact application folder)
300304
- start replacing `.css` files with `.scss` files
301305

302306
#### [LESS]
307+
303308
- `npm install --save-dev less less-loader` (inside your preact application folder)
304309
- start replacing `.css` files with `.less` files
305310

@@ -327,5 +332,5 @@ The default templates comes with a `.css` file for each component. You can start
327332
[service workers]: https://developers.google.com/web/fundamentals/getting-started/primers/service-workers
328333
[customize babel]: https://github.com/developit/preact-cli/wiki/Config-Recipes#customising-babel-options-using-loader-helpers
329334
[`async!`]: https://github.com/developit/preact-cli/blob/222e7018dd360e40f7db622191aeca62d6ef0c9a/examples/full/src/components/app.js#L7
330-
[SASS]: https://sass-lang.com
331-
[LESS]: http://lesscss.org
335+
[sass]: https://sass-lang.com
336+
[less]: http://lesscss.org

packages/cli/lib/index.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env node
2+
const envinfo = require('envinfo');
23
const sade = require('sade');
34
const notifier = require('update-notifier');
45
const { error } = require('./util');
@@ -92,4 +93,27 @@ prog
9293
.option('-p, --port', 'Set server port', 8080)
9394
.action(commands.watch);
9495

96+
prog
97+
.command('info')
98+
.describe('Print out debugging information about the local environment')
99+
.action(() => {
100+
console.log();
101+
console.log('Environment Info:');
102+
envinfo
103+
.run({
104+
System: ['OS', 'CPU'],
105+
Binaries: ['Node', 'Yarn', 'npm'],
106+
Browsers: ['Chrome', 'Edge', 'Firefox', 'Safari'],
107+
npmPackages: [
108+
'preact',
109+
'preact-compat',
110+
'preact-cli',
111+
'preact-router',
112+
'preact-render-to-string',
113+
],
114+
npmGlobalPackages: ['preact-cli'],
115+
})
116+
.then(console.log);
117+
});
118+
95119
prog.parse(process.argv);

packages/cli/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
"cross-spawn-promise": "^0.10.1",
8787
"css-loader": "^2.1.1",
8888
"ejs-loader": "^0.3.3",
89+
"envinfo": "^7.3.1",
8990
"esm": "^3.2.25",
9091
"fast-async": "^6.3.7",
9192
"file-loader": "^3.0.1",

0 commit comments

Comments
 (0)