Skip to content

Commit 72edadb

Browse files
authored
Merge pull request #68 from rxdi/67-non-matching-folder-names
fix(): removed namespacing and instead we use provided folder from fireDependencies the tool resolves now any package not only monorepo packages
2 parents 80ad4d1 + 2184330 commit 72edadb

5 files changed

Lines changed: 14 additions & 15 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ There are multiple binaries for `mac`, `windows` and `linux`
5151
There is only one tested in `linux` so keep in mind that for `mac` and `windows` may not work!
5252
If the binaries don't work in `mac` or `windows` please install it via `npm` globally with `npm i -g @rxdi/firelink`
5353

54-
The tool assumes `@group/package-name` naming convention
55-
5654
## Usage
5755

5856
#### Add `fireDependencies` inside `package.json`
@@ -173,6 +171,8 @@ Equivalent of excludes inside package.json `.fireignore` can be specified as a f
173171

174172
If you do not wish to use `.fireignore` file name the name can be specified from `fireConfig.excludesFileName`
175173

174+
You can pass `--runner dir` argument to the command which will override the default runner `firebase`
175+
176176
By default packages will be saved in `.packages` folder and `current` directory will be used
177177
U can change that by specifiyng properties `outFolderName` and `outFolderLocation` inside `fireConfig`
178178
Check `example` folder inside this repository

src/create-virtual-symlink.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { includes } from './helpers/args-extractors';
1+
import { includes, nextOrDefault } from './helpers/args-extractors';
22
import { buildPackages } from './helpers/build-packages';
33
import { copyPackages } from './helpers/copy-packages';
44
import { exitHandler } from './helpers/exit-handler';
@@ -22,7 +22,11 @@ export async function createVirtualSymlink(
2222
) {
2323
packageJson.fireConfig = packageJson.fireConfig || ({} as FireLinkConfig);
2424
let successStatus = false;
25-
const runner = packageJson.fireConfig.runner || DEFAULT_RUNNER;
25+
const runner =
26+
nextOrDefault(Tasks.RUNNER) ||
27+
packageJson.fireConfig.runner ||
28+
DEFAULT_RUNNER;
29+
2630
const excludes = [
2731
...(packageJson.fireConfig.excludes || []),
2832
...(await readExcludes(
@@ -67,7 +71,7 @@ export async function createVirtualSymlink(
6771
),
6872
);
6973

70-
await modifyJson(packageJson, dependencies, outFolder, outFolderName);
74+
await modifyJson(packageJson, dependencies);
7175
}
7276

7377
try {

src/helpers/args-extractors.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
import { Tasks } from '../injection-tokens';
2-
31
export const includes = (i: string) => process.argv.toString().includes(i);
42
export const nextOrDefault = (
53
i: string,
6-
fb: boolean | string = true,
4+
fb?: string,
75
type = (p: string) => p,
86
) => {
9-
if (process.argv.toString().includes(Tasks[i])) {
7+
if (process.argv.toString().includes(i)) {
108
const isNextArgumentPresent = process.argv[process.argv.indexOf(i) + 1];
119
if (!isNextArgumentPresent) {
1210
return fb;

src/helpers/modify-json.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,9 @@ import {
1010
export async function modifyJson(
1111
packageJson: PackageJson,
1212
dependencies: DependenciesLink[],
13-
outFolder: string,
14-
outFolderName: string,
1513
) {
16-
for (const { dep } of dependencies) {
17-
packageJson.dependencies[dep] = `file:${outFolder}/${outFolderName}/${
18-
dep.includes('/') ? dep.split('/')[1] : dep
19-
}`;
14+
for (const { dep, folder } of dependencies) {
15+
packageJson.dependencies[dep] = `file:${folder}`;
2016
}
2117
await promisify(writeFile)(
2218
WorkingFiles.PACKAGE_JSON,

src/injection-tokens.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export enum Tasks {
3939
LEAVE_CHANGES = '--leave-changes',
4040
NO_RUNNER = '--no-runner',
4141
USE_NATIVE_COPY = '--use-native-copy',
42+
RUNNER = '--runner',
4243
}
4344

4445
export interface DependenciesLink {

0 commit comments

Comments
 (0)