Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refact(): removed a lot of logic related to copy packages folder rsync is now gone and we are left with only npm resolutions #69

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# [1.0.0-beta-0](https://github.com/rxdi/firelink/compare/v0.9.2...v1.0.0-beta-0) (2023-03-07)


### Bug Fixes

* removed namespacing and instead we use provided folder from fireDependencies the tool resolves now any package not only monorepo packages ([2184330](https://github.com/rxdi/firelink/commit/2184330fdc94c9ffe982940d98f24c7fa52ff161))


### Features

* **refactor:** whole logic is refactored to new one using commander ([06ec191](https://github.com/rxdi/firelink/commit/06ec1910b5785686303eed784acc2e9a40673980))



## [0.9.2](https://github.com/rxdi/firelink/compare/v0.9.1...v0.9.2) (2023-03-05)


Expand Down
49 changes: 17 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,26 @@ If the binaries don't work in `mac` or `windows` please install it via `npm` glo

#### Usage

Bootstrapping the packages
It will run `npm install` inside the current working directory
This will install local packages referenced inside `fireDependencies`
It means that `node_modules` folder will be already populated with appropriate packages after `npm install`

```bash
firelink --bootstrap --skip-runner
```

Deploying as usual

```bash
firelink deploy
```

The same as `firebase deploy` the only differance is that it will COPY monorepos replace package.json > dependencies with appropriate local file structure and then will revert changes after `firebase` script exit
You can also use one liner replacement for `npm install` and `firebase deploy`

```bash
firelink deploy --bootstrap
```

#### Leave changes to package.json after command execution exited

Expand Down Expand Up @@ -133,50 +148,20 @@ Revert the changes made inside `package.json`
firelink --no-runner --revert-changes
```

#### Native Nodejs Copy instead of `rsync`

This argument is introduced due to recent issue that has being made https://github.com/rxdi/firelink/issues/55
It appears that in the newest nodejs 16 docker image rsync package is missing

There is a way to specify which runner firelink will use
when specify `--use-native-copy` it will default to nodejs implementation of recursive copy the files
By default in windows environment this is the main method used to copy files since `rsync` is missing in windows

```
firelink --use-native-copy
```

# Configuration

Default runner is command `firebase` but you can change it for example to `gcloud` or `serverless` by defining `fireConfig` inside `package.json`

```json
{
"fireConfig": {
"runner": "firebase",
"outFolderName": ".packages",
"outFolderLocation": ".",
"excludes": ["node_modules"],
"useNativeCopy": true
"runner": "firebase"
}
}
```

`excludes` property can exclude some folders or files from being copied it accepts `Array` from `string`

For example we may want to install dependencies of the packages when deploying using local npm path,
so we want to not waste time duplicating node modules

Equivalent of excludes inside package.json `.fireignore` can be specified as a file inside a directory where the command `firelink` will be executed. `.fireignore` behaviour is the same as `.gitignore`

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

You can pass `--runner dir` argument to the command which will override the default runner `firebase`

By default packages will be saved in `.packages` folder and `current` directory will be used
U can change that by specifiyng properties `outFolderName` and `outFolderLocation` inside `fireConfig`
Check `example` folder inside this repository

You can put even `dir` command

```json
Expand Down
16 changes: 16 additions & 0 deletions build.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import esbuild from 'esbuild';

esbuild
.build({
entryPoints: ['./src/main.ts'],
bundle: true,
treeShaking: true,
platform: 'node',
target: 'node14.4',
outfile: './dist/main.js',
})
.then((data) => console.log('SUCCESS', data))
.catch((e) => {
console.error(e);
process.exit(1);
});
4 changes: 2 additions & 2 deletions example/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 1 addition & 7 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@
"@test/dependency": "./packages/dependency"
},
"fireConfig": {
"runner": "npm",
"outFolderName": ".packages",
"outFolderLocation": ".",
"excludes": [
"node_modules"
],
"useNativeCopy": true
"runner": "firebase"
}
}
192 changes: 191 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
{
"name": "@rxdi/firelink",
"version": "0.9.2",
"version": "1.0.0-beta-0",
"bin": {
"firelink": "./dist/main.js"
},
"main": "./dist/index.js",
"scripts": {
"build": "npx [email protected] build ./src/main.ts --experimental-scope-hoisting --target node",
"start": "npx gapi start",
"build": "npx node build.mjs",
"build-binary": "npx gapi build --single-executable && mkdir binaries && npm run copy-binaries",
"build-all": "npm run build-binary && rm -rf dist && npm run build",
"build-all": "npm run clean && npm run build-binary && rm -rf dist && npm run build",
"test": "npx jest",
"lint": "npx eslint . --ext .ts",
"prepare": "husky install",
"lint-fix": "npx eslint . --fix --ext .ts",
"publish-package": "npm publish --update-readme --access public",
"changelog": "npx conventional-changelog -p angular -i CHANGELOG.md -s --commit-path . -r 0",
"ammend-changelog": "git commit --amend --no-edit",
"clean": "rm -rf binaries dist",
"copy-binaries": "cp -r ./dist/firelink-linux ./binaries && cp -r ./dist/firelink-macos ./binaries && cp -r ./dist/firelink-win.exe ./binaries"
},
"files": [
Expand All @@ -30,7 +32,9 @@
"@types/node": "^12.0.10",
"@typescript-eslint/eslint-plugin": "^5.41.0",
"@typescript-eslint/parser": "^5.41.0",
"commander": "^9.0.0",
"conventional-changelog-cli": "^2.2.2",
"esbuild": "^0.17.11",
"eslint": "^8.26.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.2.1",
Expand Down
Loading