Compare commits

...

10 Commits

Author SHA1 Message Date
semantic-release-bot
83d38073f3 chore(release): 1.4.0 [skip ci]
## [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](6c5ba0bc91))
2023-04-28 23:01:48 +00:00
Chen Asraf
6c5ba0bc91 feat: add --key | -k to config loader 2023-04-29 01:59:39 +03:00
semantic-release-bot
2c4eccd800 chore(release): 1.3.2 [skip ci]
## [1.3.2](https://github.com/chenasraf/simple-scaffold/compare/v1.3.1...v1.3.2) (2023-04-28)

### Bug Fixes

* release build ([2c23fa9](2c23fa9dbb))
* release build asset ([0bef2df](0bef2df5f3))
2023-04-28 22:08:51 +00:00
Chen Asraf
2c23fa9dbb fix: release build 2023-04-29 01:04:01 +03:00
Chen Asraf
0bef2df5f3 fix: release build asset 2023-04-29 00:59:54 +03:00
semantic-release-bot
398a5d723b chore(release): 1.3.1 [skip ci]
## [1.3.1](https://github.com/chenasraf/simple-scaffold/compare/v1.3.0...v1.3.1) (2023-04-28)

### Bug Fixes

* docs ([6e19a86](6e19a86190))
* remove old peer-dep ([c7e2ef8](c7e2ef862c))
2023-04-28 21:50:36 +00:00
Chen Asraf
c7e2ef862c fix: remove old peer-dep 2023-04-29 00:44:49 +03:00
Chen Asraf
36dd27e480 docs: fix doc links 2023-04-29 00:44:49 +03:00
Chen Asraf
6e19a86190 fix: docs 2023-04-29 00:44:49 +03:00
Chen Asraf
eba7897f84 chore: bump version number + fix changelog 2023-04-29 00:44:38 +03:00
11 changed files with 52 additions and 19 deletions

View File

@@ -2,7 +2,7 @@ name: Build Documentation
on:
push:
branches: [master]
branches: [master, develop]
jobs:
docs:
runs-on: ubuntu-latest

View File

@@ -2,7 +2,7 @@ name: Semantic Release
on:
push:
branches: [master, develop, feat/*, fix/*]
branches: [ master, develop, feat/*, fix/* ]
jobs:
build:
runs-on: ubuntu-latest
@@ -15,6 +15,7 @@ jobs:
- run: yarn install --frozen-lockfile
- run: yarn test
- run: yarn build
- run: cd ./dist && yarn pack --filename=../package.tgz
- run: yarn semantic-release
if: "!contains(github.event.head_commit.message, '[skip publish]')"
env:

View File

@@ -1,17 +1,41 @@
# Change Log
## [1.3.0](https://github.com/chenasraf/simple-scaffold/compare/v1.2.0...v1.3.0) (2023-04-25)
## [1.4.0](https://github.com/chenasraf/simple-scaffold/compare/v1.3.2...v1.4.0) (2023-04-28)
### Features
* load scaffold config from files ([c398976](https://github.com/chenasraf/simple-scaffold/commit/c3989769fee445c9183ff5e5b3892c4e9fb66a9e))
* 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
* config option should not be mandatory ([3db6a91](https://github.com/chenasraf/simple-scaffold/commit/3db6a918f13d9300efa2fcb4a356d004475ab91c))
* export config file type ([4302eb5](https://github.com/chenasraf/simple-scaffold/commit/4302eb5ce35ed6cf1dc80dfb92790c3fdd96f963))
* 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))
## [1.3.0](https://github.com/chenasraf/simple-scaffold/compare/v1.2.0...v1.3.0) (2023-04-25)
### Features
- load scaffold config from files
([c398976](https://github.com/chenasraf/simple-scaffold/commit/c3989769fee445c9183ff5e5b3892c4e9fb66a9e))
### Bug Fixes
- config option should not be mandatory
([3db6a91](https://github.com/chenasraf/simple-scaffold/commit/3db6a918f13d9300efa2fcb4a356d004475ab91c))
- export config file type
([4302eb5](https://github.com/chenasraf/simple-scaffold/commit/4302eb5ce35ed6cf1dc80dfb92790c3fdd96f963))
## [1.2.0](https://github.com/chenasraf/simple-scaffold/compare/v1.1.4...v1.2.0) (2023-04-24)

View File

@@ -7,7 +7,7 @@ module.exports = {
},
component: {
templates: ["examples/test-input/Component"],
output: "examples/test-output",
output: "examples/test-output/component",
data: { property: "myProp", value: "10" },
},
}

View File

@@ -1,6 +1,6 @@
{
"name": "simple-scaffold",
"version": "1.3.0",
"version": "1.3.1",
"description": "A simple command to generate any file structure, from single components to entire app boilerplates.",
"homepage": "https://casraf.dev/simple-scaffold",
"repository": "https://github.com/chenasraf/simple-scaffold.git",
@@ -63,8 +63,5 @@
"ts-node": "^10.9.1",
"typedoc": "^0.24.6",
"typescript": "^5.0.4"
},
"peerDependencies": {
"doc-theme": "file:./doc-theme"
}
}

View File

@@ -20,6 +20,10 @@ Options:
arguments to CLI or using a Node.js script. You may pass a
JSON or JS file, with a relative or absolute path.
--key|-k Key to load inside the config file. This overwrites the
config key provided after the colon in --config (e.g. --config
scaffold.cmd.js:component)
--output|-o Path to output to. If --create-sub-folder is enabled,
the subfolder will be created inside this path.
(default: current dir)
@@ -60,7 +64,7 @@ Options:
```
> See
> [Configuration Files](https://chenasraf.githun.io/simple-scaffold/pages/docs/docs/configuration_files.md)
> [Configuration Files](https://chenasraf.githun.io/simple-scaffold/pages/docs/configuration_files.md)
> for organizing multiple scaffold types into easy-to-maintain files
You can also add this as a script in your `package.json`:

View File

@@ -19,7 +19,7 @@ example:
```
The configuration contents are identical to the
[Node.js configuration structure](https://chenasraf.githun.io/simple-scaffold/pages/docs/node.md):
[Node.js configuration structure](https://chenasraf.github.io/simple-scaffold/pages/node.md):
```ts
interface ScaffoldConfig {

View File

@@ -57,7 +57,7 @@ module.exports = {
[
"@semantic-release/npm",
{
packageRoot: "dist",
pkgRoot: "dist",
},
],
[

View File

@@ -1,12 +1,11 @@
#!/usr/bin/env node
import massarg from "massarg"
import chalk from "chalk"
import { LogLevel, ScaffoldCmdConfig, ScaffoldConfig } from "./types"
import { LogLevel, ScaffoldCmdConfig } from "./types"
import { Scaffold } from "./scaffold"
import path from "path"
import fs from "fs/promises"
import { parseAppendData, parseConfig } from "./utils"
import { OptionsBase } from "massarg/types"
export async function parseCliArgs(args = process.argv.slice(2)) {
const pkg = JSON.parse((await fs.readFile(path.join(__dirname, "package.json"))).toString())
@@ -32,6 +31,12 @@ export async function parseCliArgs(args = process.argv.slice(2)) {
description:
"Filename to load config from instead of passing arguments to CLI or using a Node.js script. You may pass a JSON or JS file, with a relative or absolute path.",
})
.option({
name: "key",
aliases: ["k"],
description:
"Key to load inside the config file. This overwrites the config key provided after the colon in --config (e.g. --config scaffold.cmd.js:component)",
})
.option({
name: "output",
aliases: ["o"],

View File

@@ -337,6 +337,7 @@ export interface ScaffoldCmdConfig {
verbose: LogLevel
dryRun: boolean
config?: string
key?: string
}
export type ScaffoldConfigFile = Record<string, ScaffoldConfig>

View File

@@ -118,8 +118,8 @@ export function log(config: ScaffoldConfig, level: LogLevel, ...obj: any[]): voi
i instanceof Error
? chalkFn(i, JSON.stringify(i, undefined, 1), i.stack)
: typeof i === "object"
? chalkFn(JSON.stringify(i, undefined, 1))
: chalkFn(i),
? chalkFn(JSON.stringify(i, undefined, 1))
: chalkFn(i),
),
)
}
@@ -402,7 +402,8 @@ export function parseConfig(config: ScaffoldCmdConfig & OptionsBase): ScaffoldCo
let c: ScaffoldConfig = config
if (config.config) {
const [configFile, template = "default"] = config.config.split(":")
const [configFile, colonTemplate = "default"] = config.config.split(":")
const template = config.key ?? colonTemplate
const configImport: ScaffoldConfigFile = require(path.resolve(process.cwd(), configFile))
if (!configImport[template]) {
throw new Error(`Template "${template}" not found in ${configFile}`)