-
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.
Merge branch 'main' into enhance-readme
- Loading branch information
Showing
13 changed files
with
149 additions
and
98 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 |
---|---|---|
|
@@ -11,3 +11,6 @@ reviewers: | |
|
||
skipUsers: | ||
- dependabot[bot] | ||
|
||
skipKeywords: | ||
- Merge main into next |
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Create "Merge main into next" PR | ||
on: | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
main-into-next: | ||
name: Create "Merge main into next" PR | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 # Needed to also fetch next branch | ||
|
||
- name: Setup Git user | ||
run: | | ||
git config user.name github-actions | ||
git config user.email github-actions@github.com | ||
- name: Try automatic merge of main into next | ||
id: automatic-merge-attempt | ||
continue-on-error: true | ||
run: | | ||
git checkout next | ||
git merge main | ||
echo 'PR_TITLE=Merge main into next' >> $GITHUB_ENV | ||
echo 'PR_BODY=This is an automated pull request to merge changes from `main` into `next`.' >> $GITHUB_ENV | ||
- name: Merge with conflicts if automatic merge failed | ||
if: steps.automatic-merge-attempt.outcome == 'failure' && steps.automatic-merge-attempt.conclusion == 'success' # https://docs.github.com/en/actions/learn-github-actions/contexts#steps-context | ||
run: | | ||
git add . | ||
git commit -m "Merge main into next" | ||
echo 'PR_TITLE=[Conflicts] Merge main into next' >> $GITHUB_ENV | ||
echo 'PR_BODY=This is an automated pull request to merge changes from `main` into `next`. It has merge conflicts. To resolve conflicts, check out the branch `merge-main-into-next` locally, make any necessary changes to conflicting files, and commit and publish your changes.' >> $GITHUB_ENV | ||
- name: Create pull request | ||
uses: peter-evans/create-pull-request@v5 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
title: ${{ env.PR_TITLE }} | ||
body: ${{ env.PR_BODY }} | ||
base: next | ||
branch: merge-main-into-next |
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,3 +1,3 @@ | ||
#!/usr/bin/env node | ||
|
||
require("../lib/createApp"); | ||
require("../lib/index"); |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { Command } from "commander"; | ||
import kleur from "kleur"; | ||
|
||
import { createApp } from "./scripts/create-app/createApp"; | ||
import { removeShowcaseContent } from "./scripts/remove-showcase/removeShowcase"; | ||
import { removeSite } from "./scripts/remove-site/removeSite"; | ||
import { isValidNodeVersion } from "./util/isValidNodeVersion"; | ||
import { isValidProjectName } from "./util/isValidProjectName"; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const { name, version } = require("../package.json"); | ||
|
||
void (async () => { | ||
const program = new Command(); | ||
if (!isValidNodeVersion()) { | ||
console.log(kleur.bgRed("Invalid Node Version (your Node.js version is prior to v18).")); | ||
return; | ||
} | ||
|
||
program.name(name).description("CLI to create a comet app").version(version); | ||
program | ||
.argument("<projectName>", "Sets the name of the project.") | ||
.option("-v, --verbose", "Enables extra console logs for verbose output.") | ||
.action((projectName: string, options) => { | ||
if (isValidProjectName(projectName)) { | ||
createApp({ projectName, verbose: options.verbose }); | ||
} else { | ||
console.log(kleur.bgRed("Please provide a valid project name.")); | ||
} | ||
}); | ||
|
||
program.addCommand( | ||
new Command("remove-showcase").action(() => { | ||
console.log(kleur.white(`Removing showcase content from project`)); | ||
removeShowcaseContent(); | ||
}), | ||
); | ||
|
||
program.addCommand( | ||
new Command("remove-site").action(() => { | ||
console.log(kleur.white(`Removing site from project`)); | ||
removeSite(); | ||
}), | ||
); | ||
|
||
program.parse(); | ||
})(); |
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
...e-app/src/util/cleanupWorkingDirectory.ts → ...pts/create-app/cleanupWorkingDirectory.ts
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import kleur from "kleur"; | ||
import process from "process"; | ||
|
||
import { replacePlaceholder } from "../../util/replacePlaceholder"; | ||
import { cleanupReadme } from "./cleanupReadme"; | ||
import { cleanupWorkingDirectory } from "./cleanupWorkingDirectory"; | ||
import { createInitialGitCommit } from "./createInitialGitCommit"; | ||
import { createWorkingDirectoryCopy } from "./createWorkingDirectoryCopy"; | ||
|
||
interface ProjectConfiguration { | ||
projectName: string; | ||
verbose: boolean; | ||
} | ||
|
||
export async function createApp(projectConfiguration: ProjectConfiguration) { | ||
console.log(kleur.white(`Creating a new Comet app in `) + kleur.yellow(`${process.cwd()}\n`)); | ||
if (!createWorkingDirectoryCopy(projectConfiguration.projectName, projectConfiguration.verbose)) { | ||
return; | ||
} | ||
cleanupReadme(); | ||
cleanupWorkingDirectory(projectConfiguration.verbose); | ||
replacePlaceholder(projectConfiguration.projectName, projectConfiguration.verbose); | ||
createInitialGitCommit(); | ||
console.log(`\n${kleur.white(`Success! Created '${projectConfiguration.projectName}' at '${process.cwd()}'.`)}`); | ||
console.log(kleur.white(`Inside that directory, you can run several commands:\n`)); | ||
console.log(kleur.white(`nvm use\n`)); | ||
console.log(kleur.cyan(`sh ./install.sh\n`)); | ||
console.log(kleur.white(`Installs dependencies.\n`)); | ||
console.log(kleur.cyan(`npm run dev`)); | ||
console.log(kleur.white(`Starts all services.\n`)); | ||
console.log(kleur.cyan(`npx dev-pm status [--interval]`)); | ||
console.log(kleur.white(`Checks the status of services.\n`)); | ||
console.log(kleur.cyan(`npx dev-pm logs <service>`)); | ||
console.log(kleur.white(`Shows the logs of a service.\n`)); | ||
console.log(kleur.cyan(`npx dev-pm restart <service>`)); | ||
console.log(kleur.white(`Restarts a service.\n`)); | ||
console.log(kleur.cyan(`npx dev-pm shutdown`)); | ||
console.log(kleur.white(`Shutdown all services.\n`)); | ||
console.log(kleur.cyan(`npm run --prefix api fixtures`)); | ||
console.log(kleur.white(`Imports fixtures.\n`)); | ||
console.log(kleur.green(`\n☄️ Successfully created Comet app: ${projectConfiguration.projectName}`)); | ||
} |
File renamed without changes.
File renamed without changes.
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
6 changes: 3 additions & 3 deletions
6
...src/scripts/remove-site/src/removeSite.ts → ...app/src/scripts/remove-site/removeSite.ts
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export function isValidProjectName(value: string): boolean { | ||
const allowedFormat = /^[A-Za-z0-9][A-Za-z0-9-]*$/; | ||
return allowedFormat.test(value); | ||
} |