Skip to content

Commit

Permalink
it's helpful to write working code
Browse files Browse the repository at this point in the history
  • Loading branch information
chandlerprall committed Jul 1, 2021
1 parent 967f542 commit 41504ee
Showing 1 changed file with 25 additions and 6 deletions.
31 changes: 25 additions & 6 deletions scripts/dtsgenerator.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you 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.
*/

const findup = require('findup');
const resolve = require('resolve');
const fs = require('fs');
Expand Down Expand Up @@ -154,15 +173,15 @@ generator.then(() => {
function buildEuiTokensObject() {
// reduce over the tokens list as a few of the tokens are used multiple times and must be
// filtered down to a list
const i18ndefs = require('../i18ntokens.json').reduce(
({ definitions, tokens }, def) => {
if (tokens.has(def.token)) {
const { i18ndefs } = require('../i18ntokens.json').reduce(
({ i18ndefs, tokens }, def) => {
if (!tokens.has(def.token)) {
tokens.add(def.token);
definitions.push(def);
i18ndefs.push(def);
}
return definitions;
return { i18ndefs, tokens };
},
{ definitions: [], tokens: new Set() }
{ i18ndefs: [], tokens: new Set() }
);
return `
declare module '@elastic/eui' {
Expand Down

0 comments on commit 41504ee

Please sign in to comment.