Skip to content
This repository was archived by the owner on Apr 13, 2025. It is now read-only.

Commit 42b68fb

Browse files
authored
fix(install): update development installer for npm workspaces
* Fix/npm workspaces - Remove npm run bootstrap - Fix typos and grammar in README using <https://languagetool.org/> - Change test/uninstall/index.ts ls 35 because of change in api calls Signed-off-by: Tim_Tech_Dev <Tim_Tech_Dev@protonmail.com> * Implemented Requested Changes - Inline boolean in src/install/index - Remove version check in src/install/dev - Change `createDevInstall` test respectively Signed-off-by: Tim_Tech_Dev <Tim_Tech_Dev@protonmail.com>
1 parent 34b37a0 commit 42b68fb

File tree

6 files changed

+27
-27
lines changed

6 files changed

+27
-27
lines changed

README.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# nodecg-io-cli
66
<!-- prettier-ignore-end -->
77

8-
This is the cli for [nodecg-io](https://github.com/codeoverflow-org/nodecg-io) that allows you to easily manage your nodecg-io installation and helps you with nodecg-io related development.
8+
This is the CLI for [nodecg-io](https://github.com/codeoverflow-org/nodecg-io) that allows you to easily manage your nodecg-io installation and helps you with nodecg-io related development.
99

1010
## Table of contents
1111

@@ -21,46 +21,46 @@ This is the cli for [nodecg-io](https://github.com/codeoverflow-org/nodecg-io) t
2121

2222
## Commands
2323

24-
Here's a brief overview of the available commands. More indepth usage guides of these commands will be available in the [nodecg-io docs](https://nodecg.io) at some point.
24+
Here's a brief overview of the available commands. More in-depth usage guides of these commands will be available in the [nodecg-io docs](https://nodecg.io) at some point.
2525

2626
### `nodecg-io install`
2727

28-
Installs nodecg-io to your current nodecg installation into a sub-directory called `nodecg-io`. Allows you to select which released version you want or if you wish to get a development install.
28+
Installs nodecg-io to your current NodeCG installation into a subdirectory called `nodecg-io`. Allows you to select which released version you want or if you wish to get a development install.
2929

3030
A production install fetches tarballs of the needed packages from the official npm registry, unpacks them, creates a `package.json` with all packages in a npm v7 workspace configuration and installs dependencies that way.
3131

32-
A development install clones the official git repository (`master`), installs dependencies, bootstraps all packages using lerna and builds all packages.
32+
A development install clones the official git repository (`master`), installs dependencies builds all packages.
3333

34-
Either way at the end of the installation it will automatically add the nodecg-io directory (and samples if dev install and selected) to the `bundles.paths` array of your nodecg configuration. If you don't have a nodecg configuration it will create one for you.
34+
Either way at the end of the installation it will automatically add the nodecg-io directory (and samples if dev install and selected) to the `bundles.paths` array of your NodeCG configuration. If you don't have a NodeCG configuration it will create one for you.
3535

36-
If you later decide that you want to add or remove a service you can just re-run `nodecg-io install`. It saves your choices and makes them the default selected if you already have a installation so you can make changes to them. If you re-run the install command it will also pull the repo and rebuild if necessary in case of a development install and, in case of a production install, it will make any updates if some packages have a new patch version available. Updates of minor and major changes must be made explicitly by selecting the newer version when running the install command.
36+
If you later decide that you want to add or remove a service you can just re-run `nodecg-io install`. It saves your choices and makes them the default selected if you already have an installation, so you can make changes to them. If you re-run the `install` command it will also pull the repo and rebuild if necessary. In case of a development install and, in case of a production install, it will make any updates if some packages have a new patch version available. Updates of minor and major changes must be made explicitly by selecting the newer version when running the `install` command.
3737

3838
### `nodecg-io uninstall`
3939

40-
Undos everything that `nodecg-io install` did. It removes the `nodecg-io` directory with your installation and removes nodecg-io from your nodecg configuration.
40+
Undoes everything that `nodecg-io install` did. It removes the `nodecg-io` directory with your installation and removes nodecg-io from your NodeCG configuration.
4141

4242
### `nodecg-io generate`
4343

44-
Generates a new bundle in the `bundles/` directory in your nodecg installation.
45-
Allows you to decide on language (typescript or javascript), whether you want a dashboard/graphic and which services you want to use.
44+
Generates a new bundle in the `bundles/` directory in your NodeCG installation.
45+
Allows you to decide on language (TypeScript or JavaScript), whether you want a dashboard/graphic and which services you want to use.
4646
Uses your installed nodecg-io version and services, meaning you need to have the services that you want to use installed.
4747

4848
These generated bundles are only meant as a starting point, you may probably do more things like creating a git repository for your bundle,
49-
add a license, or add other tools like linters.
49+
add a licence, or add other tools like linters.
5050

51-
Also this command currently only works with installs of released versions and not with development installs. This is because all bundles using nodecg-io depend on `nodecg-io-core` and if you use typescript each used service as well. For development installs these are not published on npm and you would need some way of linking the packages locally.
51+
Also, this command currently only works with installs of released versions and not with development installs. This is because all bundles using nodecg-io depend on `nodecg-io-core` and if you use typescript each used service as well. For development installs these are not published on npm, and you would need some way of linking the packages locally.
5252

5353
## A note about versioning
5454

55-
This cli follows and is versioned independently from the rest of nodecg-io like `nodecg-io-core` or the services.
55+
This CLI follows and is versioned independently of the rest of nodecg-io like `nodecg-io-core` or the services.
5656

57-
The following table show which versions of the cli are compatible with which nodecg-io versions:
57+
The following table show which versions of the CLI are compatible with which nodecg-io versions:
5858

5959
| CLI versions | nodecg-io versions |
6060
| ------------ | ------------------ |
6161
| `0.1` | `0.1` |
6262

63-
Currently they are the same but we will follow [semver2](https://semver.org/) using [semantic-release](https://semantic-release.gitbook.io/semantic-release/) and the versions will diverge at some point.
63+
Currently, they are the same, but we will follow [semver2](https://semver.org/) using [semantic-release](https://semantic-release.gitbook.io/semantic-release/) and the versions will diverge at some point.
6464

6565
## Developer workflow
6666

@@ -73,10 +73,10 @@ $ npm i
7373
$ npm run build
7474
```
7575

76-
Then link your current local install of the cli to your global `node_modules` directory (might require `sudo` on linux):
76+
Then link your current local installation of the CLI to your global `node_modules` directory (might require `sudo` on linux):
7777

7878
```console
7979
$ npm link
8080
```
8181

82-
You can now use the `nodecg-io` command and it will use your local install. You DO NOT need to rerun the link command after you make changes to the cli, unless you move it another location. While developing you may want to start a TypeScript watcher by running `npm run watch` that will automatically update the JS files that are used while you make changes.
82+
You can now use the `nodecg-io` command, and it will use your local install. You DO NOT need to rerun the link command after you make changes to the CLI, unless you move it another location. While developing you may want to start a TypeScript watcher by running `npm run watch` that will automatically update the JS files that are used while you make changes.

src/install/development.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as chalk from "chalk";
22
import * as git from "isomorphic-git";
33
import * as fs from "fs";
44
import * as http from "isomorphic-git/http/node";
5-
import { directoryExists, executeCommand, removeDirectory } from "../utils/fs";
5+
import { directoryExists, removeDirectory } from "../utils/fs";
66
import { DevelopmentInstallation, writeInstallInfo } from "../utils/installation";
77
import { logger } from "../utils/log";
88
import * as path from "path";
@@ -175,12 +175,9 @@ function getGitCommitHash(dir: string): Promise<string> {
175175
}
176176

177177
async function installNPMDependencies(nodecgIODir: string) {
178-
logger.info("Installing npm dependencies and bootstrapping...");
179-
178+
logger.info("Installing npm dependencies...");
180179
await runNpmInstall(nodecgIODir, false);
181-
await executeCommand("npm", ["run", "bootstrap"], nodecgIODir);
182-
183-
logger.info("Installed npm dependencies and bootstrapped.");
180+
logger.info("Installed npm dependencies.");
184181
}
185182

186183
async function buildTypeScript(nodecgIODir: string, concurrency: number) {

src/install/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ async function install(concurrency: number): Promise<void> {
7171

7272
// Add bundle dirs to the nodecg config, so that they are loaded.
7373
await manageBundleDir(nodecgDir, nodecgIODir, true);
74+
await manageBundleDir(nodecgDir, path.join(nodecgIODir, "services"), requestedInstall.version !== "0.1");
7475
await manageBundleDir(
7576
nodecgDir,
7677
path.join(nodecgIODir, "samples"),

src/uninstall/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export async function uninstall(): Promise<void> {
3131

3232
// Remove bundle dirs from nodecg configuration
3333
await manageBundleDir(nodecgDir, nodecgIODir, false);
34+
await manageBundleDir(nodecgDir, path.join(nodecgIODir, "services"), false);
3435
await manageBundleDir(nodecgDir, path.join(nodecgIODir, "samples"), false);
3536

3637
// Delete directory

test/install/development.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ describe("createDevInstall", () => {
4040
expect(execSpy).toHaveBeenCalledTimes(0);
4141
});
4242

43-
test("should execute install, bootstrap and build", async () => {
43+
test("should execute install and build", async () => {
4444
fetchSpy.mockResolvedValueOnce(altFetchResult);
4545
await dev.createDevInstall(validDevInstall, fsRoot, 0);
46-
expect(execSpy).toHaveBeenCalledTimes(3);
46+
expect(execSpy).toHaveBeenCalledTimes(2);
4747
});
4848

4949
test("should not clone docs if not wanted in installation info", async () => {

test/uninstall/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,16 @@ describe("uninstall", () => {
3232
await vol.promises.mkdir(nodecgIODir);
3333
await uninstall();
3434

35-
expect(spyManageBundleDir).toHaveBeenCalledTimes(2);
35+
expect(spyManageBundleDir).toBeCalledTimes(3);
3636

3737
// Should remove nodecg-io directory and sample bundle directory (if applicable)
3838
expect(spyManageBundleDir.mock.calls[0][1]).toBe(nodecgIODir);
39-
expect(spyManageBundleDir.mock.calls[1][1]).toBe(path.join(nodecgIODir, "samples"));
40-
39+
expect(spyManageBundleDir.mock.calls[1][1]).toBe(path.join(nodecgIODir, "services"));
40+
expect(spyManageBundleDir.mock.calls[2][1]).toBe(path.join(nodecgIODir, "samples"));
4141
// Should remove them, not add them
4242
expect(spyManageBundleDir.mock.calls[0][2]).toBe(false);
4343
expect(spyManageBundleDir.mock.calls[1][2]).toBe(false);
44+
expect(spyManageBundleDir.mock.calls[2][2]).toBe(false);
4445
});
4546

4647
test("should remove nodecg-io directory", async () => {

0 commit comments

Comments
 (0)