Skip to content

Commit

Permalink
Feat: Mono-repo setup added for i18nify and i18nify plugins (#53)
Browse files Browse the repository at this point in the history
* [feat]: i18nify moved to package

* feat: i18nify-react package added

* [feat]: esilnt, prettier, husky, lint-staged setup configured for mono-repo

* [fix]: workflow actions fix for danger and coverage

* [chore]: i18nify-js package workflow triggered only if files changed for js package

* [chore]: repo url updated for i18nify-react in package.json

* Create flat-sheep-own.md
  • Loading branch information
tarun-khanna authored Jan 22, 2024
1 parent ae69a17 commit 8154f6c
Show file tree
Hide file tree
Showing 111 changed files with 11,176 additions and 577 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
6 changes: 6 additions & 0 deletions .changeset/flat-sheep-own.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@razorpay/i18nify-js": minor
"@razorpay/i18nify-react": minor
---

Feat: Mono-repo setup added for i18nify and i18nify plugins
3 changes: 1 addition & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
lib
node_modules
**/node_modules
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
push:
branches:
- master
paths:
- 'packages/i18nify-js/**'

jobs:
coverage:
Expand All @@ -25,6 +27,7 @@ jobs:
with:
install-command: yarn --frozen-lockfile
- name: Run Tests
working-directory: packages/i18nify-js
run: yarn test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
Expand All @@ -36,6 +39,7 @@ jobs:
uses: actions/upload-artifact@v2
with:
name: Unit Test Results
working-directory: packages/i18nify-js
path: src/coverage/**/*.xml

publish-test-results:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ on:
review_requested,
review_request_removed,
]
paths:
- 'packages/i18nify-js/**'

jobs:
build-base:
Expand All @@ -25,23 +27,21 @@ jobs:
steps:
- name: Checkout Codebase
uses: actions/checkout@v3
with:
ref: ${{ github.base_ref }}
- name: Use Node v20
uses: actions/setup-node@v2
with:
node-version: 20.3.1
- name: Install Dependencies
run: yarn
- name: Make Build
run: npm run build
run: yarn build-js
- name: Upload base stats
uses: actions/upload-artifact@v3
with:
name: base
path: |
./lib
!./lib/**/*.map
./packages/i18nify-js/lib
!./packages/i18nify-js/lib/**/*.map
retention-days: 1

build-pr:
Expand All @@ -57,14 +57,14 @@ jobs:
- name: Install Dependencies
run: yarn
- name: Make Build
run: npm run build
run: yarn build-js
- name: Upload pr build
uses: actions/upload-artifact@v3
with:
name: pr
path: |
./lib
!./lib/**/*.map
./packages/i18nify-js/lib
!./packages/i18nify-js/lib/**/*.map
retention-days: 1

Danger:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: Playwright Tests
on:
pull_request:
paths:
- 'packages/i18nify-js/**'

defaults:
run:
working-directory: packages/i18nify-js

jobs:
test:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
name: Build & Validate
name: (i18nify-js) Build & Validate
on:
pull_request:
paths:
- 'packages/i18nify-js/**'

defaults:
run:
working-directory: packages/i18nify-js

jobs:
validate:
name: Validate Source code
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/i18nify-react-validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: (i18nify-react) Build & Validate
on:
pull_request:

jobs:
validate:
name: Validate Source code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v2
with:
node-version: 20.3.1
- name: Install dependencies
run: yarn install
- name: run build
run: yarn build-react
- name: run eslint
working-directory: packages/i18nify-react
run: yarn lint
- name: run tsc
working-directory: packages/i18nify-react
run: yarn tsc
2 changes: 1 addition & 1 deletion .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"**/*.{js,ts,mjs}": ["yarn format", "yarn validate"]
"**/*.{js,ts,tsx,mjs}": ["yarn format", "yarn validate"]
}
3 changes: 1 addition & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
lib
node_modules
**/node_modules
4 changes: 3 additions & 1 deletion dangerfile.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// refer file: https://gist.github.com/kkemple/998aad9f2b25520c916b00891abb6543
import { danger, fail, warn, markdown } from 'danger';

const { generateTableReport } = require('./scripts/bundle-size-report');
const {
generateTableReport,
} = require('./packages/i18nify-js/scripts/bundle-size-report');

const modifiedFiles = danger.git.modified_files;
const newFiles = danger.git.created_files;
Expand Down
78 changes: 10 additions & 68 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,92 +1,34 @@
{
"name": "@razorpay/i18nify-js",
"version": "1.1.0",
"author": "tarun khanna <[email protected]>",
"license": "MIT",
"main": "lib/cjs/index.js",
"module": "lib/esm/index.js",
"types": "lib/types/index.d.ts",
"repository": {
"type": "git",
"url": "ssh://[email protected]:razorpay/i18nify.git"
},
"files": [
"lib"
"private": true,
"workspaces": [
"packages/*"
],
"exports": {
".": {
"require": "./lib/cjs/index.js",
"import": "./lib/esm/index.js"
},
"./core": {
"require": "./lib/cjs/index.js",
"import": "./lib/esm/core/index.js"
},
"./currency": {
"require": "./lib/cjs/index.js",
"import": "./lib/esm/currency/index.js"
},
"./phoneNumber": {
"require": "./lib/cjs/index.js",
"import": "./lib/esm/phoneNumber/index.js"
}
},
"typesVersions": {
"*": {
"core": [
"./lib/esm/core/index.d.ts"
],
"currency": [
"./lib/esm/currency/index.d.ts"
],
"phoneNumber": [
"./lib/esm/phoneNumber/index.d.ts"
]
}
},
"scripts": {
"lint": "eslint src",
"lint:fix": "eslint src --fix",
"tsc": "tsc --noEmit",
"validate": "yarn tsc && yarn lint:fix",
"format": "prettier src --write",
"format:check": "prettier src --check",
"clean": "rm -rf lib",
"build": "yarn clean && rollup -c",
"test": "jest",
"prepare": "husky install && yarn build",
"format": "yarn workspace @razorpay/i18nify-js run format && yarn workspace @razorpay/i18nify-react run format",
"validate": "yarn workspace @razorpay/i18nify-js run validate && yarn workspace @razorpay/i18nify-react run validate",
"lint-staged": "lint-staged -c .lintstagedrc.json",
"release": "node ./scripts/generateGitHubRegistryNpmrc.js && changeset publish",
"publish-npm": "node ./scripts/publishToNpm.js",
"test:browser": "npx playwright test"
"prepare": "husky install",
"build-js": "yarn workspace @razorpay/i18nify-js run build",
"build-react": "yarn build-js && yarn workspace @razorpay/i18nify-react run build"
},
"devDependencies": {
"@changesets/cli": "^2.26.2",
"@playwright/test": "^1.40.1",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^11.1.5",
"@types/jest": "^29.5.7",
"@types/node": "^20.10.5",
"@typescript-eslint/eslint-plugin": "^6.9.1",
"@typescript-eslint/parser": "^6.9.1",
"cross-env": "^7.0.3",
"esbuild": "^0.19.4",
"eslint": "^8.52.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^5.0.1",
"husky": "^8.0.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"lint-staged": "^15.0.2",
"prettier": "^3.0.3",
"rollup": "^4.0.2",
"rollup-plugin-dts": "^6.1.0",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
"tslib": "^2.6.2",
"typescript": "^5.2.2"
"typescript": "^5.2.2",
"execa": "5.0.0"
}
}
1 change: 1 addition & 0 deletions packages/i18nify-js/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lib
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions packages/i18nify-js/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules
lib
.DS_Store
coverage
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
4 changes: 4 additions & 0 deletions packages/i18nify-js/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
lib
src/coverage
playwright-report
test-results
File renamed without changes.
File renamed without changes.
File renamed without changes.
74 changes: 74 additions & 0 deletions packages/i18nify-js/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"name": "@razorpay/i18nify-js",
"version": "1.1.0",
"author": "tarun khanna <[email protected]>",
"license": "MIT",
"main": "lib/cjs/index.js",
"module": "lib/esm/index.js",
"types": "lib/types/index.d.ts",
"repository": {
"type": "git",
"url": "ssh://[email protected]:razorpay/i18nify.git"
},
"files": [
"lib"
],
"exports": {
".": {
"require": "./lib/cjs/index.js",
"import": "./lib/esm/index.js"
},
"./core": {
"require": "./lib/cjs/index.js",
"import": "./lib/esm/core/index.js"
},
"./currency": {
"require": "./lib/cjs/index.js",
"import": "./lib/esm/currency/index.js"
},
"./phoneNumber": {
"require": "./lib/cjs/index.js",
"import": "./lib/esm/phoneNumber/index.js"
}
},
"typesVersions": {
"*": {
"core": [
"./lib/esm/core/index.d.ts"
],
"currency": [
"./lib/esm/currency/index.d.ts"
],
"phoneNumber": [
"./lib/esm/phoneNumber/index.d.ts"
]
}
},
"scripts": {
"lint": "eslint",
"lint:fix": "eslint --fix",
"format:check": "prettier --check",
"format": "prettier src --write",
"tsc": "tsc --noEmit",
"validate": "yarn tsc && yarn lint:fix",
"clean": "rm -rf lib",
"build": "yarn clean && rollup -c",
"test": "jest",
"prepare": "yarn build",
"test:browser": "npx playwright test"
},
"devDependencies": {
"@playwright/test": "^1.40.1",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^11.1.5",
"@types/jest": "^29.5.7",
"jest": "^29.7.0",
"ts-jest": "^29.1.1",
"jest-environment-jsdom": "^29.7.0",
"rollup": "^4.0.2",
"rollup-plugin-dts": "^6.1.0"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 8154f6c

Please sign in to comment.