Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin build #59

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Plugin build #59

wants to merge 3 commits into from

Conversation

ktomk
Copy link
Contributor

@ktomk ktomk commented May 19, 2021

@freeplant these are a couple of changes I've been using while developing the plugin which may also make sense in general:

  • documentation of the node and npm version (and integration with nvm if available)
  • a shim for developing with window.app.expandRow()
  • add version number to plugin.zip and keep numbered backups when building the plugin (until npm run clean)

the change of the output filename might be backwards incompatible if there are some processes relating to the filename directly. if that is the case, just let me know, I then can update it so that the old filename is preserved.

ktomk added 3 commits June 15, 2021 09:39
- node: 12.20.0
- npm : 6.14.8

as per internal [forum], document in project package.json and .nvmrc.dist.

the package.json settings are informative only, npm does not apply it.

a .nvmrc would if nvm is configured and .nvmrc is created from the
template .nvmrc.dist.

forum: https://forum.seatable.io/t/in-use-versions-for-node-and-npm/306/
docs-npm: https://docs.npmjs.com/cli/v6/configuring-npm/package-json#engines
docs-nvm: https://github.com/nvm-sh/nvm#nvmrc
the window.app.expandRow() function is in use to open the "Row Details"
editor in the calendar and other plugins, see [ref-sdk].

in a development setup this part of the dtable-sdk dtable-ui API is not
available.

adding a shim in the development setup allows to track app.expandRow()
initiations via the browser console.

ref-sdk: https://docs.seatable.io/published/dtable-sdk/dtable-ui.md
forum: https://forum.seatable.io/t/how-does-row-details-work-in-the-calendar-plugin/321
previously when building the zip (build-plugin), the zip-file would have been
overwritten if not eradicated by (clean) earlier.

as the only file produced in the plugin-zip build folder is the zip file
itself that would be overwritten in any case, the (clean) script is
technically superfluous for the (build-plugin) npm script when building
the same version.

in this change-set:

- remove clean from build-plugin to preserve folder contents
- establish the output path per git repository (removes mkdir requirement)
- change clean to use git-clean(1) instead of rm -rf
- build zip revisions (e.g. different plugin versions)
- backup of earlier zip builds (one by default) for same plugin version

this makes the (build-plugin) zip build less destructive by keeping
backups in a similar way as cp(1) --backup=numbered.

- numbered is using a numbered suffix like ".~1~"
- "npm run clean" deletes all zips _and_ backups

this is oriented at the said cp(1) behavior (GNU Linux) [Ref-CP], another
reference for backup files is emacs [Ref-Emacs-1], [Ref-Emacs-2].

compared to before the change, output zip files are not overwritten
silently any more and a backup is kept of the file.

changing the version and/or the project name will create additional zip
files as the version is part of the zip file-name and the output directory
is not cleaned any longer.

to get the old behaviour run clean before build.

NOTE: the zip files' filename changes to a suffixed variant with the plugin
      version (calendar.zip -> calendar-0.1.20.zip).

[Ref-CP]: https://linux.die.net/man/1/cp
[Ref-Emacs-1]: https://www.gnu.org/software/emacs/manual/html_node/elisp/Backup-Names.html
[Ref-Emacs-2]: https://www.gnu.org/software/emacs/manual/html_node/elisp/Numbered-Backups.html#Numbered-Backups
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant