Skip to content

Commit f4802c5

Browse files
chore(monorepo): initial monorepo setup with ios-common-cookies module (#1)
- Introduce platform-react-native-modules monorepo to centralize reusable React Native native modules. - Add first public module @telefonica/ios-common-cookies, ready to be published on npm. - Configure npm workspaces for scalable multi-package management. - Add semantic-release setup per package with independent versioning. - Include GitHub Actions for publish, unpublish, CI and PR linting. - Define clear separation between public packages and internal tooling. - Add basic TypeScript build and type-check workflows. - Prepare repository for future reuse across React Native / Expo projects.
1 parent d4175ae commit f4802c5

20 files changed

+2043
-0
lines changed

.github/workflows/CI.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
merge_group:
9+
branches: [main]
10+
11+
concurrency:
12+
group: ci-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
ci:
17+
name: Typecheck & Build
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- name: Enable Corepack
24+
run: corepack enable
25+
26+
- name: Install dependencies
27+
run: yarn install --immutable
28+
29+
- name: Typecheck (all workspaces)
30+
run: yarn ts:check
31+
32+
- name: Build (all workspaces)
33+
run: yarn build
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: ⚠️ Deprecate package version
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
package:
7+
description: "Public package (packages/public/*)"
8+
required: true
9+
type: choice
10+
options:
11+
- ios-common-cookies
12+
range:
13+
description: "Version or range (e.g. 1.0.1 or <1.0.2)"
14+
required: true
15+
message:
16+
description: "Deprecation message (e.g. 'Bad build, use >=1.0.2')"
17+
required: true
18+
19+
jobs:
20+
deprecate:
21+
name: Deprecate
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
- uses: actions/checkout@v4
26+
with:
27+
token: ${{ secrets.FLOW_GITHUB_TOKEN }}
28+
29+
- name: Enable Corepack
30+
run: corepack enable
31+
32+
- name: Install dependencies
33+
run: yarn install --immutable
34+
35+
- name: Set npm token
36+
uses: "./.github/actions/set-npm-token"
37+
with:
38+
npm-token: ${{ secrets.NPM_PUBLISH_TOKEN }}
39+
40+
- name: Deprecate npm package version/range
41+
env:
42+
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
43+
run: |
44+
PKG_JSON="packages/public/${{ github.event.inputs.package }}/package.json"
45+
PKG_NAME=$(node -p "require(process.argv[1]).name" "$PKG_JSON")
46+
echo "Deprecating $PKG_NAME@${{ github.event.inputs.range }}"
47+
npm deprecate "$PKG_NAME@${{ github.event.inputs.range }}" "${{ github.event.inputs.message }}"

.github/workflows/lint-pr.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: "Lint PR"
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
7+
jobs:
8+
lint-pr:
9+
name: Validate PR title
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: amannn/action-semantic-pull-request@v5
14+
with:
15+
types: |
16+
feat
17+
fix
18+
chore
19+
revert
20+
requireScope: true
21+
env:
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: 📦 Publish package
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
package:
7+
description: "Public package to publish (packages/public/*)"
8+
required: true
9+
type: choice
10+
options:
11+
- ios-common-cookies
12+
cliArgs:
13+
description: "CLI args"
14+
required: false
15+
default: ""
16+
17+
jobs:
18+
publish:
19+
name: Publish selected package
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
with:
25+
token: ${{ secrets.FLOW_GITHUB_TOKEN }}
26+
27+
- name: Enable Corepack
28+
run: corepack enable
29+
30+
- name: Install dependencies
31+
run: yarn install --immutable
32+
33+
- name: Set npm token
34+
uses: "./.github/actions/set-npm-token"
35+
with:
36+
npm-token: ${{ secrets.NPM_PUBLISH_TOKEN }}
37+
38+
- name: Publish package
39+
working-directory: packages/public/${{ github.event.inputs.package }}
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.FLOW_GITHUB_TOKEN }}
42+
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
43+
run: npx semantic-release ${{ github.event.inputs.cliArgs }}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: 🧨 Unpublish package version
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
package:
7+
description: "Public package (packages/public/*)"
8+
required: true
9+
type: choice
10+
options:
11+
- ios-common-cookies
12+
version:
13+
description: "Version to unpublish (e.g. 1.0.1)"
14+
required: true
15+
16+
jobs:
17+
unpublish:
18+
name: Unpublish
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- uses: actions/checkout@v4
23+
with:
24+
token: ${{ secrets.FLOW_GITHUB_TOKEN }}
25+
26+
- name: Enable Corepack
27+
run: corepack enable
28+
29+
- name: Install dependencies
30+
run: yarn install --immutable
31+
32+
- name: Set npm token
33+
uses: "./.github/actions/set-npm-token"
34+
with:
35+
npm-token: ${{ secrets.NPM_PUBLISH_TOKEN }}
36+
37+
- name: Unpublish npm package version
38+
env:
39+
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
40+
run: |
41+
PKG_JSON="packages/public/${{ github.event.inputs.package }}/package.json"
42+
PKG_NAME=$(node -p "require(process.argv[1]).name" "$PKG_JSON")
43+
echo "Unpublishing $PKG_NAME@${{ github.event.inputs.version }}"
44+
npm unpublish "$PKG_NAME@${{ github.event.inputs.version }}" --force

.gitignore

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Dependencies
2+
node_modules/
3+
**/node_modules/
4+
5+
# Build outputs
6+
dist/
7+
**/dist/
8+
9+
# TypeScript
10+
*.tsbuildinfo
11+
12+
# Logs
13+
npm-debug.log*
14+
yarn-debug.log*
15+
yarn-error.log*
16+
17+
# OS
18+
.DS_Store
19+
.directory
20+
21+
# IDEs
22+
.idea/
23+
.vscode/
24+
25+
# Coverage / reports
26+
coverage/
27+
reports/
28+
29+
# Expo / Metro cache
30+
.expo/
31+
32+
# Yarn (Berry)
33+
.yarn/*
34+
!.yarn/patches
35+
!.yarn/plugins
36+
!.yarn/releases
37+
!.yarn/sdks
38+
!.yarn/versions
39+
.pnp.*
40+
.metro/

.yarnrc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodeLinker: node-modules

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2021 Telefonica Digital España S.L.U.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

package.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "platform-react-native-modules",
3+
"private": true,
4+
"workspaces": [
5+
"packages/*/*"
6+
],
7+
"scripts": {
8+
"build": "yarn workspaces foreach -A run build",
9+
"ts:check": "yarn workspaces foreach -A run ts:check"
10+
},
11+
"engines": {
12+
"node": ">=20"
13+
},
14+
"packageManager": "yarn@4.6.0"
15+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"branches": ["main"],
3+
"tagFormat": "ios-common-cookies-v${version}",
4+
"plugins": [
5+
"@semantic-release/commit-analyzer",
6+
"@semantic-release/release-notes-generator",
7+
"@semantic-release/npm",
8+
"@semantic-release/github"
9+
]
10+
}

0 commit comments

Comments
 (0)