Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/default_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ jobs:
run: >
pnpx nx run-many
-t lint,test
--configuration ci
--exclude
devextreme
devextreme-themebuilder
Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/demos_visual_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ on:
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_TOKEN }}
NX_SKIP_NX_CACHE: ${{ (github.event_name != 'pull_request' || contains( github.event.pull_request.labels.*.name, 'skip-cache')) && 'true' || 'false' }}
BUILD_TEST_INTERNAL_PACKAGE: true
RUN_TESTS: true

jobs:
Expand Down Expand Up @@ -145,13 +144,11 @@ jobs:
shell: bash
run: |
pnpx nx build devextreme-scss
pnpx nx build devextreme
pnpx nx build devextreme -c testing

- name: DevExtreme - Build-all
if: needs.determine-framework-tests-scope.outputs.framework-tests-scope != 'none'
env:
BUILD_TEST_INTERNAL_PACKAGE: true
run: pnpm run all:build-dev
run: pnpm nx all:build-testing workflows

- name: Zip artifacts (for jQuery tests)
working-directory: ./packages/devextreme
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/publish-demos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ jobs:
pnpm install --frozen-lockfile

- name: DevExtreme - Build-all
env:
BUILD_TEST_INTERNAL_PACKAGE: true
run: pnpm run all:build-dev
run: pnpm nx all:build-testing workflows

- name: Move packages
run: |
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/testcafe_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ on:
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_TOKEN }}
NX_SKIP_NX_CACHE: ${{ (github.event_name != 'pull_request' || contains( github.event.pull_request.labels.*.name, 'skip-cache')) && 'true' || 'false' }}
BUILD_TEST_INTERNAL_PACKAGE: true
RUN_TESTS: true

jobs:
Expand Down Expand Up @@ -72,7 +71,7 @@ jobs:
NODE_OPTIONS: --max-old-space-size=8192
run: |
pnpx nx build devextreme-scss
pnpx nx build devextreme
pnpx nx build devextreme -c testing

- name: Zip artifacts
working-directory: ./packages/devextreme
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/wrapper_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ on:
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_TOKEN }}
NX_SKIP_NX_CACHE: ${{ (github.event_name != 'pull_request' || contains( github.event.pull_request.labels.*.name, 'skip-cache')) && 'true' || 'false' }}
BUILD_TEST_INTERNAL_PACKAGE: true

jobs:
build:
Expand Down Expand Up @@ -49,10 +48,7 @@ jobs:
run: pnpm install --frozen-lockfile

- name: Build devextreme package
env:
BUILD_TEST_INTERNAL_PACKAGE: true
working-directory: ./packages/devextreme
run: pnpx nx build
run: pnpx nx build devextreme -c testing

check-regenerate:
runs-on: devextreme-shr2
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/wrapper_tests_e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ on:
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_TOKEN }}
NX_SKIP_NX_CACHE: ${{ (github.event_name != 'pull_request' || contains( github.event.pull_request.labels.*.name, 'skip-cache')) && 'true' || 'false' }}
BUILD_TEST_INTERNAL_PACKAGE: true

jobs:
build-packages:
Expand Down Expand Up @@ -55,9 +54,7 @@ jobs:
run: pnpm install --frozen-lockfile

- name: Build all DevExtreme packages
env:
BUILD_TEST_INTERNAL_PACKAGE: true
run: pnpm run all:build-dev
run: pnpm nx all:build-testing workflows

- name: Build wrappers apps
working-directory: e2e/wrappers
Expand Down
9 changes: 9 additions & 0 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@
"{projectRoot}/**/*.ts",
"{projectRoot}/tsconfig.json",
{ "externalDependencies": [ "devextreme-internal-tools", "ts-node", "typescript"] }
],
"devextreme-sources": [
"{projectRoot}/js/**/*",
"{projectRoot}/ts/**/*"
],
"devextreme-build-config": [
"{projectRoot}/build/**/*",
"{projectRoot}/webpack.config.js",
"{projectRoot}/gulpfile.js"
]
},
"targetDefaults": {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"prepare": "husky install",
"all:update-version": "ts-node tools/scripts/update-version.ts",
"all:build": "ts-node tools/scripts/build-all.ts",
"all:build-dev": "pnpm run all:build --dev",
"all:build-dev": "nx all:build-dev workflows",
"all:pack-and-copy": "nx run-many -t pack-and-copy",
"demos:prepare": "nx run devextreme-demos:prepare-js",
"demos:start": "http-server ./apps/demos --port 8080 -c-1"
Expand Down
19 changes: 16 additions & 3 deletions packages/devextreme-angular/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,13 @@
},
"build": {
"executor": "nx:run-commands",
"dependsOn": ["^build"],
"dependsOn": [
{
"dependencies": true,
"target": "build",
"params": "forward"
}
],
"options": {
"commands": [
"pnpm --workspace-root nx clean:dist devextreme-angular",
Expand All @@ -182,7 +188,14 @@
"{projectRoot}/npm/dist"
],
"cache": true,
"inputs": ["default"]
"inputs": ["default"],
"configurations": {
"testing": {
"env": {
"BUILD_TEST_INTERNAL_PACKAGE": "true"
}
}
}
},
"pack": {
"executor": "nx:run-commands",
Expand Down Expand Up @@ -289,7 +302,7 @@
"executor": "nx:run-commands",
"options": {
"commands": [
"pnpm --workspace-root nx build devextreme-angular",
"pnpm --workspace-root nx build devextreme-angular -c testing",
"pnpm --workspace-root nx build:tests devextreme-angular",
"pnpm --workspace-root nx test:all devextreme-angular"
],
Expand Down
181 changes: 2 additions & 179 deletions packages/devextreme/build/gulp/localization.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,116 +2,14 @@

const gulp = require('gulp');
const path = require('path');
const rename = require('gulp-rename');
const del = require('del');
const template = require('gulp-template');
const lint = require('gulp-eslint-new');
const shell = require('gulp-shell');
const through = require('through2');
const fs = require('fs');

const headerPipes = require('./header-pipes.js');
const compressionPipes = require('./compression-pipes.js');
const context = require('./context.js');

const Cldr = require('cldrjs');
const locales = require('cldr-core/availableLocales.json').availableLocales.full;
const weekData = require('cldr-core/supplemental/weekData.json');
const likelySubtags = require('cldr-core/supplemental/likelySubtags.json');
const parentLocales = require('cldr-core/supplemental/parentLocales.json').supplemental.parentLocales.parentLocale;

const globalizeEnCldr = require('devextreme-cldr-data/en.json');
const globalizeSupplementalCldr = require('devextreme-cldr-data/supplemental.json');

const PARENT_LOCALE_SEPARATOR = '-';
const DEFAULT_LOCALE = 'en';

const getParentLocale = (parentLocales, locale) => {
const parentLocale = parentLocales[locale];

if(parentLocale) {
return parentLocale !== 'root' && parentLocale;
}

return locale.substr(0, locale.lastIndexOf(PARENT_LOCALE_SEPARATOR));
};

const firstDayOfWeekData = function() {
const DAY_INDEXES = {
'sun': 0,
'mon': 1,
'tue': 2,
'wed': 3,
'thu': 4,
'fri': 5,
'sat': 6
};
const DEFAULT_DAY_OF_WEEK_INDEX = 0;

const result = {};

Cldr.load(weekData, likelySubtags);

const getFirstIndex = (locale) => {
const firstDay = new Cldr(locale).supplemental.weekData.firstDay();
return DAY_INDEXES[firstDay];
};

locales.forEach(function(locale) {
const firstDayIndex = getFirstIndex(locale);

const parentLocale = getParentLocale(parentLocales, locale);
if(firstDayIndex !== DEFAULT_DAY_OF_WEEK_INDEX && (!parentLocale || firstDayIndex !== getFirstIndex(parentLocale))) {
result[locale] = firstDayIndex;
}
});

return result;
};

const accountingFormats = function() {
const result = {};

locales.forEach(function(locale) {
const dataFilePath = `../../node_modules/cldr-numbers-full/main/${locale}/numbers.json`;

if(fs.existsSync(path.join(__dirname, dataFilePath))) {
const numbersData = require(dataFilePath);
result[locale] = numbersData.main[locale].numbers['currencyFormats-numberSystem-latn'].accounting;
}
});

return result;
};

const RESULT_PATH = path.join(context.RESULT_JS_PATH, 'localization');
const DICTIONARY_SOURCE_FOLDER = 'js/localization/messages';

const getLocales = function(directory) {
return fs.readdirSync(directory).map(file => {
return file.split('.')[0];
});
};

const serializeObject = function(obj, shift) {
const tab = ' ';
let result = JSON.stringify(obj, null, tab);

if(shift) {
result = result.replace(/(\n)/g, '$1' + tab);
}

return result;
};

const getMessages = function(directory, locale) {
const json = require(path.join('../../', directory, locale + '.json'));

return serializeObject(json, true);
};

gulp.task('clean-cldr-data', function() {
return del('js/__internal/core/localization/cldr-data/**', { force: true });
});
gulp.task('localization', shell.task('pnpm nx build:localization devextreme'));

gulp.task('generate-community-locales', () => {
const defaultFile = fs.readFileSync(path.join(DICTIONARY_SOURCE_FOLDER, DEFAULT_LOCALE + '.json')).toString();
Expand Down Expand Up @@ -150,78 +48,3 @@ gulp.task('generate-community-locales', () => {
}))
.pipe(gulp.dest(DICTIONARY_SOURCE_FOLDER));
});

gulp.task('localization-messages', gulp.parallel(getLocales(DICTIONARY_SOURCE_FOLDER).map(locale => Object.assign(
function() {
return gulp
.src('build/gulp/localization-template.jst')
.pipe(template({
json: getMessages(DICTIONARY_SOURCE_FOLDER, locale)
}))
.pipe(rename(['dx', 'messages', locale, 'js'].join('.')))
.pipe(compressionPipes.beautify())
.pipe(headerPipes.useStrict())
.pipe(headerPipes.bangLicense())
.pipe(gulp.dest(RESULT_PATH));
},
{ displayName: 'dx.messages.' + locale }
))));

gulp.task('localization-generated-sources', gulp.parallel([
{
data: require('../../js/localization/messages/en.json'),
filename: 'default_messages.ts',
exportName: 'defaultMessages',
destination: 'js/__internal/core/localization'
},
{
data: parentLocales,
filename: 'parent_locales.ts',
destination: 'js/__internal/core/localization/cldr-data'
},
{
data: firstDayOfWeekData(),
filename: 'first_day_of_week_data.ts',
destination: 'js/__internal/core/localization/cldr-data'
},
{
data: accountingFormats(),
filename: 'accounting_formats.ts',
destination: 'js/__internal/core/localization/cldr-data'

},
{
data: globalizeEnCldr,
exportName: 'enCldr',
filename: 'en.ts',
destination: 'js/__internal/core/localization/cldr-data'
},
{
data: globalizeSupplementalCldr,
exportName: 'supplementalCldr',
filename: 'supplemental.ts',
destination: 'js/__internal/core/localization/cldr-data'
}
].map((source) => Object.assign(
function() {
return gulp
.src('build/gulp/generated_js.jst')
.pipe(template({
exportName: source.exportName,
json: serializeObject(source.data)
}))
.pipe(lint({ fix: true }))
.pipe(lint.format())
.pipe(rename(source.filename))
.pipe(gulp.dest(source.destination));
},
{ displayName: source.filename }
))));

gulp.task('localization',
gulp.series(
'clean-cldr-data',
'localization-messages',
'localization-generated-sources'
)
);
1 change: 0 additions & 1 deletion packages/devextreme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@
"lint-dts": "eslint './js/**/*.d.ts'",
"lint-staged": "lint-staged",
"lint-texts": "node build/linters/validate-non-latin-symbols.js",
"build": "cross-env BUILD_ESM_PACKAGE=true gulp default",
"build:dev": "cross-env DEVEXTREME_TEST_CI=TRUE BUILD_ESM_PACKAGE=true gulp default",
"build:testcafe": "cross-env DEVEXTREME_TEST_CI=TRUE BUILD_ESM_PACKAGE=true BUILD_TESTCAFE=TRUE gulp default",
"build-npm-devextreme": "cross-env BUILD_ESM_PACKAGE=true gulp default",
Expand Down
Loading
Loading