mirror of
https://github.com/chenasraf/simple-scaffold.git
synced 2026-05-18 01:29:09 +00:00
Compare commits
6 Commits
v1.6.0
...
v1.5.0-dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
48d5af0fb6 | ||
|
|
408a940853 | ||
|
|
0256e9282b | ||
|
|
e0dc643d4e | ||
|
|
23fcaefdd9 | ||
|
|
9ea414fe1a |
2
.github/workflows/docs.yml
vendored
2
.github/workflows/docs.yml
vendored
@@ -1,4 +1,4 @@
|
||||
name: Documentation
|
||||
name: Build Documentation
|
||||
|
||||
on:
|
||||
push:
|
||||
|
||||
15
.github/workflows/release.yml
vendored
15
.github/workflows/release.yml
vendored
@@ -1,10 +1,10 @@
|
||||
name: Test & Build
|
||||
name: Semantic Release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master, develop, feat/*, fix/* ]
|
||||
jobs:
|
||||
test:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
if: "!contains(github.event.head_commit.message, '[skip ci]')"
|
||||
steps:
|
||||
@@ -14,17 +14,6 @@ jobs:
|
||||
node-version: "18.x"
|
||||
- run: yarn install --frozen-lockfile
|
||||
- run: yarn test
|
||||
if: "!contains(github.event.head_commit.message, '[skip test]')"
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
if: "!contains(github.event.head_commit.message, '[skip ci]')"
|
||||
needs: test
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: "18.x"
|
||||
- run: yarn install --frozen-lockfile
|
||||
- run: yarn build
|
||||
- run: cd ./dist && yarn pack --filename=../package.tgz
|
||||
- run: yarn semantic-release
|
||||
|
||||
74
CHANGELOG.md
74
CHANGELOG.md
@@ -1,68 +1,42 @@
|
||||
# Change Log
|
||||
|
||||
## [1.6.0](https://github.com/chenasraf/simple-scaffold/compare/v1.5.0...v1.6.0) (2023-05-05)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* node.js function for remote configs ([ce5adbe](https://github.com/chenasraf/simple-scaffold/commit/ce5adbe0f898a86db6046d7f66d83dfcaa519ad2))
|
||||
## [1.5.0-develop.2](https://github.com/chenasraf/simple-scaffold/compare/v1.5.0-develop.1...v1.5.0-develop.2) (2023-05-03)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* move dependency to dev dependency ([d916d88](https://github.com/chenasraf/simple-scaffold/commit/d916d88384054e6c6b40e6299073f1d1acb4d29d))
|
||||
|
||||
## Change Log
|
||||
|
||||
# [1.5.0](https://github.com/chenasraf/simple-scaffold/compare/v1.6.0-develop.1...v1.5.0) (2023-05-04)
|
||||
|
||||
## [1.6.0-develop.1](https://github.com/chenasraf/simple-scaffold/compare/v1.5.0...v1.6.0-develop.1) (2023-05-04)
|
||||
|
||||
### Features
|
||||
|
||||
- node.js function for remote configs
|
||||
([ce5adbe](https://github.com/chenasraf/simple-scaffold/commit/ce5adbe0f898a86db6046d7f66d83dfcaa519ad2))
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- move dependency to dev dependency
|
||||
([d916d88](https://github.com/chenasraf/simple-scaffold/commit/d916d88384054e6c6b40e6299073f1d1acb4d29d))
|
||||
|
||||
## [1.5.0](https://github.com/chenasraf/simple-scaffold/compare/v1.5.0-develop.1...v1.5.0) (2023-05-02)
|
||||
* move dependency to dev dependency ([408a940](https://github.com/chenasraf/simple-scaffold/commit/408a94085366bb4e39391fcfcfa7df78b06a480f))
|
||||
|
||||
## [1.5.0-develop.1](https://github.com/chenasraf/simple-scaffold/compare/v1.4.0...v1.5.0-develop.1) (2023-05-02)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
- add github remote templates
|
||||
([f961c13](https://github.com/chenasraf/simple-scaffold/commit/f961c13da15320b42540773ed958cdc3f97e4502))
|
||||
- support for remote template configs
|
||||
([05487f4](https://github.com/chenasraf/simple-scaffold/commit/05487f4d1e3b05f1d695242bb54427ee2fbdf247))
|
||||
* add github remote templates ([f961c13](https://github.com/chenasraf/simple-scaffold/commit/f961c13da15320b42540773ed958cdc3f97e4502))
|
||||
* support for remote template configs ([05487f4](https://github.com/chenasraf/simple-scaffold/commit/05487f4d1e3b05f1d695242bb54427ee2fbdf247))
|
||||
|
||||
## [1.4.0](https://github.com/chenasraf/simple-scaffold/compare/v1.3.2...v1.4.0) (2023-04-28)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
- add `--key` | `-k` to config loader
|
||||
([6c5ba0b](https://github.com/chenasraf/simple-scaffold/commit/6c5ba0bc916fb1d59240d2eaa1abedc74527a974))
|
||||
* add `--key` | `-k` to config loader ([6c5ba0b](https://github.com/chenasraf/simple-scaffold/commit/6c5ba0bc916fb1d59240d2eaa1abedc74527a974))
|
||||
|
||||
## [1.3.2](https://github.com/chenasraf/simple-scaffold/compare/v1.3.1...v1.3.2) (2023-04-28)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- release build
|
||||
([2c23fa9](https://github.com/chenasraf/simple-scaffold/commit/2c23fa9dbb310cd0a31f09606798f96b95d66779))
|
||||
- release build asset
|
||||
([0bef2df](https://github.com/chenasraf/simple-scaffold/commit/0bef2df5f3aa800ad5f1094c0996108db9acce51))
|
||||
* release build ([2c23fa9](https://github.com/chenasraf/simple-scaffold/commit/2c23fa9dbb310cd0a31f09606798f96b95d66779))
|
||||
* release build asset ([0bef2df](https://github.com/chenasraf/simple-scaffold/commit/0bef2df5f3aa800ad5f1094c0996108db9acce51))
|
||||
|
||||
## [1.3.1](https://github.com/chenasraf/simple-scaffold/compare/v1.3.0...v1.3.1) (2023-04-28)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- docs
|
||||
([6e19a86](https://github.com/chenasraf/simple-scaffold/commit/6e19a86190dd924058a48448aa6463569ef1125f))
|
||||
- remove old peer-dep
|
||||
([c7e2ef8](https://github.com/chenasraf/simple-scaffold/commit/c7e2ef862cb658feb1071ac120b185d8b34d6dd3))
|
||||
* docs ([6e19a86](https://github.com/chenasraf/simple-scaffold/commit/6e19a86190dd924058a48448aa6463569ef1125f))
|
||||
* remove old peer-dep ([c7e2ef8](https://github.com/chenasraf/simple-scaffold/commit/c7e2ef862cb658feb1071ac120b185d8b34d6dd3))
|
||||
|
||||
## [1.3.0](https://github.com/chenasraf/simple-scaffold/compare/v1.2.0...v1.3.0) (2023-04-25)
|
||||
|
||||
@@ -89,15 +63,29 @@
|
||||
|
||||
- ci node version
|
||||
([767d34c](https://github.com/chenasraf/simple-scaffold/commit/767d34c684516d4cea865b25e87c27c779bb79ce))
|
||||
- github action node version
|
||||
([7c19c53](https://github.com/chenasraf/simple-scaffold/commit/7c19c533376dc6904231e5cc51c7a4b2658c66e0))
|
||||
- github action node version
|
||||
([94fec76](https://github.com/chenasraf/simple-scaffold/commit/94fec766165f7540c578dbf2d0aeeb6ea3969ad8))
|
||||
- semantic-release build dir
|
||||
([f7956dd](https://github.com/chenasraf/simple-scaffold/commit/f7956ddc786018905c48ccf1f21a3bb4657c3d75))
|
||||
- support quote wrapping in append-data
|
||||
([4fecca8](https://github.com/chenasraf/simple-scaffold/commit/4fecca848347312d45d704f82f2bcb3822da9b06))
|
||||
|
||||
## [1.1.4](https://github.com/chenasraf/simple-scaffold/compare/v1.1.3...v1.1.4) (2023-03-13)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- github action node version
|
||||
([7c19c53](https://github.com/chenasraf/simple-scaffold/commit/7c19c533376dc6904231e5cc51c7a4b2658c66e0))
|
||||
- github action node version
|
||||
([94fec76](https://github.com/chenasraf/simple-scaffold/commit/94fec766165f7540c578dbf2d0aeeb6ea3969ad8))
|
||||
|
||||
### Misc
|
||||
|
||||
- update typedoc version
|
||||
([c334396](https://github.com/chenasraf/simple-scaffold/commit/c334396d74414cbe0aba305c66dfad7fdeb88669))
|
||||
- update dependencies
|
||||
([20400bd](https://github.com/chenasraf/simple-scaffold/commit/20400bd81dd43d457427675286c9964a8bc0d5f6))
|
||||
- bump version number
|
||||
([8e432bf](https://github.com/chenasraf/simple-scaffold/commit/8e432bfb0b410dc0655c3924031bea2648a42ad0))
|
||||
|
||||
## [1.1.3](https://github.com/chenasraf/simple-scaffold/compare/v1.1.2...v1.1.3) (2023-03-11)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "simple-scaffold",
|
||||
"version": "1.6.0",
|
||||
"description": "Generate any file structure - from single components to entire app boilerplates, with a single command.",
|
||||
"version": "1.5.0",
|
||||
"description": "A simple command to generate any file structure, from single components to entire app boilerplates.",
|
||||
"homepage": "https://chenasraf.github.io/simple-scaffold",
|
||||
"repository": "https://github.com/chenasraf/simple-scaffold.git",
|
||||
"author": "Chen Asraf <inbox@casraf.com>",
|
||||
@@ -39,7 +39,8 @@
|
||||
"glob": "^9.2.1",
|
||||
"handlebars": "^4.7.7",
|
||||
"lodash": "^4.17.21",
|
||||
"massarg": "^1.0.7-pre.1"
|
||||
"massarg": "^1.0.7-pre.1",
|
||||
"util.promisify": "^1.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@knodes/typedoc-plugin-pages": "^0.23.4",
|
||||
|
||||
@@ -132,24 +132,3 @@ This example is equivalent to the above, just shorter to write:
|
||||
```shell
|
||||
simple-scaffold -c chenasraf/simple-scaffold#examples/test-input/scaffold.config.js:component
|
||||
```
|
||||
|
||||
## Use In Node.js
|
||||
|
||||
You can also start a scaffold from Node.js with a remote file or URL config.
|
||||
|
||||
Just use the `Scaffold.fromConfig` function:
|
||||
|
||||
```ts
|
||||
Scaffold.fromConfig(
|
||||
"scaffold.config.js", // file or HTTPS git URL
|
||||
{
|
||||
// name of the generated component
|
||||
name: "My Component",
|
||||
// key to load from the config
|
||||
key: "component",
|
||||
},
|
||||
{
|
||||
// other config overrides
|
||||
},
|
||||
)
|
||||
```
|
||||
|
||||
4764
pnpm-lock.yaml
generated
4764
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -6,7 +6,7 @@ const releaseRules = [
|
||||
{ type: "perf", section: "Misc", release: "patch" },
|
||||
{ type: "build", section: "Build", release: "patch" },
|
||||
{ type: "chore", section: "Misc", release: "patch" },
|
||||
{ type: "test", section: "Tests", release: false },
|
||||
{ type: "test", section: "Tests", release: "patch" },
|
||||
]
|
||||
|
||||
/** @type {import('semantic-release').Options} */
|
||||
@@ -42,7 +42,7 @@ module.exports = {
|
||||
{
|
||||
preset: "conventionalcommits",
|
||||
parserOpts: {
|
||||
noteKeywords: ["breaking", "major"],
|
||||
noteKeywords: ["breaking"],
|
||||
types: releaseRules,
|
||||
},
|
||||
},
|
||||
@@ -57,13 +57,6 @@ module.exports = {
|
||||
[
|
||||
"@semantic-release/npm",
|
||||
{
|
||||
npmPublish: false,
|
||||
},
|
||||
],
|
||||
[
|
||||
"@semantic-release/npm",
|
||||
{
|
||||
npmPublish: true,
|
||||
pkgRoot: "dist",
|
||||
},
|
||||
],
|
||||
|
||||
39
src/scaffold.ts
Executable file → Normal file
39
src/scaffold.ts
Executable file → Normal file
@@ -23,10 +23,8 @@ import {
|
||||
getTemplateFileInfo,
|
||||
logInitStep,
|
||||
logInputFile,
|
||||
parseConfig,
|
||||
} from "./utils"
|
||||
import { LogLevel, ScaffoldCmdConfig, ScaffoldConfig } from "./types"
|
||||
import { OptionsBase } from "massarg/types"
|
||||
import { LogLevel, ScaffoldConfig } from "./types"
|
||||
|
||||
/**
|
||||
* Create a scaffold using given `options`.
|
||||
@@ -52,7 +50,6 @@ import { OptionsBase } from "massarg/types"
|
||||
* For available default values, see {@link DefaultHelpers}.
|
||||
*
|
||||
* @param {ScaffoldConfig} config The main configuration object
|
||||
* @return {Promise<void>} A promise that resolves when the scaffold is complete
|
||||
*
|
||||
* @see {@link DefaultHelpers}
|
||||
* @see {@link CaseHelpers}
|
||||
@@ -104,40 +101,6 @@ export async function Scaffold(config: ScaffoldConfig): Promise<void> {
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a scaffold based on a config file or URL.
|
||||
*
|
||||
* @param {string} pathOrUrl The path or URL to the config file
|
||||
* @param {Record<string, string>} config Information needed before loading the config
|
||||
* @param {Partial<Omit<ScaffoldConfig, 'name'>>} overrides Any overrides to the loaded config
|
||||
*
|
||||
* @see {@link Scaffold}
|
||||
* @category Main
|
||||
* @return {Promise<void>} A promise that resolves when the scaffold is complete
|
||||
*/
|
||||
Scaffold.fromConfig = async function (
|
||||
pathOrUrl: string,
|
||||
config: Pick<ScaffoldCmdConfig, "name" | "key">,
|
||||
overrides?: Partial<Omit<ScaffoldConfig, "name">>,
|
||||
): Promise<void> {
|
||||
const _cmdConfig: ScaffoldCmdConfig & OptionsBase = {
|
||||
dryRun: false,
|
||||
output: process.cwd(),
|
||||
verbose: LogLevel.Info,
|
||||
overwrite: false,
|
||||
templates: [],
|
||||
createSubFolder: false,
|
||||
quiet: false,
|
||||
help: false,
|
||||
extras: [],
|
||||
config: pathOrUrl,
|
||||
...config,
|
||||
}
|
||||
const _config = await parseConfig(_cmdConfig)
|
||||
return Scaffold({ ..._config, ...overrides })
|
||||
}
|
||||
|
||||
async function handleTemplateFile(
|
||||
config: ScaffoldConfig,
|
||||
{ templatePath, basePath }: { templatePath: string; basePath: string },
|
||||
|
||||
@@ -325,10 +325,6 @@ export type FileResponse<T> = T | FileResponseHandler<T>
|
||||
|
||||
/** @internal */
|
||||
export interface ScaffoldCmdConfig {
|
||||
/**
|
||||
* Name to be passed to the generated files. `{{name}}` and `{{Name}}` inside contents and file names will be replaced
|
||||
* accordingly.
|
||||
*/
|
||||
name: string
|
||||
templates: string[]
|
||||
output: string
|
||||
@@ -340,7 +336,6 @@ export interface ScaffoldCmdConfig {
|
||||
verbose: LogLevel
|
||||
dryRun: boolean
|
||||
config?: string
|
||||
/** The key to use for the file which contains the template configurations. */
|
||||
key?: string
|
||||
github?: string
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user