Skip to content

Commit

Permalink
chore: Improve cli & create-cli consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
rschristian committed Dec 17, 2022
1 parent 9d351d0 commit dec9b0d
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 32 deletions.
4 changes: 1 addition & 3 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
"keywords": [
"preact",
"cli",
"pwa",
"project",
"generator"
"pwa"
],
"homepage": "https://github.com/preactjs/preact-cli",
"bugs": "https://github.com/preactjs/preact-cli/issues",
Expand Down
9 changes: 0 additions & 9 deletions packages/cli/src/commands/index.js

This file was deleted.

6 changes: 3 additions & 3 deletions packages/cli/src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/usr/bin/env node
const sade = require('sade');
const { build } = require('./commands/build');
const { info } = require('./commands/info');
const { watch } = require('./commands/watch');
const { error } = require('./util');
const pkg = require('../package.json');

Expand All @@ -15,9 +18,6 @@ if (
);
}

// Safe to load async-based funcs
const { build, info, watch } = require('./commands');

const prog = sade('preact').version(pkg.version);

prog
Expand Down
36 changes: 20 additions & 16 deletions packages/create-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,39 @@
"name": "create-preact-cli",
"version": "0.0.1",
"description": "Start building a Preact Progressive Web App in seconds.",
"repository": "preactjs/preact-cli",
"main": "src/index.js",
"bin": "src/index.js",
"scripts": {
"pretest": "rimraf ../cli/tests/output",
"test": "jest"
},
"engines": {
"node": ">=14"
},
"files": [
"lib"
],
"keywords": [
"preact",
"cli",
"pwa",
"project",
"generator"
],
"license": "MIT",
"bugs": "https://github.com/preactjs/preact-cli/issues",
"homepage": "https://github.com/preactjs/preact-cli",
"bugs": "https://github.com/preactjs/preact-cli/issues",
"repository": {
"type": "git",
"url": "https://github.com/preactjs/preact-cli.git",
"directory": "packages/create-cli"
},
"license": "MIT",
"author": "The Preact CLI Authors (https://github.com/preactjs/preact-cli/contributors)",
"main": "src/index.js",
"bin": "src/index.js",
"files": [
"src"
],
"scripts": {
"pretest": "rimraf ../cli/tests/output",
"test": "jest"
},
"dependencies": {
"cross-spawn-promise": "^0.10.1",
"gittar": "^0.1.0",
"isomorphic-unfetch": "^3.1.0",
"kleur": "^4.1.4",
"ora": "^5.4.1",
"sade": "^1.8.1"
},
"engines": {
"node": ">=14"
}
}
15 changes: 14 additions & 1 deletion packages/create-cli/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,21 @@ const sade = require('sade');
const { create } = require('./commands/create');
const { list } = require('./commands/list');
const { error } = require('./util');
const pkg = require('../package.json');

const prog = sade('create-preact-app').version('0.1.3');
const ver = process.version;
const min = pkg.engines.node;
if (
ver
.substring(1)
.localeCompare(min.match(/\d+/g).join('.'), 'en', { numeric: true }) === -1
) {
error(
`You are using Node ${ver} but create-preact-cli requires Node ${min}. Please upgrade Node to continue!\n`
);
}

const prog = sade('create-preact-app').version(pkg.version);

prog
.command('create <template> <dest>', '', { default: true })
Expand Down

0 comments on commit dec9b0d

Please sign in to comment.