sahpa-monorepo 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
package/README.md ADDED
@@ -0,0 +1,20 @@
1
+ # Sahpa Monorepo
2
+
3
+ این ساختار یک مونوریپوی مبتنی بر `npm workspaces` است که امکان توسعه هم‌زمان چند پکیج و اپلیکیشن را می‌دهد.
4
+
5
+ ## مفهوم Workspace در مونوریپو
6
+ در npm، یک **workspace** به مجموعه‌ای از پکیج‌های داخلی گفته می‌شود که با هم تحت یک `package.json` استاندارد مدیریت می‌شوند. هر workspace یک پکیج مجزا است، ولی نصب وابستگی‌ها، اجرای اسکریپت‌ها و لینک دادن پکیج‌ها از ریشه مونوریپو انجام می‌شود. بنابراین می‌توانید یک کتابخانه مشترک بنویسید (`packages/utils`)، آن را به اپ وب اضافه کنید (`apps/web`) و نسخه‌های محلی را بدون انتشار خارج از ریشه مصرف کنید. این سازوکار هزینه‌ی نصب را کاهش و هماهنگی بین پکیج‌ها را ساده‌تر می‌کند.
7
+
8
+ ## ساختار
9
+ - `package.json` ریشه با فیلد `workspaces` تعریف کننده‌ی زیرپکیج‌های `apps/*` و `packages/*`.
10
+ - `apps/web` اپ نمونه‌ای است که از پکیج‌های داخلی استفاده می‌کند.
11
+ - `packages/utils` و `packages/shared` به عنوان پکیج‌های کمکی قابل reuse.
12
+
13
+ ## راه‌اندازی
14
+ 1. `npm run bootstrap` — نصب وابستگی‌ها برای تمام workspaceها.
15
+ 2. `npm run start:web` — اجرای اپ نمونه از workspace `apps/web`.
16
+ 3. `npm run build` / `npm run test` / `npm run lint` — اجرای اسکریپت‌های تعریف شده در تمام workspaceها به کمک `npm run <script> --workspaces`.
17
+
18
+ ## توسعه
19
+ - اگر پکیج جدیدی لازم دارید، کافی است پوشه‌ای در `apps/` یا `packages/` بسازید، `package.json` خودش را تعریف کنید و روی آن فایل‌های لازم را اضافه نمایید.
20
+ - وابستگی بین workspaceها با `workspace:*` در `dependencies` تعریف شود تا npm به صورت خودکار به نسخه‌های محلی اشاره کند.
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "apps-web",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "description": "Frontend simulation for the Sahpa monorepo",
6
+ "main": "src/index.js",
7
+ "scripts": {
8
+ "start": "node src/index.js",
9
+ "test": "node src/index.test.js"
10
+ },
11
+ "dependencies": {
12
+ "@sahpa/shared": "^0.1.0"
13
+ }
14
+ }
@@ -0,0 +1,5 @@
1
+ const { formatMonorepoMessage } = require("@sahpa/utils");
2
+ const { config } = require("@sahpa/shared");
3
+
4
+ console.log("App Name:", config.projectName);
5
+ console.log(formatMonorepoMessage("Sahpa Web App"));
@@ -0,0 +1,2 @@
1
+ require('./index');
2
+ console.log('web app boot successful');
package/package.json ADDED
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "sahpa-monorepo",
3
+ "version": "0.1.0",
4
+ "description": "npm workspace scaffold for Sahpa projects",
5
+ "workspaces": [
6
+ "apps/*",
7
+ "packages/*"
8
+ ],
9
+ "scripts": {
10
+ "bootstrap": "npm install",
11
+ "build": "npm run build --workspaces",
12
+ "test": "npm run test --workspaces",
13
+ "lint": "npm run lint --workspaces",
14
+ "start:web": "npm --workspace apps/web start"
15
+ },
16
+ "packageManager": "yarn@3.6.1+sha512.de524adec81a6c3d7a26d936d439d2832e351cdfc5728f9d91f3fc85dd20b04391c038e9b4ecab11cae2b0dd9f0d55fd355af766bc5c1a7f8d25d96bb2a0b2ca"
17
+ }
@@ -0,0 +1 @@
1
+ //registry.npmjs.org/:_authToken=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
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "shared22",
3
+ "version": "0.1.23",
4
+ "main": "src/index.js",
5
+ "scripts": {
6
+ "test": "node src/index.js"
7
+ }
8
+ }
@@ -0,0 +1,10 @@
1
+ const config = {
2
+ projectName: 'sahpa-monorepo',
3
+ createdAt: new Date().toISOString()
4
+ };
5
+
6
+ function info() {
7
+ console.log('shared config loaded', config);
8
+ }
9
+
10
+ module.exports = { config, info };
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "@sahpa/utils",
3
+ "version": "0.1.0",
4
+ "description": "Utility helpers shared across Sahpa workspaces",
5
+ "main": "src/index.js",
6
+ "scripts": {
7
+ "test": "node src/index.test.js"
8
+ }
9
+ }
@@ -0,0 +1,5 @@
1
+ function formatMonorepoMessage(name) {
2
+ return `Welcome to ${name}!`;
3
+ }
4
+
5
+ module.exports = { formatMonorepoMessage };
@@ -0,0 +1,5 @@
1
+ const { formatMonorepoMessage } = require('./index');
2
+ const assert = require('node:assert');
3
+
4
+ assert.strictEqual(formatMonorepoMessage('Sahpa'), 'Welcome to Sahpa!');
5
+ console.log('utils tests pass');