在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):palmerhq/monorepo-starter开源软件地址(OpenSource Url):https://github.com/palmerhq/monorepo-starter开源编程语言(OpenSource Language):Kotlin 88.1%开源软件介绍(OpenSource Introduction):Monorepo StarterThis is a polyglot monorepo boilerplate for The Palmer Group. It is a starter monorepo comprised of TypeScript apps/packages, placeholder JVM and Python apps and an example deployment workflow. OverviewThe repository is powered by Lerna and Yarn. Lerna is responsible for bootstrapping, installing, symlinking all of the packages/apps together. What's insideThis repo includes multiple packages and applications for a hypothetical project called
Tweaking for your projectYou should run a search and replace on the word TypeScriptReferencing packages from other packages/appsEach package can be referenced within other packages/app files by importing from import * as React from 'react';
import './App.css';
import { Button } from '@mono/ui';
class App extends React.Component<any> {
render() {
return (
<div className="App">
<header className="App-header">
<h1 className="App-title">Welcome to React</h1>
</header>
<Button>Hello</Button>
<p className="App-intro">
To get started, edit <code>src/App.tsx</code> and save to reload.
</p>
</div>
);
}
}
export default App; IMPORTANT: YOU DO NOT NEED TO CREATE/OWN THE NPM ORGANIZATION OF YOUR PROJECT NAME BECAUSE NOTHING IS EVER PUBLISHED TO NPM. For more info, see the section on package versioning InstallingInstall lerna globally.
DevelopmentLerna allows some pretty nifty development stuff. Here's a quick rundown of stuff you can do:
Package Management**IF you run Installing a module from YarnTo add a new npm module to ALL packages, run lerna add <module> To add a new npm module(s) to just one package lerna add <module> --scope=<package-name> <other yarn-flags>
# Examples (if your project name was `mono`)
lerna add classnames --scope=@mono/ui
lerna add @types/classnames @types/jest --scope=@mono/ui --dev Uninstalling a module from a packageUnfortunately, there is no Reference issue: lerna/lerna#1229 (comment) Package Versioning and TS PathsNone of the packages in this setup are ever published to NPM. Instead, each shared packages' (like
Somewhat confusingly, (and amazingly), the TypeScript setup for this thing for both {
"extends": "./tsconfig.base.json",
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@mono/common/*": ["./mono/common/src"],
"@mono/ui/*": ["./mono/ui/src"]
}
}
} Long story short, this means that you can open up this whole thing at the root directory and VSCode will understand what is going on. You are welcome. Altering paths and package namesIf you don't like the To do this, you need to (search and replace
Again, search and replace will work. Important: If you do this, then your Lerna installation scoping will also change because it uses the package name. # old
lerna add axios --scope=@mono/common
# new (changed to mono-common)
lerna add axios --scope=mono-common JVMKotlinRefer to internal Palmer Group documentation. Deployment workflow for the PythonInside of the Running locallySet up Python environment: pipenv install To create a virtual environment you just execute the Run a development server: FLASK_APP=helloworld flask run Docker imageBuild the docker image: docker build -t flask-pipenv-helloworld . Run the Docker Container: docker run -p 8000:8000 flask-pipenv-helloworld You can find the container runtime details as shown below: docker ps
# ...
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
80af0bce64c7 flask-pipenv-helloworld "gunicorn -b0.0.0.0:…" 1 second ago Up Less than a second 0.0.0.0:8000->8000/tcp silly_goldstine Running the testsInstall the prerequisites: pipenv install --dev Runs tests: pipenv run python -m pytest InspirationA LOT of this has been shameless taken from Quramy/lerna-yarn-workspaces-example. So much so, in fact, you can read the original README.md in WORKSPACES.md |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论