Skip to content

Commit

Permalink
fix: rename react-native-ci-cli to setup-ci after migration (#100)
Browse files Browse the repository at this point in the history
* fix: rename react-native-ci-cli to setup-ci after migration

* Update readme.md

Co-authored-by: Maciej Stosio <[email protected]>

* rename React Native CI CLI to npx setup-ci

* add publish-alias.yml workflow

* change commit links in CHANGELOG

* update name in feature request template

* docs: update header

* bump to dev version when publishing to react-native-ci-cli

* remove old test file

* remove unused import in bump-version-dev.ts

* update tests after binary name change

* remove unnecessary generate command file

* update demo git in readme

* update demo description in readme to match new gif

---------

Co-authored-by: Maciej Stosio <[email protected]>
  • Loading branch information
km1chno and maciekstosio authored Sep 17, 2024
1 parent 12743c0 commit b15de42
Show file tree
Hide file tree
Showing 21 changed files with 98 additions and 134 deletions.
7 changes: 4 additions & 3 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**What feature would you like a to see in react-native-ci-cli?**
<!-- Go with the flow -->
**What feature would you like a to see in setup-ci?**

<!-- Go with the flow -->

**Is there already a workaround for it?**

<!-- If so, please provide us with one. -->
33 changes: 33 additions & 0 deletions .github/workflows/publish-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# publish as "react-native-ci-cli" with dev version instead of "setup-ci" for testing purposes

name: Publish dev version to NPM
on:
push: main

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 🏗 Setup repo
uses: actions/checkout@v4

- name: 🍀 Setup Node
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'yarn'
registry-url: 'https://registry.npmjs.org'

- name: 📦 Install dependencies
run: yarn

- name: 🏷️ Bump dev version
run: yarn bump:dev

- name: 🛠️ Build dev
run: yarn build:dev

- name: 🚀 Publish dev to NPM repository
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
6 changes: 3 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ jobs:
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: 🛠️ Build for alias
run: yarn build:alias
- name: 🛠️ Build dev
run: yarn build:dev

- name: 🚀 Publish package to NPM repository for alias
- name: 🚀 Publish dev package to NPM repository
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
38 changes: 11 additions & 27 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,30 @@
## [0.4.10](https://github.com/software-mansion-labs/react-native-ci-cli/compare/v0.4.9...v0.4.10) (2024-08-27)

## [0.4.10](https://github.com/software-mansion/setup-ci/compare/v0.4.9...v0.4.10) (2024-08-27)

### Bug Fixes

* add credits and spell check ([#84](https://github.com/software-mansion-labs/react-native-ci-cli/issues/84)) ([91a00e2](https://github.com/software-mansion-labs/react-native-ci-cli/commit/91a00e2a24207ce7535acdb2bbd9d542d9d41479))



## [0.4.9](https://github.com/software-mansion-labs/react-native-ci-cli/compare/v0.4.8...v0.4.9) (2024-08-27)
- add credits and spell check ([#84](https://github.com/software-mansion/setup-ci/issues/84)) ([91a00e2](https://github.com/software-mansion/setup-ci/commit/91a00e2a24207ce7535acdb2bbd9d542d9d41479))

## [0.4.9](https://github.com/software-mansion/setup-ci/compare/v0.4.8...v0.4.9) (2024-08-27)

### Bug Fixes

* add contents read permissions to detox workflows ([#83](https://github.com/software-mansion-labs/react-native-ci-cli/issues/83)) ([f6ab340](https://github.com/software-mansion-labs/react-native-ci-cli/commit/f6ab340ef66cda33727044e700c05a19f6ba2af9))



## [0.4.8](https://github.com/software-mansion-labs/react-native-ci-cli/compare/v0.4.7...v0.4.8) (2024-08-27)
- add contents read permissions to detox workflows ([#83](https://github.com/software-mansion/setup-ci/issues/83)) ([f6ab340](https://github.com/software-mansion/setup-ci/commit/f6ab340ef66cda33727044e700c05a19f6ba2af9))

## [0.4.8](https://github.com/software-mansion/setup-ci/compare/v0.4.7...v0.4.8) (2024-08-27)

### Bug Fixes

* add check read permissions to detox workflows ([#82](https://github.com/software-mansion-labs/react-native-ci-cli/issues/82)) ([6aa5079](https://github.com/software-mansion-labs/react-native-ci-cli/commit/6aa5079824fd0b5612b59150346ac0c6f564d564))



## [0.4.7](https://github.com/software-mansion-labs/react-native-ci-cli/compare/v0.4.6...v0.4.7) (2024-08-26)
- add check read permissions to detox workflows ([#82](https://github.com/software-mansion/setup-ci/issues/82)) ([6aa5079](https://github.com/software-mansion/setup-ci/commit/6aa5079824fd0b5612b59150346ac0c6f564d564))

## [0.4.7](https://github.com/software-mansion/setup-ci/compare/v0.4.6...v0.4.7) (2024-08-26)

### Bug Fixes

* add repository url ([621c19a](https://github.com/software-mansion-labs/react-native-ci-cli/commit/621c19af3ac0fc63785b79f22c012ec4ae6bbb9b))



## [0.4.6](https://github.com/software-mansion-labs/react-native-ci-cli/compare/v0.4.5...v0.4.6) (2024-08-26)
- add repository url ([621c19a](https://github.com/software-mansion/setup-ci/commit/621c19af3ac0fc63785b79f22c012ec4ae6bbb9b))

## [0.4.6](https://github.com/software-mansion/setup-ci/compare/v0.4.5...v0.4.6) (2024-08-26)

### Bug Fixes

* add token back ([a789a31](https://github.com/software-mansion-labs/react-native-ci-cli/commit/a789a315f947191572b47be70531b7e17329f45e))
* remove unused token ([ca2d93c](https://github.com/software-mansion-labs/react-native-ci-cli/commit/ca2d93c138714c3e8bba9009ded175b6af56de1d))



- add token back ([a789a31](https://github.com/software-mansion/setup-ci/commit/a789a315f947191572b47be70531b7e17329f45e))
- remove unused token ([ca2d93c](https://github.com/software-mansion/setup-ci/commit/ca2d93c138714c3e8bba9009ded175b6af56de1d))
2 changes: 1 addition & 1 deletion __tests__/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ test('prints help', async () => {
expect(output).toContain(version)

for (const message of [
'Welcome to react-native-ci-cli',
'Welcome to setup-ci',
'Quickly setup CI workflows for your React Native app',
'--help',
'--version',
Expand Down
2 changes: 1 addition & 1 deletion __tests__/utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { execSync, spawn } from 'child_process'
import { join } from 'path'

const PATH_TO_BINARY = join(__dirname, '..', 'bin', 'react-native-ci-cli')
const PATH_TO_BINARY = join(__dirname, '..', 'bin', 'setup-ci')

const TEST_PROJECTS_FOLDER = 'test-projects'
const TEST_PROJECT_NAME = 'test-project'
Expand Down
File renamed without changes.
3 changes: 0 additions & 3 deletions docs/commands.md

This file was deleted.

Binary file modified docs/example-usage.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/header.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 0 additions & 47 deletions docs/plugins.md

This file was deleted.

11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
{
"name": "react-native-ci-cli",
"name": "setup-ci",
"version": "0.4.10",
"description": "Effortlessly generate GitHub workflows for the most popular CI tasks in your React Native project.",
"types": "build/types/types.d.ts",
"bin": {
"react-native-ci-cli": "bin/react-native-ci-cli"
"setup-ci": "bin/setup-ci"
},
"scripts": {
"clean-build": "rimraf -rf ./build",
"compile": "tsc -p .",
"copy-templates": "cp -r ./src/templates/ ./build/templates",
"build": "yarn clean-build && yarn compile && yarn copy-templates",
"build:dev": "sed -i 's/\"name\": \"react-native-ci-cli\"/\"name\": \"setup-ci\"/g' package.json && yarn build",
"bump:dev": "node scripts/bump-version-dev.ts",
"prepublishOnly": "yarn build",
"format": "eslint \"**/*.{js,jsx,ts,tsx}\" --fix && prettier \"**/*.{js,jsx,ts,tsx,json}\" --write",
"test": "jest --runInBand --bail --verbose",
"watch": "jest --watch",
"build:alias": "sed -i 's/\"name\": \"react-native-ci-cli\"/\"name\": \"setup-ci\"/g' package.json && yarn build",
"snapupdate": "jest --updateSnapshot",
"coverage": "jest --coverage",
"ts:check": "tsc -p . --noEmit",
Expand All @@ -37,7 +37,7 @@
"cli",
"CD"
],
"repository": "github:software-mansion-labs/react-native-ci-cli",
"repository": "github:software-mansion/setup-ci",
"dependencies": {
"@clack/core": "^0.3.4",
"@clack/prompts": "^0.7.0",
Expand All @@ -61,6 +61,7 @@
"jest": "24.5.0",
"prettier": "^2.2.1",
"pretty-quick": "^3.1.0",
"semver": "^7.6.3",
"ts-jest": "24.3.0",
"ts-node": "^10.9.1",
"typescript": "^5.5.3"
Expand Down
24 changes: 12 additions & 12 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<img src="https://s10.gifyu.com/images/SDHiW.png" />
<img src="./docs/header.png" />

## 🤔 Why?

The problem we noticed is that setting up CI is performed once, needs to be researched every time, and is often trial and error driven. The process is repetitive.

We created a tool that bootstraps CI with the most used features, which are ready for customization in the future. When you run `npx setup-ci` React Native CI CLI generates GitHub workflows for the most popular CI tasks.
We created a tool that bootstraps CI with the most used features, which are ready for customization in the future. Running `npx setup-ci` generates GitHub workflows for the most popular CI tasks.

## 📖 Usage

Expand All @@ -14,22 +14,22 @@ Simply go to your project root directory and run:
npx setup-ci
```

then select the setup that matches your project - React Native CI CLI generates workflows and tries to add missing configs and install necessary dependencies.
then select the setup that matches your project - `npx setup-ci` generates workflows and tries to add missing configs and install necessary dependencies.

If your project has a monorepo structure, run the script from the root directory of the app for which you want to set up workflows.

## 💡 Demo

Say we want to set up GitHub actions that run ESLint check and Jest tests on our project every time we create or push to an existing Pull Request.
Let's try to use `react-native-ci-cli` to do the heavy lifting and generate all the necessary configurations.
Say we want to set up GitHub actions that run Typescript and Prettier checks on our project every time we create or push to an existing Pull Request.
Let's try to use `npx setup-ci` to do the heavy lifting and generate all the necessary configurations.

<p align="center">
<img
style="width: 80%;"
src="https://s12.gifyu.com/images/SonNQ.gif"/>
src="docs/example-usage.gif"/>
</p>

Alternatively, we can go fully automatic by passing flags `--preset --lint --jest` to avoid all interaction with the script. You can check the section below for more information about available flags!
Alternatively, we can use flags `--preset --ts --prettier` to avoid the interactive survey at the beginning of the script. You can check the section below for more information about available flags!

## ⚙️ Features

Expand All @@ -38,7 +38,7 @@ Alternatively, we can go fully automatic by passing flags `--preset --lint --jes
- Monorepo structure is supported, but make sure you run the script from the app directory,
not the monorepo root.

When using `react-native-ci-cli`, you can provide additional flags to modify its default behavior.
When using `npx setup-ci`, you can provide additional flags to modify its default behavior.

<table>
<tr>
Expand Down Expand Up @@ -104,7 +104,7 @@ The following are **feature flags** that can be used with `--preset` flag (they

## 🔐 Repository secrets

Some workflows generated by `react-native-ci-cli` require setting up repository secrets that can be then accessed by workflows as `${{ secrets.* }}`. Make sure to read logs printed by the script
Some workflows generated by `npx setup-ci` require setting up repository secrets that can be then accessed by workflows as `${{ secrets.* }}`. Make sure to read logs printed by the script
as you will always be prompted to create secrets if necessary. The following table shows a summary of secrets you might have to create for generated workflows to work properly.

<table>
Expand All @@ -120,7 +120,7 @@ as you will always be prompted to create secrets if necessary. The following tab

## 💬 Your feedback

This tool is supposed to be helpful to as many developers as possible - and therefore we are open to your ideas and general feedback! If you want to share your opinion about `react-native-ci-cli` or
This tool is supposed to be helpful to as many developers as possible - and therefore we are open to your ideas and general feedback! If you want to share your opinion about `npx setup-ci` or
have some thoughts about how it could be further developed, don't hesitate to create an issue or contact
the maintainers directly.

Expand All @@ -134,14 +134,14 @@ the maintainers directly.

## 📋 License

React Native CI CLI is licensed under [The MIT License](LICENSE).
`npx setup-ci` is licensed under [The MIT License](LICENSE).

## 💸 Credits

This project has been built and is maintained thanks to the support from [Software Mansion](https://swmansion.com)

[![swm](https://logo.swmansion.com/logo?color=white&variant=desktop&width=150&tag=react-native-reanimated-github 'Software Mansion')](https://swmansion.com)

## React Native CI CLI is created by Software Mansion
## `setup-ci` is created by Software Mansion

Since 2012 [Software Mansion](https://swmansion.com) is a software agency with experience in building web and mobile apps. We are Core React Native Contributors and experts in dealing with all kinds of React Native issues. We can help you build your next dream product – [Hire us](https://swmansion.com/contact/projects?utm_source=reanimated&utm_medium=readme).
14 changes: 14 additions & 0 deletions scripts/bump-version-dev.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const fs = require('fs')
const semver = require('semver')

const packageJSON = require('../package.json')

const currentVersion = packageJSON.version

const timestamp = Math.floor(Date.now() / 1000)
const newVersion = `${semver.inc(currentVersion, 'patch')}-dev.${timestamp}`

packageJSON.version = newVersion
fs.writeFileSync('package.json', JSON.stringify(packageJSON, null, 2))

console.log(`Updated version to ${newVersion}`)
4 changes: 2 additions & 2 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { Options } from 'gluegun/build/types/domain/options'

async function run(argv: string | Options) {
const cli = build()
.brand('react-native-ci-cli')
.brand('setup-ci')
.src(__dirname)
.plugins('./node_modules', {
matching: 'react-native-ci-cli-*',
matching: 'setup-ci-*',
hidden: true,
})
.defaultCommand(require('./commands/index'))
Expand Down
23 changes: 0 additions & 23 deletions src/commands/generate.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/commands/help.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { GluegunCommand, GluegunToolbox } from 'gluegun'
import { CycliCommand } from './react-native-ci-cli'
import { CycliCommand } from './setup-ci'
import { HELP_FLAG } from '../constants'

module.exports = {
Expand Down
4 changes: 2 additions & 2 deletions src/commands/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { GluegunToolbox } from 'gluegun'
import { HelpCommand } from './help'
import { CycliCommand } from './react-native-ci-cli'
import { CycliCommand } from './setup-ci'
import { HELP_FLAG } from '../constants'

const help: HelpCommand = require('./help')
const cycli: CycliCommand = require('./react-native-ci-cli')
const cycli: CycliCommand = require('./setup-ci')

module.exports = {
hidden: true,
Expand Down
Loading

0 comments on commit b15de42

Please sign in to comment.