diff --git a/.changeset/heavy-adults-beg.md b/.changeset/heavy-adults-beg.md new file mode 100644 index 0000000..1727cf8 --- /dev/null +++ b/.changeset/heavy-adults-beg.md @@ -0,0 +1,5 @@ +--- +'create-boilertowns': patch +--- + +Display brief stack next to boilerplate name. diff --git a/.changeset/pre.json b/.changeset/pre.json new file mode 100644 index 0000000..9f26327 --- /dev/null +++ b/.changeset/pre.json @@ -0,0 +1,8 @@ +{ + "mode": "pre", + "tag": "next", + "initialVersions": { + "create-boilertowns": "0.0.6" + }, + "changesets": [] +} diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 2fc8c76..48a7083 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -6,4 +6,4 @@ ## Appreciation - + diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml new file mode 100644 index 0000000..46b406b --- /dev/null +++ b/.github/workflows/pr-test.yml @@ -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 diff --git a/.npmrc b/.npmrc deleted file mode 100644 index d9331cc..0000000 --- a/.npmrc +++ /dev/null @@ -1,2 +0,0 @@ -# https://docs.npmjs.com/using-private-packages-in-a-ci-cd-workflow -//registry.npmjs.org/:_authToken=${NPM_TOKEN} diff --git a/README.md b/README.md index 5c90e92..bf85f5f 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/__tests__/cli.test.ts b/__tests__/cli.test.ts index eac05a8..b9c49c2 100644 --- a/__tests__/cli.test.ts +++ b/__tests__/cli.test.ts @@ -31,5 +31,5 @@ describe('create-boilertowns cli', () => { ).toBeTruthy(); expect(fs.existsSync(path.resolve(testDir, 'node_modules'))).toBe(false); - }); + }, 10000); }); diff --git a/scripts/add-boilerplate.js b/scripts/add-boilerplate.js index 487faae..fbaf366 100644 --- a/scripts/add-boilerplate.js +++ b/scripts/add-boilerplate.js @@ -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', @@ -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, }); diff --git a/scripts/templates/index.ts.hbs b/scripts/templates/index.ts.hbs index b64ada6..ed657fc 100644 --- a/scripts/templates/index.ts.hbs +++ b/scripts/templates/index.ts.hbs @@ -3,6 +3,7 @@ import { modifier } from './modifier.js'; const boilerplates: Boilerplate = { name: '{{ name }}', + hint: '{{ stack }}', repo: '{{ repo }}', scripts: [{{#each scripts }}'{{ this }}',{{/each}}], modifier, diff --git a/src/boilerplates/node-cli-boilerplate/index.ts b/src/boilerplates/node-cli-boilerplate/index.ts index c48471b..2a68516 100644 --- a/src/boilerplates/node-cli-boilerplate/index.ts +++ b/src/boilerplates/node-cli-boilerplate/index.ts @@ -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, diff --git a/src/boilerplates/react-minimal-boilerplate/index.ts b/src/boilerplates/react-minimal-boilerplate/index.ts index 3689256..d3b8ad9 100644 --- a/src/boilerplates/react-minimal-boilerplate/index.ts +++ b/src/boilerplates/react-minimal-boilerplate/index.ts @@ -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, diff --git a/src/boilerplates/react-monorepo-boilerplate/index.ts b/src/boilerplates/react-monorepo-boilerplate/index.ts index 2712483..b4c246b 100644 --- a/src/boilerplates/react-monorepo-boilerplate/index.ts +++ b/src/boilerplates/react-monorepo-boilerplate/index.ts @@ -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, diff --git a/src/boilerplates/react-nostalgia-boilerplate/index.ts b/src/boilerplates/react-nostalgia-boilerplate/index.ts index 21bb398..68518f0 100644 --- a/src/boilerplates/react-nostalgia-boilerplate/index.ts +++ b/src/boilerplates/react-nostalgia-boilerplate/index.ts @@ -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, diff --git a/src/boilerplates/react-ui-boilerplate/index.ts b/src/boilerplates/react-ui-boilerplate/index.ts index 493e15e..3ae97f8 100644 --- a/src/boilerplates/react-ui-boilerplate/index.ts +++ b/src/boilerplates/react-ui-boilerplate/index.ts @@ -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, diff --git a/src/types/index.ts b/src/types/index.ts index 901bae6..22e6a30 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -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.