Skip to content

Commit

Permalink
Merge branch 'main' of github.com:Create-Node-App/create-node-app
Browse files Browse the repository at this point in the history
  • Loading branch information
ulises-jeremias committed Aug 6, 2023
2 parents 9dc87cb + 6853858 commit b0bd532
Show file tree
Hide file tree
Showing 8 changed files with 128 additions and 21 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<!--lint disable double-link awesome-heading awesome-git-repo-age awesome-toc-->

<div align="center">
<h1>Create Node App</h1>
<h1>🌟 Create Awesome Node App 🚀</h1>

[Changelog](#) |
[Changelog](./packages/create-awesome-node-app/CHANGELOG.md) |
[Contributing](./CONTRIBUTING.md)

</div>
Expand All @@ -16,23 +16,23 @@

</div>

This repository contains the source code for the [`create-awesome-node-app`][npmurl] package.
This repository contains the source code for the `create-awesome-node-app` package.

![cna](https://user-images.githubusercontent.com/17727170/229553510-49d0d46f-11ac-4b07-acf3-8db8ce7959ec.gif)

## Available Scripts
## 🚀 Available Scripts

In the project directory, you can run:

| `npm run <script>` | Description |
| ------------------ | ----------------------------------------------------------------------------------------------------------------------- |
| `test` | Runs unit tests with Jest. |
| `lint` | [Lints](http://stackoverflow.com/questions/8503559/what-is-linting) the project for potential errors |
| `lint` | 🚦 [Lints](http://stackoverflow.com/questions/8503559/what-is-linting) the project for potential errors |
| `lint:fix` | Lints the project and [fixes all correctable errors](http://eslint.org/docs/user-guide/command-line-interface.html#fix) |
| `format` | Formats the project using [Prettier](https://prettier.io/) |
| `type-check` | Runs [TypeScript](https://www.typescriptlang.org/) type checking |

## Contributing
## 🤝 Contributing

- Contributions make the open source community such an amazing place to learn, inspire, and create.
- Any contributions you make are **truly appreciated**.
Expand Down
44 changes: 44 additions & 0 deletions packages/create-awesome-node-app/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,49 @@
# create-awesome-node-app

## 0.4.17

### Patch Changes

- Updated changelog

## 0.4.16

### Patch Changes

- Updated docs

## 0.4.15

### Patch Changes

- Small fix
- Updated dependencies
- @create-node-app/core@0.3.9

## 0.4.14

### Patch Changes

- Simple fix
- Updated dependencies
- @create-node-app/core@0.3.8

## 0.4.13

### Patch Changes

- Updated package loader
- Updated dependencies
- @create-node-app/core@0.3.7

## 0.4.12

### Patch Changes

- Added conditional installation for npm, yarn and pnpm
- Updated dependencies
- @create-node-app/core@0.3.6

## 0.4.11

### Patch Changes
Expand Down
22 changes: 13 additions & 9 deletions packages/create-awesome-node-app/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
<!--lint disable double-link awesome-heading awesome-git-repo-age awesome-toc-->

<div align="center">
<h1>Create Awesome Node App</h1>

[Changelog](#) |
[Contributing](./CONTRIBUTING.md)

</div>
<div align="center">
<h1>🌟 Create Awesome Node App 🚀</h1>

[![Continious Integration][cibadge]][ciurl]
[![npm][npmversion]][npmurl]
Expand All @@ -16,11 +10,21 @@

</div>

Powerful tool to scaffold your application choosing between different templates and extensions for Web apps, Web Extensions, Monorepos and more!
🔥 Powerful tool to scaffold your application choosing between different templates and extensions for Web apps, Web Extensions, Monorepos, and more!

![cna](https://user-images.githubusercontent.com/17727170/229553510-49d0d46f-11ac-4b07-acf3-8db8ce7959ec.gif)

## Creating an app
## ⚙️ Requirements

To use `create-awesome-node-app`, you need to have the following requirements:

- **Node.js 18**: We recommend using [`fnm`](https://github.com/Schniz/fnm) to manage your Node.js versions. Install `fnm` and set the Node.js version to the latest 18 version:

```sh
fnm use 18
```

## 🌟 Creating an app

- With NPM:

Expand Down
2 changes: 1 addition & 1 deletion packages/create-awesome-node-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-awesome-node-app",
"version": "0.4.11",
"version": "0.4.17",
"type": "module",
"description": "Command line tool to create Node apps with a lot of different templates and extensions.",
"license": "MIT",
Expand Down
24 changes: 24 additions & 0 deletions packages/create-node-app-core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
# @create-node-app/core

## 0.3.9

### Patch Changes

- Small fix

## 0.3.8

### Patch Changes

- Simple fix

## 0.3.7

### Patch Changes

- Updated package loader

## 0.3.6

### Patch Changes

- Added conditional installation for npm, yarn and pnpm

## 0.3.5

### Patch Changes
Expand Down
16 changes: 13 additions & 3 deletions packages/create-node-app-core/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,19 @@ const install = (
}
} else if (usePnpm) {
command = "pnpm";
args = ["add", "--save"];
args = [
"install",
"--ignore-workspace-root-check",
"--loglevel",
"error",
];
if (isDevDependencies) {
args.push("--save-dev");
} else {
args.push("--save");
}

args.push(...dependencies);
args.push("--cwd");
args.push(root);
} else {
command = "npm";
args = ["install", "--loglevel", "error"];
Expand Down Expand Up @@ -164,6 +170,8 @@ const run = async ({
appName,
originalDirectory,
verbose,
useYarn,
usePnpm,
runCommand,
installCommand,
...customOptions,
Expand Down Expand Up @@ -364,6 +372,8 @@ export const createApp = async ({
const { packageJson, dependencies, devDependencies } = await loadPackages({
templatesOrExtensions,
appName,
usePnpm,
useYarn,
runCommand,
ignorePackage,
});
Expand Down
27 changes: 26 additions & 1 deletion packages/create-node-app-core/loaders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ type FileLoaderOptions = {
appName: string;
originalDirectory: string;
verbose: boolean;
useYarn?: boolean;
usePnp?: boolean;
srcDir: string;
mode?: string;
runCommand: string;
Expand All @@ -97,7 +99,9 @@ const copyLoader: FileLoader =
({ path }) => {
return copyFile(
`${templateDir}/${path}`,
`${root}/${path}`.replace(SRC_PATH_PATTERN, getSrcDirPattern(srcDir)),
`${root}/${path}`
.replace(/.if-(npm|yarn|pnpm)$/, "")
.replace(SRC_PATH_PATTERN, getSrcDirPattern(srcDir)),
verbose
);
};
Expand All @@ -107,6 +111,7 @@ const appendLoader: FileLoader =
({ path }) => {
const newPath = path
.replace(/.append$/, "")
.replace(/.if-(npm|yarn|pnpm)$/, "")
.replace(SRC_PATH_PATTERN, getSrcDirPattern(srcDir));
return appendFile(`${templateDir}/${path}`, `${root}/${newPath}`, verbose);
};
Expand All @@ -130,6 +135,7 @@ const templateLoader: FileLoader =
const newPath = path
.replace(/.template$/, "")
.replace(/.append$/, "")
.replace(/.if-(npm|yarn|pnpm)$/, "")
.replace(SRC_PATH_PATTERN, getSrcDirPattern(srcDir));

return writeFile(
Expand All @@ -153,6 +159,8 @@ const fileLoader: FileLoader =
appName,
originalDirectory,
verbose,
useYarn,
usePnpm,
srcDir = DEFAULT_SRC_PATH,
runCommand,
installCommand,
Expand All @@ -174,6 +182,8 @@ const fileLoader: FileLoader =
appName,
originalDirectory,
verbose,
useYarn,
usePnpm,
mode,
srcDir,
runCommand,
Expand All @@ -192,6 +202,8 @@ export type LoadFilesOptions = {
appName: string;
originalDirectory: string;
verbose: boolean;
useYarn?: boolean;
usePnpm?: boolean;
srcDir?: string;
runCommand: string;
installCommand: string;
Expand All @@ -205,6 +217,8 @@ export const loadFiles = async ({
appName,
originalDirectory,
verbose,
useYarn = false,
usePnpm = false,
srcDir = DEFAULT_SRC_PATH,
runCommand,
installCommand,
Expand All @@ -225,6 +239,15 @@ export const loadFiles = async ({
"!template.json",
"!yarn.lock",
"!pnpm-lock.yaml",
// based on the package manager we want to ignore files containing
// the other package as condition.
// For example, if `usePnpm` is true, the we need to ignore
// all files with `.if-npm` or `.if-yarn` somewhere in the name.
...(usePnpm
? ["!*.if-npm.*", "!*.if-yarn.*"]
: useYarn
? ["!*.if-npm.*", "!*.if-pnpm.*"]
: ["!*.if-yarn.*", "!*.if-pnpm.*"]),
],
directoryFilter: ["!package"],
})) {
Expand All @@ -235,6 +258,8 @@ export const loadFiles = async ({
appName,
originalDirectory,
verbose,
useYarn,
usePnpm,
srcDir,
runCommand,
installCommand,
Expand Down
2 changes: 1 addition & 1 deletion packages/create-node-app-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@create-node-app/core",
"version": "0.3.5",
"version": "0.3.9",
"main": "./dist/index.js",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down

0 comments on commit b0bd532

Please sign in to comment.