सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।
Peanut एक Dart पैकेज है जो संकलित वेब ऐप आउटपुट को GitHub gh-pages शाखा में स्वचालित रूप से डेप्लॉय करता है। यह पुराने 'pub build' और आधुनिक 'pub run build_runner' कार्यप्रवाह दोनों का समर्थन करता है, जिससे Flutter वेब ऐप्स के प्रकाशन प्रक्रिया को सरल बनाया जाता है। वेब ऐप्स को GitHub Pages पर होस्ट करना चाहने वाले विकासकर्ताओं के लिए डिज़ाइन किया गया, Peanut कम सेटिंग के साथ बिल्ड और पुश चरणों को हैंडल करता है। यह CI/CD पाइपलाइन या macOS, Windows और Linux पर स्थानीय विकास वातावरण में बिना किसी दिक्कत के एकीकृत होता है।
उपयोग
GitHub Pages पर Flutter वेब ऐप्स को डिप्लॉय करना
बिल्ड और डेप्लॉयमेंट को स्वचालित करना
CI/CD कार्यप्रवाहों के साथ एकीकरण
Dart प्रोजेक्ट्स से स्थिर वेब सामग्री प्रकाशित करना
बिल्ड के बाद gh-pages अपडेट को सरल बनाना
मुख्य विशेषताएँ
pub build और build_runner का समर्थन करता है
गिट पुश को gh-pages में स्वचालित करता है
क्रॉस-प्लेटफॉर्म संगतता
आवश्यक सेटअप न्यूनतम
Flutter web ऐप्स के साथ काम करता है
इनके लिए उपयुक्त
Flutter web विकासकर्ता
GitHub Pages उपयोगकर्ता
CI/CD स्वचालन
Dart परियोजना रखरखावकर्ता
सरल डेप्लॉयमेंट की तलाश में विकासकर्ता
विचार योग्य बातें
GitHub रिपॉज़िटरी एक्सेस की आवश्यकता है
सही गिट प्रामाणिकता कॉन्फ़िगर करने की आवश्यकता है
गिटहब के अलावा होस्टिंग के लिए उपयुक्त नहीं
आधुनिक कार्य प्रवाहों के लिए build_runner पर निर्भर है
पर्यावरण-विशिष्ट सेटअप की आवश्यकता हो सकती है
मूल README
संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।
Run flutter build web or dart pub run build_runner build and put the output
in another branch. An easy way to update gh-pages.
Install
dart pub global activate peanut
or
flutter pub global activate peanut
Run
peanut
or
flutter pub global run peanut
This will build your project into a temporary directory, and then it will update
the local gh-pages branch with the build output.
$ peanut --help
Usage: peanut [<args>]
Arguments:
-d, --directories The directories that should be built.
(defaults to "web")
-b, --branch The git branch where the built content should
be committed.
(defaults to "gh-pages")
-c, --build-config The configuration to use when running
`build_runner`.
--[no-]release Flutter: enabled passes `--release`, otherwise
passes `--profile`.
Other: enabled passes `--release`, otherwise
passes `--no-release`.
(defaults to on)
-m, --message (defaults to "Built <directories>")
--[no-]source-branch-info Includes the name of the source branch and SHA
in the commit message
(defaults to on)
--[no-]version-info Includes the pubspec version of the package in
the commit message
--post-build-dart-script Optional Dart script to run after all builds
have completed, but before files are committed
to the repository.
--builder-options Builder options YAML or a path to a file
containing builder options YAML.
See the README for details.
--[no-]verbose Print more details when running.
--dry-run Verifies configuration and prints commands that
would be executed, but does not do any work.
--[no-]wasm Whether to build for WebAssembly (WASM).
--extra-args Extra arguments to provide to the target CLI
within a single string.
Examples:
--extra-args "--dart-define TEST_VAR=123"
--extra-args "--dart-define --base-href=/base/"
-h, --help Prints usage information.
--version Print the current version.
Configuration file
peanut also supports a configuration file. Convenient if you have one-off
settings you'd rather not type every time you deploy.
The peanut.yaml from this repository:
# Configuration for https://pub.dev/packages/peanutdirectories:-example# The Dart script to run after the build is complete, but before the changes are committed.# This script is run in the root of the package.# The script has access to the root of the build output directory as the first argument.post-build-dart-script:tool/post_build.dart# Build options to pass to `build_runner`.# These are merged with any existing `build.yaml` file.builder-options:build_web_compilers|entrypoint:compilers:dart2wasm:args:--O4---no-strip-wasmdart2js:args:---stage=dump-info-all---no-frequency-based-minification---no-source-maps--O4build_web_compilers|dart2js_archive_extractor:filter_outputs:false
Post-build Dart script
You can optionally specify a Dart script to run after the build is complete, but
before the changes are committed.
post-build-dart-script:tool/post_build.dart
This script is run from the root of the package.
It receives two arguments:
The path to a temporary directory which contains the build output. For
example, if you are building a single directory web, the output will be in
a web subdirectory of this temporary directory.
A JSON-encoded map where keys are the source directories that were built,
and values are the corresponding output sub-directories within the temporary
directory from the first argument.
For example, if you run peanut -d web, the script will be called with:
args[0]: /tmp/peanut.xyz (a temporary path)
args[1]: {"web":"."}
The index.html for the web build would be at /tmp/peanut.xyz/index.html.