Skip to content

Commit

Permalink
feat(cli): implement http mode and git mode creation, some test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Cphayim committed Mar 7, 2022
1 parent 148cb6c commit 517d24e
Show file tree
Hide file tree
Showing 32 changed files with 1,216 additions and 202 deletions.
182 changes: 112 additions & 70 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,91 @@
# @vrn-deco/cli

## 1.0.2
## 1.1.0

Two other creation modes from the [1.x Features](https://github.com/vrn-deco/cli/wiki/Features) concept are implemented

#### Features

- Implements the `http` creation mode

- Support interactive and non-interactive creation
- Support specify the `apiURL`

- Implements the `git` creation mode
- Support `HTTPS` and `SSH`
- Support handle original records after `git clone`

The `http` mode is similar to the `v0.x`, fetching the `manifest` data from a `manifest.json` interface, which contains all the optional `boilerplate` compressed files, selecting one of the `boilerplates` interactively based on the command line prompts, and then downloading and decompressing it

##### HTTP Mode creation

Interactive creation:

```sh
# You need to pass `--mode=http` to enable it, as 'package' mode is default
vrn boi create myapp --mode=http
# You can pass `--api-url` to specify the baseURL, default https://vrndeco.cn/boilerplate
vrn boi create myapp --mode=http --api-url=https://yoursite.com/boilerplate
```

Non-interactive creation:

```sh
# As with the `package` mode, you need to pass `--yes`, `--name`, `--version`, `--author`, `--target`
# here `--target` is packed file name, not the package name
# this means that it will download from the default `--api-url`
# https://vrndeco.cn/boilerplate/boilerplate-typescript-vue3-varlet.tgz
vrn boi create myapp --mode=http --yes \
--name=myapp --version=1.0.0 --author=cphayim \
--target boilerplate-typescript-vue3-varlet.tgz

# You can pass the full url directly to `—target`
vrn boi create myapp --mode=http --yes \
--name=myapp --version=1.0.0 --author=cphayim \
--target https://yoursite.com/boilerplate/boilerplate-typescript-vue3-varlet.tgz

# Equivalent to
vrn boi create myapp --mode=http --yes \
--name=myapp --version=1.0.0 --author=cphayim \
--api-url= https://yoursite.com/boilerplate \
--target boilerplate-typescript-vue3-varlet.tgz
```

> The `http` mode exists to complement specific scenarios, we still recommend that you use the `package` mode.
##### Git Mode creation

The `git` mode is created by cloning the specified repository

```sh
# You need to pass `--mode=git` to enable it, as 'package' mode is default
# `--target` is repository url, support `HTTPS` and `SSH`
vrn boi create --mode=git --target=https://github.com/vrn-deco/xxx.git
vrn boi create --mode=git [email protected]:vrn-deco/xxx.git
```

You can pass `—post-git` handle original records after `git clone`

### Patch Changes
```sh
# keep origin record
vrn boi create --mode=git --post-git=retain [email protected]:vrn-deco/xxx.git
# rm -rf .git
vrn boi create --mode=git --post-git=remove [email protected]:vrn-deco/xxx.git
# rm -rf .git && git init && git add . && git commit -m "chore: init repository"
vrn boi create --mode=git --post-git=rebuild [email protected]:vrn-deco/xxx.git
```

## 1.0.2

The `boi create` and `boi list` commands now support specifying manifest-package

#### Features:

- `boi create` & `boi list` support specifying `--manifest-package`

```sh
# Interactive creation, pulling the manifest from `@your-scope/your-manifest-package`
vrn boi create ooo --manifest-package @your-scope/your-manifest-package
vrn boi create myapp --manifest-package @your-scope/your-manifest-package

# Non-nteractive creation
# can specify a boilerplate that is not in the manifest as the target
Expand All @@ -18,44 +95,24 @@ vrn boi create myapp --yes \
--target @your-scope/boilerplate-xxx

# Will list the available boilerplate in `@your-scope/your-manifest-package`
vrn boi list --manifest-package @your-scope/your-manifest-package
vrn boi ls --manifest-package @your-scope/your-manifest-package
```

#### Updated dependencies:

- @vrn-deco/cli-check-update@1.0.2
- @vrn-deco/cli-command@1.0.2
- @vrn-deco/cli-command-boilerplate@1.0.2
- @vrn-deco/cli-command-config@1.0.2
- @vrn-deco/cli-config-helper@1.0.2
- @vrn-deco/cli-log@1.0.2
- @vrn-deco/cli-npm-helper@1.0.2
- @vrn-deco/cli-shared@1.0.2

## 1.0.1

### Patch Changes

Embrace the `Pure ESM`, need Node.js `v14.13.1` above

#### Refactor:

- Migrate all modules from cjs to esm
- Migrate all modules from CJS to ESM

#### Updated dependencies::
- Change the test case to ESM

- @vrn-deco/cli-check-update@1.0.1
- @vrn-deco/cli-command@1.0.1
- @vrn-deco/cli-command-boilerplate@1.0.1
- @vrn-deco/cli-command-config@1.0.1
- @vrn-deco/cli-config-helper@1.0.1
- @vrn-deco/cli-log@1.0.1
- @vrn-deco/cli-npm-helper@1.0.1
- @vrn-deco/cli-shared@1.0.1
#### Bug Fixes:

## 1.0.0
- Possible command parsing errors when passing `debug`

### Major Changes
## 1.0.0

Completely refactored with new architectural designs and specifications

Expand All @@ -65,14 +122,18 @@ Completely refactored with new architectural designs and specifications
- Support for multiple Package manager: npm, yarn, pnpm
- `boilerplate create` implements the `package` mode, creates projects by fetching `boilerplate-package` from `manifest-package`

`boilerplate create`:
##### Package Mode creation

Interactive creation:

```sh
# Interactive creation
vrn boi create myapp
vrn boi create myapp ./packages
```

Non-interactive creation, suitable for CI and automation tasks:

# Non-interactive creation, suitable for CI and automation tasks
```sh
vrn boi create myapp --yes \
--name=myapp --version=1.0.0 --author=cphayim \
--target @vrn-deco/boilerplate-javascript-vue
Expand All @@ -82,89 +143,70 @@ vrn boi create myapp ./packages --yes \
--target @vrn-deco/boilerplate-javascript-vue
```

`boilerplate list`:
##### Boilerplate list

list available boilerplate, can specify format and output file

```sh
# list available boilerplate
vrn boilerplate list
vrn boilerplate list --json
vrn boilerplate list --json --out-file ./boilerplate.json
vrn boilerplate list --yaml
vrn boilerplate list --yaml --out-file ./boilerplate.yaml
vrn boi ls
vrn boi ls --json
vrn boi ls --json --out-file ./boilerplate.json
vrn boi ls --yaml
vrn boi ls --yaml --out-file ./boilerplate.yaml
```

`config`:
##### Global config

Interactively edit configuration items, you can modify `npmRegistry`, `packageManager`, `checkUpdateEnabled`

```sh
# Interactively edit configuration items
# you can modify `npmRegistry`, `packageManager`, `checkUpdateEnabled`
vrn config
```

#### BREAKING CHANGE:
### BREAKING CHANGE:

Boilerplate related services are reimplemented using the `@vrn-deco/boilerplate-protocol` specification. If you are using `v0.x` and use a custom network interface to distribute boilerplate, please refer to the migration guide

### Patch Changes

#### Updated dependencies::

- @vrn-deco/cli-check-update@1.0.0
- @vrn-deco/cli-command@1.0.0
- @vrn-deco/cli-command-boilerplate@1.0.0
- @vrn-deco/cli-command-config@1.0.0
- @vrn-deco/cli-config-helper@1.0.0
- @vrn-deco/cli-log@1.0.0
- @vrn-deco/cli-npm-helper@1.0.0
- @vrn-deco/cli-shared@1.0.0

## 0.3.4

### Patch Changes

Automatic check for updates turned off

## 0.3.0

### Minor Changes

#### Fetures:
#### Features:

- Replacing the `tar` command with the built-in decompressor
- Adapt to new `vrn-boilerplate` rules

## 0.2.12

### Patch Changes

#### Bug Fixes:

- Rebuild the missing config file
- Compatibility with `non-tty` terminals (Windows)

## 0.2.10

### Patch Changes

#### Bug Fixes:

- Rebuild the missing config file
- Compatibility with `non-tty` terminals (Windows)

## 0.2.4

### Patch Changes

#### Bug Fixes:

- User directory write permission problem

## 0.2.0

### Minor Changes

#### Fetures:
#### Features:

- Support for custom `registry`
- Now you can distribute `boilerplate` using your own web interface
- Automatic new version check and prompt

```sh
vrn config set registry https://boilerplate.vrndeco.cn
vrn create app
```
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Of course, it is possible to use `npx` to execute commands directly without inst
npx @vrn-deco/cli create my-app
```

## Essentials
## Advanced Guide

TODO

Expand Down
2 changes: 1 addition & 1 deletion README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ vrn create my-app
npx @vrn-deco/cli create my-app
```

## 详细说明
## 进阶指南

TODO

Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
"test:coverage": "esno scripts/test.ts --coverage",
"lint": "eslint packages/*/src/**.ts",
"format": "prettier --write --parser typescript \"packages/**/*.ts\"",
"commit": "git add . && cz"
"commit": "git add . && cz",
"ch:add": "esno scripts/changeset.ts --add",
"ch:version": "esno scripts/changeset.ts --version"
},
"config": {
"commitizen": {
Expand Down
10 changes: 5 additions & 5 deletions packages/check-update/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vrn-deco/cli-check-update",
"version": "1.0.2",
"version": "1.1.0",
"description": "@vrn-deco/cli-check-update",
"author": "Cphayim <[email protected]>",
"homepage": "https://github.com/vrn-deco/cli#readme",
Expand All @@ -27,10 +27,10 @@
"url": "https://github.com/vrn-deco/cli/issues"
},
"dependencies": {
"@vrn-deco/cli-config-helper": "workspace:1.0.2",
"@vrn-deco/cli-log": "workspace:1.0.2",
"@vrn-deco/cli-npm-helper": "workspace:1.0.2",
"@vrn-deco/cli-shared": "workspace:1.0.2",
"@vrn-deco/cli-config-helper": "workspace:*",
"@vrn-deco/cli-log": "workspace:*",
"@vrn-deco/cli-npm-helper": "workspace:*",
"@vrn-deco/cli-shared": "workspace:*",
"semver": "^7.3.5"
},
"devDependencies": {
Expand Down
18 changes: 9 additions & 9 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vrn-deco/cli",
"version": "1.0.2",
"version": "1.1.0",
"description": "⚙️ Project scaffolding with command line tools. 🛠",
"author": "Cphayim <[email protected]>",
"homepage": "https://github.com/vrn-deco/cli#readme",
Expand Down Expand Up @@ -35,14 +35,14 @@
"url": "https://github.com/vrn-deco/cli/issues"
},
"dependencies": {
"@vrn-deco/cli-check-update": "workspace:1.0.2",
"@vrn-deco/cli-command": "workspace:1.0.2",
"@vrn-deco/cli-command-boilerplate": "workspace:1.0.2",
"@vrn-deco/cli-command-config": "workspace:1.0.2",
"@vrn-deco/cli-config-helper": "workspace:1.0.2",
"@vrn-deco/cli-log": "workspace:1.0.2",
"@vrn-deco/cli-npm-helper": "workspace:1.0.2",
"@vrn-deco/cli-shared": "workspace:1.0.2",
"@vrn-deco/cli-check-update": "workspace:*",
"@vrn-deco/cli-command": "workspace:*",
"@vrn-deco/cli-command-boilerplate": "workspace:*",
"@vrn-deco/cli-command-config": "workspace:*",
"@vrn-deco/cli-config-helper": "workspace:*",
"@vrn-deco/cli-log": "workspace:*",
"@vrn-deco/cli-npm-helper": "workspace:*",
"@vrn-deco/cli-shared": "workspace:*",
"dotenv": "^10.0.0",
"fs-extra": "^10.0.0",
"import-local": "^3.0.2",
Expand Down
17 changes: 10 additions & 7 deletions packages/command-boilerplate/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vrn-deco/cli-command-boilerplate",
"version": "1.0.2",
"version": "1.1.0",
"description": "vrn boilerplate command",
"author": "Cphayim <[email protected]>",
"homepage": "https://github.com/vrn-deco/cli#readme",
Expand All @@ -27,13 +27,16 @@
"url": "https://github.com/vrn-deco/cli/issues"
},
"dependencies": {
"@vrn-deco/boilerplate-protocol": "^1.1.0",
"@vrn-deco/cli-command": "workspace:1.0.2",
"@vrn-deco/cli-config-helper": "workspace:1.0.2",
"@vrn-deco/cli-log": "workspace:1.0.2",
"@vrn-deco/cli-npm-helper": "workspace:1.0.2",
"@vrn-deco/cli-shared": "workspace:1.0.2",
"@vrn-deco/boilerplate-protocol": "^1.2.0",
"@vrn-deco/cli-command": "workspace:*",
"@vrn-deco/cli-config-helper": "workspace:*",
"@vrn-deco/cli-log": "workspace:*",
"@vrn-deco/cli-npm-helper": "workspace:*",
"@vrn-deco/cli-shared": "workspace:*",
"compressing": "^1.5.1",
"execa": "^6.1.0",
"fs-extra": "^10.0.0",
"node-fetch": "^3.2.0",
"yaml": "^1.10.2"
}
}
Loading

0 comments on commit 517d24e

Please sign in to comment.