Code Monkey home page Code Monkey logo

Comments (8)

xAlien95 avatar xAlien95 commented on May 24, 2024 1

A user cannot really distinguish a "third-party" action from a "first-party" action, since this attribute isn't explicitly specified in the Shortcuts app.
Do third-party actions refer to those actions that do not have an identifier starting with 'is.workflow.actions.'?

As an example, the Post on Facebook action is a first-party action although it refers to a third-party app, and this may led to confusion.

Post on Facebook => is.workflow.actions.postonfacebook

If in the near future the Facebook app will add support for custom third-party shortcuts actions, then we will have actions in different groups/sub-modules that belong to the same app: the ones starting with 'is.workflow.actions.' and the ones starting with 'com.facebook.' as identifier.

Early, I suggested

pythonista.editScript();
pythonista.runScript();

just to distinguish those actions from future actions that may have a similar or equal shown name.

I would not reject the possibility to call those actions with completely custom names, like

editPythonistaScript();
runPythonistaScript();

if a good documentation is provided on the cool Shortcuts Fun website (really, those css, that editor.. I do really like how you presented that website!).

Can we work on a documentation page in which all the actions are grouped and listed as they shows up in the Shortcuts app? That way users won't have any problems distinguishing all the actions and getting the right function names used in this node module.

from shortcuts-js.

joshfarrant avatar joshfarrant commented on May 24, 2024 1

Finally made a decision on this and went with @xAlien95's initial suggestion. See #37 for the exact implementation.

from shortcuts-js.

xAlien95 avatar xAlien95 commented on May 24, 2024

I would use:

import { pythonista } from '@joshfarrant/shortcuts-js/actions';

pythonista.editScript();
pythonista.runScript();

This would work well also in your site's Playground. Regarding the directory structure, I would prefer to have camelCased folders:

├─ actions
│  ├─ pythonista
│  │  ├─ editScript.ts
│  │  ├─ index.ts
│  │  └─ runScript.ts
│  ├─ addToVariable.ts
│  ├─ ask.ts
│  ├─ calculate.ts
│  ├─ ...

CamelCase will homogenize app names and built-in action names.
It could be based on the app name rather than the last bit of the action identifier, so:

└─ actions
   ├─ editorial
   ├─ pythonista
   └─ tally

from shortcuts-js.

gcordalis avatar gcordalis commented on May 24, 2024

I think what @xAlien95 has suggested sounds great.

We’ll need to be mindful about naming as some apps will be very similar...

As an example here are 2 of the Carrot apps:

Carrot⁵ (Carrot Weather)
Carrot³ (Carrot Fit)

from shortcuts-js.

bachya avatar bachya commented on May 24, 2024

I like the explicit namespacing of @xAlien95's solution, as well.

from shortcuts-js.

joshfarrant avatar joshfarrant commented on May 24, 2024

I do like that this is quite a clean solution. My only concern with this is that it introduces the possibility of collisions between action names and app names. It’s not unreasonable to think that there could be an app called calculate or list, in which case what would

import { list } from @joshfarrant/shortcuts-js/actions’;

actually import?

Do we just have to make special cases for those and set the app name as listApp?

from shortcuts-js.

gcordalis avatar gcordalis commented on May 24, 2024

Prefacing each app action group with app[appName] could be a good way to do this. From a folder structure POV it would keep them all together too rather than spread between the native actions in alphabetical order (for the most part)

from shortcuts-js.

joshfarrant avatar joshfarrant commented on May 24, 2024

What about an apps directory in src/actions? You could then do something like:

import {
  pythonista,
} from @joshfarrant/shortcuts-js/actions/apps’;

pythonista.editScript();

We could then also expose an apps variable in the default actions export.

import {
  apps,
} from @joshfarrant/shortcuts-js/actions’;

const {
  pythonista,
} = apps;

pythonista.editScript();

People can then use whichever method they prefer.

from shortcuts-js.

Related Issues (20)

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.