Skip to content

Instantly share code, notes, and snippets.

Getting Dropzone back on track

Matias Meno enyo

Getting Dropzone back on track
View GitHub Profile
View rollup.config.js
import commonjs from '@rollup/plugin-commonjs'
import resolve from '@rollup/plugin-node-resolve'
import typescript from '@rollup/plugin-typescript'
import svelte from 'rollup-plugin-svelte'
import { terser } from 'rollup-plugin-terser'
import sveltePreprocess from 'svelte-preprocess'
const production = !process.env.ROLLUP_WATCH
export default {
enyo / web-components.ts
Last active Aug 23, 2022
Svelte Web Components
View web-components.ts
import HeaderMenu from './lib/components/HeaderMenu.svelte'
import type { SvelteComponent } from 'svelte'
// I recommend prefixing your custom elements, but for this example
// I'm keeping it simple.
class extends HTMLElement {
_element: SvelteComponent;
View jquery-dropzone.html
<!-- HTML heavily inspired by -->
<div class="table table-striped" class="files" id="previews">
<div id="template" class="file-row">
<!-- This is used as the file preview template -->
<span class="preview"><img data-dz-thumbnail /></span>
<p class="name" data-dz-name></p>
View base.yaml
name: CI
branches: [main]
branches: [main]
View deploy.yaml
# ...
# ...
# Only run if merged to main.
if: github.ref == 'refs/heads/main'
# Only deploy if all tests passed.
View build.yaml
# We're running on ubuntu-latest, nothing special
runs-on: ubuntu-latest
# As usual, we simply checkout the project
- name: Checkout
uses: actions/checkout@v2
# This action is provided by Cypress. It installs node and the NPM
View test.yaml
# Everything from the last section
# We depend on the build step for this.
needs: build
timeout-minutes: 15
runs-on: ubuntu-latest
# We need to use the cypress container here, that includes chrome and
View grpc_client.dart
/// A channel that the gRPC libray communicates over.
/// This is provided by the gRPC library.
final channel = GrpcWebClientChannel.xhr(Uri.parse('https://your.api.url:8080'));
/// The class [AccountServiceClient] is generated by the gRPC library from
/// your `.proto` definition.
final client = AccountServiceClient(channel);
Future<void> changePassword() async {
/// The message you want to send to the API. It's also generated from your
View grpc_server_stub.dart
class AccountService extends AccountServiceBase {
Future<Empty> sendEmailVerification(ServiceCall call, VerificationRequest request) {
// TODO: implement sendEmailVerification
throw UnimplementedError();
Future<User> signInWithPassword(ServiceCall call, PasswordSignInRequest request) {
// TODO: implement signInWithPassword
View account.proto
syntax = "proto3";
package dropzone.public_account;
import "shared.proto";
// Very simplified version of our account service.
service AccountService {
rpc SendEmailVerification(VerificationRequest) returns(shared.Empty);