Code Monkey home page Code Monkey logo

helix-sidekick's Introduction

This code has moved to @adobe/helix-sidekick-extension

Franklin Sidekick

Browser-based helper for authoring Franklin projects

Status

codecov CircleCI GitHub license GitHub issues LGTM Code Quality Grade: JavaScript semantic-release

Installation

Bookmarklet

Navigate to https://www.hlx.live/tools/sidekick/ and follow the instructions.

Browser Extension

See https://github.com/adobe/helix-sidekick#readme

Configuration

Franklin Sidekick supports a number of (optional) configuration options developers can add to the project to maximize the Sidekick experience.

See the API documentation.

Usage

Refer to the Sidekick documentation to learn more about its features.

Development

Build

$ npm install

Test

$ npm test

Lint

$ npm run lint

Testing a development version of the module or bookmarklet

Every development branch in this repository will be mirrored in https://github.com/adobe/helix-website with a sidekick- prefix to enable enable branch testing:

  1. Push changes to a branch issue-77
  2. Note the sidekick-issue-77 branch in https://github.com/adobe/helix-website/branches
  3. Go to https://sidekick-issue-77--helix-website--adobe.hlx.page/tools/sidekick/ to install a development version of the bookmarklet for your project

Note: Mirrored development branches in https://github.com/adobe/helix-website/branches must be deleted manually when no longer needed.

Local testing

You can leverage Franklin CLI for local testing. If you haven't already installed it, run: npm i -g @adobe/helix-cli

Testing a local Sidekick version

  1. Run npm start on your local checkout of this repository
  2. Go to `http://localhost:3001/ and follow the instructions.

Testing a local project config

If you want to test a config file before deploying it to your project:

  1. Run hlx up on your local checkout of the project repository
  2. Install a Sidekick bookmarklet for your project: https://www.hlx.live/tools/sidekick/
  3. Edit the bookmarklet URL by appending ,"devMode":"true" after "ref":"*" (* being your project branch)
  4. Click the bookmarklet to launch Sidekick using your local config

Deployment

The Sidekick module and bookmarklet gets staged automatically each time a pull request is merged into main.

  1. Go to helix-website pull requests
  2. Click the Sidekick Release Candidate PR
  3. Add a comment listing the helix-sidekick PR(s) included in this release
  4. Get a team member to review the Sidekick RC. The PR is based on a sidekick-rc-* branch (* being a random ID) so the RC can be tested at: https://sidekick-rc-*--helix-website--adobe.hlx.page/tools/sidekick/
  5. Once approved, merge the RC PR to deploy the changes into production

helix-sidekick's People

Contributors

dominique-pfister avatar dylandepass avatar hsaginor avatar kptdobe avatar lucanerlich avatar renovate-bot avatar renovate[bot] avatar rofe avatar semantic-release-bot avatar tripodsan avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

helix-sidekick's Issues

Remove special hlx3 flag handling for known projects

When migrating the first projects to hlx3, we hardcoded known projects to always have hlx3=true in the sidekick config, so we didn't have to bother the authors to update their bookmarklets.

Since #14, this is no longer necessary, as hlx3 can now be defined centrally for projects. The hardcoded projects and corresponding logic should be removed from the sidekick again.

publish button does not work with hlx3

Do the full setup of a site running with hlx3.
Go to page preview and hit the publish button, you are redirected to a 404 page.

Reason: the main branch name is missing in the URL.

cc @rofe

[Extension] work with any ref in preview and live

For convenience, the sidekick extension should work on any ref/branch in preview and live. The ref specified in the config should just be the default when switching to preview or live from the editor.

Delete and Unpublish

If a page no longer has a source document, it should be possible for authors to remove its renditions in preview and live (effectively unpublishing it).

If a missing source document is detected in..

  • Preview: Reload and Publish plugins should be hidden, Delete plugin should be shown
  • Live: Publish should be hidden, Delete plugin should be shown

When clicked and confirmed by the user, all renditions will be removed.

Add outerHost config property

In some special cases, it is required to have a outerHost that's deviating from the regular naming scheme. For this purpose, it should be possible to configure it in config.js.

HLX3 support for Sidekick homepage without supplying repo URL.

User Story

As a tutorial writer, I would like the ability to send my students to the Sidekick creator with the hlx3 query param so they can enter their own project and have hlx3 support.

Expected Behaviour

Sidekick homepage respects hlx3=true without any other query parameters and can successfully pass this parameter to the bookmark when a visitor enters a github repo url.

Actual Behaviour

Sidekick homepage throws an alert that there is no repository URL.

Reproduce Scenario (including but not limited to)

Visit: https://www.hlx.live/tools/sidekick/?hlx3=true

Remove purgeHost config property

The purgeHost config property was introduced to enable sending the HLXPURGE request to a diferent host than the current one. It was never officially documented and is no longer used. Custom plugins using it should be refactored.

Support code API

The sidekick currently defaults to the preview and live admin APIs. When surfing code files (JS, CSS), it could be helpful to be able to use actions from the code API when clicking Reload or Publish.

Do not overlay content

The sidekick overlays the top of the document, hiding navigation or editor controls underneath. It would be better if it pushed the body down by its own height.

Sidekick does not detect CI build domain in preview URL

When launching the sidekick on a CI/branch deployment of helix-pages (e.g. *.hlx-1.page), it doesn't recognize the URL as a preview URL and loads the config.js from the fallback *.hlx.page, which works, but subsequent CORS-bound requests made from within the config.js, such as loading one of the project's JS modules, will fail.

Emit events

For custom extensions, integrations and telemetry, it would be useful to be able to listen to Sidekick events, e.g.

  • shown
  • hidden
  • pluginused
  • contextloaded
  • statusfetched
  • envswitched
  • updated
  • published

"Personalize" Button for Adobe Audience Manager

In the context of https://github.com/adobe/express-website-issues/issues/158 we should add a "Personalize" button to the Sidekick, which will work like this:

Screen Shot 2021-08-18 at 13 22 13

Preview/Live/Production

Clicking the button will open a dropdown that allows the user to select or reset an audience. The list of audiences is pulled from /_audiences.json at the site root, which is populated by a table consisting of the columns:

  • name: display name of the audience, e.g. "returning visitor"
  • description: optional description of the audience, shown as tooltip, e.g. "visitors who have been to adobe.com before in the last two weeks"
  • id: ID of the audience manager audience, e.g. 1738236

Upon selecting an audience, the button will:

  • set the window.hlx.audience variable to the selected ID
  • fire a window.dispatchEvent(new CustomEvent('helix-audiencechanged', { detail: audienceId })); event
  • persist the selected audience in a cookie or session storage

An (upcoming) personalization component will be able to listen to these events or read the values and display the matching content.

Edit

The same dropdown will be shown, but without an option to clear or set the audience, instead clicking an audience name will copy the audience ID so that it can be used in the first column of the personalization block's table

Edit 2

Incorporated @rofe's suggestions from below: #64 (comment)

Load config and plugins from project host

The sidekick config is currently stored in the author's bookmarklet URL. When an update to the config is required, e.g. to make use of a new feature, authors are asked to update their bookmarklets (i.e. replace it with a new one). Even though the sidekick redirects them to the right URL to get the fresh bookmarklet, it is still a manual task.

The sidekick also makes a request to the project host to see if there are any custom plugins to load.

In order to avoid manual bookmarklet updates in the future, both the sidekick config and plugins could be loaded from a single config file located on the project host.

Fetch preview status once initially

In order to speed up environment button actions, instead of fetching the preview status every time a button is clicked to retrieve the editUrl or path, it should be fetched once as part of loadContext(), and then again at an interval to update lastModified and lastPublished. This information could later be used to modify button states . For example, to disable the reload button if lastModified is in the past, or enable the publish button only of lastModified is newer than lastPublished.

Dash in production hostname will be transformed to double-dash

If a production hostname contains a dash, the sidekick will turn it into a double dash. The expectation would be to leave non-helix hostnames untouched.

Input: abc-123.com
Expected output: abc-123.com
Actual output: abc--123.com

As a result, the sidekick plugins will not be available.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Awaiting Schedule

These updates are awaiting their schedule. Click on a checkbox to get an update now.

  • chore(deps): update external fixes (eslint, puppeteer)

Detected dependencies

circleci
.circleci/config.yml
  • cimg/node 16.16.0-browsers
  • browser-tools 1.4.0
  • codecov 3.2.4
github-actions
.github/workflows/branch-release.yaml
  • actions/checkout v3
  • actions/checkout v3
.github/workflows/release.yaml
  • actions/checkout v3
  • actions/checkout v3
  • peter-evans/create-pull-request v4
npm
package.json
  • @adobe/eslint-config-helix 1.3.2
  • @esm-bundle/chai 4.3.4-fix.0
  • @semantic-release/changelog 6.0.1
  • @semantic-release/git 10.0.1
  • @web/test-runner 0.15.0
  • @web/test-runner-commands 0.6.5
  • eslint 8.26.0
  • eslint-plugin-header 3.1.1
  • eslint-plugin-import 2.26.0
  • express 4.18.2
  • husky 8.0.1
  • jsdoc-to-markdown 7.1.1
  • junit-report-builder 3.0.1
  • lint-staged 13.0.3
  • mocha 10.1.0
  • nyc 15.1.0
  • puppeteer 19.2.0
  • puppeteer-to-istanbul 1.4.0
  • semantic-release 19.0.5

  • Check this box to trigger a request for Renovate to run again on this repository

endless wait if fetchStatus fails

it seems that if

fetch(this.status.apiUrl, { cache: 'no-store' })
.then((resp) => resp.json())
.then((json) => Object.assign(this.status, json))
.then((json) => fireEvent(this, 'statusfetched', json))
.catch((e) => console.error('failed to fetch status', e));

fails... then the UX is stuck in an endless loop with a setTimout(, 1000)

Add isEnabled to pluginButton config

The condition function determines whether a plugin can be added or not in the first place. For added plugins, it could also be useful to influence the button state based on certain criteria. Like the {boolean|Function} isPressed, the pluginButton object could thereby support a {boolean|Function} isEnabled property. By default, a plugin button would always be enabled. If isEnabled evaluated to false however, the button would be rendered disabled.

The automated release is failing 🚨

🚨 The automated release from the main branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you can benefit from your bug fixes and new features again.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can fix this πŸ’ͺ.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the main branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here are some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


No npm token specified.

An npm token must be created and set in the NPM_TOKEN environment variable on your CI environment.

Please make sure to create an npm token and to set it in the NPM_TOKEN environment variable on your CI environment. The token must allow to publish to the registry https://registry.npmjs.org/.


Good luck with your project ✨

Your semantic-release bot πŸ“¦πŸš€

Broken sidekick toggling

Clicking the bookmarklet multiple times should toggle the sidekick. Instead, it now throws

Uncaught DOMException: Failed to execute 'define' on 'CustomElementRegistry': the name "helix-sidekick" has already been used with this registry

Separate edit from environment switchers

@davidnuescheler suggested that intuitely, Edit isn't really an environment but more of an action, so should be separated from the other environment switching actions, also from a window management POV: Edit should always open in its own (recycled?) window, while the others continue to share a single window (unless Cmd/Ctrl is being held down).

[Extension] First project not visible

I followed the Show&Tell instructions and installed the extension. I just added my first project: open the sidekick via bookmarklet, click the share button, go to that page, click "ok" to add to extension and click "ok" to open extensions.

First observation: the project I just added is not there.
Second observation: I pasted the share url to add the project again and it says the project has already been added.

See

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.