Tools to share common tasks for GRUD data.
All sub packages' exports are also exported by the package's main entry point.
Publishing is done in the jsr way. You can publish manually or automatically via github actions, which is the default and recommended way.
Steps to follow:
- Make your changes
- Update the version in
deno.jsoncin semver format - Document your changes in the
CHANGELOG.mdfile - Create a pull request and ask a nice colleague to approve your great changes
- Merge the pull request and wait for the github action to publish the new version
Go to https://jsr.io/@grud/devtools, choose your runtime and follow the instructions.
Can be found in the grud-devtools/types sub package.
A number of useful predicates can be imported from grud-devtools/predicates
import { isBooleanColumn } from "grud-devtools/predicates";import { formatCurrency, getCurrency } from "grud-devtools/intl";
const langtag = "de-DE";
const amount = 1234.56;
formatCurrency(langtag, getCurrency(langtag), amount);
// > "1.234,56 EUR"Creates display value objects with entries for all required langtags.
As such it needs to know which langtags should be generated.
It will optionally format numbers, currencies and dates either for a specific
language, or infer a format for every given langtag.
import { getDisplayValue } from "grud-devtools";
const supportedLangs = ["de-DE", "en-US"];
const gdv = getDisplayValue(supportedLangs);
const getGermanDisplayValue = gdv("de-DE");
const getDisplayValuePerLangtag = gdv();
getGermanDisplayValue(numberColumn, 1234.56);
// > { "de-DE": "1.234,56",
// "en-US": "1.234,56" }
// All numbers formatted for German viewers -- e.g. GRUD frontend
getDisplayValuePerLangtag(numberColumn, 1234.56);
// > { "de-DE": "1.234,56",
// "en-US": "1,234.56" }
// All numbers formatted for the country of the value -- e.g. national cataloguesCopyright 2016-present Campudus GmbH
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.