Skip to content

feat/decoupled hooks #4

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

Draft
wants to merge 6 commits into
base: main
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
File renamed without changes.
1 change: 1 addition & 0 deletions packages/build-hooks-drive/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# @flexn/build-hooks-drive
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@flexn/build-hooks",
"version": "0.31.0",
"description": "Flexn Build Hooks",
"name": "@flexn/build-hooks-drive",
"version": "0.1.0",
"description": "Flexn Build Hooks Version manager",
"main": "lib/index",
"types": "lib/index",
"scripts": {
Expand All @@ -16,7 +16,7 @@
"src"
],
"repository": {
"directory": "packages/build-hooks",
"directory": "packages/build-hooks-drive",
"type": "git",
"url": "git+https://github.com/flexn-io/build-hooks.git"
},
Expand All @@ -34,11 +34,6 @@
"rnv": "*"
},
"dependencies": {
"googleapis": "39",
"isomorphic-unfetch": "^3.1.0",
"lodash-es": "4.17.21",
"rnv": "0.37.1",
"simple-git": "2.48.0",
"ts-object-utils": "0.0.5"
"googleapis": "39"
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
describe('Test template', () => {
describe('Test', () => {
beforeEach(() => {
console.log('Testing');
});
Expand Down
1 change: 1 addition & 0 deletions packages/build-hooks-drive/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './googleDrive';
File renamed without changes.
1 change: 1 addition & 0 deletions packages/build-hooks-fastlane/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# @flexn/build-hooks-fastlane
39 changes: 39 additions & 0 deletions packages/build-hooks-fastlane/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"name": "@flexn/build-hooks-fastlane",
"version": "0.1.0",
"description": "Flexn Build Hooks Version manager",
"main": "lib/index",
"types": "lib/index",
"scripts": {
"watch": "tsc --watch --preserveWatchOutput",
"build": "yarn clean && yarn compile",
"clean": "rm -rf ./lib && rm -rf tsconfig.tsbuildinfo",
"compile": "tsc -b tsconfig.json"
},
"files": [
"lib",
"LICENSE",
"src"
],
"repository": {
"directory": "packages/build-hooks-fastlane",
"type": "git",
"url": "git+https://github.com/flexn-io/build-hooks.git"
},
"publishConfig": {
"access": "public"
},
"keywords": [],
"author": "Flexn",
"license": "MIT",
"bugs": {
"url": "https://github.com/flexn-io/build-hooks/issues"
},
"homepage": "https://github.com/flexn-io/build-hooks#readme",
"peerDependencies": {
"rnv": "*"
},
"dependencies": {
"deepmerge": "3.2.0"
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
describe('Test template', () => {
describe('Test', () => {
beforeEach(() => {
console.log('Testing');
});
Expand Down
2 changes: 2 additions & 0 deletions packages/build-hooks-fastlane/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './androidGooglePlay';
export * from './iosTestFlight';
21 changes: 21 additions & 0 deletions packages/build-hooks-firebase/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 - present Flexn B.V.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
1 change: 1 addition & 0 deletions packages/build-hooks-firebase/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# @flexn/build-hooks-firebase
39 changes: 39 additions & 0 deletions packages/build-hooks-firebase/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"name": "@flexn/build-hooks-firebase",
"version": "0.1.0",
"description": "Flexn Build Hooks Version manager",
"main": "lib/index",
"types": "lib/index",
"scripts": {
"watch": "tsc --watch --preserveWatchOutput",
"build": "yarn clean && yarn compile",
"clean": "rm -rf ./lib && rm -rf tsconfig.tsbuildinfo",
"compile": "tsc -b tsconfig.json"
},
"files": [
"lib",
"LICENSE",
"src"
],
"repository": {
"directory": "packages/build-hooks-firebase",
"type": "git",
"url": "git+https://github.com/flexn-io/build-hooks.git"
},
"publishConfig": {
"access": "public"
},
"keywords": [],
"author": "Flexn",
"license": "MIT",
"bugs": {
"url": "https://github.com/flexn-io/build-hooks/issues"
},
"homepage": "https://github.com/flexn-io/build-hooks#readme",
"peerDependencies": {
"rnv": "*"
},
"dependencies": {
"deepmerge": "3.2.0"
}
}
9 changes: 9 additions & 0 deletions packages/build-hooks-firebase/src/__tests__/sanity.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
describe('Test', () => {
beforeEach(() => {
console.log('Testing');
});
it('init test', async () => {
const x = true;
expect(x).toEqual(true);
});
});
2 changes: 2 additions & 0 deletions packages/build-hooks-firebase/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './androidFirebase';
export * from './iosFirebase';
1 change: 1 addition & 0 deletions packages/build-hooks-firebase/src/rnv.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare module 'rnv';
7 changes: 7 additions & 0 deletions packages/build-hooks-firebase/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "@flexn/typescript-config/tsconfig.lib.node.json",
"compilerOptions": {
"outDir": "./lib",
"rootDir": "./src"
}
}
21 changes: 21 additions & 0 deletions packages/build-hooks-git/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 - present Flexn B.V.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@flexn/build-hooks-git",
"version": "0.30.0",
"version": "0.1.0",
"description": "Flexn Build Hook for Git",
"main": "lib/index",
"types": "lib/index",
Expand Down Expand Up @@ -34,6 +34,6 @@
"rnv": "*"
},
"dependencies": {
"simple-git": "3.12.0"
"simple-git": "^3.16.0"
}
}
1 change: 1 addition & 0 deletions packages/build-hooks-git/rnv.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare module 'rnv';
9 changes: 9 additions & 0 deletions packages/build-hooks-git/src/__tests__/sanity.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
describe('Test', () => {
beforeEach(() => {
console.log('Testing');
});
it('init test', async () => {
const x = true;
expect(x).toEqual(true);
});
});
1 change: 1 addition & 0 deletions packages/build-hooks-git/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './git';
1 change: 1 addition & 0 deletions packages/build-hooks-git/src/rnv.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare module 'rnv';
7 changes: 7 additions & 0 deletions packages/build-hooks-git/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "@flexn/typescript-config/tsconfig.lib.node.json",
"compilerOptions": {
"outDir": "./lib",
"rootDir": "./src"
}
}
21 changes: 21 additions & 0 deletions packages/build-hooks-monorepo/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 - present Flexn B.V.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
1 change: 1 addition & 0 deletions packages/build-hooks-monorepo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# @flexn/build-hooks-monorepo
39 changes: 39 additions & 0 deletions packages/build-hooks-monorepo/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"name": "@flexn/build-hooks-monorepo",
"version": "0.1.0",
"description": "Flexn Build Hooks Version manager",
"main": "lib/index",
"types": "lib/index",
"scripts": {
"watch": "tsc --watch --preserveWatchOutput",
"build": "yarn clean && yarn compile",
"clean": "rm -rf ./lib && rm -rf tsconfig.tsbuildinfo",
"compile": "tsc -b tsconfig.json"
},
"files": [
"lib",
"LICENSE",
"src"
],
"repository": {
"directory": "packages/build-hooks-monorepo",
"type": "git",
"url": "git+https://github.com/flexn-io/build-hooks.git"
},
"publishConfig": {
"access": "public"
},
"keywords": [],
"author": "Flexn",
"license": "MIT",
"bugs": {
"url": "https://github.com/flexn-io/build-hooks/issues"
},
"homepage": "https://github.com/flexn-io/build-hooks#readme",
"peerDependencies": {
"rnv": "*"
},
"dependencies": {
"deepmerge": "3.2.0"
}
}
9 changes: 9 additions & 0 deletions packages/build-hooks-monorepo/src/__tests__/sanity.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
describe('Test', () => {
beforeEach(() => {
console.log('Testing');
});
it('init test', async () => {
const x = true;
expect(x).toEqual(true);
});
});
5 changes: 5 additions & 0 deletions packages/build-hooks-monorepo/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// export * from './versions';
export * from './parser';
export * from './patcher';
export * from './synchronizer';
export * from './versions';
74 changes: 74 additions & 0 deletions packages/build-hooks-monorepo/src/parser.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import path from 'path';
import fs from 'fs';
import { FileUtils } from 'rnv';
import { MonoPackageConfig, MonorepoConfig } from './types';
const { readObjectSync } = FileUtils;

const parseRenativeProject = (dirPath: string): MonoPackageConfig => {
const conf: MonoPackageConfig = {};

if (fs.statSync(dirPath).isDirectory()) {
const _pkgPath = path.join(dirPath, 'package.json');
if (fs.existsSync(_pkgPath)) {
conf.pkgFile = readObjectSync(_pkgPath);
conf.pkgPath = _pkgPath;
conf.pkgName = conf.pkgFile?.name;
}
const _rnvPath = path.join(dirPath, 'renative.json');
if (fs.existsSync(_rnvPath)) {
conf.rnvPath = _rnvPath;
conf.rnvFile = readObjectSync(_rnvPath);
}
const _metaPath = path.join(dirPath, 'metadata.json');
if (fs.existsSync(_metaPath)) {
conf.metaPath = _metaPath;
conf.metaFile = readObjectSync(_metaPath);
}
const _plugTempPath = path.join(dirPath, '/pluginTemplates/renative.plugins.json');
if (fs.existsSync(_plugTempPath)) {
conf.plugTempPath = _plugTempPath;
conf.plugTempFile = readObjectSync(_plugTempPath);
}

const _templateConfigPath = path.join(dirPath, 'renative.template.json');
if (fs.existsSync(_templateConfigPath)) {
conf.templateConfigPath = _templateConfigPath;
conf.templateConfigFile = readObjectSync(_templateConfigPath);
}
}
return conf;
};

export const parseMonorepo = (packagesDirs: string[], projectDirs?: string[]): MonorepoConfig => {
// const packageNamesAll: any = [];
const monoConfig: MonorepoConfig = {};

packagesDirs.forEach((pkgDirPath) => {
const dirs = fs.readdirSync(pkgDirPath);

dirs.forEach((dir) => {
const conf = parseRenativeProject(path.join(pkgDirPath, dir));
if (conf.pkgName) {
monoConfig[conf.pkgName] = conf;
}

// packageNamesAll.push(conf.pkgName);
});
});
if (projectDirs) {
projectDirs.forEach((projectDir) => {
const conf = parseRenativeProject(projectDir);
if (conf.pkgName) {
monoConfig[conf.pkgName] = conf;
}

// packageNamesAll.push(conf.pkgName);
});
}

// return {
// packageNamesAsArray: packageNamesAll,
// configs: packageConfigs,
// };
return monoConfig;
};
Loading