[markdown] use build_runner to build js & wasm (#1969)
diff --git a/.github/workflows/deploy_pages.yaml b/.github/workflows/deploy_pages.yaml
index 879c57f..691544a 100644
--- a/.github/workflows/deploy_pages.yaml
+++ b/.github/workflows/deploy_pages.yaml
@@ -26,28 +26,18 @@
- uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94
# Build the markdown playground.
- - name: "markdown: pub get"
- run: dart pub get
+ - run: dart pub get
working-directory: pkgs/markdown
- - name: "markdown: build playground"
- run: >
- dart compile js -o example/app.dart.js
- --minify --no-frequency-based-minification --no-source-maps
- example/app.dart
+ - run: dart run build_runner build -o example:build --release
working-directory: pkgs/markdown
# Create the _site directory.
- run: mkdir _site
- - run: cp -r pkgs/markdown/example _site/markdown
- - run: rm _site/markdown/*.dart
+ - run: cp -r pkgs/markdown/build _site/markdown
# Deploy to GitHub Pages.
- - name: setup pages
- uses: actions/configure-pages@v5
- - name: upload artifact
- uses: actions/upload-pages-artifact@v3
+ - uses: actions/configure-pages@v5
+ - uses: actions/upload-pages-artifact@v3
with:
path: _site
- - name: deploy to github pages
- id: deployment
- uses: actions/deploy-pages@v4
+ - uses: actions/deploy-pages@v4
diff --git a/pkgs/markdown/.gitignore b/pkgs/markdown/.gitignore
index a48b1c4..fcd8776 100644
--- a/pkgs/markdown/.gitignore
+++ b/pkgs/markdown/.gitignore
@@ -1,9 +1,4 @@
+# https://dart.dev/tools/pub/private-files
.dart_tool
-.packages
-.pub
+build
pubspec.lock
-doc/
-
-example/app.dart.js
-example/app.dart.js.deps
-example/app.dart.js.map
diff --git a/pkgs/markdown/build.yaml b/pkgs/markdown/build.yaml
new file mode 100644
index 0000000..81238ac
--- /dev/null
+++ b/pkgs/markdown/build.yaml
@@ -0,0 +1,19 @@
+# See https://github.com/dart-lang/build/tree/master/build_web_compilers#configuration
+targets:
+ $default:
+ builders:
+ build_web_compilers|dart2js_archive_extractor:
+ options:
+ filter_outputs: false
+ build_web_compilers|entrypoint:
+ generate_for:
+ - example/**.dart
+ options:
+ compilers:
+ dart2wasm:
+ args:
+ - -O4
+ - --no-strip-wasm
+ dart2js:
+ args:
+ - -O4