trydofor / professional-razor

Use front-end tech (Vue/Css/Ts) to build multi-platform from one codebase, suitable for small team and app to write logic once, run anywhere.
Apache License 2.0
0 stars 0 forks source link

monorepo hoist&local deps #2

Open trydofor opened 6 months ago

trydofor commented 6 months ago
trydofor commented 6 months ago

2.1. hoist dependencies

hoist dependencies from workspaces to top package.json. just copy shared dependencies to top package.json (not move from worksapce to top, keep them both), leave individual dependencies alone.

"dependencies": {
  "@capacitor/app": "5.0.7",
  "@capacitor/core": "5.7.4",
  "@capacitor/haptics": "5.0.7",
  "@capacitor/keyboard": "5.0.8",
  "@capacitor/status-bar": "5.0.7",
  "@ionic/vue": "^7.0.0",
  "@ionic/vue-router": "^7.0.0",
  "ionicons": "^7.0.0",
  "vue": "^3.3.0",
  "vue-router": "^4.2.0"
},
"devDependencies": {
  "@capacitor/cli": "5.7.4",
  "@vitejs/plugin-legacy": "^5.0.0",
  "@vitejs/plugin-vue": "^4.0.0",
  "@vue/eslint-config-typescript": "^12.0.0",
  "@vue/test-utils": "^2.3.0",
  "cypress": "^13.5.0",
  "eslint": "^8.35.0",
  "eslint-plugin-vue": "^9.9.0",
  "jsdom": "^22.1.0",
  "terser": "^5.4.0",
  "typescript": "^5.1.6",
  "vite": "^5.0.0",
  "vitest": "^0.34.6",
  "vue-tsc": "^1.0.24"
}

then, modify and reorder version,description in all package.json.

## at top project, install and check
npm install
##> added 702 packages, and removed 1474 packages in 37s
## move shared deps, for workspace `node_modules` to top's 

cd packages/front-desktop 
npx cap open @capacitor-community/electron
##> Opening Electron platform: running electron app

## save point
git add --all && git commit -am '2.1 hoist deps #2'
trydofor commented 6 months ago

build electron

TS2411: Property '"accept-charset"' of type 'string | string[]' is not assignable to 'string' index type 'string'.

add skipLibCheck

{
  "compilerOptions": {
    "skipLibCheck": true
  }
}

Cannot detect repository by .git/config. Please specify "repository" in the package.json Please see https://electron.build/configuration/publish

delete publish

  "publish": {
    "provider": "github"
  },
trydofor commented 6 months ago

install local monorepo

npm install @razor/shared --workspace packages/front-shared
npm install @razor/front-shared --workspace packages/front-desktop
npm install @razor/front-shared --workspace packages/front-mobile

and use file:../ instead of local snapshot version

- "@razor/front-shared": "1.0.0-beta.100",
+ "@razor/front-shared": "file:../front-shared",
- "@razor/shared": "1.0.0-beta.100",
+ "@razor/shared": "file:../shared",