-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(Package): convert to strict ESM #1215
Draft
pladaria
wants to merge
27
commits into
master
Choose a base branch
from
pladaria/WEB-2001_distribute-as-esm-package
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 26 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
f8baf64
WEB-2001 define package as esm
f767a97
Merge remote-tracking branch 'origin/master' into pladaria/WEB-2001_d…
9731180
WEB-2001 update configuration
062ea47
WEB-2001 update configuration
1f34412
WEB-2001 ignore external packages
8021a0b
WEB-2001 update build config
648f639
WEB-2001 fix size-stats
495b636
WEB-2001 fix size-stats
e5496ac
WEB-2001 update browserlist
f7c5656
WEB-2001 fix size-stats
cd65685
WEB-2001 fix size-stats
eba61c9
WEB-2001 export all icons from index
c9808b5
WEB-2001 remove export
68105ca
WEB-2001 fix export
1a7df2e
Merge remote-tracking branch 'origin/master' into pladaria/WEB-2001_d…
442b387
WEB-2001 workflows to cjs
2e8a58a
WEB-2001 use cjs in generate-design-tokens
2454559
WEB-2001 use cjs
e9145d1
WEB-2001 fix lint
264ad6e
WEB-2001 fix build
997eb65
WEB-2001 ignore import errors in SSR test pages
ad089b4
WEB-2001 calculate size-stats
17cf71f
WEB-2001 fix moment locales import
6e31b8c
WEB-2001 move to cjs scripts
a001a16
WEB-2001 fix acceptance config
d5bcca5
WEB-2001 fix pptr config path
3930366
WEB-2001 fix icons tests
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.github/actions/size-stats/main.js → .github/actions/size-stats/main.cjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...actions/upload-failed-screenshots/main.js → ...ctions/upload-failed-screenshots/main.cjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"env": { | ||
"coreJs": 3.27, | ||
"coreJs": "3.27", | ||
"targets": { | ||
"chrome": "51", | ||
"firefox": "78", | ||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-111 KB
.yarn/cache/@vanilla-extract-css-npm-1.15.2-d94352a08f-acb08a943d.zip
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+7 KB
...namic-npm-2.1.1-8707677ad4-03fd6bcd47.zip → ...namic-npm-2.1.2-16ce9f4c98-ec6ec9b02c.zip
Binary file not shown.
Binary file removed
BIN
-19.3 KB
.yarn/cache/@vanilla-extract-integration-npm-6.5.0-f9483072b2-69778fb897.zip
Binary file not shown.
Binary file removed
BIN
-19.8 KB
.yarn/cache/@vanilla-extract-integration-npm-7.1.5-492d48ba08-14c85f3c7f.zip
Binary file not shown.
Binary file added
BIN
+20.1 KB
.yarn/cache/@vanilla-extract-integration-npm-7.1.9-af4380f865-6f6b1eab9f.zip
Binary file not shown.
Binary file renamed
BIN
+7.53 KB
...sform-npm-1.1.5-208eb5e29f-c5df992673.zip → ...sform-npm-1.1.9-cc22888b38-6a5243671e.zip
Binary file not shown.
Binary file renamed
BIN
+7.07 KB
...ivate-npm-1.0.5-710d3387e4-147acf9b17.zip → ...ivate-npm-1.0.6-6569b02004-2265b02af2.zip
Binary file not shown.
Binary file renamed
BIN
+30.2 KB
...nkles-npm-1.6.2-4388d874dd-e062992dd2.zip → ...nkles-npm-1.6.3-8553c69abf-7eb4fe0f1a.zip
Binary file not shown.
Binary file removed
BIN
-13.2 KB
.yarn/cache/@vanilla-extract-vite-plugin-npm-3.9.5-f670f606eb-4ef573feb5.zip
Binary file not shown.
Binary file added
BIN
+13.2 KB
.yarn/cache/@vanilla-extract-vite-plugin-npm-4.0.15-76da4d6053-b99f1bb339.zip
Binary file not shown.
Binary file renamed
BIN
+34.6 KB
...lugin-npm-2.3.9-d23f0bd23c-0f5775f086.zip → ...ugin-npm-2.3.13-0559e53145-939b864f25.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-8.98 KB
.yarn/cache/postcss-load-config-npm-4.0.2-319bcff9ca-7c27dd3801.zip
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
const config = require('@telefonica/acceptance-testing/jest-puppeteer.config'); | ||
const config = require('@telefonica/acceptance-testing/jest-puppeteer.config.js'); | ||
module.exports = config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module.exports = { | ||
...require('./jest.base.config.cjs'), | ||
projects: [ | ||
'<rootDir>/jest.unit.config.cjs', | ||
'<rootDir>/jest.ssr.config.cjs', | ||
'<rootDir>/jest.acceptance.config.cjs', | ||
], | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"env": { | ||
"es6": true | ||
} | ||
} | ||
Comment on lines
+1
to
+5
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should update our jest configuration to understand |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"env": { | ||
"es6": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,10 +3,11 @@ const mkdirp = require('mkdirp'); | |
const rimraf = require('rimraf'); | ||
const {join, basename} = require('path'); | ||
const {execSync} = require('child_process'); | ||
// @ts-ignore | ||
const svgr = require('@svgr/core').default; | ||
const prettier = require('prettier'); | ||
const {camelCase, kebabCase, upperFirst, uniq} = require('lodash'); | ||
const {yellow, green} = require('colors/safe'); | ||
const {yellow, green} = require('colors/safe.js'); | ||
const glob = require('glob'); | ||
|
||
const pascalCase = (s) => upperFirst(camelCase(s)); | ||
|
@@ -15,7 +16,7 @@ const PATH_REPO_ROOT = join(__dirname, '..', '..'); | |
const PATH_CACHE = join(__dirname, 'node_modules', '.cache'); | ||
const PATH_MISTICA_ICONS_REPO = join(PATH_CACHE, 'mistica-icons'); | ||
const PATH_OUTPUT = join(PATH_REPO_ROOT, 'src', 'generated/mistica-icons'); | ||
const PATH_OUTPUT_INDEX_FILENAME = join(PATH_OUTPUT, 'index.tsx.txt'); | ||
const PATH_OUTPUT_INDEX_FILENAME = join(PATH_OUTPUT, 'index.tsx'); | ||
const GIT_MISTICA_ICONS_BRANCH = 'production'; | ||
const GIT_MISTICA_ICONS = '[email protected]:Telefonica/mistica-icons.git'; | ||
|
||
|
@@ -221,9 +222,9 @@ const createAllIconKeywordsSource = () => { | |
* To update, execute "yarn start" inside "import-mistica-icons" | ||
*/ | ||
|
||
const iconKeywords: {[key: string]: Array<string>} = ${JSON.stringify(result)}; | ||
const keywords: {[key: string]: Array<string>} = ${JSON.stringify(result)}; | ||
|
||
export default iconKeywords; | ||
export default keywords; | ||
`; | ||
|
||
return format(source); | ||
|
@@ -252,22 +253,18 @@ const main = async () => { | |
|
||
const index = components | ||
.sort((a, b) => (a[0].toLowerCase() > b[0].toLowerCase() ? 1 : -1)) | ||
.map( | ||
([componentName, importName]) => | ||
`export {default as ${componentName}} from './generated/mistica-icons/${importName}';` | ||
) | ||
.map(([componentName, importName]) => `export {default as ${componentName}} from './${importName}';`) | ||
.join('\n'); | ||
|
||
fs.writeFileSync(PATH_OUTPUT_INDEX_FILENAME, index, 'utf8'); | ||
|
||
console.log(); | ||
console.log('Generating keywords for each icon.'); | ||
const keywordsSource = await createAllIconKeywordsSource(); | ||
fs.writeFileSync(join(PATH_OUTPUT, 'icons-keywords.tsx'), keywordsSource); | ||
fs.writeFileSync(join(PATH_OUTPUT, 'keywords.tsx'), keywordsSource); | ||
|
||
console.log(); | ||
console.log(`Done! (${allIconNames.length} components).`); | ||
console.log(`Copy exports in `, yellow(PATH_OUTPUT_INDEX_FILENAME), ' to src/index.tsx'); | ||
console.log(); | ||
}; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
JEST_PUPPETEER_CONFIG
env var tellsjest-environment-puppeteer
where to find thepuppeteer
config.This is needed because we're using an old version of the
jest-environment-puppeteer
library (v6) and it is unaware of.cjs
files. Newer versions don't have this issue but we cannot upgrade because this requires apuppeteer
upgrade.