@js-joda/locale 4.2.1 → 4.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/dist/js-joda-locale.esm.js +1823 -0
- package/dist/js-joda-locale.js +1095 -1297
- package/dist/js-joda-locale.js.map +1 -1
- package/dist/js-joda-locale.min.js +9 -36
- package/dist/prebuilt/de/index.js +1105 -1307
- package/dist/prebuilt/de/index.js.map +1 -1
- package/dist/prebuilt/de-de/index.js +1105 -1307
- package/dist/prebuilt/de-de/index.js.map +1 -1
- package/dist/prebuilt/en/index.js +1106 -1308
- package/dist/prebuilt/en/index.js.map +1 -1
- package/dist/prebuilt/en-us/index.js +1105 -1307
- package/dist/prebuilt/en-us/index.js.map +1 -1
- package/dist/prebuilt/es/index.js +1106 -1308
- package/dist/prebuilt/es/index.js.map +1 -1
- package/dist/prebuilt/fr/index.js +1106 -1308
- package/dist/prebuilt/fr/index.js.map +1 -1
- package/dist/prebuilt/fr-fr/index.js +1105 -1307
- package/dist/prebuilt/fr-fr/index.js.map +1 -1
- package/dist/prebuilt/hi/index.js +1105 -1307
- package/dist/prebuilt/hi/index.js.map +1 -1
- package/dist/prebuilt/it/index.js +1105 -1307
- package/dist/prebuilt/it/index.js.map +1 -1
- package/dist/prebuilt/it-it/index.js +1105 -1307
- package/dist/prebuilt/it-it/index.js.map +1 -1
- package/dist/prebuilt/ja/index.js +1105 -1307
- package/dist/prebuilt/ja/index.js.map +1 -1
- package/dist/prebuilt/ja-jp/index.js +1105 -1307
- package/dist/prebuilt/ja-jp/index.js.map +1 -1
- package/dist/prebuilt/ko/index.js +1105 -1307
- package/dist/prebuilt/ko/index.js.map +1 -1
- package/dist/prebuilt/ro/index.js +1105 -1307
- package/dist/prebuilt/ro/index.js.map +1 -1
- package/dist/prebuilt/ru/index.js +4035 -0
- package/dist/prebuilt/ru/index.js.map +1 -0
- package/dist/prebuilt/sv/index.js +1105 -1307
- package/dist/prebuilt/sv/index.js.map +1 -1
- package/dist/prebuilt/sv-se/index.js +1105 -1307
- package/dist/prebuilt/sv-se/index.js.map +1 -1
- package/dist/prebuilt/zh/index.js +1105 -1307
- package/dist/prebuilt/zh/index.js.map +1 -1
- package/package.json +24 -17
- package/src/Locale.js +8 -0
- package/src/js-joda-locale.js +3 -1
- package/{dist → typings}/js-joda-locale.d.ts +28 -2
- package/.babelrc +0 -24
- package/build_package.default.json +0 -14
- package/build_package.prebuilt.json +0 -66
- package/examples/usage_browser.html +0 -111
- package/examples/usage_browser_build.html +0 -72
- package/examples/usage_es6.js +0 -15
- package/examples/usage_node.js +0 -38
- package/examples/usage_node_build.js +0 -48
- package/utils/CldrDataIgnorePlugin.js +0 -57
- package/utils/README_package.template.md +0 -13
- package/utils/buildWebpackConfig.js +0 -28
- package/utils/build_package.js +0 -170
- package/utils/create_packages.js +0 -136
- package/utils/load_cldrData.prebuilt.js +0 -18
- package/utils/publish_release.js +0 -151
- package/webpack.config.js +0 -88
package/utils/build_package.js
DELETED
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/*
|
|
3
|
-
* @copyright (c) 2017, Philipp Thuerwaechter & Pattrick Hueper
|
|
4
|
-
* @license BSD-3-Clause (see LICENSE.md in the root directory of this source tree)
|
|
5
|
-
*/
|
|
6
|
-
const path = require('path');
|
|
7
|
-
const fs = require('fs');
|
|
8
|
-
const webpack = require('webpack');
|
|
9
|
-
const yargsPkg = require('yargs');
|
|
10
|
-
const { updateWebpackConfigForLocales } = require('./buildWebpackConfig');
|
|
11
|
-
|
|
12
|
-
let yargs = yargsPkg
|
|
13
|
-
.options({
|
|
14
|
-
output: {
|
|
15
|
-
alias: 'o',
|
|
16
|
-
string: true,
|
|
17
|
-
default: path.resolve(`${__dirname}/../build/package`),
|
|
18
|
-
description: 'output directory, where the package(s) are generated, can be absolute or relative (to cwd)'
|
|
19
|
-
},
|
|
20
|
-
locales: {
|
|
21
|
-
alias: 'l',
|
|
22
|
-
array: true,
|
|
23
|
-
description: 'the locale(s) to generate in package'
|
|
24
|
-
},
|
|
25
|
-
stats: {
|
|
26
|
-
alias: 's',
|
|
27
|
-
boolean: true,
|
|
28
|
-
default: false,
|
|
29
|
-
description: 'output webpack stats at the end of the build'
|
|
30
|
-
},
|
|
31
|
-
statsOptions: {
|
|
32
|
-
hidden: true,
|
|
33
|
-
default: {
|
|
34
|
-
colors: true,
|
|
35
|
-
},
|
|
36
|
-
description: '(only in config/pkgConfig) change the webpack stats options to be used, see also https://webpack.js.org/configuration/stats/'
|
|
37
|
-
},
|
|
38
|
-
cldrDataLoader: {
|
|
39
|
-
alias: 'c',
|
|
40
|
-
string: true,
|
|
41
|
-
default: path.resolve(`${__dirname}/load_cldrData.prebuilt.js`),
|
|
42
|
-
description: 'specify the cldrDataLoader to use, this will need to require the cldr-data json files. Since it has to require the actual files, it is different depending on installation location. See for example test/utils/karma_clrData.js and utils/load_cldrData.js. Can be absolute or relative (to cwd)'
|
|
43
|
-
},
|
|
44
|
-
modulesDir: {
|
|
45
|
-
alias: 'm',
|
|
46
|
-
string: true,
|
|
47
|
-
default: path.resolve(`${__dirname}/../..`),
|
|
48
|
-
description: 'specify the location of the node_modules dir. NOTE: both js-joda-locale and cldr-data must be located in this dir. Can be absolute or relative (to cdw)'
|
|
49
|
-
},
|
|
50
|
-
config: {
|
|
51
|
-
config: true,
|
|
52
|
-
description: 'path to a JSON file with config options, for a format example see build_package.default.json'
|
|
53
|
-
},
|
|
54
|
-
packages: {
|
|
55
|
-
hidden: true,
|
|
56
|
-
description: 'only from config and pkgConf, define several packages that will be built, for a format example see build_package.default.json'
|
|
57
|
-
},
|
|
58
|
-
debug: {
|
|
59
|
-
boolean: true,
|
|
60
|
-
default: false,
|
|
61
|
-
description: 'output debug infos'
|
|
62
|
-
},
|
|
63
|
-
})
|
|
64
|
-
.parserConfiguration({
|
|
65
|
-
'camel-case-expansion': false
|
|
66
|
-
})
|
|
67
|
-
.wrap(Math.min(120, yargsPkg.terminalWidth()))
|
|
68
|
-
.help();
|
|
69
|
-
|
|
70
|
-
if ((process.env['npm_lifecycle_event'] === 'postinstall') || (process.env['POSTINSTALL_BUILD'] === '1')) {
|
|
71
|
-
yargs = yargs
|
|
72
|
-
.pkgConf('@js-joda/locale', process.cwd()) // in postinstall this is the js-joda-locale module dir
|
|
73
|
-
.pkgConf('@js-joda/locale', path.resolve(process.cwd(), '../..')); // in postinstall this is the dir of the root package
|
|
74
|
-
|
|
75
|
-
const postInstallArgv = yargs.parse();
|
|
76
|
-
if (!postInstallArgv.packages) {
|
|
77
|
-
// load default packages from build_package.default.json
|
|
78
|
-
yargs = yargs.config(require(path.resolve(__dirname, '../build_package.default.json')));
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
const argv = yargs.parse();
|
|
83
|
-
if (argv.debug) {
|
|
84
|
-
/* eslint-disable no-console */
|
|
85
|
-
console.log('build_package parsed argument', argv);
|
|
86
|
-
console.log('build_package cwd', process.cwd());
|
|
87
|
-
console.log('build_package environemnt');
|
|
88
|
-
Object.keys(process.env)
|
|
89
|
-
.sort()
|
|
90
|
-
.forEach(function (v) {
|
|
91
|
-
console.log(v, process.env[v]);
|
|
92
|
-
});
|
|
93
|
-
/* eslint-enable no-console */
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
function createWebpackConfig(locales, output) {
|
|
97
|
-
let webpackConfig = require(path.resolve(__dirname, '../webpack.config.js'))();
|
|
98
|
-
// change output path
|
|
99
|
-
webpackConfig.output.path = path.resolve(process.cwd(), output);
|
|
100
|
-
webpackConfig.output.filename = 'index.js';
|
|
101
|
-
|
|
102
|
-
// add cldr-data load workaround
|
|
103
|
-
webpackConfig.resolve = {
|
|
104
|
-
alias: {
|
|
105
|
-
'cldr-data$': path.resolve(process.cwd(), argv.cldrDataLoader),
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
const modulesDir = path.resolve(process.cwd(), argv.modulesDir);
|
|
110
|
-
const cldrDataDir = path.resolve(modulesDir, 'cldr-data');
|
|
111
|
-
if (!(fs.existsSync(cldrDataDir))) {
|
|
112
|
-
// eslint-disable-next-line no-console
|
|
113
|
-
console.warn(
|
|
114
|
-
`cldr-data module directory (${cldrDataDir}) does not exist, js-joda-locale package build will very probably fail, so skipping it...!`);
|
|
115
|
-
process.exit(0);
|
|
116
|
-
}
|
|
117
|
-
webpackConfig = updateWebpackConfigForLocales(webpackConfig, locales, modulesDir);
|
|
118
|
-
return webpackConfig;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
let webpackConfig;
|
|
122
|
-
|
|
123
|
-
if (argv.locales) {
|
|
124
|
-
webpackConfig = [createWebpackConfig(argv.locales, argv.output)];
|
|
125
|
-
} else if (argv.packages) {
|
|
126
|
-
webpackConfig = Object.keys(argv.packages).map((key) => {
|
|
127
|
-
const locales = argv.packages[key];
|
|
128
|
-
const output = path.resolve(path.resolve(process.cwd(), argv.output, key));
|
|
129
|
-
return createWebpackConfig(locales, output);
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
if (webpackConfig) {
|
|
134
|
-
RegExp.prototype.toJSON = RegExp.prototype.toString;
|
|
135
|
-
/* eslint-disable no-console */
|
|
136
|
-
if (argv.debug) {
|
|
137
|
-
console.log(JSON.stringify(webpackConfig, null, 4));
|
|
138
|
-
}
|
|
139
|
-
const webpackCompiler = webpack(webpackConfig);
|
|
140
|
-
|
|
141
|
-
webpackCompiler.apply(new webpack.ProgressPlugin());
|
|
142
|
-
|
|
143
|
-
webpackCompiler.run((err, stats) => {
|
|
144
|
-
if (err) {
|
|
145
|
-
console.error(err.stack || err);
|
|
146
|
-
if (err.details) {
|
|
147
|
-
console.error(err.details);
|
|
148
|
-
}
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
const info = stats.toJson();
|
|
153
|
-
|
|
154
|
-
if (stats.hasErrors()) {
|
|
155
|
-
console.error(info.errors);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
if (stats.hasWarnings()) {
|
|
159
|
-
console.warn(info.warnings);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
if (argv.stats) {
|
|
163
|
-
const statsOptions = argv.statsOptions || 'normal';
|
|
164
|
-
console.log(stats.toString(statsOptions));
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
|
-
/* eslint-enable no-console */
|
|
168
|
-
} else {
|
|
169
|
-
yargs.showHelp();
|
|
170
|
-
}
|
package/utils/create_packages.js
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/*
|
|
3
|
-
* @copyright (c) 2018, Philipp Thuerwaechter & Pattrick Hueper
|
|
4
|
-
* @license BSD-3-Clause (see LICENSE.md in the root directory of this source tree)
|
|
5
|
-
*/
|
|
6
|
-
const path = require('path');
|
|
7
|
-
const fs = require('fs');
|
|
8
|
-
const yargsPkg = require('yargs');
|
|
9
|
-
const { execFile } = require('child_process');
|
|
10
|
-
|
|
11
|
-
// this file will create npm (sub-) packages, build_package is used to create a js-joda-locale bundled packages in each package dir
|
|
12
|
-
|
|
13
|
-
const yargs = yargsPkg
|
|
14
|
-
.options({
|
|
15
|
-
packagesDir: {
|
|
16
|
-
alias: 'p',
|
|
17
|
-
string: true,
|
|
18
|
-
default: path.resolve(__dirname, '../packages'),
|
|
19
|
-
description: 'packages directory, where the package(s) are generated, can be absolute or relative (to cwd)'
|
|
20
|
-
},
|
|
21
|
-
config: {
|
|
22
|
-
config: true,
|
|
23
|
-
description: 'path to a JSON file with config options, for a format example see build_package.default.json'
|
|
24
|
-
},
|
|
25
|
-
packages: {
|
|
26
|
-
hidden: true,
|
|
27
|
-
description: 'only from config, define several packages that will be created'
|
|
28
|
-
},
|
|
29
|
-
debug: {
|
|
30
|
-
boolean: true,
|
|
31
|
-
default: false,
|
|
32
|
-
description: 'output debug infos'
|
|
33
|
-
},
|
|
34
|
-
})
|
|
35
|
-
.parserConfiguration({
|
|
36
|
-
'camel-case-expansion': false
|
|
37
|
-
})
|
|
38
|
-
.wrap(Math.min(120, yargsPkg.terminalWidth()))
|
|
39
|
-
.help();
|
|
40
|
-
|
|
41
|
-
const argv = yargs.parse();
|
|
42
|
-
if (argv.debug) {
|
|
43
|
-
/* eslint-disable no-console */
|
|
44
|
-
console.log('create_packages parsed argument', argv);
|
|
45
|
-
console.log('create_packages cwd', process.cwd());
|
|
46
|
-
/* eslint-enable no-console */
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const mainPackageJSON = JSON.parse(fs.readFileSync(path.resolve(__dirname, '..', 'package.json')));
|
|
50
|
-
const packageTemplate = {
|
|
51
|
-
name: '<will be overridden>',
|
|
52
|
-
version: '<will be overridden>',
|
|
53
|
-
description: '<will be overridden>',
|
|
54
|
-
repository: {
|
|
55
|
-
type: 'git',
|
|
56
|
-
url: 'https://github.com/js-joda/js-joda-locale.git'
|
|
57
|
-
},
|
|
58
|
-
main: 'dist/index.js',
|
|
59
|
-
typings: 'dist/js-joda-locale.d.ts',
|
|
60
|
-
keywords: [
|
|
61
|
-
'date',
|
|
62
|
-
'time',
|
|
63
|
-
'locale'
|
|
64
|
-
],
|
|
65
|
-
author: 'phueper',
|
|
66
|
-
contributors: [
|
|
67
|
-
'pithu',
|
|
68
|
-
'phueper'
|
|
69
|
-
],
|
|
70
|
-
license: 'BSD-3-Clause',
|
|
71
|
-
bugs: {
|
|
72
|
-
url: 'https://github.com/js-joda/js-joda-locale/issues'
|
|
73
|
-
},
|
|
74
|
-
homepage: 'https://github.com/js-joda/js-joda-locale#readme',
|
|
75
|
-
peerDependencies: {
|
|
76
|
-
'@js-joda/core': mainPackageJSON.peerDependencies['@js-joda/core'],
|
|
77
|
-
'@js-joda/timezone': mainPackageJSON.peerDependencies['@js-joda/timezone'],
|
|
78
|
-
},
|
|
79
|
-
dependencies: {},
|
|
80
|
-
devDependencies: {}
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
const readmeTemplate = fs.readFileSync(path.resolve(__dirname, 'README_package.template.md'),
|
|
84
|
-
'utf8');
|
|
85
|
-
const readmeLocaleRegex = /{{locale}}/g;
|
|
86
|
-
|
|
87
|
-
// TODO: build minified (DIST_MIN=1) package?? in dist/index.min.js?
|
|
88
|
-
Object.keys(argv.packages).forEach((packageName) => {
|
|
89
|
-
// eslint-disable-next-line no-console
|
|
90
|
-
console.info('creating', packageName);
|
|
91
|
-
const packageDir = path.resolve(argv.packagesDir, packageName);
|
|
92
|
-
if (!fs.existsSync(packageDir)) {
|
|
93
|
-
fs.mkdirSync(packageDir);
|
|
94
|
-
}
|
|
95
|
-
const distDir = path.resolve(argv.packagesDir, packageName, 'dist');
|
|
96
|
-
if (!fs.existsSync(distDir)) {
|
|
97
|
-
fs.mkdirSync(distDir);
|
|
98
|
-
}
|
|
99
|
-
// create package.json
|
|
100
|
-
packageTemplate.version = mainPackageJSON.version;
|
|
101
|
-
packageTemplate.name = `@js-joda/locale_${packageName}`;
|
|
102
|
-
packageTemplate.description = `prebuilt js-joda locale package for locales: ${argv.packages[packageName]}`;
|
|
103
|
-
fs.writeFileSync(path.resolve(packageDir, 'package.json'),
|
|
104
|
-
JSON.stringify(packageTemplate, null, 4));
|
|
105
|
-
fs.writeFileSync(path.resolve(packageDir, 'README.md'),
|
|
106
|
-
readmeTemplate.replace(readmeLocaleRegex, argv.packages[packageName].join(',')));
|
|
107
|
-
fs.copyFileSync(path.resolve(__dirname, '..', 'dist', 'js-joda-locale.d.ts'),
|
|
108
|
-
path.resolve(packageDir, 'dist', 'js-joda-locale.d.ts'));
|
|
109
|
-
const nodeArgs = [
|
|
110
|
-
'./utils/build_package.js',
|
|
111
|
-
'-o', `${path.resolve(packageDir, 'dist')}`,
|
|
112
|
-
'-m', 'node_modules',
|
|
113
|
-
'-c', 'utils/load_cldrData.prebuilt.js',
|
|
114
|
-
];
|
|
115
|
-
argv.packages[packageName].forEach((locale) => {
|
|
116
|
-
nodeArgs.push('-l', `${locale}`);
|
|
117
|
-
});
|
|
118
|
-
execFile(
|
|
119
|
-
'node',
|
|
120
|
-
nodeArgs,
|
|
121
|
-
undefined, /* options */
|
|
122
|
-
(error, stdout, stderr) => {
|
|
123
|
-
if (error) {
|
|
124
|
-
throw error;
|
|
125
|
-
}
|
|
126
|
-
if (stdout) {
|
|
127
|
-
// eslint-disable-next-line no-console
|
|
128
|
-
console.log(`stdout output from creating '${packageName}': `, stdout);
|
|
129
|
-
}
|
|
130
|
-
if (stderr) {
|
|
131
|
-
// eslint-disable-next-line no-console
|
|
132
|
-
console.error(`stderr output from creating '${packageName}': `, stderr);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
);
|
|
136
|
-
});
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
// we must use es5 compatible code in this post install file
|
|
3
|
-
|
|
4
|
-
/*
|
|
5
|
-
* @copyright (c) 2018, Philipp Thuerwaechter & Pattrick Hueper
|
|
6
|
-
* @license BSD-3-Clause (see LICENSE.md in the root directory of this source tree)
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
/* since the npm cldrData load is using `fs` and other modules not available in browser,
|
|
10
|
-
* we define our own cldrData "load" function that just `requires` a cldr-data file
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
/* NOTE: the path is relative to the installed js-joda-locale package and assuming,
|
|
14
|
-
* that cldr-data is installed in parallel!
|
|
15
|
-
*/
|
|
16
|
-
module.exports = function (cldrPath) {
|
|
17
|
-
return require('../node_modules/cldr-data/'.concat(cldrPath));
|
|
18
|
-
};
|
package/utils/publish_release.js
DELETED
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/*
|
|
3
|
-
* @copyright (c) 2018, Philipp Thuerwaechter & Pattrick Hueper
|
|
4
|
-
* @license BSD-3-Clause (see LICENSE.md in the root directory of this source tree)
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
const path = require('path');
|
|
8
|
-
const fs = require('fs');
|
|
9
|
-
const yargsPkg = require('yargs');
|
|
10
|
-
const { execFile } = require('child_process');
|
|
11
|
-
|
|
12
|
-
// this file will npm publish the locales specific packages create with create_package.js
|
|
13
|
-
|
|
14
|
-
const yargs = yargsPkg
|
|
15
|
-
.options({
|
|
16
|
-
packagesDir: {
|
|
17
|
-
alias: 'p',
|
|
18
|
-
string: true,
|
|
19
|
-
default: path.resolve(__dirname, '../packages'),
|
|
20
|
-
description: 'packages directory, where the package(s) are generated, can be absolute or relative (to cwd)'
|
|
21
|
-
},
|
|
22
|
-
mainDir: {
|
|
23
|
-
alias: 'm',
|
|
24
|
-
string: true,
|
|
25
|
-
default: path.resolve(__dirname, '..'),
|
|
26
|
-
description: 'main directory, where the main package is located, can be absolute or relative (to cwd)'
|
|
27
|
-
},
|
|
28
|
-
dryRun: {
|
|
29
|
-
alias: 'd',
|
|
30
|
-
boolean: true,
|
|
31
|
-
default: true,
|
|
32
|
-
description: 'perform dryRun, defaults to true'
|
|
33
|
-
},
|
|
34
|
-
beta: {
|
|
35
|
-
alias: 'b',
|
|
36
|
-
boolean: true,
|
|
37
|
-
default: true,
|
|
38
|
-
description: 'perform release / publish'
|
|
39
|
-
},
|
|
40
|
-
release: {
|
|
41
|
-
alias: 'r',
|
|
42
|
-
boolean: true,
|
|
43
|
-
default: false,
|
|
44
|
-
description: 'perform release / publish'
|
|
45
|
-
},
|
|
46
|
-
debug: {
|
|
47
|
-
boolean: true,
|
|
48
|
-
default: false,
|
|
49
|
-
description: 'output debug infos'
|
|
50
|
-
},
|
|
51
|
-
})
|
|
52
|
-
.wrap(Math.min(120, yargsPkg.terminalWidth()))
|
|
53
|
-
.help();
|
|
54
|
-
|
|
55
|
-
const argv = yargs.parse();
|
|
56
|
-
if (argv.debug) {
|
|
57
|
-
/* eslint-disable no-console */
|
|
58
|
-
console.log('publish_release parsed argument', argv);
|
|
59
|
-
console.log('publish_release cwd', process.cwd());
|
|
60
|
-
/* eslint-enable no-console */
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const packages = fs
|
|
64
|
-
.readdirSync(argv.packagesDir)
|
|
65
|
-
.filter((name) => fs.lstatSync(path.resolve(argv.packagesDir, name)).isDirectory());
|
|
66
|
-
const npmArgs = [
|
|
67
|
-
'publish',
|
|
68
|
-
'--access=public',
|
|
69
|
-
];
|
|
70
|
-
if (argv.beta) {
|
|
71
|
-
npmArgs.push('--tag', 'beta');
|
|
72
|
-
}
|
|
73
|
-
packages.forEach((packageName) => {
|
|
74
|
-
const packageJSON = JSON.parse(
|
|
75
|
-
fs.readFileSync(path.resolve(argv.packagesDir, packageName, 'package.json')));
|
|
76
|
-
|
|
77
|
-
// eslint-disable-next-line no-console
|
|
78
|
-
console.info('processing', packageJSON.name);
|
|
79
|
-
|
|
80
|
-
const npmOptions = {
|
|
81
|
-
cwd: path.resolve(argv.packagesDir, packageName)
|
|
82
|
-
};
|
|
83
|
-
const runArgs = [...npmArgs, path.resolve(argv.packagesDir, packageName)];
|
|
84
|
-
if (argv.debug) {
|
|
85
|
-
/* eslint-disable no-console */
|
|
86
|
-
console.log('running npm with args', runArgs, 'options ', npmOptions);
|
|
87
|
-
/* eslint-enable no-console */
|
|
88
|
-
}
|
|
89
|
-
if (argv.dryRun) {
|
|
90
|
-
// eslint-disable-next-line no-console
|
|
91
|
-
console.info('dryRun, not running npm publish');
|
|
92
|
-
} else {
|
|
93
|
-
execFile(
|
|
94
|
-
'npm',
|
|
95
|
-
runArgs,
|
|
96
|
-
npmOptions,
|
|
97
|
-
(error, stdout, stderr) => {
|
|
98
|
-
if (error) {
|
|
99
|
-
// eslint-disable-next-line no-console
|
|
100
|
-
console.error(`error occurred when creating '${packageName}': `, error);
|
|
101
|
-
}
|
|
102
|
-
if (stdout) {
|
|
103
|
-
// eslint-disable-next-line no-console
|
|
104
|
-
console.log(`stdout output from creating '${packageName}': `, stdout);
|
|
105
|
-
}
|
|
106
|
-
if (stderr) {
|
|
107
|
-
// eslint-disable-next-line no-console
|
|
108
|
-
console.error(`stderr output from creating '${packageName}': `, stderr);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
const npmOptions = {
|
|
115
|
-
cwd: path.resolve(argv.mainDir)
|
|
116
|
-
};
|
|
117
|
-
const packageJSON = JSON.parse(
|
|
118
|
-
fs.readFileSync(path.resolve(argv.mainDir, 'package.json')));
|
|
119
|
-
const runArgs = [...npmArgs, path.resolve(argv.mainDir)];
|
|
120
|
-
|
|
121
|
-
// eslint-disable-next-line no-console
|
|
122
|
-
console.info('processing', packageJSON.name);
|
|
123
|
-
if (argv.debug) {
|
|
124
|
-
/* eslint-disable no-console */
|
|
125
|
-
console.log('running npm with args', runArgs, 'options ', npmOptions);
|
|
126
|
-
/* eslint-enable no-console */
|
|
127
|
-
}
|
|
128
|
-
if (argv.dryRun) {
|
|
129
|
-
// eslint-disable-next-line no-console
|
|
130
|
-
console.info('dryRun, not running npm publish');
|
|
131
|
-
} else {
|
|
132
|
-
execFile(
|
|
133
|
-
'npm',
|
|
134
|
-
runArgs,
|
|
135
|
-
npmOptions,
|
|
136
|
-
(error, stdout, stderr) => {
|
|
137
|
-
if (error) {
|
|
138
|
-
// eslint-disable-next-line no-console
|
|
139
|
-
console.error('error occurred when creating main package: ', error);
|
|
140
|
-
}
|
|
141
|
-
if (stdout) {
|
|
142
|
-
// eslint-disable-next-line no-console
|
|
143
|
-
console.log('stdout output from creating main package: ', stdout);
|
|
144
|
-
}
|
|
145
|
-
if (stderr) {
|
|
146
|
-
// eslint-disable-next-line no-console
|
|
147
|
-
console.error('stderr output from creating main package: ', stderr);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
);
|
|
151
|
-
}
|
package/webpack.config.js
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @copyright (c) 2017, Philipp Thuerwaechter & Pattrick Hueper
|
|
3
|
-
* @license BSD-3-Clause (see LICENSE.md in the root directory of this source tree)
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
const fs = require('fs');
|
|
7
|
-
const path = require('path');
|
|
8
|
-
const webpack = require('webpack');
|
|
9
|
-
|
|
10
|
-
const minify = JSON.parse(process.env.DIST_MIN || '0');
|
|
11
|
-
const sourceMaps = !minify;
|
|
12
|
-
|
|
13
|
-
function createBanner() {
|
|
14
|
-
const packageJson = require('./package.json');
|
|
15
|
-
const version = `//! @version ${packageJson.name} - ${packageJson.version}\n`;
|
|
16
|
-
const preamble = fs.readFileSync('./src/license-preamble.js', 'utf8');
|
|
17
|
-
return version + preamble;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const banner = createBanner();
|
|
21
|
-
|
|
22
|
-
const outputFilename = minify ? 'js-joda-locale.min.js' : 'js-joda-locale.js';
|
|
23
|
-
|
|
24
|
-
const createConfig = (/*env, argv*/) => {
|
|
25
|
-
const config = {
|
|
26
|
-
mode: minify ? 'production' : 'development',
|
|
27
|
-
context: __dirname,
|
|
28
|
-
entry: './src/js-joda-locale.js',
|
|
29
|
-
devtool: sourceMaps ? 'hidden-source-map' : false,
|
|
30
|
-
output: {
|
|
31
|
-
globalObject: 'this',
|
|
32
|
-
path: `${__dirname}/dist`,
|
|
33
|
-
filename: outputFilename,
|
|
34
|
-
libraryTarget: 'umd',
|
|
35
|
-
library: 'JSJodaLocale',
|
|
36
|
-
},
|
|
37
|
-
externals: {
|
|
38
|
-
'@js-joda/core': {
|
|
39
|
-
amd: '@js-joda/core',
|
|
40
|
-
commonjs: '@js-joda/core',
|
|
41
|
-
commonjs2: '@js-joda/core',
|
|
42
|
-
root: 'JSJoda',
|
|
43
|
-
},
|
|
44
|
-
'@js-joda/timezone': {
|
|
45
|
-
amd: '@js-joda/timezone',
|
|
46
|
-
commonjs: '@js-joda/timzezone',
|
|
47
|
-
commonjs2: '@js-joda/timezone',
|
|
48
|
-
root: 'JSJodaTimezone',
|
|
49
|
-
},
|
|
50
|
-
'cldr-data': {
|
|
51
|
-
amd: 'cldr-data',
|
|
52
|
-
commonjs: 'cldr-data',
|
|
53
|
-
commonjs2: 'cldr-data',
|
|
54
|
-
root: 'cldrData',
|
|
55
|
-
},
|
|
56
|
-
'cldrjs': {
|
|
57
|
-
amd: 'cldrjs',
|
|
58
|
-
commonjs: 'cldrjs',
|
|
59
|
-
commonjs2: 'cldrjs',
|
|
60
|
-
root: 'Cldr',
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
module: {
|
|
64
|
-
rules: [
|
|
65
|
-
{
|
|
66
|
-
use: [{ loader: 'babel-loader' }],
|
|
67
|
-
resource: {
|
|
68
|
-
include: [
|
|
69
|
-
path.resolve(__dirname, 'src'),
|
|
70
|
-
path.resolve(__dirname, 'test'),
|
|
71
|
-
],
|
|
72
|
-
test: /.js$/,
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
],
|
|
76
|
-
},
|
|
77
|
-
plugins: [
|
|
78
|
-
new webpack.BannerPlugin({ banner, raw: true }),
|
|
79
|
-
],
|
|
80
|
-
performance: {
|
|
81
|
-
/* we know that we will be generating big packages with locale data, no reason to have webpack warn us */
|
|
82
|
-
maxEntrypointSize: 25000000,
|
|
83
|
-
maxAssetSize: 25000000,
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
return config;
|
|
87
|
-
};
|
|
88
|
-
module.exports = createConfig;
|