Skip to content
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

[ENG-4579][scripts] convert to ESM #1192

Merged
merged 11 commits into from
Jul 4, 2022
Merged

[ENG-4579][scripts] convert to ESM #1192

merged 11 commits into from
Jul 4, 2022

Conversation

dsokal
Copy link
Contributor

@dsokal dsokal commented Jul 1, 2022

Checklist

  • I've added an entry to CHANGELOG.md if necessary. You can comment this pull request with /changelog-entry [breaking-change|new-feature|bug-fix|chore] [message] and CHANGELOG.md will be updated automatically.

Why

The first part of the effort to convert EAS CLI to ESM.
This PR converts the scripts package to ESM.

How

Mostly based on https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c

  • 7bad1e4 upgrades typescript to the latest.
  • 1b3853a updates imports so they have extensions - .js.
  • 6bdf657 configures scripts as ESM.
  • d03cb05 + b988235 ESM-compatibility fixes.
  • a970332 makes scripts work only with node >=14.16.
  • 7bace80 adds node: protocol to standard lib imports.
  • a2b5b86 adds scripts/build to .gitignore.
  • 0a22bd9 adds typecheck script so we can have some tests in CI.
  • 40aab0d adds new GH workflow for testing scripts.

Test Plan

  • Added new GH workflow.
  • I manually ran all scripts from scripts to verify they work fine.

@dsokal dsokal changed the title @dsokal/convert to esm [scripts] convert to ESM Jul 1, 2022
@dsokal dsokal changed the title [scripts] convert to ESM [ENG-4579][scripts] convert to ESM Jul 1, 2022
@linear
Copy link

linear bot commented Jul 1, 2022

ENG-4579 Convert eas-cli to esm

Screenshot 2022-04-07 at 15.26.32.png

We can't convert a bunch of deps in eas-cli because it's not an ESM. It seems that it should be possible to convert eas-cli now

oclif/core#130

https://github.com/typhonjs-oclif-scratch/test-cli-modern/tree/main/src

@github-actions
Copy link

github-actions bot commented Jul 1, 2022

Size Change: +669 B (0%)

Total Size: 25.1 MB

Filename Size Change
./packages/eas-cli/dist/eas-linux-x64.tar.gz 25.1 MB +669 B (0%)

compressed-size-action

@codecov
Copy link

codecov bot commented Jul 1, 2022

Codecov Report

Merging #1192 (40aab0d) into main (d0b9af2) will increase coverage by 0.11%.
The diff coverage is n/a.

❗ Current head 40aab0d differs from pull request most recent head 5330cf7. Consider uploading reports for the commit 5330cf7 to get more accurate results

@@            Coverage Diff             @@
##             main    #1192      +/-   ##
==========================================
+ Coverage   51.33%   51.43%   +0.11%     
==========================================
  Files         373      373              
  Lines       13329    13358      +29     
  Branches     2739     2752      +13     
==========================================
+ Hits         6841     6870      +29     
  Misses       5974     5974              
  Partials      514      514              
Impacted Files Coverage Δ
...ckages/eas-cli/src/metadata/apple/config/writer.ts 100.00% <0.00%> (ø)
...etadata/apple/config/__tests__/fixtures/appInfo.ts 100.00% <0.00%> (ø)
...ckages/eas-cli/src/metadata/apple/config/reader.ts 82.90% <0.00%> (+3.87%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0534328...5330cf7. Read the comment docs.

@dsokal dsokal marked this pull request as ready for review July 4, 2022 09:04
@dsokal dsokal requested a review from wkozyra95 as a code owner July 4, 2022 09:04
import { readAndParseChangelogAsync, writeChangelogAsync } from './changelog/file.js';
import * as markdown from './markdown.js';

const nullthrows = nullthrowsModule.default;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if w need a workaround like this for such a simple package I would prefer to remove it entirely and just add and utll with the same name

@@ -1,6 +1,6 @@
// this is mostly copy-pasted from https://github.com/expo/expo/blob/master/tools/src/Markdown.ts

import { unescape } from 'lodash';
import _ from 'lodash';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import _ from 'lodash';
import unescape from 'lodash/unescape';

is this not supported with esm?

@dsokal dsokal requested a review from wkozyra95 July 4, 2022 09:44
@dsokal dsokal merged commit 04a8b08 into main Jul 4, 2022
@dsokal dsokal deleted the @dsokal/convert-to-esm branch July 4, 2022 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants