rabowl——使用方法概述
源碼下載
源碼托管在碼云(gitee)
源碼地址:https://gitee.com/rasir/rabowl
任何人都可以直接通過(guò)fock的方式clone源碼澈吨。
使用方法
1熊锭、在目標(biāo)文件夾打開(kāi)終端設(shè)備
2茫经、git clone https://gitee.com/rasir/rabowl
$ git clone https://gitee.com/rasir/rabowl
Cloning into 'rabowl'...
remote: Enumerating objects: 117, done.
remote: Counting objects: 100% (117/117), done.
remote: Compressing objects: 100% (88/88), done.
remote: Total 253 (delta 15), reused 111 (delta 13), pack-reused 136
Receiving objects: 100% (253/253), 460.28 KiB | 405.00 KiB/s, done.
Resolving deltas: 100% (46/46), done.
$ ls
rabowl
clone
完成后會(huì)在目錄下生成一個(gè)rabowl
文件夾了嚎。將該目錄下除了.git、readme.md
文件的其他文件都拷貝到你的目標(biāo)目錄下咧七。
3衰齐、在主項(xiàng)目目錄下,使用 npm run install:rabowl
安裝rabowl
工具的依賴項(xiàng)继阻。
$ npm run install:rabowl
> inc-bdp-usb-web-main@1.21.0 install:rabowl
> cd rabowl && npm i --legacy-peer-deps
added 24 packages in 2s
4耻涛、全局安裝 yarn
通過(guò) yarn rabowl commoned
來(lái)執(zhí)行rabowl
的命令。 不過(guò)初始化時(shí)只需要使用npm run rabowl commoned
就可以了瘟檩。
$ yarn -v
1.22.10
5抹缕、初始化時(shí),需要使用rabowl
的ready
命令芒帕∏干ぃ可以通過(guò)rabowl ready
、yarn rabowl ready
背蟆、npm run rabowl ready
來(lái)實(shí)現(xiàn)。初始化的主要目的是為了矯正主應(yīng)用的script
命令哮幢。生成對(duì)應(yīng)的 build
带膀、start
、install
命令橙垢。
$ npm run rabowl ready
> inc-bdp-usb-web-main@1.21.0 rabowl
> node rabowl/bin/index.js "ready"
主項(xiàng)目生成腳本命令
主項(xiàng)目生成腳本命令完成
因?yàn)槌跏紩r(shí)沒(méi)有子應(yīng)用垛叨,所以ready
命令執(zhí)行很快。但是后期有了子應(yīng)用柜某,這個(gè)命令會(huì)自動(dòng)清理packages
下的子應(yīng)用文件(如果你已經(jīng)開(kāi)發(fā)了子應(yīng)用內(nèi)容嗽元,但是沒(méi)有提交你的代碼,執(zhí)行這個(gè)命令會(huì)讓代碼丟失)喂击,并自動(dòng)clone
子應(yīng)用切換到指定的分支(具體配置方式在后面講)剂癌。
6、初始化完成后翰绊,使用npm run install:allApp
命令來(lái)給所有相關(guān)應(yīng)用安裝依賴包佩谷。
$ npm run install:allApp
> inc-bdp-usb-web-main@1.21.0 install:allApp
> npm run install:rbutils && npm run build:utils && npm run install:rbui && npm run install:main
> inc-bdp-usb-web-main@1.21.0 install:rbutils
> cd libraries/rbutils/ && npm i --legacy-peer-deps
up to date in 2s
3 packages are looking for funding
run `npm fund` for details
> inc-bdp-usb-web-main@1.21.0 build:utils
> cd libraries/rbutils/ && npm run build
> rbutils@1.0.0 build
> concurrently "npm run build:es" "npm run build:lib"
[0]
[0] > rbutils@1.0.0 build:es
[0] > rimraf es && babel src --extensions ".tsx,.js,.ts,.jsx" --out-dir es --config-file ./babel.es.js && npm run types:es
[0]
[1]
[1] > rbutils@1.0.0 build:lib
[1] > rimraf lib && babel src --extensions ".tsx,.js,.ts,.jsx" --out-dir lib --config-file ./babel.lib.js && npm run types:lib
[1]
[0] Successfully compiled 3 files with Babel (458ms).
[1] Successfully compiled 3 files with Babel (779ms).
[0]
[0] > rbutils@1.0.0 types:es
[0] > tsc --rootDir src --outDir es --emitDeclarationOnly --declaration
[0]
[1]
[1] > rbutils@1.0.0 types:lib
[1] > tsc --rootDir src --outDir lib --emitDeclarationOnly --declaration
[1]
[0] npm run build:es exited with code 0
[1] npm run build:lib exited with code 0
> inc-bdp-usb-web-main@1.21.0 install:rbui
> cd libraries/rbui/ && npm i --legacy-peer-deps
> rbui@1.0.0 postinstall
> umi generate tmp
up to date in 6s
> inc-bdp-usb-web-main@1.21.0 install:main
> npm i --legacy-peer-deps
npm WARN deprecated xxxxx
……
> inc-bdp-usb-web-main@1.21.0 postinstall
> umi generate tmp
added 1542 packages in 1m
10 packages are looking for funding
run `npm fund` for details
這個(gè)命令是自動(dòng)安裝主應(yīng)用旁壮,公共庫(kù)(rbui,rbutils)以及packages
目錄下所有子應(yīng)用的依賴谐檀。
7抡谐、如果是已經(jīng)有子應(yīng)用的項(xiàng)目,經(jīng)過(guò)以上步驟就可以直接通過(guò)npm run start
啟動(dòng)桐猬。但是如果是新項(xiàng)目麦撵,想要項(xiàng)目運(yùn)行起來(lái),還需要添加一個(gè)子應(yīng)用溃肪∶馕福可以通過(guò)命令yarn rabowl cca --app App1 (子應(yīng)用的名稱--英文)
來(lái)創(chuàng)建一個(gè)子應(yīng)用。
注意這里無(wú)法通過(guò) npm
來(lái)執(zhí)行 rabowl
命令乍惊。
$ yarn rabowl cca --app App1
yarn run v1.22.10
warning ../../../../package.json: No license field
$ node rabowl/bin/index.js cca --app App1
開(kāi)始在 /Users/xxxxx/Desktop/codes/temp/rabowl/packages/App1 執(zhí)行 yarn create @umijs/umi-app
yarn @umijs/create-umi-app stderr: warning ../../../../package.json: No license field
yarn @umijs/create-umi-app stdout [1/4] Resolving packages...
yarn @umijs/create-umi-app stdout [2/4] Fetching packages...
yarn @umijs/create-umi-app stdout [3/4] Linking dependencies...
yarn @umijs/create-umi-app stdout [4/4] Building fresh packages...
yarn @umijs/create-umi-app stdout success Installed "@umijs/create-umi-app@3.5.20" with binaries:
yarn @umijs/create-umi-app stdout - create-umi-app
yarn @umijs/create-umi-app stdout Copy: .editorconfig
yarn @umijs/create-umi-app stdout Write: .gitignore
yarn @umijs/create-umi-app stdout Copy: .prettierignore
yarn @umijs/create-umi-app stdout Copy: .prettierrc
yarn @umijs/create-umi-app stdout Write: .umirc.ts
yarn @umijs/create-umi-app stdout Copy: mock/.gitkeep
yarn @umijs/create-umi-app stdout Write: package.json
yarn @umijs/create-umi-app stdout Copy: README.md
yarn @umijs/create-umi-app stdout Copy: src/pages/index.less
yarn @umijs/create-umi-app stdout Copy: src/pages/index.tsx
yarn @umijs/create-umi-app stdout Copy: tsconfig.json
yarn @umijs/create-umi-app stdout Copy: typings.d.ts
yarn @umijs/create-umi-app 執(zhí)行完畢
修改主應(yīng)用 /Users/xxxxxx/Desktop/codes/temp/rabowl .umirc.ts
master 應(yīng)用下 .umirc.ts 修改完畢
修改 App1 應(yīng)用下 .umirc.ts
App1應(yīng)用下 .umirc.ts 修改完畢
修改 App1 應(yīng)用下 package.json
App1應(yīng)用下 package.json 修改完畢
修改 App1 應(yīng)用下 tsconfig.json
App1應(yīng)用下 tsconfig.json 修改完畢
主項(xiàng)目生成腳本命令
主項(xiàng)目生成腳本命令完成
修改主項(xiàng)目 /Users/xxxxx/Desktop/codes/temp/rabowl .gitignore
.gitignore 修改完成
開(kāi)始在 /Users/xxxxxxx/Desktop/codes/temp/rabowl/packages/App1 執(zhí)行 npm i --legacy-peer-deps
npm i --legacy-peer-deps stderr: npm
npm i --legacy-peer-deps stderr: WARN deprecated flatten@1.0.3: flatten is deprecated in favor of utility frameworks such as lodash.
npm i --legacy-peer-deps stderr: npm
npm i --legacy-peer-deps stderr: WARN deprecated request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
npm i --legacy-peer-deps stderr: npm
npm i --legacy-peer-deps stderr:
npm i --legacy-peer-deps stderr: WARN
npm i --legacy-peer-deps stderr:
npm i --legacy-peer-deps stderr: deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm i --legacy-peer-deps stderr: npm
npm i --legacy-peer-deps stderr: WARN deprecated har-validator@5.1.5: this library is no longer supported
npm i --legacy-peer-deps stderr: npm WARN
npm i --legacy-peer-deps stderr: deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated validate-commit-msg@2.14.0: Check out CommitLint which provides the same functionality with a more user-focused experience.
npm WARN deprecated sane@4.1.0: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm i --legacy-peer-deps stderr: npm
npm i --legacy-peer-deps stderr: WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm i --legacy-peer-deps stderr: npm WARN deprecated react-native-swipeout@2.3.6: Package no longer supported. Use at your own risk or consider using https://github.com/software-mansion/react-native-gesture-handler
npm i --legacy-peer-deps stderr: npm
npm i --legacy-peer-deps stderr: WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm i --legacy-peer-deps stderr: npm WARN deprecated intl-messageformat-parser@3.6.4: We've written a new parser that's 6x faster and is backwards compatible. Please use @formatjs/icu-messageformat-parser
npm i --legacy-peer-deps stderr: npm
npm i --legacy-peer-deps stderr: WARN deprecated core-js@1.2.7: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
npm i --legacy-peer-deps stderr: npm
npm i --legacy-peer-deps stderr: WARN deprecated core-js@2.6.12: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
npm i --legacy-peer-deps stderr: npm
npm i --legacy-peer-deps stderr: WARN deprecated @formatjs/intl-unified-numberformat@3.3.7: We have renamed the package to @formatjs/intl-numberformat
npm i --legacy-peer-deps stdout
> App1@1.0.0 postinstall
> umi generate tmp
npm i --legacy-peer-deps stdout
added 1520 packages, and audited 1521 packages in 3m
npm i --legacy-peer-deps stdout
npm i --legacy-peer-deps stdout 129 packages are looking for funding
run `npm fund` for details
npm i --legacy-peer-deps stdout
54 vulnerabilities (9 low, 5 moderate, 39 high, 1 critical)
To address issues that do not require attention, run:
npm audit fix
To address all issues possible (including breaking changes), run:
npm audit fix --force
Some issues need review, and may require choosing
a different dependency.
Run `npm audit` for details.
npm i --legacy-peer-deps 執(zhí)行完畢
? Done in 165.15s.
rabowl cca
是在packages
目錄下創(chuàng)建一個(gè)子應(yīng)用杜秸,并會(huì)對(duì)主項(xiàng)目、子應(yīng)用進(jìn)行相應(yīng)的配置润绎。rabowl
命令我們會(huì)在后續(xù)的文章中詳細(xì)講解撬碟。
8、啟動(dòng)項(xiàng)目npm run start
$ yarn start
yarn run v1.22.10
warning ../../../../package.json: No license field
$ npm run preBuild && npm run start:allApp
> inc-bdp-usb-web-main@1.21.0 preBuild
> rimraf dist && npm run build:utils
> inc-bdp-usb-web-main@1.21.0 build:utils
> cd libraries/rbutils/ && npm run build
> rbutils@1.0.0 build
> concurrently "npm run build:es" "npm run build:lib"
[0]
[0] > rbutils@1.0.0 build:es
[0] > rimraf es && babel src --extensions ".tsx,.js,.ts,.jsx" --out-dir es --config-file ./babel.es.js && npm run types:es
[0]
[1]
[1] > rbutils@1.0.0 build:lib
[1] > rimraf lib && babel src --extensions ".tsx,.js,.ts,.jsx" --out-dir lib --config-file ./babel.lib.js && npm run types:lib
[1]
[0] Successfully compiled 3 files with Babel (323ms).
[1] Successfully compiled 3 files with Babel (640ms).
[0]
[0] > rbutils@1.0.0 types:es
[0] > tsc --rootDir src --outDir es --emitDeclarationOnly --declaration
[0]
[1]
[1] > rbutils@1.0.0 types:lib
[1] > tsc --rootDir src --outDir lib --emitDeclarationOnly --declaration
[1]
[0] npm run build:es exited with code 0
[1] npm run build:lib exited with code 0
> inc-bdp-usb-web-main@1.21.0 start:allApp
> concurrently "npm run start:main" "npm run start:App1"
[0]
[0] > inc-bdp-usb-web-main@1.21.0 start:main
[0] > umi dev
[0]
[1]
[1] > inc-bdp-usb-web-main@1.21.0 start:App1
[1] > cd packages/app1 && npm run start
[1]
[1]
[1] > App1@1.0.0 start
[1] > umi dev
[1]
[1] Starting the development server...
[0] Starting the development server...
[1] ? Compiling Webpack
[0] ? Compiling Webpack
[1] ? Webpack: Compiled successfully in 8.69s
[1] DONE Compiled successfully in 8688ms下午6:28:05
[1]
[1]
[1] App running at:
[1] - Local: http://localhost:8001 (copied to clipboard)
[1] - Network: http://0.0.0.0:8001
[1] WAIT Compiling...下午6:28:05
[1]
[1] ? Compiling Webpack
[1] ? Webpack: Compiled successfully in 330.61ms
[1] DONE Compiled successfully in 332ms下午6:28:06
[1]
[0] ? Webpack: Compiled successfully in 18.28s
[0]
[0] App running at:
[0] - Local: http://localhost:8000 (copied to clipboard)
[0] - Network: http://0.0.0.0:8000
至此莉撇,項(xiàng)目正式啟動(dòng)呢蛤。通過(guò)http://localhost:8000
訪問(wèn)項(xiàng)目。