Compare commits

..

79 Commits

Author SHA1 Message Date
semantic-release-bot
9be8a8b71b chore(release): 2.1.0 [skip ci]
# [2.1.0](https://github.com/chenasraf/simple-scaffold/compare/v2.0.2...v2.1.0) (2024-02-12)

### Features

* support directory in --config flag ([e48b832](e48b832e0b))
* support providing name in config ([4e7ac34](4e7ac34db9))
2024-02-12 23:39:35 +00:00
5cb8c3c081 docs: update navbar logo 2024-02-13 01:39:04 +02:00
3b52c255f0 chore: dry 2024-02-13 01:39:04 +02:00
80cf2076b0 chore: update dependencies 2024-02-13 01:39:04 +02:00
4fd710b763 test: fix tests 2024-02-13 01:39:04 +02:00
4e7ac34db9 feat: support providing name in config 2024-02-13 01:39:04 +02:00
e48b832e0b feat: support directory in --config flag 2024-02-13 01:39:04 +02:00
06ffa656ae docs: update templates page 2024-02-13 01:39:04 +02:00
919fd54ebb docs: usage page order 2024-02-13 01:39:04 +02:00
semantic-release-bot
dbc3283d5a chore(release): 2.0.2 [skip ci]
## [2.0.2](https://github.com/chenasraf/simple-scaffold/compare/v2.0.1...v2.0.2) (2024-02-04)

### Bug Fixes

* try to await scaffold before finally ([1b70897](1b70897f98))
2024-02-04 14:20:58 +00:00
Chen Asraf
0e567ec56f chore: show handlebars fail on default log level
fixes #86
2024-02-04 16:20:25 +02:00
semantic-release-bot
0ec671fe83 chore(release): 2.0.2-pre.1 [skip ci]
## [2.0.2-pre.1](https://github.com/chenasraf/simple-scaffold/compare/v2.0.1...v2.0.2-pre.1) (2024-02-03)

### Bug Fixes

* try to await scaffold before finally ([b0a6bf7](b0a6bf7021))
2024-02-04 16:20:25 +02:00
1b70897f98 fix: try to await scaffold before finally 2024-02-04 16:20:25 +02:00
43c9e8748f docs: update readme 2024-02-04 16:20:25 +02:00
65b14bc707 docs: update logo 2024-02-04 16:20:25 +02:00
f583af662c docs: update readme 2024-02-04 16:20:25 +02:00
600cc78186 docs: add logo, update docs 2024-02-04 16:20:25 +02:00
b4aea804cb docs: update readme 2024-02-04 16:20:25 +02:00
795635dc61 docs: update readme 2024-02-04 16:20:25 +02:00
6a026ce1a1 chore: version output + docs update 2024-02-04 16:20:25 +02:00
268e4d973c docs: fix github link 2024-02-04 16:20:25 +02:00
a403d9df9b ci: clean up release config 2024-02-04 16:20:25 +02:00
298beff355 docs: fix edit link 2024-02-04 16:20:25 +02:00
8f1d58f2c2 ci: fix pack step order 2024-02-04 16:20:25 +02:00
b10d69d2fe chore: update package.json spec 2024-02-04 16:20:25 +02:00
semantic-release-bot
069c890ca3 chore(release): 2.0.1 [skip ci]
## [2.0.1](https://github.com/chenasraf/simple-scaffold/compare/v2.0.0...v2.0.1) (2024-02-02)

### Bug Fixes

* log level flag ([5d7f449](5d7f449050))
* rm tmp dir too early ([4aa52c8](4aa52c84bd))
2024-02-02 00:48:01 +00:00
5d7f449050 fix: log level flag 2024-02-02 02:47:27 +02:00
cd29bd0521 docs: fix migration docs 2024-02-02 02:47:27 +02:00
c9e5dad746 test: fix tests 2024-02-02 02:47:27 +02:00
18f73b3eca build: try to pack in semantic-release 2024-02-02 02:47:27 +02:00
4aa52c84bd fix: rm tmp dir too early 2024-02-02 02:47:27 +02:00
f748125ae6 docs: update changelog 2024-02-02 02:47:27 +02:00
semantic-release-bot
43afe60ce8 chore(release): 2.0.0 [skip ci]
# [2.0.0](https://github.com/chenasraf/simple-scaffold/compare/v1.10.0...v2.0.0) (2024-01-31)

* fix!: version number ([bc0a18d](bc0a18dce0))

### BREAKING CHANGES

* see changelog
2024-01-31 22:27:49 +00:00
bc0a18dce0 fix!: version number
BREAKING CHANGE: see changelog
2024-02-01 00:27:12 +02:00
semantic-release-bot
179fabc579 chore(release): 1.10.0 [skip ci]
# [1.10.0](https://github.com/chenasraf/simple-scaffold/compare/v1.9.0...v1.10.0) (2024-01-31)

### Bug Fixes

* remove gh flag ([939200c](939200c9f2))
* tests ([ff92fd7](ff92fd7607))

### Features

* try multiple default config files ([89aacb5](89aacb58fd))
2024-01-31 22:22:21 +00:00
909fe5bbea fix!: version number 2024-02-01 00:21:49 +02:00
semantic-release-bot
bc7d687977 chore(release): 1.10.0 [skip ci]
# [1.10.0](https://github.com/chenasraf/simple-scaffold/compare/v1.9.0...v1.10.0) (2024-01-31)

### Bug Fixes

* remove gh flag ([939200c](939200c9f2))
* tests ([ff92fd7](ff92fd7607))

### Features

* try multiple default config files ([89aacb5](89aacb58fd))
2024-01-31 22:15:13 +00:00
e6d9816a2f ci: fix release 2024-02-01 00:14:32 +02:00
e2353134d4 chore: update deps 2024-01-31 23:55:39 +02:00
6c7e3e5068 build: fix versioning 2024-01-31 23:55:39 +02:00
81dd6e3b19 docs: fix usage index link 2024-01-31 23:55:39 +02:00
b852a956ba docs: update badges 2024-01-31 23:55:39 +02:00
0ecc2590c7 docs: update badges 2024-01-31 23:55:39 +02:00
af4b753a6d docs: fix intro gif 2024-01-31 23:55:39 +02:00
semantic-release-bot
a8162f2315 chore(release): 2.0.0-pre.3 [skip ci]
# [2.0.0-pre.3](https://github.com/chenasraf/simple-scaffold/compare/v2.0.0-pre.2...v2.0.0-pre.3) (2024-01-30)

### Bug Fixes

* tests ([c219d38](c219d382e6))
2024-01-31 23:55:39 +02:00
ff92fd7607 fix: tests 2024-01-31 23:55:39 +02:00
0dc1116141 feat!: rename createSubFolder and subFolderNameHelper 2024-01-31 23:55:39 +02:00
f36cf4c2f2 docs: regenerate changelog
d
2024-01-31 23:55:39 +02:00
Chen Asraf
dd58c7fdda Update README.md 2024-01-31 23:55:39 +02:00
semantic-release-bot
058f1d4afa chore(release): 2.0.0-pre.2 [skip ci]
# [2.0.0-pre.2](https://github.com/chenasraf/simple-scaffold/compare/v2.0.0-pre.1...v2.0.0-pre.2) (2024-01-29)
2024-01-31 23:55:39 +02:00
583be2d9d2 docs: fix readme doc links
a
2024-01-31 23:55:39 +02:00
semantic-release-bot
18f1fac119 chore(release): 2.0.0-pre.1 [skip ci]
# [2.0.0-pre.1](https://github.com/chenasraf/simple-scaffold/compare/v1.9.0...v2.0.0-pre.1) (2024-01-29)

### Bug Fixes

* remove gh flag ([e66d6ba](e66d6ba86a))

### Features

* try multiple default config files ([f25cda7](f25cda738b))
2024-01-31 23:55:39 +02:00
693b8c8ea4 ci: fix docs 2024-01-31 23:55:39 +02:00
901d5d76b4 ci: fix docs 2024-01-31 23:55:39 +02:00
fac571f588 ci: fix docs 2024-01-31 23:55:39 +02:00
a10f412337 ci: use tag versions 2024-01-31 23:55:39 +02:00
819cd20644 docs: gtag + update deps 2024-01-31 23:55:39 +02:00
dc4c940559 ci: fix docs command 2024-01-31 23:55:39 +02:00
816e2f9aa0 ci: fix 2024-01-31 23:55:39 +02:00
825bd096c2 chore: fix docs & formatting 2024-01-31 23:55:39 +02:00
939200c9f2 fix: remove gh flag 2024-01-31 23:55:39 +02:00
0b7653de72 ci: fix docs build dir 2024-01-31 23:55:39 +02:00
89aacb58fd feat: try multiple default config files 2024-01-31 23:55:39 +02:00
9ce2845ace feat!: separate git/github/config flags
feat: separate git/github/config

t

test

cleanup
2024-01-31 23:55:39 +02:00
5373495f80 docs: update 2024-01-31 23:55:39 +02:00
70a080cc8e docs: update docs 2024-01-31 23:55:39 +02:00
ef7811d7e2 docs: update readme image 2024-01-31 23:55:39 +02:00
8b6b958480 docs: update docs, remove generated files from git 2024-01-31 23:55:39 +02:00
2c73207784 docs: update 2024-01-31 23:55:39 +02:00
5252642f6b docs: docusaurus initial commit 2024-01-31 23:55:39 +02:00
361778a188 feat!: rename verbose to logLevel 2024-01-31 23:55:39 +02:00
a54b1d6297 chore: update deps 2024-01-31 23:55:39 +02:00
ae69eb52db chore: update deps 2024-01-31 23:55:39 +02:00
3b60f1816d docs: update docs 2024-01-31 23:55:39 +02:00
c04d1cc42a chore!: remove Name from default data 2024-01-31 23:55:39 +02:00
c6b185cd8f feat!: remove url colon syntax 2024-01-31 23:55:39 +02:00
5abf528b81 chore!: update massarg 2024-01-31 23:55:39 +02:00
aeb3680ddf ci: update docs build 2024-01-31 23:55:39 +02:00
40e2381d05 ci: update build 2024-01-31 23:55:39 +02:00
32 changed files with 660 additions and 404 deletions

View File

@@ -31,8 +31,6 @@ jobs:
run: pnpm test
- name: Build Package
run: pnpm build
- name: Pack
run: cd ./dist && pnpm pack --pack-destination=../
- name: Semantic Release
run: npx semantic-release
env:

View File

@@ -1,21 +1,36 @@
# Change Log
# [2.0.0-pre.3](https://github.com/chenasraf/simple-scaffold/compare/v2.0.0-pre.2...v2.0.0-pre.3) (2024-01-30)
# [2.1.0](https://github.com/chenasraf/simple-scaffold/compare/v2.0.2...v2.1.0) (2024-02-12)
### Features
* support directory in --config flag ([e48b832](https://github.com/chenasraf/simple-scaffold/commit/e48b832e0b72a084d33fa2cbcca332e8209a734f))
* support providing name in config ([4e7ac34](https://github.com/chenasraf/simple-scaffold/commit/4e7ac34db9bf67d012bbd1c06c1a26bc5ac93559))
## [2.0.2](https://github.com/chenasraf/simple-scaffold/compare/v2.0.1...v2.0.2) (2024-02-04)
### Bug Fixes
* tests ([c219d38](https://github.com/chenasraf/simple-scaffold/commit/c219d382e6df8b2ca1157544a7785f6645d04be2))
* try to await scaffold before finally ([1b70897](https://github.com/chenasraf/simple-scaffold/commit/1b70897f9840e6365ff800490fbb813b9840177d))
## 2.0.0-pre.2 (2024-01-29)
## [2.0.1](https://github.com/chenasraf/simple-scaffold/compare/v2.0.0...v2.0.1) (2024-02-02)
### Bug Fixes
* log level flag ([5d7f449](https://github.com/chenasraf/simple-scaffold/commit/5d7f449050e50a6e4b2d00b7a2215cdb5fc9b611))
* rm tmp dir too early ([4aa52c8](https://github.com/chenasraf/simple-scaffold/commit/4aa52c84bd8cf302031e9f7f6407466aa736beb7))
# [2.0.0](https://github.com/chenasraf/simple-scaffold/compare/v1.9.0...v2.0.0) (2024-01-31)
* fix!: version number ([bc0a18d](https://github.com/chenasraf/simple-scaffold/commit/bc0a18dce01fefec6187192cb20c9303f7f7dbfa))
* remove gh flag ([939200c](https://github.com/chenasraf/simple-scaffold/commit/939200c9f21be240485ea602a73b983ba2f47aaf))
* tests ([ff92fd7](https://github.com/chenasraf/simple-scaffold/commit/ff92fd7607f1b86f36fc6b62652fdfc81cb391a3))
* try multiple default config files ([89aacb5](https://github.com/chenasraf/simple-scaffold/commit/89aacb58fd90a892f4994c758c61c43b2a6b1fba))
* Update README.md ([e012d51](https://github.com/chenasraf/simple-scaffold/commit/e012d51))
* docs: fix readme doc links ([55e561b](https://github.com/chenasraf/simple-scaffold/commit/55e561b))
## 2.0.0-pre.1 (2024-01-29)
* chore: fix docs & formatting ([b4f0731](https://github.com/chenasraf/simple-scaffold/commit/b4f0731))
* chore: update deps ([22ad5d4](https://github.com/chenasraf/simple-scaffold/commit/22ad5d4))
* chore: update deps ([b2373aa](https://github.com/chenasraf/simple-scaffold/commit/b2373aa))

186
README.md
View File

@@ -1,4 +1,6 @@
<h1 align="center">Simple Scaffold</h1>
<p align="center">
<img src="https://chenasraf.github.io//simple-scaffold/img/logo-lg.png" alt="Logo" />
</p>
<h2 align="center">
@@ -6,7 +8,7 @@
[Documentation](https://chenasraf.github.io/simple-scaffold) |
[NPM](https://npmjs.com/package/simple-scaffold) | [casraf.dev](https://casraf.dev)
![version](https://img.shields.io/github/package-json/v/chenasraf/simple-scaffold/master?label=version)
![master](https://img.shields.io/github/package-json/v/chenasraf/simple-scaffold/master?label=master)
![build](https://img.shields.io/github/actions/workflow/status/chenasraf/simple-scaffold/release.yml?branch=master)
</h2>
@@ -25,60 +27,82 @@ lifting for you and start building your projects faster and more efficiently tod
<div align="center">
![Intro](https://github.com/chenasraf/simple-scaffold/assets/167217/6341efab-f961-4f1a-83e2-831b1308b9eb)
![Intro](https://chenasraf.github.io/simple-scaffold/img/intro.gif)
</div>
---
## Quick Start
## Documentation
### Local Templates
See full documentation [here](https://chenasraf.github.io/simple-scaffold).
The fastest way to get started is to use `npx` to immediately start a scaffold process.
- [Command Line Interface (CLI) usage](https://chenasraf.github.io/simple-scaffold/docs/usage/cli)
- [Node.js usage](https://chenasraf.github.io/simple-scaffold/docs/usage/node)
- [Templates](https://chenasraf.github.io/simple-scaffold/docs/usage/templates)
- [Configuration Files](https://chenasraf.github.io/simple-scaffold/docs/usage/configuration_files)
- [Migration](https://chenasraf.github.io/simple-scaffold/docs/usage/migration)
Prepare any templates you want to use - for example, in the directory `templates/component`; and use
that in the CLI args. Here is a simple example file:
## Getting Started
Simple Scaffold will maintain any file and directory structure you try to generate.
### Cheat Sheet
`templates/component/{{ pascalName name }}.tsx`
A quick rundown of common usage scenarios:
```tsx
// Created: {{ now 'yyyy-MM-dd' }}
import React from 'react'
- Remote template config file on GitHub:
export default {{pascalCase name}}: React.FC = (props) => {
return (
<div className="{{camelCase name}}">{{pascalCase name}} Component</div>
)
}
```
```sh
npx simple-scaffold -g username/repository -c scaffold.js -k component NewComponentName
```
To generate the template output, run:
- Local template config file:
```sh
npx simple-scaffold -c scaffold.js -k component NewComponentName
```
- Local one-time usage:
```sh
npx simple-scaffold -t templates/component -o src/components NewComponentName
```
### Remote Configurations
The fastest way to get started is to is to re-use someone else's (or your own) work using a template
repository.
A remote config can be loaded in one of these ways:
- For templates hosted on GitHub, the syntax is `-g user/repository_name`
- For other Git platforms like GitLab, use `-g https://example.com/user/repository_name.git`
These remote configurations support multiple scaffold groups, which can be specified using the
`--key` or `-k` argument:
```sh
# generate single component
$ npx simple-scaffold@latest \
-t templates/component -o src/components PageWrapper
$ npx simple-scaffold \
-g chenasraf/simple-scaffold \
-k component \
PageWrapper
# equivalent to:
$ npx simple-scaffold \
-g https://github.com/chenasraf/simple-scaffold.git \
-c scaffold.config.js \
-k component \
PageWrapper
```
This will immediately create the following file: `src/components/PageWrapper.tsx`
By default, the template name is set to `default` when the `--key` option is not provided.
```tsx
// Created: 2077-01-01
import React from 'react'
export default PageWrapper: React.FC = (props) => {
return (
<div className="pageWrapper">PageWrapper Component</div>
)
}
```
See information about each option and flag using the `--help` flag, or read the
[CLI documentation](https://chenasraf.github.io/simple-scaffold/docs/usage/cli). For information
about how configuration files work, [see below](#configuration-files).
### Configuration Files
You can also use a config file to more easily maintain all your scaffold definitions.
You can use a config file to more easily maintain all your scaffold definitions.
`scaffold.config.js`
@@ -99,66 +123,61 @@ module.exports = {
Then call your scaffold like this:
```sh
$ npx simple-scaffold@latest -c scaffold.config.js PageWrapper
$ npx simple-scaffold -c scaffold.config.js PageWrapper
```
This will allow you to avoid needing to remember which configs are needed or to store them in a
1-liner in `packqge.json` which can get pretty long and messy, which is harder to maintain.
one-liner in `package.json` which can get pretty long and messy, and harder to maintain.
Also, this allows you to define more complex scaffolds with logic without having to use the Node.js
API directly. (Of course you always have the option to still do so if you wish)
See more at the [CLI documentation](https://chenasraf.github.io/simple-scaffold/docs/usage/cli) and
[Configuration Files](https://chenasraf.github.io/simple-scaffold/docs/usage/configuration_files).
More information can be found at the
[Configuration Files documentation](https://chenasraf.github.io/simple-scaffold/docs/usage/configuration_files).
### Remote Configurations
### Templates Structure
Another quick way to start is to re-use someone else's (or your own) work using a template
repository.
Templates are **any file** in the a directory given to `--templates`.
A remote config can be loaded in one of these ways:
Simple Scaffold will maintain any file and directory structure you try to generate, while replacing
any tokens such as `{{ name }}` or other custom-data using
[Handlebars.js](https://handlebarsjs.com/).
- If it's on GitHub, you can use `-g user/repository_name`
- If it's on another git server (such as GitLab), you can use
`-g https://example.com/user/repository_name.git`
`templates/component/{{ pascalName name }}.tsx`
Configurations can hold multiple scaffold groups. Each group can be accessed using its key by
supplying the `--key` or `-k` argument, like so:
```tsx
// Created: {{ now 'yyyy-MM-dd' }}
import React from 'react'
```sh
-g user/repository_name -c scaffold.js -k key_name`.
export default {{pascalCase name}}: React.FC = (props) => {
return (
<div className="{{camelCase name}}">{{pascalCase name}} Component</div>
)
}
```
Here is an example for loading the example component templates in this very repository:
To generate the template output once without saving a configuration file, run:
```sh
$ npx simple-scaffold@latest \
-g chenasraf/simple-scaffold \
-k component \
PageWrapper
# equivalent to:
$ npx simple-scaffold@latest \
-g https://github.com/chenasraf/simple-scaffold.git \
-c scaffold.config.js \
-k component \
# generate single component
$ npx simple-scaffold \
-t templates/component \
-o src/components \
PageWrapper
```
When template name (`-k component`) is omitted, `default` is used.
This will immediately create the following file: `src/components/PageWrapper.tsx`
See more at the [CLI documentation](https://chenasraf.github.io/simple-scaffold/docs/usage/cli) and
[Configuration Files](https://chenasraf.github.io/simple-scaffold/docs/usage/configuration_files).
```tsx
// Created: 2077-01-01
import React from 'react'
## Documentation
See full documentation [here](https://chenasraf.github.io/simple-scaffold).
- [Command Line Interface (CLI) usage](https://chenasraf.github.io/simple-scaffold/docs/usage/cli)
- [Node.js usage](https://chenasraf.github.io/simple-scaffold/docs/usage/node)
- [Templates](https://chenasraf.github.io/simple-scaffold/docs/usage/templates)
- [Configuration Files](https://chenasraf.github.io/simple-scaffold/docs/usage/configuration_files)
- [Migration](https://chenasraf.github.io/simple-scaffold/docs/usage/migration)
export default PageWrapper: React.FC = (props) => {
return (
<div className="pageWrapper">PageWrapper Component</div>
)
}
```
## Contributing
@@ -189,22 +208,9 @@ If you are a developer and want to contribute code, here are some starting tips:
Some tips on getting around the code:
- Use `pnpm dev` for development - it runs TypeScript compile in watch mode, allowing you to make
changes and immediately be able to try them using `pnpm cmd`.
- Use `pnpm build` to build the output once
- Use `pnpm test` to run tests
- Use `pnpm cmd` to use the CLI feature of Simple Scaffold from within the root directory, enabling
you to test different behaviors. See `pnpm cmd -h` for more information.
> This requires an updated build, and does not trigger one itself. From here you have several
> options:
>
> - Run `pnpm dev` to watch for file changes and build automatically
> - Run `pnpm build` before running this to trigger a one-time build
> - Run `pnpm build-cmd` which triggers a build right before running `pnpm cmd` automatically with
> the rest of the given arguments.
- Use `pnpm build-docs` to build the documentation once
- Use `pnpm watch-docs` to start docs in watch mode
- To see the documentation, currently you have to serve the directory yourself with a static web
server (like node's built in serve, VS code's "Go Live" mode, etc)
- Use `pnpm test` to run tests
- Use `pnpm docs:build` to build the documentation once
- Use `pnpm docs:watch` to start docs in watch mode
- Use `pnpm build` to build the output

View File

@@ -50,7 +50,6 @@ The contents of the file will be transformed in a similar fashion.
Your `data` will be pre-populated with the following:
- `{{Name}}`: PascalCase of the component name
- `{{name}}`: raw name of the component as you entered it
> Simple-Scaffold uses [Handlebars.js](https://handlebarsjs.com/) for outputting the file contents.
@@ -110,7 +109,15 @@ Further details:
```
- **The now helper** (for current time) takes the same arguments, minus the first one (`date`) as it
is implicitly the current date.
is implicitly the current date:
```typescript
(
format: string,
offsetAmount?: number,
offsetType?: "years" | "months" | "weeks" | "days" | "hours" | "minutes" | "seconds"
)
```
### Custom Helpers

View File

@@ -23,48 +23,11 @@ module.exports = {
}
```
The configuration contents are identical to the
[Node.js configuration structure](https://chenasraf.github.io/simple-scaffold/docs/usage/node):
```ts
interface ScaffoldConfig {
name: string
templates: string[]
output: FileResponse<string>
subdir?: boolean
git?: string
config?: string
key?: string
data?: Record<string, any>
overwrite?: FileResponse<boolean>
quiet?: boolean
verbose?: LogLevel
dryRun?: boolean
helpers?: Record<string, Helper>
subdirHelper?: DefaultHelpers | string
beforeWrite?(
content: Buffer,
rawContent: Buffer,
outputPath: string,
): string | Buffer | undefined | Promise<string | Buffer | undefined>
}
```
For the full configuration options, see [ScaffoldConfigFile](../api/modules#scaffoldconfigfile).
If you want to supply functions inside the configurations, you must use a `.js`/`.cjs`/`.mjs` file
as JSON does not support non-primitives.
A `.js` file can be just like a `.json` file, make sure to export the final configuration:
```js
/** @type {import('simple-scaffold').ScaffoldConfigFile} */
module.exports = {
component: {
templates: ["templates/component"],
output: "src/components",
},
}
```
Another feature of using a JS file is you can export a function which will be loaded with the CMD
config provided to Simple Scaffold. The `extra` key contains any values not consumed by built-in
flags, so you can pre-process your args before outputting a config:
@@ -82,6 +45,12 @@ module.exports = (config) => {
}
```
If you want to provide templates that need no name (such as common config files which are easily
portable between projects), you may provide the `name` property in the config object.
You will always be able to override it using `--name NewName`, but it will be given a value by
default and therefore it will no longer be required in the CLI arguments.
## Using a config file
Once your config is created, you can use it by providing the file name to the `--config` (or `-c`
@@ -116,7 +85,7 @@ And then:
simple-scaffold -c scaffold.json MyComponentName
```
- When the filename is omitted, the following files will be tried in order:
- When the a directory is given, the following files in the given directory will be tried in order:
- `scaffold.config.*`
- `scaffold.*`
@@ -162,6 +131,12 @@ simple-scaffold -g git://gitlab.com/<username>/<project_name> [-c <filename>] [-
simple-scaffold -g https://gitlab.com/<username>/<project_name>.git [-c <filename>] [-k <template_key>]
```
When a config file path is omitted, the files given in the list above will be tried on the root
directory of the git repository.
**Note:** The repository will be cloned to a temporary directory and removed after the scaffolding
has been done.
## Use In Node.js
You can also start a scaffold from Node.js with a remote file or URL config.

View File

@@ -28,6 +28,7 @@ To see this and more information anytime, add the `-h` or `--help` flag to your
| `--log-level` \| `-l` | Determine amount of logs to display. The values are: `none \| debug \| info \| warn \| error`. The provided level will display messages of the same level or higher. |
| `--dry-run` \| `-dr` | Don't emit files. This is good for testing your scaffolds and making sure they don't fail, without having to write actual file contents or create directories. |
| `--help` \| `-h` | Show this help message |
| `--version` \| `-v` | Display version. |
## Examples:

View File

@@ -15,8 +15,7 @@ title: Migration
- The `#template_file` syntax has been removed, you may use `--config` or `-c` to tell Simple
Scaffold which file to look for inside the git project. There is a default file priority list
which can find the file for you if it is in one of the supported filenames.
- `verbose` can now take the names `debug`, `info`, `warn`, `error` or `none` (case insensitive) or
as usual by using the numbering from before.
- `verbose` can now take the names `debug`, `info`, `warn`, `error` or `none` (case insensitive).
- `--create-sub-folder` (`-s`) has been renamed to `--subdir` (`-s`) in the CLI. The Node.js names
have been changed as well.
- `--sub-folder-name-helper` (`-sh`) has been renamed to `--subdir-helper` (`-sh`). The Node.js

View File

@@ -3,7 +3,7 @@ title: Usage
---
- [CLI Usage](cli)
- [Configuration Files](configuation_files)
- [Configuration Files](configuration_files)
- [Examples](examples)
- [Migration](migration)
- [Node.js Usage](node)

View File

@@ -5,7 +5,7 @@ import type * as Preset from "@docusaurus/preset-classic"
const config: Config = {
title: "Simple Scaffold",
tagline: "Generate any file structure - from single components to entire app boilerplates, with a single command.",
favicon: "img/favicon.ico",
favicon: "img/favicon.svg",
// Set the production url of your site here
url: "https://chenasraf.github.io",
@@ -64,13 +64,7 @@ const config: Config = {
sidebarPath: "./sidebars.ts",
// Please change this to your repo.
// Remove this to remove the "edit this page" links.
editUrl: "https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/",
},
blog: {
showReadingTime: true,
// Please change this to your repo.
// Remove this to remove the "edit this page" links.
editUrl: "https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/",
editUrl: "https://github.com/chenasraf/simple-scaffold/blob/master/docs",
},
theme: {
customCss: "./src/css/custom.css",
@@ -89,7 +83,7 @@ const config: Config = {
title: "Simple Scaffold",
logo: {
alt: "Simple Scaffold",
src: "img/logo.svg",
src: "img/favicon.svg",
},
items: [
{
@@ -127,7 +121,7 @@ const config: Config = {
position: "right",
},
{
href: "https://github.com/facebook/docusaurus",
href: "https://github.com/chenasraf/simple-scaffold",
label: "GitHub",
position: "right",
},

View File

@@ -22,3 +22,13 @@
justify-content: center;
gap: 2rem;
}
.heroImage {
margin-bottom: 1.5rem;
}
.logo {
width: 100%;
max-width: 300px;
margin: 0 auto;
}

View File

@@ -12,10 +12,12 @@ function HomepageHeader() {
return (
<header className={clsx("hero hero--primary", styles.heroBanner)}>
<div className="container">
<img className={styles.logo} src="img/logo-lg.svg" alt="Simple Scaffold" />
<Heading as="h1" className="hero__title">
{siteConfig.title}
</Heading>
<p className="hero__subtitle">{siteConfig.tagline}</p>
<img className={styles.heroImage} src="img/intro.gif" alt="Simple-Scaffold doing its thing" />
<div className={styles.buttons}>
<Link className="button button--secondary button--lg" to="/docs/api">
API

BIN
docs/static/img/favicon.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

20
docs/static/img/favicon.svg vendored Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 265 KiB

BIN
docs/static/img/intro.gif vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 385 KiB

BIN
docs/static/img/logo-lg.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

20
docs/static/img/logo-lg.svg vendored Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 281 KiB

BIN
docs/static/img/logo.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 432 KiB

View File

@@ -1,14 +1,19 @@
{
"name": "simple-scaffold",
"version": "0.0.0",
"version": "2.1.0",
"description": "Generate any file structure - from single components to entire app boilerplates, with a single command.",
"homepage": "https://chenasraf.github.io/simple-scaffold",
"repository": "https://github.com/chenasraf/simple-scaffold.git",
"author": "Chen Asraf <contact@casraf.dev>",
"homepage": "https: //chenasraf.github.io/simple-scaffold",
"repository": {
"type": "git",
"url": "https://github.com/chenasraf/simple-scaffold.git"
},
"author": "Chen Asraf <contact@casraf.dev> (https://casraf.dev)",
"license": "MIT",
"main": "index.js",
"bin": "cmd.js",
"packageManager": "pnpm@8.6.2",
"bin": {
"simple-scaffold": "cmd.js"
},
"packageManager": "pnpm@8.15.1",
"keywords": [
"javascript",
"cli",
@@ -37,22 +42,22 @@
"date-fns": "^3.3.1",
"glob": "^10.3.10",
"handlebars": "^4.7.8",
"massarg": "2.0.0-pre.12"
"massarg": "2.0.0"
},
"devDependencies": {
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/exec": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"@semantic-release/release-notes-generator": "^12.1.0",
"@types/jest": "^29.5.11",
"@types/jest": "^29.5.12",
"@types/mock-fs": "^4.13.4",
"@types/node": "^20.11.10",
"@types/node": "^20.11.17",
"@types/semantic-release": "^20.0.6",
"conventional-changelog": "^5.1.0",
"conventional-changelog-cli": "^4.1.0",
"jest": "^29.7.0",
"mock-fs": "^5.2.0",
"semantic-release": "^23.0.0",
"semantic-release": "^23.0.2",
"semantic-release-conventional-commits": "^3.0.0",
"ts-jest": "^29.1.2",
"ts-node": "^10.9.2",

376
pnpm-lock.yaml generated
View File

@@ -18,31 +18,31 @@ dependencies:
specifier: ^4.7.8
version: 4.7.8
massarg:
specifier: 2.0.0-pre.12
version: 2.0.0-pre.12
specifier: 2.0.0
version: 2.0.0
devDependencies:
'@semantic-release/changelog':
specifier: ^6.0.3
version: 6.0.3(semantic-release@23.0.0)
version: 6.0.3(semantic-release@23.0.2)
'@semantic-release/exec':
specifier: ^6.0.3
version: 6.0.3(semantic-release@23.0.0)
version: 6.0.3(semantic-release@23.0.2)
'@semantic-release/git':
specifier: ^10.0.1
version: 10.0.1(semantic-release@23.0.0)
version: 10.0.1(semantic-release@23.0.2)
'@semantic-release/release-notes-generator':
specifier: ^12.1.0
version: 12.1.0(semantic-release@23.0.0)
version: 12.1.0(semantic-release@23.0.2)
'@types/jest':
specifier: ^29.5.11
version: 29.5.11
specifier: ^29.5.12
version: 29.5.12
'@types/mock-fs':
specifier: ^4.13.4
version: 4.13.4
'@types/node':
specifier: ^20.11.10
version: 20.11.10
specifier: ^20.11.17
version: 20.11.17
'@types/semantic-release':
specifier: ^20.0.6
version: 20.0.6
@@ -54,13 +54,13 @@ devDependencies:
version: 4.1.0
jest:
specifier: ^29.7.0
version: 29.7.0(@types/node@20.11.10)(ts-node@10.9.2)
version: 29.7.0(@types/node@20.11.17)(ts-node@10.9.2)
mock-fs:
specifier: ^5.2.0
version: 5.2.0
semantic-release:
specifier: ^23.0.0
version: 23.0.0(typescript@5.3.3)
specifier: ^23.0.2
version: 23.0.2(typescript@5.3.3)
semantic-release-conventional-commits:
specifier: ^3.0.0
version: 3.0.0
@@ -69,7 +69,7 @@ devDependencies:
version: 29.1.2(@babel/core@7.23.9)(jest@29.7.0)(typescript@5.3.3)
ts-node:
specifier: ^10.9.2
version: 10.9.2(@types/node@20.11.10)(typescript@5.3.3)
version: 10.9.2(@types/node@20.11.17)(typescript@5.3.3)
typescript:
specifier: ^5.3.3
version: 5.3.3
@@ -465,7 +465,7 @@ packages:
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
dependencies:
'@jest/types': 29.6.3
'@types/node': 20.11.10
'@types/node': 20.11.17
chalk: 4.1.2
jest-message-util: 29.7.0
jest-util: 29.7.0
@@ -486,14 +486,14 @@ packages:
'@jest/test-result': 29.7.0
'@jest/transform': 29.7.0
'@jest/types': 29.6.3
'@types/node': 20.11.10
'@types/node': 20.11.17
ansi-escapes: 4.3.2
chalk: 4.1.2
ci-info: 3.9.0
exit: 0.1.2
graceful-fs: 4.2.11
jest-changed-files: 29.7.0
jest-config: 29.7.0(@types/node@20.11.10)(ts-node@10.9.2)
jest-config: 29.7.0(@types/node@20.11.17)(ts-node@10.9.2)
jest-haste-map: 29.7.0
jest-message-util: 29.7.0
jest-regex-util: 29.6.3
@@ -521,7 +521,7 @@ packages:
dependencies:
'@jest/fake-timers': 29.7.0
'@jest/types': 29.6.3
'@types/node': 20.11.10
'@types/node': 20.11.17
jest-mock: 29.7.0
dev: true
@@ -548,7 +548,7 @@ packages:
dependencies:
'@jest/types': 29.6.3
'@sinonjs/fake-timers': 10.3.0
'@types/node': 20.11.10
'@types/node': 20.11.17
jest-message-util: 29.7.0
jest-mock: 29.7.0
jest-util: 29.7.0
@@ -581,7 +581,7 @@ packages:
'@jest/transform': 29.7.0
'@jest/types': 29.6.3
'@jridgewell/trace-mapping': 0.3.22
'@types/node': 20.11.10
'@types/node': 20.11.17
chalk: 4.1.2
collect-v8-coverage: 1.0.2
exit: 0.1.2
@@ -669,7 +669,7 @@ packages:
'@jest/schemas': 29.6.3
'@types/istanbul-lib-coverage': 2.0.6
'@types/istanbul-reports': 3.0.4
'@types/node': 20.11.10
'@types/node': 20.11.17
'@types/yargs': 17.0.32
chalk: 4.1.2
dev: true
@@ -729,7 +729,7 @@ packages:
engines: {node: '>= 8'}
dependencies:
'@nodelib/fs.scandir': 2.1.5
fastq: 1.17.0
fastq: 1.17.1
dev: true
/@octokit/auth-token@4.0.0:
@@ -743,7 +743,7 @@ packages:
dependencies:
'@octokit/auth-token': 4.0.0
'@octokit/graphql': 7.0.2
'@octokit/request': 8.1.6
'@octokit/request': 8.2.0
'@octokit/request-error': 5.0.1
'@octokit/types': 12.4.0
before-after-hook: 2.2.3
@@ -762,7 +762,7 @@ packages:
resolution: {integrity: sha512-OJ2iGMtj5Tg3s6RaXH22cJcxXRi7Y3EBqbHTBRq+PQAqfaS8f/236fUrWhfSn8P4jovyzqucxme7/vWSSZBX2Q==}
engines: {node: '>= 18'}
dependencies:
'@octokit/request': 8.1.6
'@octokit/request': 8.2.0
'@octokit/types': 12.4.0
universal-user-agent: 6.0.1
dev: true
@@ -813,8 +813,8 @@ packages:
once: 1.4.0
dev: true
/@octokit/request@8.1.6:
resolution: {integrity: sha512-YhPaGml3ncZC1NfXpP3WZ7iliL1ap6tLkAp6MvbK2fTTPytzVUyUesBBogcdMm86uRYO5rHaM1xIWxigWZ17MQ==}
/@octokit/request@8.2.0:
resolution: {integrity: sha512-exPif6x5uwLqv1N1irkLG1zZNJkOtj8bZxuVHd71U5Ftuxf2wGNvAJyNBcPbPC+EBzwYEbBDdSFb8EPcjpYxPQ==}
engines: {node: '>= 18'}
dependencies:
'@octokit/endpoint': 9.0.4
@@ -857,7 +857,7 @@ packages:
config-chain: 1.1.13
dev: true
/@semantic-release/changelog@6.0.3(semantic-release@23.0.0):
/@semantic-release/changelog@6.0.3(semantic-release@23.0.2):
resolution: {integrity: sha512-dZuR5qByyfe3Y03TpmCvAxCyTnp7r5XwtHRf/8vD9EAn4ZWbavUX8adMtXYzE86EVh0gyLA7lm5yW4IV30XUag==}
engines: {node: '>=14.17'}
peerDependencies:
@@ -867,10 +867,10 @@ packages:
aggregate-error: 3.1.0
fs-extra: 11.2.0
lodash: 4.17.21
semantic-release: 23.0.0(typescript@5.3.3)
semantic-release: 23.0.2(typescript@5.3.3)
dev: true
/@semantic-release/commit-analyzer@11.1.0(semantic-release@23.0.0):
/@semantic-release/commit-analyzer@11.1.0(semantic-release@23.0.2):
resolution: {integrity: sha512-cXNTbv3nXR2hlzHjAMgbuiQVtvWHTlwwISt60B+4NZv01y/QRY7p2HcJm8Eh2StzcTJoNnflvKjHH/cjFS7d5g==}
engines: {node: ^18.17 || >=20.6.1}
peerDependencies:
@@ -883,7 +883,7 @@ packages:
import-from-esm: 1.3.3
lodash-es: 4.17.21
micromatch: 4.0.5
semantic-release: 23.0.0(typescript@5.3.3)
semantic-release: 23.0.2(typescript@5.3.3)
transitivePeerDependencies:
- supports-color
dev: true
@@ -898,7 +898,7 @@ packages:
engines: {node: '>=18'}
dev: true
/@semantic-release/exec@6.0.3(semantic-release@23.0.0):
/@semantic-release/exec@6.0.3(semantic-release@23.0.2):
resolution: {integrity: sha512-bxAq8vLOw76aV89vxxICecEa8jfaWwYITw6X74zzlO0mc/Bgieqx9kBRz9z96pHectiTAtsCwsQcUyLYWnp3VQ==}
engines: {node: '>=14.17'}
peerDependencies:
@@ -910,12 +910,12 @@ packages:
execa: 5.1.1
lodash: 4.17.21
parse-json: 5.2.0
semantic-release: 23.0.0(typescript@5.3.3)
semantic-release: 23.0.2(typescript@5.3.3)
transitivePeerDependencies:
- supports-color
dev: true
/@semantic-release/git@10.0.1(semantic-release@23.0.0):
/@semantic-release/git@10.0.1(semantic-release@23.0.2):
resolution: {integrity: sha512-eWrx5KguUcU2wUPaO6sfvZI0wPafUKAMNC18aXY4EnNcrZL86dEmpNVnC9uMpGZkmZJ9EfCVJBQx4pV4EMGT1w==}
engines: {node: '>=14.17'}
peerDependencies:
@@ -929,12 +929,12 @@ packages:
lodash: 4.17.21
micromatch: 4.0.5
p-reduce: 2.1.0
semantic-release: 23.0.0(typescript@5.3.3)
semantic-release: 23.0.2(typescript@5.3.3)
transitivePeerDependencies:
- supports-color
dev: true
/@semantic-release/github@9.2.6(semantic-release@23.0.0):
/@semantic-release/github@9.2.6(semantic-release@23.0.2):
resolution: {integrity: sha512-shi+Lrf6exeNZF+sBhK+P011LSbhmIAoUEgEY6SsxF8irJ+J2stwI5jkyDQ+4gzYyDImzV6LCKdYB9FXnQRWKA==}
engines: {node: '>=18'}
peerDependencies:
@@ -948,20 +948,20 @@ packages:
aggregate-error: 5.0.0
debug: 4.3.4
dir-glob: 3.0.1
globby: 14.0.0
http-proxy-agent: 7.0.0
https-proxy-agent: 7.0.2
globby: 14.0.1
http-proxy-agent: 7.0.1
https-proxy-agent: 7.0.3
issue-parser: 6.0.0
lodash-es: 4.17.21
mime: 4.0.1
p-filter: 4.1.0
semantic-release: 23.0.0(typescript@5.3.3)
semantic-release: 23.0.2(typescript@5.3.3)
url-join: 5.0.0
transitivePeerDependencies:
- supports-color
dev: true
/@semantic-release/npm@11.0.2(semantic-release@23.0.0):
/@semantic-release/npm@11.0.2(semantic-release@23.0.2):
resolution: {integrity: sha512-owtf3RjyPvRE63iUKZ5/xO4uqjRpVQDUB9+nnXj0xwfIeM9pRl+cG+zGDzdftR4m3f2s4Wyf3SexW+kF5DFtWA==}
engines: {node: ^18.17 || >=20}
peerDependencies:
@@ -978,12 +978,12 @@ packages:
rc: 1.2.8
read-pkg: 9.0.1
registry-auth-token: 5.0.2
semantic-release: 23.0.0(typescript@5.3.3)
semver: 7.5.4
semantic-release: 23.0.2(typescript@5.3.3)
semver: 7.6.0
tempy: 3.1.0
dev: true
/@semantic-release/release-notes-generator@12.1.0(semantic-release@23.0.0):
/@semantic-release/release-notes-generator@12.1.0(semantic-release@23.0.2):
resolution: {integrity: sha512-g6M9AjUKAZUZnxaJZnouNBeDNTCUrJ5Ltj+VJ60gJeDaRRahcHsry9HW8yKrnKkKNkx5lbWiEP1FPMqVNQz8Kg==}
engines: {node: ^18.17 || >=20.6.1}
peerDependencies:
@@ -999,7 +999,7 @@ packages:
into-stream: 7.0.0
lodash-es: 4.17.21
read-pkg-up: 11.0.0
semantic-release: 23.0.0(typescript@5.3.3)
semantic-release: 23.0.2(typescript@5.3.3)
transitivePeerDependencies:
- supports-color
dev: true
@@ -1013,8 +1013,8 @@ packages:
engines: {node: '>=10'}
dev: true
/@sindresorhus/merge-streams@1.0.0:
resolution: {integrity: sha512-rUV5WyJrJLoloD4NDN1V1+LDMDWOa4OTsT4yYJwQNpTU6FWxkxHpL7eu4w+DmiH8x/EAM1otkPE1+LaspIbplw==}
/@sindresorhus/merge-streams@2.2.0:
resolution: {integrity: sha512-UTce8mUwUW0RikMb/eseJ7ys0BRkZVFB86orHzrfW12ZmFtym5zua8joZ4L7okH2dDFHkcFjqnZ5GocWBXOFtA==}
engines: {node: '>=18'}
dev: true
@@ -1078,7 +1078,7 @@ packages:
/@types/graceful-fs@4.1.9:
resolution: {integrity: sha512-olP3sd1qOEe5dXTSaFvQG+02VdRXcdytWLAZsAq1PecU8uqQAhkrnbli7DagjtXKW/Bl7YJbUsa8MPcuc8LHEQ==}
dependencies:
'@types/node': 20.11.10
'@types/node': 20.11.17
dev: true
/@types/istanbul-lib-coverage@2.0.6:
@@ -1097,8 +1097,8 @@ packages:
'@types/istanbul-lib-report': 3.0.3
dev: true
/@types/jest@29.5.11:
resolution: {integrity: sha512-S2mHmYIVe13vrm6q4kN6fLYYAka15ALQki/vgDC3mIukEOx8WJlv0kQPM+d4w8Gp6u0uSdKND04IlTXBv0rwnQ==}
/@types/jest@29.5.12:
resolution: {integrity: sha512-eDC8bTvT/QhYdxJAulQikueigY5AsdBRH2yDKW3yveW7svY3+DzN84/2NUgkw10RTiJbWqZrTtoGVdYlvFJdLw==}
dependencies:
expect: 29.7.0
pretty-format: 29.7.0
@@ -1111,11 +1111,11 @@ packages:
/@types/mock-fs@4.13.4:
resolution: {integrity: sha512-mXmM0o6lULPI8z3XNnQCpL0BGxPwx1Ul1wXYEPBGl4efShyxW2Rln0JOPEWGyZaYZMM6OVXM/15zUuFMY52ljg==}
dependencies:
'@types/node': 20.11.10
'@types/node': 20.11.17
dev: true
/@types/node@20.11.10:
resolution: {integrity: sha512-rZEfe/hJSGYmdfX9tvcPMYeYPW2sNl50nsw4jZmRcaG0HIAb0WYEpsB05GOb53vjqpyE9GUhlDQ4jLSoB5q9kg==}
/@types/node@20.11.17:
resolution: {integrity: sha512-QmgQZGWu1Yw9TDyAP9ZzpFJKynYNeOvwMJmaxABfieQoVoiVOS6MN1WSpqpRcbeA5+RW82kraAVxCCJg+780Qw==}
dependencies:
undici-types: 5.26.5
dev: true
@@ -1127,7 +1127,7 @@ packages:
/@types/semantic-release@20.0.6:
resolution: {integrity: sha512-8YJXvsT1FwMrNdZI1e6NBHPzZWendDiUsLryzxurdup+9LnV3s9fF4NgO0D3LkBfLMnocb4Ax6TQ5yFdF3dXGQ==}
dependencies:
'@types/node': 20.11.10
'@types/node': 20.11.17
dev: true
/@types/stack-utils@2.0.3:
@@ -1238,8 +1238,8 @@ packages:
engines: {node: '>=12'}
dev: false
/ansicolors@0.3.2:
resolution: {integrity: sha512-QXu7BPrP29VllRxH8GwB7x5iX5qWKAAMLqKQGWTeLWVlNHNOpVMJ91dsxQAIWXpjuW5wqvxu3Jd/nRjrJ+0pqg==}
/any-promise@1.3.0:
resolution: {integrity: sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==}
dev: true
/anymatch@3.1.3:
@@ -1385,8 +1385,8 @@ packages:
engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7}
hasBin: true
dependencies:
caniuse-lite: 1.0.30001581
electron-to-chromium: 1.4.648
caniuse-lite: 1.0.30001587
electron-to-chromium: 1.4.667
node-releases: 2.0.14
update-browserslist-db: 1.0.13(browserslist@4.22.3)
dev: true
@@ -1432,16 +1432,8 @@ packages:
engines: {node: '>=10'}
dev: true
/caniuse-lite@1.0.30001581:
resolution: {integrity: sha512-whlTkwhqV2tUmP3oYhtNfaWGYHDdS3JYFQBKXxcUR9qqPWsRhFHhoISO2Xnl/g0xyKzht9mI1LZpiNWfMzHixQ==}
dev: true
/cardinal@2.1.1:
resolution: {integrity: sha512-JSr5eOgoEymtYHBjNWyjrMqet9Am2miJhlfKNdqLp6zoeAh0KN5dRAcxlecj5mAJrmQomgiOBj35xHLrFjqBpw==}
hasBin: true
dependencies:
ansicolors: 0.3.2
redeyed: 2.1.1
/caniuse-lite@1.0.30001587:
resolution: {integrity: sha512-HMFNotUmLXn71BQxg8cijvqxnIAofforZOwGsxyXJ0qugTdspUF4sPSJ2vhgprHCB996tIDzEq1ubumPDV8ULA==}
dev: true
/chalk@2.4.2:
@@ -1491,6 +1483,19 @@ packages:
escape-string-regexp: 5.0.0
dev: true
/cli-highlight@2.1.11:
resolution: {integrity: sha512-9KDcoEVwyUXrjcJNvHD0NFc/hiwe/WPVYIleQh2O1N2Zro5gWJZ/K+3DGn8w8P/F6FxOgzyC5bxDyHIgCSPhGg==}
engines: {node: '>=8.0.0', npm: '>=5.0.0'}
hasBin: true
dependencies:
chalk: 4.1.2
highlight.js: 10.7.3
mz: 2.7.0
parse5: 5.1.1
parse5-htmlparser2-tree-adapter: 6.0.1
yargs: 16.2.0
dev: true
/cli-table3@0.6.3:
resolution: {integrity: sha512-w5Jac5SykAeZJKntOxJCrm63Eg5/4dhMWIcuTbo9rpE+brgaSZo0RuNJZeOyMgsUdhDeojvgyQLmjI+K50ZGyg==}
engines: {node: 10.* || >= 12.*}
@@ -1500,6 +1505,14 @@ packages:
'@colors/colors': 1.5.0
dev: true
/cliui@7.0.4:
resolution: {integrity: sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==}
dependencies:
string-width: 4.2.3
strip-ansi: 6.0.1
wrap-ansi: 7.0.0
dev: true
/cliui@8.0.1:
resolution: {integrity: sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==}
engines: {node: '>=12'}
@@ -1647,7 +1660,7 @@ packages:
handlebars: 4.7.8
json-stringify-safe: 5.0.1
meow: 12.1.1
semver: 7.5.4
semver: 7.6.0
split2: 4.2.0
dev: true
@@ -1721,7 +1734,7 @@ packages:
typescript: 5.3.3
dev: true
/create-jest@29.7.0(@types/node@20.11.10)(ts-node@10.9.2):
/create-jest@29.7.0(@types/node@20.11.17)(ts-node@10.9.2):
resolution: {integrity: sha512-Adz2bdH0Vq3F53KEMJOoftQFutWCukm6J24wbPWRO4k1kMY7gS7ds/uoJkNuV8wDCtWWnuwGcJwpWcih+zEW1Q==}
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
hasBin: true
@@ -1730,7 +1743,7 @@ packages:
chalk: 4.1.2
exit: 0.1.2
graceful-fs: 4.2.11
jest-config: 29.7.0(@types/node@20.11.10)(ts-node@10.9.2)
jest-config: 29.7.0(@types/node@20.11.17)(ts-node@10.9.2)
jest-util: 29.7.0
prompts: 2.4.2
transitivePeerDependencies:
@@ -1855,8 +1868,8 @@ packages:
resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==}
dev: false
/electron-to-chromium@1.4.648:
resolution: {integrity: sha512-EmFMarXeqJp9cUKu/QEciEApn0S/xRcpZWuAm32U7NgoZCimjsilKXHRO9saeEW55eHZagIDg6XTUOv32w9pjg==}
/electron-to-chromium@1.4.667:
resolution: {integrity: sha512-66L3pLlWhTNVUhnmSA5+qDM3fwnXsM6KAqE36e2w4KN0g6pkEtlT5bs41FQtQwVwKnfhNBXiWRLPs30HSxd7Kw==}
dev: true
/emittery@0.13.1:
@@ -1894,8 +1907,8 @@ packages:
is-arrayish: 0.2.1
dev: true
/escalade@3.1.1:
resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==}
/escalade@3.1.2:
resolution: {integrity: sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==}
engines: {node: '>=6'}
dev: true
@@ -1981,8 +1994,8 @@ packages:
resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==}
dev: true
/fastq@1.17.0:
resolution: {integrity: sha512-zGygtijUMT7jnk3h26kUms3BkSDp4IfIKjmnqI2tvx6nuBfiF1UqOxbnLfzdv+apBy+53oaImsKtMw/xYbW+1w==}
/fastq@1.17.1:
resolution: {integrity: sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==}
dependencies:
reusify: 1.0.4
dev: true
@@ -2146,7 +2159,7 @@ packages:
hasBin: true
dependencies:
meow: 12.1.1
semver: 7.5.4
semver: 7.6.0
dev: true
/glob-parent@5.1.2:
@@ -2184,13 +2197,13 @@ packages:
engines: {node: '>=4'}
dev: true
/globby@14.0.0:
resolution: {integrity: sha512-/1WM/LNHRAOH9lZta77uGbq0dAEQM+XjNesWwhlERDVenqothRbnzTrL3/LrIoEPPjeUHC3vrS6TwoyxeHs7MQ==}
/globby@14.0.1:
resolution: {integrity: sha512-jOMLD2Z7MAhyG8aJpNOpmziMOP4rPLcc95oQPKXBazW82z+CEgPFBQvEpRUa1KeIMUJo4Wsm+q6uzO/Q/4BksQ==}
engines: {node: '>=18'}
dependencies:
'@sindresorhus/merge-streams': 1.0.0
'@sindresorhus/merge-streams': 2.2.0
fast-glob: 3.3.2
ignore: 5.3.0
ignore: 5.3.1
path-type: 5.0.0
slash: 5.1.0
unicorn-magic: 0.1.0
@@ -2230,13 +2243,17 @@ packages:
resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==}
engines: {node: '>=8'}
/hasown@2.0.0:
resolution: {integrity: sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==}
/hasown@2.0.1:
resolution: {integrity: sha512-1/th4MHjnwncwXsIW6QMzlvYL9kG5e/CpVvLRZe4XPa8TOUNbCELqmvhDmnkNsAjwaG4+I8gJJL0JBvTTLO9qA==}
engines: {node: '>= 0.4'}
dependencies:
function-bind: 1.1.2
dev: true
/highlight.js@10.7.3:
resolution: {integrity: sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A==}
dev: true
/hook-std@3.0.0:
resolution: {integrity: sha512-jHRQzjSDzMtFy34AGj1DN+vq54WVuhSvKgrHf0OMiFQTwDD4L/qqofVEWjLOBMTn5+lCD3fPg32W9yOfnEJTTw==}
engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
@@ -2264,8 +2281,8 @@ packages:
resolution: {integrity: sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==}
dev: true
/http-proxy-agent@7.0.0:
resolution: {integrity: sha512-+ZT+iBxVUQ1asugqnD6oWoRiS25AkjNfG085dKJGtGxkdwLQrMKU5wJr2bOOFAXzKcTuqq+7fZlTMgG3SRfIYQ==}
/http-proxy-agent@7.0.1:
resolution: {integrity: sha512-My1KCEPs6A0hb4qCVzYp8iEvA8j8YqcvXLZZH8C9OFuTYpYjHE7N2dtG3mRl1HMD4+VGXpF3XcDVcxGBT7yDZQ==}
engines: {node: '>= 14'}
dependencies:
agent-base: 7.1.0
@@ -2274,8 +2291,8 @@ packages:
- supports-color
dev: true
/https-proxy-agent@7.0.2:
resolution: {integrity: sha512-NmLNjm6ucYwtcUmL7JQC1ZQ57LmHP4lT15FQ8D61nak1rO6DH+fz5qNK2Ap5UN4ZapYICE3/0KodcLYSPsPbaA==}
/https-proxy-agent@7.0.3:
resolution: {integrity: sha512-kCnwztfX0KZJSLOBrcL0emLeFako55NWMovvyPP2AjsghNk9RB1yjSI+jVumPHYZsNXegNoqupSW9IY3afSH8w==}
engines: {node: '>= 14'}
dependencies:
agent-base: 7.1.0
@@ -2294,8 +2311,8 @@ packages:
engines: {node: '>=16.17.0'}
dev: true
/ignore@5.3.0:
resolution: {integrity: sha512-g7dmpshy+gD7mh88OC9NwSGTKoc3kyLAZQRU1mt53Aw/vnvfXnbC+F/7F7QoYVKbV+KNvJx8wArewKy1vXMtlg==}
/ignore@5.3.1:
resolution: {integrity: sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw==}
engines: {node: '>= 4'}
dev: true
@@ -2380,7 +2397,7 @@ packages:
/is-core-module@2.13.1:
resolution: {integrity: sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==}
dependencies:
hasown: 2.0.0
hasown: 2.0.1
dev: true
/is-extglob@2.1.1:
@@ -2492,7 +2509,7 @@ packages:
'@babel/parser': 7.23.9
'@istanbuljs/schema': 0.1.3
istanbul-lib-coverage: 3.2.2
semver: 7.5.4
semver: 7.6.0
transitivePeerDependencies:
- supports-color
dev: true
@@ -2556,7 +2573,7 @@ packages:
'@jest/expect': 29.7.0
'@jest/test-result': 29.7.0
'@jest/types': 29.6.3
'@types/node': 20.11.10
'@types/node': 20.11.17
chalk: 4.1.2
co: 4.6.0
dedent: 1.5.1
@@ -2577,7 +2594,7 @@ packages:
- supports-color
dev: true
/jest-cli@29.7.0(@types/node@20.11.10)(ts-node@10.9.2):
/jest-cli@29.7.0(@types/node@20.11.17)(ts-node@10.9.2):
resolution: {integrity: sha512-OVVobw2IubN/GSYsxETi+gOe7Ka59EFMR/twOU3Jb2GnKKeMGJB5SGUUrEz3SFVmJASUdZUzy83sLNNQ2gZslg==}
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
hasBin: true
@@ -2591,10 +2608,10 @@ packages:
'@jest/test-result': 29.7.0
'@jest/types': 29.6.3
chalk: 4.1.2
create-jest: 29.7.0(@types/node@20.11.10)(ts-node@10.9.2)
create-jest: 29.7.0(@types/node@20.11.17)(ts-node@10.9.2)
exit: 0.1.2
import-local: 3.1.0
jest-config: 29.7.0(@types/node@20.11.10)(ts-node@10.9.2)
jest-config: 29.7.0(@types/node@20.11.17)(ts-node@10.9.2)
jest-util: 29.7.0
jest-validate: 29.7.0
yargs: 17.7.2
@@ -2605,7 +2622,7 @@ packages:
- ts-node
dev: true
/jest-config@29.7.0(@types/node@20.11.10)(ts-node@10.9.2):
/jest-config@29.7.0(@types/node@20.11.17)(ts-node@10.9.2):
resolution: {integrity: sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ==}
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
peerDependencies:
@@ -2620,7 +2637,7 @@ packages:
'@babel/core': 7.23.9
'@jest/test-sequencer': 29.7.0
'@jest/types': 29.6.3
'@types/node': 20.11.10
'@types/node': 20.11.17
babel-jest: 29.7.0(@babel/core@7.23.9)
chalk: 4.1.2
ci-info: 3.9.0
@@ -2640,7 +2657,7 @@ packages:
pretty-format: 29.7.0
slash: 3.0.0
strip-json-comments: 3.1.1
ts-node: 10.9.2(@types/node@20.11.10)(typescript@5.3.3)
ts-node: 10.9.2(@types/node@20.11.17)(typescript@5.3.3)
transitivePeerDependencies:
- babel-plugin-macros
- supports-color
@@ -2681,7 +2698,7 @@ packages:
'@jest/environment': 29.7.0
'@jest/fake-timers': 29.7.0
'@jest/types': 29.6.3
'@types/node': 20.11.10
'@types/node': 20.11.17
jest-mock: 29.7.0
jest-util: 29.7.0
dev: true
@@ -2697,7 +2714,7 @@ packages:
dependencies:
'@jest/types': 29.6.3
'@types/graceful-fs': 4.1.9
'@types/node': 20.11.10
'@types/node': 20.11.17
anymatch: 3.1.3
fb-watchman: 2.0.2
graceful-fs: 4.2.11
@@ -2748,7 +2765,7 @@ packages:
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
dependencies:
'@jest/types': 29.6.3
'@types/node': 20.11.10
'@types/node': 20.11.17
jest-util: 29.7.0
dev: true
@@ -2803,7 +2820,7 @@ packages:
'@jest/test-result': 29.7.0
'@jest/transform': 29.7.0
'@jest/types': 29.6.3
'@types/node': 20.11.10
'@types/node': 20.11.17
chalk: 4.1.2
emittery: 0.13.1
graceful-fs: 4.2.11
@@ -2834,7 +2851,7 @@ packages:
'@jest/test-result': 29.7.0
'@jest/transform': 29.7.0
'@jest/types': 29.6.3
'@types/node': 20.11.10
'@types/node': 20.11.17
chalk: 4.1.2
cjs-module-lexer: 1.2.3
collect-v8-coverage: 1.0.2
@@ -2876,7 +2893,7 @@ packages:
jest-util: 29.7.0
natural-compare: 1.4.0
pretty-format: 29.7.0
semver: 7.5.4
semver: 7.6.0
transitivePeerDependencies:
- supports-color
dev: true
@@ -2886,7 +2903,7 @@ packages:
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
dependencies:
'@jest/types': 29.6.3
'@types/node': 20.11.10
'@types/node': 20.11.17
chalk: 4.1.2
ci-info: 3.9.0
graceful-fs: 4.2.11
@@ -2911,7 +2928,7 @@ packages:
dependencies:
'@jest/test-result': 29.7.0
'@jest/types': 29.6.3
'@types/node': 20.11.10
'@types/node': 20.11.17
ansi-escapes: 4.3.2
chalk: 4.1.2
emittery: 0.13.1
@@ -2923,13 +2940,13 @@ packages:
resolution: {integrity: sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw==}
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
dependencies:
'@types/node': 20.11.10
'@types/node': 20.11.17
jest-util: 29.7.0
merge-stream: 2.0.0
supports-color: 8.1.1
dev: true
/jest@29.7.0(@types/node@20.11.10)(ts-node@10.9.2):
/jest@29.7.0(@types/node@20.11.17)(ts-node@10.9.2):
resolution: {integrity: sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw==}
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
hasBin: true
@@ -2942,7 +2959,7 @@ packages:
'@jest/core': 29.7.0(ts-node@10.9.2)
'@jest/types': 29.6.3
import-local: 3.1.0
jest-cli: 29.7.0(@types/node@20.11.10)(ts-node@10.9.2)
jest-cli: 29.7.0(@types/node@20.11.17)(ts-node@10.9.2)
transitivePeerDependencies:
- '@types/node'
- babel-plugin-macros
@@ -3120,7 +3137,7 @@ packages:
resolution: {integrity: sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==}
engines: {node: '>=10'}
dependencies:
semver: 7.5.4
semver: 7.6.0
dev: true
/make-error@1.3.6:
@@ -3143,29 +3160,29 @@ packages:
engines: {node: '>=8'}
dev: true
/marked-terminal@6.2.0(marked@11.2.0):
resolution: {integrity: sha512-ubWhwcBFHnXsjYNsu+Wndpg0zhY4CahSpPlA70PlO0rR9r2sZpkyU+rkCsOWH+KMEkx847UpALON+HWgxowFtw==}
/marked-terminal@7.0.0(marked@12.0.0):
resolution: {integrity: sha512-sNEx8nn9Ktcm6pL0TnRz8tnXq/mSS0Q1FRSwJOAqw4lAB4l49UeDf85Gm1n9RPFm5qurCPjwi1StAQT2XExhZw==}
engines: {node: '>=16.0.0'}
peerDependencies:
marked: '>=1 <12'
marked: '>=1 <13'
dependencies:
ansi-escapes: 6.2.0
cardinal: 2.1.1
chalk: 5.3.0
cli-highlight: 2.1.11
cli-table3: 0.6.3
marked: 11.2.0
marked: 12.0.0
node-emoji: 2.1.3
supports-hyperlinks: 3.0.0
dev: true
/marked@11.2.0:
resolution: {integrity: sha512-HR0m3bvu0jAPYiIvLUUQtdg1g6D247//lvcekpHO1WMvbwDlwSkZAX9Lw4F4YHE1T0HaaNve0tuAWuV1UJ6vtw==}
/marked@12.0.0:
resolution: {integrity: sha512-Vkwtq9rLqXryZnWaQc86+FHLC6tr/fycMfYAhiOIXkrNmeGAyhSxjqu0Rs1i0bBqw5u0S7+lV9fdH2ZSVaoa0w==}
engines: {node: '>= 18'}
hasBin: true
dev: true
/massarg@2.0.0-pre.12:
resolution: {integrity: sha512-ncD9mXRQh4y8IIi5qcNEzh0qsqXyVq0FH0/v2vdMy/+WJCdAIuKG3TqlWML1SWMH4QdqZ/XJnbDfp8u2i91NNg==}
/massarg@2.0.0:
resolution: {integrity: sha512-oeB1dT/e4K3GBCPmUPwPXybeZbjrAnjsoMWSqshlfs4ndkeNdyxEHr6UAf0bkZMu3pqxT/QqembAM4nrUcPrAQ==}
dependencies:
zod: 3.22.4
dev: false
@@ -3269,6 +3286,14 @@ packages:
resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==}
dev: true
/mz@2.7.0:
resolution: {integrity: sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==}
dependencies:
any-promise: 1.3.0
object-assign: 4.1.1
thenify-all: 1.6.0
dev: true
/natural-compare@1.4.0:
resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==}
dev: true
@@ -3313,7 +3338,7 @@ packages:
dependencies:
hosted-git-info: 4.1.0
is-core-module: 2.13.1
semver: 7.5.4
semver: 7.6.0
validate-npm-package-license: 3.0.4
dev: true
@@ -3323,7 +3348,7 @@ packages:
dependencies:
hosted-git-info: 7.0.1
is-core-module: 2.13.1
semver: 7.5.4
semver: 7.6.0
validate-npm-package-license: 3.0.4
dev: true
@@ -3428,6 +3453,11 @@ packages:
- which
- write-file-atomic
/object-assign@4.1.1:
resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==}
engines: {node: '>=0.10.0'}
dev: true
/once@1.4.0:
resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==}
dependencies:
@@ -3581,7 +3611,21 @@ packages:
dependencies:
'@babel/code-frame': 7.23.5
index-to-position: 0.1.2
type-fest: 4.10.1
type-fest: 4.10.2
dev: true
/parse5-htmlparser2-tree-adapter@6.0.1:
resolution: {integrity: sha512-qPuWvbLgvDGilKc5BoicRovlT4MtYT6JfJyBOMDsKoiT+GiuP5qyrPCnR9HcPECIJJmZh5jRndyNThnhhb/vlA==}
dependencies:
parse5: 6.0.1
dev: true
/parse5@5.1.1:
resolution: {integrity: sha512-ugq4DFI0Ptb+WWjAdOK16+u/nHfiIrcE+sh8kZMaM0WllQKLI9rOUq6c2b7cwPkXdzfQESqvoqK6ug7U/Yyzug==}
dev: true
/parse5@6.0.1:
resolution: {integrity: sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==}
dev: true
/path-exists@3.0.0:
@@ -3727,7 +3771,7 @@ packages:
dependencies:
find-up: 6.3.0
read-pkg: 8.1.0
type-fest: 4.10.1
type-fest: 4.10.2
dev: true
/read-pkg-up@11.0.0:
@@ -3737,7 +3781,7 @@ packages:
dependencies:
find-up-simple: 1.0.0
read-pkg: 9.0.1
type-fest: 4.10.1
type-fest: 4.10.2
dev: true
/read-pkg-up@7.0.1:
@@ -3766,7 +3810,7 @@ packages:
'@types/normalize-package-data': 2.4.4
normalize-package-data: 6.0.0
parse-json: 7.1.1
type-fest: 4.10.1
type-fest: 4.10.2
dev: true
/read-pkg@9.0.1:
@@ -3776,7 +3820,7 @@ packages:
'@types/normalize-package-data': 2.4.4
normalize-package-data: 6.0.0
parse-json: 8.1.0
type-fest: 4.10.1
type-fest: 4.10.2
unicorn-magic: 0.1.0
dev: true
@@ -3809,12 +3853,6 @@ packages:
strip-indent: 3.0.0
dev: true
/redeyed@2.1.1:
resolution: {integrity: sha512-FNpGGo1DycYAdnrKFxCMmKYgo/mILAqtRYbkdQD8Ep/Hk2PQ5+aEAEx+IU713RTDmuBaH0c8P5ZozurNu5ObRQ==}
dependencies:
esprima: 4.0.1
dev: true
/registry-auth-token@5.0.2:
resolution: {integrity: sha512-o/3ikDxtXaA59BmZuZrJZDJv8NMDGSj+6j6XaeBmHw8eY1i1qd9+6H+LjVvQXx3HN6aRCGa1cUdJ9RaJZUugnQ==}
engines: {node: '>=14'}
@@ -3884,16 +3922,16 @@ packages:
conventional-commits-parser: 3.2.4
dev: true
/semantic-release@23.0.0(typescript@5.3.3):
resolution: {integrity: sha512-Jz7jEWO2igTtske112gC4PPE2whCMVrsgxUPG3/SZI7VE357suIUZFlJd1Yu0g2I6RPc2HxNEfUg7KhmDTjwqg==}
/semantic-release@23.0.2(typescript@5.3.3):
resolution: {integrity: sha512-OnVYJ6Xgzwe1x8MKswba7RU9+5djS1MWRTrTn5qsq3xZYpslroZkV9Pt0dA2YcIuieeuSZWJhn+yUWoBUHO5Fw==}
engines: {node: '>=20.8.1'}
hasBin: true
dependencies:
'@semantic-release/commit-analyzer': 11.1.0(semantic-release@23.0.0)
'@semantic-release/commit-analyzer': 11.1.0(semantic-release@23.0.2)
'@semantic-release/error': 4.0.0
'@semantic-release/github': 9.2.6(semantic-release@23.0.0)
'@semantic-release/npm': 11.0.2(semantic-release@23.0.0)
'@semantic-release/release-notes-generator': 12.1.0(semantic-release@23.0.0)
'@semantic-release/github': 9.2.6(semantic-release@23.0.2)
'@semantic-release/npm': 11.0.2(semantic-release@23.0.2)
'@semantic-release/release-notes-generator': 12.1.0(semantic-release@23.0.2)
aggregate-error: 5.0.0
cosmiconfig: 9.0.0(typescript@5.3.3)
debug: 4.3.4
@@ -3907,14 +3945,14 @@ packages:
hosted-git-info: 7.0.1
import-from-esm: 1.3.3
lodash-es: 4.17.21
marked: 11.2.0
marked-terminal: 6.2.0(marked@11.2.0)
marked: 12.0.0
marked-terminal: 7.0.0(marked@12.0.0)
micromatch: 4.0.5
p-each-series: 3.0.0
p-reduce: 3.0.0
read-pkg-up: 11.0.0
resolve-from: 5.0.0
semver: 7.5.4
semver: 7.6.0
semver-diff: 4.0.0
signale: 1.4.0
yargs: 17.7.2
@@ -3927,7 +3965,7 @@ packages:
resolution: {integrity: sha512-0Ju4+6A8iOnpL/Thra7dZsSlOHYAHIeMxfhWQRI1/VLcT3WDBZKKtQt/QkBOsiIN9ZpuvHE6cGZ0x4glCMmfiA==}
engines: {node: '>=12'}
dependencies:
semver: 7.5.4
semver: 7.6.0
dev: true
/semver-regex@4.0.5:
@@ -3945,8 +3983,8 @@ packages:
hasBin: true
dev: true
/semver@7.5.4:
resolution: {integrity: sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==}
/semver@7.6.0:
resolution: {integrity: sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==}
engines: {node: '>=10'}
hasBin: true
dependencies:
@@ -4020,7 +4058,7 @@ packages:
resolution: {integrity: sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==}
dependencies:
spdx-expression-parse: 3.0.1
spdx-license-ids: 3.0.16
spdx-license-ids: 3.0.17
dev: true
/spdx-exceptions@2.4.0:
@@ -4031,11 +4069,11 @@ packages:
resolution: {integrity: sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==}
dependencies:
spdx-exceptions: 2.4.0
spdx-license-ids: 3.0.16
spdx-license-ids: 3.0.17
dev: true
/spdx-license-ids@3.0.16:
resolution: {integrity: sha512-eWN+LnM3GR6gPu35WxNgbGl8rmY1AEmoMDvL/QD6zYmPWgywxWqJWNdLGT+ke8dKNWrcYgYjPpG5gbTfghP8rw==}
/spdx-license-ids@3.0.17:
resolution: {integrity: sha512-sh8PWc/ftMqAAdFiBu6Fy6JUOYjqDJBJvIhpfDMyHrr0Rbp5liZqd4TjtQ/RgfLjKFZb+LMx5hpml5qOWy0qvg==}
dev: true
/split2@1.0.0:
@@ -4234,6 +4272,19 @@ packages:
engines: {node: '>=8'}
dev: true
/thenify-all@1.6.0:
resolution: {integrity: sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==}
engines: {node: '>=0.8'}
dependencies:
thenify: 3.3.1
dev: true
/thenify@3.3.1:
resolution: {integrity: sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==}
dependencies:
any-promise: 1.3.0
dev: true
/through2@2.0.5:
resolution: {integrity: sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==}
dependencies:
@@ -4301,17 +4352,17 @@ packages:
'@babel/core': 7.23.9
bs-logger: 0.2.6
fast-json-stable-stringify: 2.1.0
jest: 29.7.0(@types/node@20.11.10)(ts-node@10.9.2)
jest: 29.7.0(@types/node@20.11.17)(ts-node@10.9.2)
jest-util: 29.7.0
json5: 2.2.3
lodash.memoize: 4.1.2
make-error: 1.3.6
semver: 7.5.4
semver: 7.6.0
typescript: 5.3.3
yargs-parser: 21.1.1
dev: true
/ts-node@10.9.2(@types/node@20.11.10)(typescript@5.3.3):
/ts-node@10.9.2(@types/node@20.11.17)(typescript@5.3.3):
resolution: {integrity: sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==}
hasBin: true
peerDependencies:
@@ -4330,7 +4381,7 @@ packages:
'@tsconfig/node12': 1.0.11
'@tsconfig/node14': 1.0.3
'@tsconfig/node16': 1.0.4
'@types/node': 20.11.10
'@types/node': 20.11.17
acorn: 8.11.3
acorn-walk: 8.3.2
arg: 4.1.3
@@ -4382,8 +4433,8 @@ packages:
engines: {node: '>=14.16'}
dev: true
/type-fest@4.10.1:
resolution: {integrity: sha512-7ZnJYTp6uc04uYRISWtiX3DSKB/fxNQT0B5o1OUeCqiQiwF+JC9+rJiZIDrPrNCLLuTqyQmh4VdQqh/ZOkv9MQ==}
/type-fest@4.10.2:
resolution: {integrity: sha512-anpAG63wSpdEbLwOqH8L84urkL6PiVIov3EMmgIhhThevh9aiMQov+6Btx0wldNcvm4wV+e2/Rt1QdDwKHFbHw==}
engines: {node: '>=16'}
dev: true
@@ -4437,7 +4488,7 @@ packages:
browserslist: '>= 4.21.0'
dependencies:
browserslist: 4.22.3
escalade: 3.1.1
escalade: 3.1.2
picocolors: 1.0.0
dev: true
@@ -4543,12 +4594,25 @@ packages:
engines: {node: '>=12'}
dev: true
/yargs@16.2.0:
resolution: {integrity: sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==}
engines: {node: '>=10'}
dependencies:
cliui: 7.0.4
escalade: 3.1.2
get-caller-file: 2.0.5
require-directory: 2.1.1
string-width: 4.2.3
y18n: 5.0.8
yargs-parser: 20.2.9
dev: true
/yargs@17.7.2:
resolution: {integrity: sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==}
engines: {node: '>=12'}
dependencies:
cliui: 8.0.1
escalade: 3.1.1
escalade: 3.1.2
get-caller-file: 2.0.5
require-directory: 2.1.1
string-width: 4.2.3

View File

@@ -1,37 +1,69 @@
/** @type {import('semantic-release').Options} */
const ref = process.env.GITHUB_REF || ""
const branch = ref.split("/").pop()
/**
* @type {import('semantic-release').GlobalConfig}
*/
module.exports = {
branches: ["master", { name: "pre", prerelease: true }],
analyzeCommits: {
path: "semantic-release-conventional-commits",
},
plugins: [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/changelog",
"@semantic-release/npm",
{
changelogFile: "CHANGELOG.md",
changelogTitle: "# Change Log",
// only update the pkg version on root, don't publish
npmPublish: false,
},
],
// [
// '@semantic-release/npm',
// {
// // only update the pkg version on doc, don't publish
// npmPublish: false,
// pkgRoot: 'doc',
// },
// ]
[
"@semantic-release/exec",
{
publish: "cd ./dist && pnpm pack --pack-destination=../",
},
],
[
"@semantic-release/npm",
{
npmPublish: true,
// publish from dist dir instead of root
pkgRoot: "dist",
},
],
[
"@semantic-release/git",
{
assets: ["CHANGELOG.md"],
},
],
[
"@semantic-release/github",
{
assets: ["*.tgz"],
},
],
],
branch === "master"
? [
"@semantic-release/changelog",
{
changelogFile: "CHANGELOG.md",
changelogTitle: "# Change Log",
},
]
: undefined,
[
"@semantic-release/git",
{
assets: ["package.json", "CHANGELOG.md"].filter(Boolean),
},
],
//
// [
// '@semantic-release/exec',
// {
// verifyReleaseCmd: 'echo ${nextRelease.version} > .VERSION',
// },
// ],
].filter(Boolean),
}

View File

@@ -1,4 +1,5 @@
/** @type {import('simple-scaffold').ScaffoldConfigFile} */
// @ts-check
/** @type {import('./dist').ScaffoldConfigFile} */
module.exports = (conf) => {
console.log("Config:", conf)
return {
@@ -12,5 +13,10 @@ module.exports = (conf) => {
output: "examples/test-output/component",
data: { property: "myProp", value: "10" },
},
configs: {
templates: ["examples/test-input/**/.*"],
output: "examples/test-output/configs",
name: "---",
},
}
}

View File

@@ -1,4 +1,6 @@
#!/usr/bin/env node
import os from "node:os"
import { massarg } from "massarg"
import chalk from "chalk"
import { LogLevel, ScaffoldCmdConfig } from "./types"
@@ -6,21 +8,38 @@ import { Scaffold } from "./scaffold"
import path from "node:path"
import fs from "node:fs/promises"
import { parseAppendData, parseConfigFile } from "./config"
import { log } from "./logger"
export async function parseCliArgs(args = process.argv.slice(2)) {
const isProjectRoot = Boolean(await fs.stat(path.join(__dirname, "package.json")).catch(() => false))
const pkgFile = await fs.readFile(path.resolve(__dirname, isProjectRoot ? "." : "..", "package.json"))
const pkg = JSON.parse(pkgFile.toString())
const isVersionFlag = args.includes("--version") || args.includes("-v")
const isConfigProvided =
args.includes("--config") || args.includes("-c") || args.includes("--git") || args.includes("-g")
args.includes("--config") || args.includes("-c") || args.includes("--git") || args.includes("-g") || isVersionFlag
return massarg<ScaffoldCmdConfig>({
name: pkg.name,
description: pkg.description,
})
.main(async (config) => {
const parsed = await parseConfigFile(config)
return Scaffold(parsed)
if (config.version) {
console.log(pkg.version)
return
}
log(config, LogLevel.info, `Simple Scaffold v${pkg.version}`)
const tmpPath = path.resolve(os.tmpdir(), `scaffold-config-${Date.now()}`)
try {
log(config, LogLevel.debug, "Parsing config file...", config)
const parsed = await parseConfigFile(config, tmpPath)
await Scaffold(parsed)
} catch (e) {
const message = "message" in (e as any) ? (e as any).message : e?.toString()
log(config, LogLevel.error, message)
} finally {
log(config, LogLevel.debug, "Cleaning up temporary files...", tmpPath)
await fs.rm(tmpPath, { recursive: true, force: true })
}
})
.option({
name: "name",
@@ -29,7 +48,7 @@ export async function parseCliArgs(args = process.argv.slice(2)) {
"Name to be passed to the generated files. `{{name}}` and other data parameters inside " +
"contents and file names will be replaced accordingly. You may omit the `--name` or `-n` for this specific option.",
isDefault: true,
required: true,
required: !isConfigProvided,
})
.option({
name: "config",
@@ -119,7 +138,13 @@ export async function parseCliArgs(args = process.argv.slice(2)) {
"Determine amount of logs to display. The values are: " +
`${chalk.bold`\`none | debug | info | warn | error\``}. ` +
"The provided level will display messages of the same level or higher.",
parse: Number,
parse: (v) => {
const val = v.toLowerCase()
if (!(val in LogLevel)) {
throw new Error(`Invalid log level: ${val}, must be one of: ${Object.keys(LogLevel).join(", ")}`)
}
return val
},
})
.flag({
name: "dry-run",
@@ -129,6 +154,11 @@ export async function parseCliArgs(args = process.argv.slice(2)) {
"Don't emit files. This is good for testing your scaffolds and making sure they " +
"don't fail, without having to write actual file contents or create directories.",
})
.flag({
name: "version",
aliases: ["v"],
description: "Display version.",
})
.example({
description: "Usage with config file",
input: "simple-scaffold -c scaffold.cmd.js --key component",

View File

@@ -1,4 +1,5 @@
import path from "node:path"
import fs from "node:fs/promises"
import {
ConfigLoadConfig,
FileResponse,
@@ -14,6 +15,7 @@ import { handlebarsParse } from "./parser"
import { log } from "./logger"
import { resolve, wrapNoopResolver } from "./utils"
import { getGitConfig } from "./git"
import { isDir, pathExists } from "./file"
/** @internal */
export function getOptionValueForFile<T>(
@@ -48,7 +50,7 @@ function isWrappedWithQuotes(string: string): boolean {
}
/** @internal */
export async function parseConfigFile(config: ScaffoldCmdConfig): Promise<ScaffoldConfig> {
export async function parseConfigFile(config: ScaffoldCmdConfig, tmpPath: string): Promise<ScaffoldConfig> {
let output: ScaffoldConfig = config
if (config.quiet) {
@@ -68,9 +70,10 @@ export async function parseConfigFile(config: ScaffoldCmdConfig): Promise<Scaffo
const configFilename = config.config
const configPath = isGit ? config.git : configFilename
log(config, LogLevel.info, `Loading config from ${configFilename} with key ${key}`)
const configPromise = await (config.git
? getRemoteConfig({ git: configPath, config: configFilename, logLevel: config.logLevel })
log(config, LogLevel.info, `Loading config from file ${configFilename} with key ${key}`)
const configPromise = await (isGit
? getRemoteConfig({ git: configPath, config: configFilename, logLevel: config.logLevel, tmpPath })
: getLocalConfig({ config: configFilename, logLevel: config.logLevel }))
// resolve the config
@@ -78,6 +81,7 @@ export async function parseConfigFile(config: ScaffoldCmdConfig): Promise<Scaffo
// If the config is a function or promise, return the output
if (typeof configImport.default === "function" || configImport.default instanceof Promise) {
log(config, LogLevel.debug, "Config is a function or promise, resolving...")
configImport = await resolve(configImport.default, config)
}
@@ -85,19 +89,23 @@ export async function parseConfigFile(config: ScaffoldCmdConfig): Promise<Scaffo
throw new Error(`Template "${key}" not found in ${configFilename}`)
}
const importedKey = configImport[key]
const imported = configImport[key]
log(config, LogLevel.debug, "Imported result", imported)
output = {
...config,
...importedKey,
...imported,
data: {
...(importedKey as any).data,
...(imported as any).data,
...config.data,
},
}
}
output.data = { ...output.data, ...config.appendData }
delete config.appendData
if (!output.name) {
throw new Error("simple-scaffold: Missing required option: name")
}
log(output, LogLevel.debug, "Parsed config", output)
return output
}
@@ -114,8 +122,22 @@ export function githubPartToUrl(part: string): string {
export async function getLocalConfig(config: ConfigLoadConfig & Partial<LogConfig>): Promise<ScaffoldConfigFile> {
const { config: configFile, ...logConfig } = config as Required<typeof config>
log(logConfig, LogLevel.info, `Loading config from file ${configFile}`)
const absolutePath = path.resolve(process.cwd(), configFile)
const _isDir = await isDir(absolutePath)
if (_isDir) {
log(logConfig, LogLevel.debug, `Resolving config file from directory ${absolutePath}`)
const file = await findConfigFile(absolutePath)
const exists = await pathExists(file)
if (!exists) {
throw new Error(`Could not find config file in directory ${absolutePath}`)
}
log(logConfig, LogLevel.info, `Loading config from: ${path.resolve(absolutePath, file)}`)
return wrapNoopResolver(import(path.resolve(absolutePath, file)))
}
log(logConfig, LogLevel.info, `Loading config from: ${absolutePath}`)
return wrapNoopResolver(import(absolutePath))
}
@@ -123,7 +145,7 @@ export async function getLocalConfig(config: ConfigLoadConfig & Partial<LogConfi
export async function getRemoteConfig(
config: RemoteConfigLoadConfig & Partial<LogConfig>,
): Promise<ScaffoldConfigFile> {
const { config: configFile, git, ...logConfig } = config as Required<typeof config>
const { config: configFile, git, tmpPath, ...logConfig } = config as Required<typeof config>
log(logConfig, LogLevel.info, `Loading config from remote ${git}, file ${configFile}`)
@@ -135,5 +157,21 @@ export async function getRemoteConfig(
throw new Error(`Unsupported protocol ${url.protocol}`)
}
return getGitConfig(url, configFile, logConfig)
return getGitConfig(url, configFile, tmpPath, logConfig)
}
/** @internal */
export async function findConfigFile(root: string): Promise<string> {
const allowed = ["mjs", "cjs", "js", "json"].reduce((acc, ext) => {
acc.push(`scaffold.config.${ext}`)
acc.push(`scaffold.${ext}`)
return acc
}, [] as string[])
for (const file of allowed) {
const exists = await pathExists(path.resolve(root, file))
if (exists) {
return file
}
}
throw new Error(`Could not find config file in git repo`)
}

View File

@@ -1,23 +1,22 @@
import path from "node:path"
import os from "node:os"
import fs from "node:fs/promises"
import { log } from "./logger"
import { AsyncResolver, LogConfig, LogLevel, ScaffoldCmdConfig, ScaffoldConfigMap } from "./types"
import { spawn } from "node:child_process"
import { resolve, wrapNoopResolver } from "./utils"
import { findConfigFile } from "./config"
export async function getGitConfig(
url: URL,
file: string,
tmpPath: string,
logConfig: LogConfig,
): Promise<AsyncResolver<ScaffoldCmdConfig, ScaffoldConfigMap>> {
const repoUrl = `${url.protocol}//${url.host}${url.pathname}`
log(logConfig, LogLevel.info, `Cloning git repo ${repoUrl}`)
const tmpPath = path.resolve(os.tmpdir(), `scaffold-config-${Date.now()}`)
return new Promise((res, reject) => {
log(logConfig, LogLevel.debug, `Cloning git repo to ${tmpPath}`)
const clone = spawn("git", ["clone", "--recurse-submodules", "--depth", "1", repoUrl, tmpPath])
clone.on("error", reject)
@@ -47,6 +46,7 @@ export async function loadGitConfig({
log(logConfig, LogLevel.info, `Loading config from git repo: ${repoUrl}`)
const filename = file || (await findConfigFile(tmpPath))
const absolutePath = path.resolve(tmpPath, filename)
log(logConfig, LogLevel.debug, `Resolving config file: ${absolutePath}`)
const loadedConfig = await resolve(async () => (await import(absolutePath)).default as ScaffoldConfigMap, logConfig)
log(logConfig, LogLevel.info, `Loaded config from git`)
@@ -58,25 +58,5 @@ export async function loadGitConfig({
templates: v.templates.map((t) => path.resolve(tmpPath, t)),
}
}
await fs.rm(tmpPath, { recursive: true })
return wrapNoopResolver(fixedConfig)
}
/** @internal */
export async function findConfigFile(root: string): Promise<string> {
const allowed = ["mjs", "cjs", "js", "json"].reduce((acc, ext) => {
acc.push(`scaffold.config.${ext}`)
acc.push(`scaffold.${ext}`)
return acc
}, [] as string[])
for (const file of allowed) {
const exists = await fs
.stat(path.resolve(root, file))
.then(() => true)
.catch(() => false)
if (exists) {
return file
}
}
throw new Error(`Could not find config file in git repo`)
}

View File

@@ -1,4 +1,5 @@
export * from "./scaffold"
export * from "./types"
import Scaffold from "./scaffold"
export default Scaffold

View File

@@ -121,7 +121,7 @@ export function handlebarsParse(
return Buffer.from(outputContents)
} catch (e) {
log(config, LogLevel.debug, e)
log(config, LogLevel.warning, "Couldn't parse file with handlebars, returning original content")
log(config, LogLevel.info, "Couldn't parse file with handlebars, returning original content")
return Buffer.from(templateBuffer)
}
}

View File

@@ -5,6 +5,8 @@
* See [readme](README.md)
*/
import path from "node:path"
import os from "node:os"
import { handleErr, resolve } from "./utils"
import {
isDir,
@@ -126,10 +128,12 @@ Scaffold.fromConfig = async function (
subdir: false,
quiet: false,
config: pathOrUrl,
version: false,
...config,
}
const tmpPath = path.resolve(os.tmpdir(), `scaffold-config-${Date.now()}`)
const _overrides = resolve(overrides, _cmdConfig)
const _config = await parseConfigFile(_cmdConfig)
const _config = await parseConfigFile(_cmdConfig, tmpPath)
return Scaffold({ ..._config, ..._overrides })
}

View File

@@ -257,6 +257,18 @@ export type DefaultHelpers = CaseHelpers | DateHelpers
*/
export type Helper = HelperDelegate
/**
* The amount of information to log when generating scaffold.
* When not `none`, the selected level will be the lowest level included.
*
* For example, level `info` will include `info`, `warning` and `error`, but not `debug`; and `warning` will only
* show `warning` and `error`, but not `info` or `debug`.
*
* @default `info`
*
* @category Logging (const)
*/
export const LogLevel = {
/** Silent output */
none: "none",
@@ -276,17 +288,14 @@ export const LogLevel = {
/**
* The amount of information to log when generating scaffold.
* When not `None`, the selected level will be the lowest level included.
* When not `none`, the selected level will be the lowest level included.
*
* For example, level `Info` (2) will include `Info`, `Warning` and `Error`, but not `Debug`; and `Warning` will only
* show `Warning` and `Error`.
* For example, level `info` will include `info`, `warning` and `error`, but not `debug`; and `warning` will only
* show `warning` and `error`, but not `info` or `debug`.
*
* You may use either the number or the name of the level.
* For example, `2` or `info` are both valid.
* @default `info`
*
* @default `2 (info)`
*
* @category Logging
* @category Logging (type)
*/
export type LogLevel = (typeof LogLevel)[keyof typeof LogLevel]
@@ -324,7 +333,7 @@ export type FileResponse<T> = T | FileResponseHandler<T>
* The Scaffold config for CLI
* Contains less and more specific options than {@link ScaffoldConfig}
*/
export interface ScaffoldCmdConfig {
export type ScaffoldCmdConfig = {
/** The name of the scaffold template to use. */
name: string
/** The templates to use for generation */
@@ -357,6 +366,8 @@ export interface ScaffoldCmdConfig {
key?: string
/** The git repository to use to fetch the config file */
git?: string
/** Display version */
version: boolean
}
/**
@@ -369,14 +380,19 @@ export interface ScaffoldCmdConfig {
* When no template key is provided to the scaffold command, the "default" template is used.
*
* @see {@link ScaffoldConfig}
*
* @category Config
*/
export type ScaffoldConfigMap = Record<string, ScaffoldConfig>
/** The scaffold config file is either:
/**
* The scaffold config file is either:
* - A {@link ScaffoldConfigMap} object
* - A function that returns a {@link ScaffoldConfigMap} object
* - A promise that resolves to a {@link ScaffoldConfigMap} object
* - A function that returns a promise that resolves to a {@link ScaffoldConfigMap} object
*
* @category Config
*/
export type ScaffoldConfigFile = AsyncResolver<ScaffoldCmdConfig, ScaffoldConfigMap>
@@ -393,7 +409,7 @@ export type LogConfig = Pick<ScaffoldConfig, "logLevel">
export type ConfigLoadConfig = LogConfig & Pick<ScaffoldCmdConfig, "config">
/** @internal */
export type RemoteConfigLoadConfig = LogConfig & Pick<ScaffoldCmdConfig, "config" | "git">
export type RemoteConfigLoadConfig = LogConfig & Pick<ScaffoldCmdConfig, "config" | "git"> & { tmpPath: string }
/** @internal */
export type MinimalConfig = Pick<ScaffoldCmdConfig, "name" | "key">

View File

@@ -6,7 +6,7 @@ import * as config from "../src/config"
import { resolve } from "../src/utils"
// @ts-ignore
import * as configFile from "../scaffold.config"
import { findConfigFile } from "../src/git"
import { findConfigFile } from "../src/config"
jest.mock("../src/git", () => {
return {
@@ -30,6 +30,7 @@ const blankCliConf: ScaffoldCmdConfig = {
subdir: false,
dryRun: false,
quiet: false,
version: false,
}
const blankConfig: ScaffoldCmdConfig = {
@@ -68,25 +69,37 @@ describe("config", () => {
describe("parseConfigFile", () => {
test("normal config does not change", async () => {
expect(
await parseConfigFile({
...blankCliConf,
}),
).toEqual(blankCliConf)
await parseConfigFile(
{
...blankCliConf,
name: "-",
},
`/tmp/scaffold-config-${Date.now()}`,
),
).toEqual({ ...blankCliConf, name: "-" })
})
describe("appendData", () => {
test("appends", async () => {
const result = await parseConfigFile({
...blankCliConf,
appendData: { key: "value" },
})
const result = await parseConfigFile(
{
...blankCliConf,
name: "-",
appendData: { key: "value" },
},
`/tmp/scaffold-config-${Date.now()}`,
)
expect(result?.data?.key).toEqual("value")
})
test("overwrites existing value", async () => {
const result = await parseConfigFile({
...blankCliConf,
data: { num: "123" },
appendData: { num: "1234" },
})
const result = await parseConfigFile(
{
...blankCliConf,
name: "-",
data: { num: "123" },
appendData: { num: "1234" },
},
`/tmp/scaffold-config-${Date.now()}`,
)
expect(result?.data?.num).toEqual("1234")
})
})
@@ -97,6 +110,7 @@ describe("config", () => {
const resultFn = await config.getRemoteConfig({
git: "https://github.com/chenasraf/simple-scaffold.git",
logLevel: LogLevel.none,
tmpPath: `/tmp/scaffold-config-${Date.now()}`,
})
const result = await resolve(resultFn, blankCliConf)
expect(result).toEqual(blankCliConf)