Skip to content

Commit

Permalink
chore: render Stack message (#38)
Browse files Browse the repository at this point in the history
* feat: display hint

* chore: enter prerelease mode

* chore: update PR template

* test: increase timeout 10s

* ci: add PR test

* ci: add build step

* chore: remove npmrc
  • Loading branch information
quanphm committed Aug 25, 2022
1 parent 1981fef commit 905b774
Show file tree
Hide file tree
Showing 15 changed files with 86 additions and 17 deletions.
5 changes: 5 additions & 0 deletions .changeset/heavy-adults-beg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'create-boilertowns': patch
---

Display brief stack next to boilerplate name.
8 changes: 8 additions & 0 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"mode": "pre",
"tag": "next",
"initialVersions": {
"create-boilertowns": "0.0.6"
},
"changesets": []
}
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@

## Appreciation

<!-- If your create pull request to add a new boilerplate, don't forget to ⭐️ and give credit to the authors/maintainers. -->
<!-- If your create pull request to add a new boilerplate, don't forget to ⭐️ and give credit to its authors/maintainers. -->
31 changes: 31 additions & 0 deletions .github/workflows/pr-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: PR Test

on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches:
- main

jobs:
unit-test:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: pnpm/action-setup@v2.2.2
with:
version: 7.8.0

- uses: actions/setup-node@v3
with:
node-version: '16'
cache: 'pnpm'

- name: Install dependencies
run: pnpm install --frozen-lockfile

- run: pnpm run build

- name: Unit test
run: pnpm run test
2 changes: 0 additions & 2 deletions .npmrc

This file was deleted.

13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,18 @@ pnpm create boilertowns

## Available boilerplates

The list of current boilerplates that you can select in Boilertowns. More will come soon.
The list of current boilerplates that you can select in Boilertowns. More coming soon!

### React

- [react-nostalgia-boilerplate](https://github.com/boilertowns/react-nostalgia-boilerplate) - Application boilerplate with Typescript, React, Styled-components, React Router v6, Babel and Webpack.
- [react-ui-boilerplate](https://github.com/boilertowns/react-ui-boilerplate) - UI library with Typescript, React, Emotion, Rollup and Babel.
- [react-monorepo-boilerplate](https://github.com/boilertowns/react-monorepo-boilerplate) - The boilerplate with opinionated setup to help you quickly kickstart your React monorepo project.
- [react-minimal-boilerplate](https://github.com/boilertowns/react-minimal-boilerplate) - Basic Vite boilerplate with a little steroids. Typescript, Vite, Vitest, React, React Router v6, Tailwind CSS.
- [react-nostalgia-boilerplate](https://github.com/boilertowns/react-nostalgia-boilerplate) - Application boilerplate. Typescript, React, React Router v6, Styled-components, Babel, Webpack.
- [react-ui-boilerplate](https://github.com/boilertowns/react-ui-boilerplate) - React UI components boilerplate. Typescript, React, Emotion, Rollup, Babel.
- [react-monorepo-boilerplate](https://github.com/boilertowns/react-monorepo-boilerplate) - Monorepo boilerplate. Typescript, Turborepo, React, React Router v6, Next.js, Rollup, Babel, Webpack.

### Node

- [node-cli-boilerplate](https://github.com/boilertowns/node-cli-boilerplate) - Node CLI boilerplate - `create-boilertowns` is using this. Typescript, tsup, Vitest.

## Contributing

Expand Down
2 changes: 1 addition & 1 deletion __tests__/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ describe('create-boilertowns cli', () => {
).toBeTruthy();

expect(fs.existsSync(path.resolve(testDir, 'node_modules'))).toBe(false);
});
}, 10000);
});
18 changes: 16 additions & 2 deletions scripts/add-boilerplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,19 @@ async function boilerplateIndexFileContent() {
type: 'input',
message: 'Boilerplate name (ex. my-boilerplate):',
},
{
name: 'stack',
type: 'input',
message: 'Featured stack (ex. Typescript, React, ...):',
validate: (value) => {
if (typeof value === 'string' && value.length > 100) {
return `Please briefly describe the stack, max ${chalk.italic(
'100 characters',
)}.`;
}
return true;
},
},
{
name: 'repo',
type: 'input',
Expand Down Expand Up @@ -102,13 +115,14 @@ async function boilerplateIndexFileContent() {
message: 'NPM "scripts" (comma-separated):',
},
]);
const { name, repo, scripts } = answers;
const { name, stack, repo, scripts } = answers;

const dir = path.resolve(boilerplatesDir, name);
const dir = path.resolve(boilerplatesDir, name.toLowerCase());
await fs.mkdir(dir);

const dirIndex = await createFileByTemplate('index.ts', {
name,
stack,
repo,
scripts,
});
Expand Down
1 change: 1 addition & 0 deletions scripts/templates/index.ts.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { modifier } from './modifier.js';

const boilerplates: Boilerplate = {
name: '{{ name }}',
hint: '{{ stack }}',
repo: '{{ repo }}',
scripts: [{{#each scripts }}'{{ this }}',{{/each}}],
modifier,
Expand Down
1 change: 1 addition & 0 deletions src/boilerplates/node-cli-boilerplate/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { modifier } from './modifier.js';

const boilerplates: Boilerplate = {
name: 'node-cli-boilerplate',
hint: 'Typescript, tsup, Vitest',
repo: 'https://github.com/boilertowns/node-cli-boilerplate',
scripts: ['dev'],
modifier,
Expand Down
1 change: 1 addition & 0 deletions src/boilerplates/react-minimal-boilerplate/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { modifier } from './modifier.js';

const boilerplates: Boilerplate = {
name: 'react-minimal-boilerplate',
hint: 'Typescript, Vite, Vitest, React, React Router v6, Tailwind CSS',
repo: 'https://github.com/boilertowns/react-minimal-boilerplate',
scripts: ['dev'],
modifier,
Expand Down
1 change: 1 addition & 0 deletions src/boilerplates/react-monorepo-boilerplate/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { modifier } from './modifier.js';

const boilerplates: Boilerplate = {
name: 'react-monorepo-boilerplate',
hint: 'Monorepo, Typescript, Turborepo, React, React Router v6, Next.js, Rollup, Babel, Webpack',
repo: 'https://github.com/boilertowns/react-monorepo-boilerplate',
scripts: ['build', 'dev'],
modifier,
Expand Down
1 change: 1 addition & 0 deletions src/boilerplates/react-nostalgia-boilerplate/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { modifier } from './modifier.js';

const boilerplates: Boilerplate = {
name: 'react-nostalgia-boilerplate',
hint: 'Typescript, React, React Router v6, Styled-components, Babel, Webpack',
repo: 'https://github.com/boilertowns/react-nostalgia-boilerplate',
scripts: ['dev'],
modifier,
Expand Down
1 change: 1 addition & 0 deletions src/boilerplates/react-ui-boilerplate/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { modifier } from './modifier.js';

const boilerplates: Boilerplate = {
name: 'react-ui-boilerplate',
hint: 'Typescript, React, Emotion, Rollup, Babel',
repo: 'https://github.com/boilertowns/react-ui-boilerplate',
scripts: ['storybook'],
modifier,
Expand Down
16 changes: 9 additions & 7 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@ interface ModifierParams {

export type Modifier = (params: ModifierParams) => void;

export interface Boilerplate {
/**
* Name of the repository.
*/
interface EnquirerChoice {
name: string;
message?: string;
value?: string;
hint?: string;
disabled?: boolean | string;
}

export interface Boilerplate extends EnquirerChoice {
name: string;
/**
* HTTP URL of repository.
*/
repo: string;
/**
* The npm scripts to get started with the boilerplate.
Expand Down

0 comments on commit 905b774

Please sign in to comment.