Skip to content

Commit

Permalink
Merge branch 'master' into pug_py
Browse files Browse the repository at this point in the history
  • Loading branch information
jperon authored Jan 4, 2024
2 parents 6b619e8 + 7278cd6 commit 68ef882
Show file tree
Hide file tree
Showing 22 changed files with 383 additions and 42 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ jobs:
python-version: [3.9]
node-version: [18.x]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ jobs:
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true

- name: Build manifest
run: ./buildtools/publish.js manifest.json
Expand Down
8 changes: 8 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
[submodule "pug_py"]
path = pug_py
url = https://github.com/jperon/Grist-pug-py-widget
[submodule "chart"]
path = chart
url = https://github.com/gristlabs/custom-charts-widget
branch = gh-pages
[submodule "jupyterlite"]
path = jupyterlite
url = https://github.com/gristlabs/jupyterlite-widget
branch = gh-pages
56 changes: 40 additions & 16 deletions buildtools/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,14 @@
* describe the widgets as a plugin to Grist. The
* clash in file names is a little unfortunate.
*
* Call without any arguments. Run from the root of the
* repository. Places results in:
* dist/grist-widget-bundle
* Run from the root of the repository. Places results
* the dist/plugins directory. Call as:
* node buildtools/bundle.js
* To make all widgets unlisted in the UI when bundled
* with Grist do:
* node buildtools/bundle.js --unlisted
* To set the name of the bundle directory, do:
* node buildtools/bundle.js --name the-bundle-name
*
* Will run a temporary server on port 9990.
*
Expand All @@ -41,12 +46,20 @@
*/

const { spawn, spawnSync } = require('child_process');
const { program } = require('commander');
const fs = require('fs');
const fetch = require('node-fetch');
const path = require('path');

program
.option('--unlisted')
.option('-n, --name <string>');

program.parse();
const { unlisted, name } = program.opts();

// This is where we will place our output.
const TARGET_DIR = 'dist/grist-widget-bundle';
const TARGET_DIR = `dist/plugins/${ name ?? 'grist-widget-bundle' }`;

// This is a temporary port number.
const TMP_PORT = 9990;
Expand Down Expand Up @@ -136,6 +149,27 @@ class Bundler {
for (const url of (widget.archive.entrypoints || [])) {
this.downloadUrl(url, widget);
}
// Fix up the URL in the manifest to be relative to where
// the widget material will be moved to.
widget.url = widget.url.replace(
this.assetUrl,
'./' + this.renamedHost
);
// Do same for entrypoint URLs - not really necessary, but feels
// a bit cleaner to keep consistent.
if (widget.archive?.entrypoints) {
widget.archive.entrypoints = widget.archive.entrypoints.map(
e => e.replace(
this.assetUrl,
'./' + this.renamedHost
)
);
}
// Set a timestamp.
widget.bundledAt = this.bundledAt.toISOString();
if (unlisted) {
widget.published = false;
}
this.widgets.push(widget);
}

Expand All @@ -152,7 +186,7 @@ class Bundler {
this.reviseManifest();

fs.writeFileSync(path.join(targetDir, 'manifest.yml'),
'name: Grist Widget Bundle\n' +
`name: ${name}\n` +
'components:\n' +
' widgets: archive/manifest.json\n');
}
Expand Down Expand Up @@ -195,18 +229,8 @@ class Bundler {
// Run the wget command.
const result = spawnSync(cmd, {shell: true, stdio: 'inherit'});
if (result.status !== 0) {
throw new Error('failure');
throw new Error(`failure running: ${cmd}`);
}

// Fix up the URL in the manifest to be relative to where
// the widget material will be moved to.
widget.url = widget.url.replace(
this.assetUrl,
'./' + this.renamedHost
);

// Set a timestamp.
widget.bundledAt = this.bundledAt.toISOString();
}

// Quick sanity check on domains, since we'll be inserting
Expand Down
33 changes: 32 additions & 1 deletion calendar/i18n/cs/translation.json
Original file line number Diff line number Diff line change
@@ -1 +1,32 @@
{}
{
"Sun": "Ne",
"month": "měsíc",
"Sat": "So",
"title of event": "nadpis události",
"Fri": "",
"next": "další",
"Is All Day": "Jedná se o celý den?",
"Type": "typ",
"Start Date": "začínající datum",
"starting point of event": "začátek události",
"event category and style": "Kategorie události a její styl",
"Edit": "Upravit",
"Mon": "Po",
"Title": "Nadpis",
"previous": "předchozí",
"Update": "Aktualizovat",
"Tue": "Út",
"newEvent": "nová Událost",
"Wed": "St",
"ending point of event": "konec události",
"Thu": "Čt",
"is event all day long": "je událost na celý den?",
"week": "týden",
"Save": "Uložit",
"Delete": "Vymazat",
"All Day": "Celý den",
"calendar": "kalendář",
"day": "den",
"today": "dnes",
"End Date": "končící datum"
}
32 changes: 32 additions & 0 deletions calendar/i18n/fr/translation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"Sun": "Dim",
"month": "mois",
"Sat": "Sam",
"title of event": "titre de l'événement",
"Fri": "Ven",
"next": "suivant",
"Is All Day": "C'est toute la journée ?",
"Type": "type",
"Start Date": "date de début",
"starting point of event": "point de départ de l'événement",
"event category and style": "Catégorie et style d'événement",
"Edit": "Modifier",
"Mon": "Lun",
"Title": "Titre",
"previous": "précédent",
"Update": "Mise à jour",
"Tue": "Mar",
"newEvent": "nouvel évènement",
"Wed": "Mer",
"ending point of event": "point final de l'événement",
"Thu": "Jeu",
"is event all day long": "L'événement dure-t-il toute la journée ?",
"week": "semaine",
"Save": "Sauvegarder",
"Delete": "Supprimer",
"All Day": "Toute la journée",
"calendar": "calendrier",
"day": "jour",
"today": "aujourd'hui",
"End Date": "date de fin"
}
32 changes: 32 additions & 0 deletions calendar/i18n/it/translation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"Sun": "Dom",
"month": "mese",
"Sat": "Sab",
"title of event": "titolo dell'evento",
"Fri": "Ven",
"next": "prossimo",
"Is All Day": "È tutto il giorno?",
"Type": "tipo",
"Start Date": "data d'inizio",
"starting point of event": "punto di partenza dell'evento",
"event category and style": "Categoria e stile dell'evento",
"Edit": "Modificare",
"Mon": "Lun",
"Title": "Titolo",
"previous": "precedente",
"Update": "Aggiornamento",
"Tue": "Mar",
"newEvent": "nuovo evento",
"Wed": "Mer",
"ending point of event": "punto finale dell'evento",
"Thu": "Gio",
"is event all day long": "L'evento dura tutto il giorno?",
"week": "settimana",
"Save": "Salva",
"Delete": "Eliminare",
"All Day": "Tutto il giorno",
"calendar": "calendario",
"day": "giorno",
"today": "oggi",
"End Date": "data di fine"
}
32 changes: 32 additions & 0 deletions calendar/i18n/pt/translation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"Sun": "Dom",
"month": "mês",
"Sat": "Sáb",
"title of event": "título do evento",
"Fri": "Sex",
"next": "próximo",
"Is All Day": "É o dia todo?",
"Type": "tipo",
"Start Date": "data inicial",
"starting point of event": "ponto inicial do evento",
"event category and style": "Categoria e estilo do evento",
"Edit": "Editar",
"Mon": "Seg",
"Title": "Título",
"previous": "anterior",
"Update": "Atualizar",
"Tue": "Ter",
"newEvent": "novo evento",
"Wed": "Qua",
"ending point of event": "ponto final do evento",
"Thu": "Qui",
"is event all day long": "O evento dura o dia todo?",
"week": "semana",
"Save": "Gravar",
"Delete": "Apagar",
"All Day": "Todo o dia",
"calendar": "calendário",
"day": "dia",
"today": "hoje",
"End Date": "data final"
}
32 changes: 32 additions & 0 deletions calendar/i18n/ro/translation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"Sun": "Dum",
"month": "lună",
"Sat": "Sâm",
"title of event": "titlul evenimentului",
"Fri": "Vin",
"next": "următorul",
"Is All Day": "Toată ziua?",
"Type": "tip",
"Start Date": "data de început",
"starting point of event": "începerea evenimentului",
"event category and style": "Categoria și stilul evenimentului",
"Edit": "Editează",
"Mon": "Lun",
"Title": "Titlu",
"previous": "precedentul",
"Update": "Actualizează",
"Tue": "Mar",
"newEvent": "Eveniment nou",
"Wed": "Mie",
"ending point of event": "încheierea evenimentului",
"Thu": "Joi",
"is event all day long": "evenimentul este toată ziua?",
"week": "săptămână",
"Save": "Salvează",
"Delete": "Șterge",
"All Day": "Toată ziua",
"calendar": "calendar",
"day": "zi",
"today": "astăzi",
"End Date": "data de încheiere"
}
2 changes: 1 addition & 1 deletion calendar/i18n/sl/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"Wed": "Sre",
"ending point of event": "končna točka dogodka",
"Thu": "Čet",
"is event all day long": "je dogodek ves dan?",
"is event all day long": "je celodnevni dogodek?",
"week": "teden",
"Save": "Shrani",
"Delete": "Izbriši",
Expand Down
1 change: 1 addition & 0 deletions chart
Submodule chart added at cca0d3
7 changes: 0 additions & 7 deletions chart/index.html

This file was deleted.

1 change: 1 addition & 0 deletions jupyterlite
Submodule jupyterlite added at 1e2bcc
7 changes: 0 additions & 7 deletions jupyterlite/index.html

This file was deleted.

14 changes: 10 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "grist-widget",
"version": "0.0.2",
"name": "@gristlabs/grist-widget",
"version": "0.0.4",
"description": "A repository of grist custom widgets that have no back-end requirements.",
"scripts": {
"build": "tsc --build && node ./buildtools/publish.js manifest.json",
Expand All @@ -12,14 +12,15 @@
"test": "docker image inspect gristlabs/grist --format 'gristlabs/grist image present' && NODE_PATH=_build SELENIUM_BROWSER=chrome mocha -g \"${GREP_TESTS}\" _build/test/*.js",
"test:ci": "MOCHA_WEBDRIVER_HEADLESS=1 npm run test",
"pretest": "docker pull gristlabs/grist && tsc --build && node ./buildtools/publish.js manifest.json http://localhost:9998",
"bundle": "node ./buildtools/bundle.js"
"prepack": "node ./buildtools/bundle.js --name grist-bundled --unlisted"
},
"devDependencies": {
"@types/chai": "^4.3.5",
"@types/mocha": "^10.0.1",
"@types/node": "18.11.9",
"@types/node-fetch": "^2.6.4",
"@types/selenium-webdriver": "^4.1.15",
"commander": "^11.1.0",
"live-server": "^1.2.1",
"mocha": "^10.2.0",
"mocha-webdriver": "0.3.1",
Expand All @@ -33,5 +34,10 @@
"require": [
"_build/test/init-mocha-webdriver"
]
}
},
"files": [
"dist/plugins",
"LICENSE",
"README.md"
]
}
4 changes: 2 additions & 2 deletions test/calendar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,8 @@ describe('calendar', function () {

// Now configure bi-directional mapping.
await grist.sendActionsAndWaitForServer([
['UpdateRecord', '_grist_Views_section', 1, {linkSrcSectionRef: 3}],
['UpdateRecord', '_grist_Views_section', 3, {linkSrcSectionRef: 1}],
['UpdateRecord', '_grist_Views_section', 1, {linkSrcSectionRef: 4}],
['UpdateRecord', '_grist_Views_section', 4, {linkSrcSectionRef: 1}],
]);

// Add 4 events in the calendar.
Expand Down
Loading

0 comments on commit 68ef882

Please sign in to comment.