Skip to content

Commit 425e9fc

Browse files
committed
update README, CHANGELOG, version
1 parent e9a2b74 commit 425e9fc

31 files changed

+159
-306
lines changed

CHANGELOG.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,16 @@ Changelog
77

88
introduced new plugin concept
99
* Hide `use(plug)` concept from public api.
10-
The function for extending js-joda is not exported anymore (the default export of this module is removed).
11-
The code for extending js-joda `use(plug)` is not required anymore, because js-joda-timezone automaticaly extends
10+
The function for extending js-joda is not exported anymore.
11+
The code for extending js-joda `use(plug)` is not required anymore, because js-joda-locale automaticaly extends
1212
js-joda when imported.
13+
However, using `Locale` now requires extracting it from the `@js-joda/locale` module instead of `js-joda`
1314

1415
* get rid of postinstall build
1516

16-
* add possibility to publish locale specific packages (e.g. js-joda-locale_de, js-joda-locale_en-US, ...)
17+
* add possibility to publish locale specific packages (e.g. @js-joda/locale_de, @js-joda/locale_en-US, ...)
1718

18-
* add prebuilt packages to main js-joda-locale package (e.g. js-joda-locale/build/package/de/js-joda-locale, ...)
19+
* add prebuilt packages to main js-joda-locale package (e.g. @js-joda/locale/dist/prebuilt/de/js-joda-locale, ...)
1920

2021
### 1.0.0
2122

README.md

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ The implementation requires cldr data provided by the [cldr-data](https://github
5252
and uses [cldrjs](https://github.com/rxaviers/cldrjs) to load the data.
5353
This is necessary to display and parse locale specific data, e.g DayOfWeek or Month Names.
5454

55-
The cldr data is a peer dependency of this package, meaning it must be provided/`npm install`ed by users of `js-joda-locale`
55+
The cldr data is a peer dependency of this package, meaning it must be provided/`npm install`ed by users of `@js-joda/locale`
5656

5757
Since the complete cldr-data package can be quite large, the examples and documentation below show ways to dynamically
5858
load or reduce the amount of data needed.
5959

60-
The implementation of `js-joda-locale` also requires `js-joda-timezone` package e.g. to parse and output timezone names and offsets
60+
The implementation of `@js-joda/locale` also requires `js-joda-timezone` package e.g. to parse and output timezone names and offsets
6161

6262
### Node
6363

@@ -68,13 +68,14 @@ Install joda using npm
6868
npm install js-joda-timezone
6969
npm install cldr-data
7070
npm install cldrjs
71-
npm install js-joda-locale
71+
npm install @js-joda/locale
7272
```
7373

74-
To enable js-joda-locale you will need to provide it to js-joda as a plugin via the `use` function
74+
To enable js-joda-locale you will onlye need to require it, requireing it automatically registers the locale extensions in the base `js-joda`
75+
Note: the `Locale` class is exported by `@js-joda/locale` so in order to use it, you will need to extract it from there.
7576

7677
```javascript
77-
jsJoda.use('js-joda-locale')
78+
require('js-joda-locale')
7879
```
7980
since `js-joda-locale` requires `js-joda-timezone` it will also need to be provided, as shown
8081
in the following examples
@@ -85,23 +86,33 @@ the plugin `use`
8586
### es5
8687

8788
```javascript
88-
var joda = require('js-joda').use(require('js-joda-timezone')).use(require('../dist/js-joda-locale'));
89-
var zdt = joda.ZonedDateTime.of(2016, 1, 1, 0, 0, 0, 0, joda.ZoneId.of('Europe/Berlin'));
90-
console.log('en_US formatted string:', zdt.format(joda.DateTimeFormatter.ofPattern('eeee MMMM dd yyyy GGGG, hh:mm:ss a zzzz, \'Week \' ww, \'Quarter \' QQQ').withLocale(joda.Locale.US)));
89+
const joda = require('js-joda');
90+
require('js-joda-timezone');
91+
92+
const {
93+
DateTimeFormatter,
94+
ZonedDateTime,
95+
ZoneId,
96+
} = joda;
97+
98+
const {
99+
Locale,
100+
} = require('js-joda-locale');
101+
102+
var zdt = ZonedDateTime.of(2016, 1, 1, 0, 0, 0, 0, ZoneId.of('Europe/Berlin'));
103+
console.log('en_US formatted string:', zdt.format(DateTimeFormatter.ofPattern('eeee MMMM dd yyyy GGGG, hh:mm:ss a zzzz, \'Week \' ww, \'Quarter \' QQQ').withLocale(Locale.US)));
91104
```
92105
also see [examples/usage_node.js](examples/usage_node.js) or [examples/usage_node_build.js](examples/usage_node_build.js)
93106

94107
### es6
95108

96109
```ecmascript 6
97-
import { use as jsJodaUse } from 'js-joda';
98-
import jsJodaTimeZone from 'js-joda-timezone';
99-
import jsJodaLocale from 'js-joda-locale';
100-
101-
const { DateTimeFormatter, Locale, ZonedDateTime, ZoneId } = jsJodaUse(jsJodaTimeZone).use(jsJodaLocale);
102-
103-
const zdt = ZonedDateTime.of(2016, 1, 1, 0, 0, 0, 0, ZoneId.of('Europe/Berlin'));
104-
console.log('en_US formatted string:', zdt.format(DateTimeFormatter.ofPattern('eeee MMMM dd yyyy GGGG, hh:mm:ss a zzzz, \'Week \' ww, \'Quarter \' QQQ').withLocale(Locale.US)));
110+
import { DateTimeFormatter, ZonedDateTime, ZoneId } from 'js-joda';
111+
import 'js-joda-timezone';
112+
import { Locale } from './build/js-joda-locale';
113+
114+
const zdt = ZonedDateTime.of(2016, 1, 1, 0, 0, 0, 0, ZoneId.of('Europe/Berlin'));
115+
console.log('en_US formatted string:', zdt.format(DateTimeFormatter.ofPattern('eeee MMMM dd yyyy GGGG, hh:mm:ss a zzzz, \'Week \' ww, \'Quarter \' QQQ').withLocale(Locale.US)));
105116
```
106117

107118
also see the [example](examples/usage_es6.js)

dist/js-joda-locale.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! @version @js-joda/locale - 2.0.0-pre5+34.0.0
1+
//! @version @js-joda/locale - 2.0.0-pre6+34.0.0
22
//! @copyright (c) 2015-2016, Philipp Thürwächter, Pattrick Hüper & js-joda contributors
33
//! @copyright (c) 2007-present, Stephen Colebourne & Michael Nascimento Santos
44
//! @license BSD-3-Clause (see LICENSE in the root directory of this source tree)

dist/js-joda-locale.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@js-joda/locale",
3-
"version": "2.0.0-pre5+34.0.0",
3+
"version": "2.0.0-pre6+34.0.0",
44
"description": "plugin for locale functionality for js-joda",
55
"repository": {
66
"type": "git",
@@ -17,8 +17,9 @@
1717
"build-dist-es5": "./node_modules/.bin/babel src -d build/es5",
1818
"build-dist": "./node_modules/.bin/webpack --progress --colors --bail && DIST_MIN=1 ./node_modules/.bin/webpack --progress --colors --bail",
1919
"build-examples": "node ./utils/build_package.js -o examples/build/js-joda-locale -m node_modules -c utils/load_cldrData.prebuilt.js -l \"en.*\" de fr es zh hi ru",
20-
"create-packages": "rm -rf packages/*;node utils/create_packages.js --config build_package.prebuilt.json",
20+
"build-prebuilt": "rm -rf dist/prebuilt/*;node utils/build_package.js --config build_package.prebuilt.json",
2121
"build_package": "node ./utils/build_package.js",
22+
"create-packages": "rm -rf packages/*;node utils/create_packages.js --config build_package.prebuilt.json",
2223
"lint": "./node_modules/.bin/eslint ."
2324
},
2425
"keywords": [

packages/de-de/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@js-joda/locale_de-de",
3-
"version": "2.0.0-pre5+34.0.0",
3+
"version": "2.0.0-pre6+34.0.0",
44
"description": "prebuilt js-joda locale package for locales: de,de-DE",
55
"repository": {
66
"type": "git",

packages/de/dist/index.js

Lines changed: 13 additions & 33 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/de/dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/de/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@js-joda/locale_de",
3-
"version": "2.0.0-pre5+34.0.0",
3+
"version": "2.0.0-pre6+34.0.0",
44
"description": "prebuilt js-joda locale package for locales: de.*",
55
"repository": {
66
"type": "git",

packages/en-us/dist/index.js

Lines changed: 13 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! @version @js-joda/locale - 2.0.0-pre5+34.0.0
1+
//! @version @js-joda/locale - 2.0.0-pre6+34.0.0
22
//! @copyright (c) 2015-2016, Philipp Thürwächter, Pattrick Hüper & js-joda contributors
33
//! @copyright (c) 2007-present, Stephen Colebourne & Michael Nascimento Santos
44
//! @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
@@ -1940,31 +1940,6 @@ init();
19401940

19411941
/***/ }),
19421942

1943-
/***/ "./src/auto-plug.js":
1944-
/*!**************************!*\
1945-
!*** ./src/auto-plug.js ***!
1946-
\**************************/
1947-
/*! exports provided: default */
1948-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
1949-
1950-
"use strict";
1951-
__webpack_require__.r(__webpack_exports__);
1952-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return autoPlug; });
1953-
/* harmony import */ var js_joda__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! js-joda */ "js-joda");
1954-
/* harmony import */ var js_joda__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(js_joda__WEBPACK_IMPORTED_MODULE_0__);
1955-
/* harmony import */ var _plug__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./plug */ "./src/plug.js");
1956-
/*
1957-
* @copyright (c) 2016-present, Philipp Thürwächter, Pattrick Hüper
1958-
* @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
1959-
*/
1960-
1961-
1962-
function autoPlug() {
1963-
Object(js_joda__WEBPACK_IMPORTED_MODULE_0__["use"])(_plug__WEBPACK_IMPORTED_MODULE_1__["default"]);
1964-
}
1965-
1966-
/***/ }),
1967-
19681943
/***/ "./src/format/LocaleDateTimeFormatter.js":
19691944
/*!***********************************************!*\
19701945
!*** ./src/format/LocaleDateTimeFormatter.js ***!
@@ -3244,18 +3219,26 @@ var WeekFieldsPrinterParser = function () {
32443219
/*!*******************************!*\
32453220
!*** ./src/js-joda-locale.js ***!
32463221
\*******************************/
3247-
/*! no exports provided */
3222+
/*! exports provided: Locale */
32483223
/***/ (function(module, __webpack_exports__, __webpack_require__) {
32493224

32503225
"use strict";
32513226
__webpack_require__.r(__webpack_exports__);
3252-
/* harmony import */ var _auto_plug__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./auto-plug */ "./src/auto-plug.js");
3227+
/* harmony import */ var js_joda__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! js-joda */ "js-joda");
3228+
/* harmony import */ var js_joda__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(js_joda__WEBPACK_IMPORTED_MODULE_0__);
3229+
/* harmony import */ var _plug__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./plug */ "./src/plug.js");
3230+
/* harmony import */ var _Locale__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Locale */ "./src/Locale.js");
3231+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Locale", function() { return _Locale__WEBPACK_IMPORTED_MODULE_2__["default"]; });
3232+
32533233
/*
32543234
* @copyright (c) 2017, Philipp Thuerwaechter & Pattrick Hueper
32553235
* @license BSD-3-Clause (see LICENSE.md in the root directory of this source tree)
32563236
*/
32573237

3258-
Object(_auto_plug__WEBPACK_IMPORTED_MODULE_0__["default"])();
3238+
3239+
3240+
Object(js_joda__WEBPACK_IMPORTED_MODULE_0__["use"])(_plug__WEBPACK_IMPORTED_MODULE_1__["default"]);
3241+
32593242

32603243
/***/ }),
32613244

@@ -3270,16 +3253,14 @@ Object(_auto_plug__WEBPACK_IMPORTED_MODULE_0__["default"])();
32703253
__webpack_require__.r(__webpack_exports__);
32713254
/* harmony import */ var _format_cldr_CldrDateTimeFormatterBuilder__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./format/cldr/CldrDateTimeFormatterBuilder */ "./src/format/cldr/CldrDateTimeFormatterBuilder.js");
32723255
/* harmony import */ var _format_LocaleDateTimeFormatter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./format/LocaleDateTimeFormatter */ "./src/format/LocaleDateTimeFormatter.js");
3273-
/* harmony import */ var _Locale__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Locale */ "./src/Locale.js");
3274-
/* harmony import */ var _init__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./_init */ "./src/_init.js");
3256+
/* harmony import */ var _init__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_init */ "./src/_init.js");
32753257
/*
32763258
* @copyright (c) 2017, Philipp Thuerwaechter & Pattrick Hueper
32773259
* @license BSD-3-Clause (see LICENSE.md in the root directory of this source tree)
32783260
*/
32793261

32803262

32813263

3282-
32833264
/* harmony default export */ __webpack_exports__["default"] = (function (jsJoda) {
32843265
Object.getOwnPropertyNames(_format_cldr_CldrDateTimeFormatterBuilder__WEBPACK_IMPORTED_MODULE_0__["default"].prototype).forEach(function (prop) {
32853266
if (prop !== 'constructor') {
@@ -3291,7 +3272,6 @@ __webpack_require__.r(__webpack_exports__);
32913272
jsJoda.DateTimeFormatter.prototype[prop] = _format_LocaleDateTimeFormatter__WEBPACK_IMPORTED_MODULE_1__["default"].prototype[prop];
32923273
}
32933274
});
3294-
jsJoda.Locale = _Locale__WEBPACK_IMPORTED_MODULE_2__["default"];
32953275
});
32963276

32973277
/***/ }),

0 commit comments

Comments
 (0)