generated from raisiqueira/ts-template-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Rai Siqueira <[email protected]>
- Loading branch information
1 parent
559a6ce
commit d7c965e
Showing
6 changed files
with
136 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,130 +1,43 @@ | ||
name: Release to NPM | ||
|
||
concurrency: ${{ github.workflow }}-${{ github.ref }} | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
install-deps: | ||
name: Install dependencies | ||
if: github.repository == 'eruptionjs/create-eruption' && github.event_name != 'pull_request' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
packages: write | ||
|
||
- name: Install PNPM | ||
uses: pnpm/[email protected] | ||
with: | ||
version: 7 | ||
|
||
- name: Cache node_modules | ||
uses: actions/cache@v3 | ||
id: pnpm-cache | ||
with: | ||
path: '**/node_modules' | ||
key: ${{ runner.os }}-node-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}-node- | ||
- name: Setup Node and install project dependencies | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '16' | ||
check-latest: true | ||
cache: 'pnpm' | ||
|
||
if: steps.pnpm-cache.outputs.cache-hit != 'true' | ||
- run: pnpm install --prefer-offline | ||
# Automatically cancel in-progress actions on the same branch | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.head_ref || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build: | ||
name: Build package | ||
runs-on: ubuntu-latest | ||
needs: install-deps | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install PNPM | ||
uses: pnpm/[email protected] | ||
with: | ||
version: 7 | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '16' | ||
check-latest: true | ||
cache: 'pnpm' | ||
|
||
- name: Install dependencies | ||
if: steps.pnpm-cache.outputs.cache-hit != 'true' | ||
run: pnpm install --prefer-offline | ||
|
||
- name: Build package | ||
run: pnpm run build | ||
|
||
- name: Check for errors | ||
run: pnpm run lint | ||
|
||
# - name: Run tests | ||
# run: pnpm run test # The process to run the tests needs the build step. | ||
|
||
release: | ||
name: Release to NPM | ||
if: github.event.inputs.forceGPR != 'true' | ||
name: Build Packages | ||
runs-on: ubuntu-latest | ||
needs: build | ||
outputs: | ||
published: ${{ steps.changesets.outputs.published }} | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 # Fetch the entire Git history. | ||
|
||
- name: Install PNPM | ||
uses: pnpm/[email protected] | ||
- uses: actions/checkout@v3 | ||
- uses: pnpm/action-setup@v2 | ||
with: | ||
version: 7 | ||
|
||
- name: Load node_modules | ||
uses: actions/cache@v3 | ||
version: 8 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
path: '**/node_modules' | ||
key: ${{ runner.os }}-node-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
|
||
- name: Load build files | ||
uses: actions/cache@v3 | ||
with: | ||
path: '**/dist' | ||
key: ${{ runner.os }}-build-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
|
||
- name: Setup Node for NPM | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '16.14.2' | ||
check-latest: true | ||
node-version: 18 | ||
cache: 'pnpm' | ||
registry-url: 'https://registry.npmjs.org' | ||
|
||
- name: Set git user | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Raí Siqueira" | ||
- name: Create Changesets Pull Request or Publish to NPM | ||
id: changesets | ||
uses: changesets/action@v1 | ||
with: | ||
setupGitUser: false | ||
title: 'chore(changesets): bump package version' | ||
commit: 'chore: bump package version' | ||
version: node .github/changeset-version.js | ||
publish: pnpm run release | ||
cwd: './lib' | ||
- if: ${{ steps.cache-node.outputs.cache-hit != 'true' }} | ||
run: pnpm install | ||
- run: pnpm run build | ||
- uses: changesets/action@v1 | ||
if: ${{ github.event_name != 'pull_request' }} | ||
with: | ||
version: pnpm run ci:version | ||
publish: pnpm run ci:publish | ||
commit: '[ci] release' | ||
title: '[ci] release' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "create-eruption", | ||
"version": "0.4.0", | ||
"version": "0.5.0-beta.0", | ||
"description": "The Eruption CLI 🌋", | ||
"license": "MIT", | ||
"author": "Raí Siqueira <[email protected]>", | ||
|
@@ -28,7 +28,9 @@ | |
"dev": "tsup src --watch", | ||
"test": "vitest", | ||
"test:watch": "vitest watch", | ||
"coverage": "vitest run --coverage" | ||
"coverage": "vitest run --coverage", | ||
"ci:version": "changeset version", | ||
"ci:publish": "changeset publish" | ||
}, | ||
"keywords": [ | ||
"cli", | ||
|
@@ -40,7 +42,7 @@ | |
"vitest" | ||
], | ||
"devDependencies": { | ||
"@clack/prompts": "^0.5.0", | ||
"@clack/prompts": "^0.7.0", | ||
"@tsconfig/node16": "^1.0.3", | ||
"@types/yargs-parser": "^21.0.0", | ||
"@vitest/coverage-c8": "^0.24.5", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,24 @@ | ||
import type { Kit } from './types'; | ||
/** | ||
* The available kits. | ||
* The available kits to create a new project. | ||
* @returns returns a list of available kits. | ||
*/ | ||
export const AVAILABLE_KITS: Kit[] = [ | ||
{ | ||
label: 'Eruption Core (React, Vite and Vitest)', | ||
value: 'core', | ||
hint: 'The core kit for Eruption', | ||
}, | ||
]; | ||
|
||
/** | ||
* The available libraries to create a new library project. | ||
* @returns returns a list of available libraries. | ||
*/ | ||
export const AVAILABLE_LIBRARIES: Kit[] = [ | ||
{ | ||
label: 'React + TypeScript', | ||
value: 'react-lib', | ||
hint: 'Create a React library with TypeScript', | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.