Skip to content

Commit

Permalink
[labs/cli] Lazily install and locally version localize (#2936)
Browse files Browse the repository at this point in the history
* [cli] Lazily install and locally version localize

Also merge the two localize commands into one

They have just about the same deps and share some setup and teardown code, there's no win in putting them in separate modules.

* Use better assertions of no errors.

This should print out the stderr output in the case there was some.

* Fix error output

The .finally fork of the Promise.race result promise was causing an early exit from node before the ordinary uvu error handling could kick in.

* Fix failing test

It was passing locally because the cwd was set to the CLI directory, but we want to run in a fake workspace directory.

* Add an installation message when running npm install.

* Changeset

* Use try/finally instead of promise methods

* Move localize command into its own package.
  • Loading branch information
rictic committed Sep 29, 2022
1 parent b225bd3 commit 7a9fc0f
Show file tree
Hide file tree
Showing 21 changed files with 975 additions and 134 deletions.
6 changes: 6 additions & 0 deletions .changeset/clean-parents-doubt.md
@@ -0,0 +1,6 @@
---
'@lit-labs/cli': minor
'@lit/localize-tools': minor
---

Locally version and lazily install the localize command.
3 changes: 3 additions & 0 deletions .eslintignore
Expand Up @@ -159,6 +159,9 @@ packages/labs/cli/index.d.ts
packages/labs/cli/index.d.ts.map
packages/labs/cli/test-gen/

packages/labs/cli-localize/lib/
packages/labs/cli-localize/node_modules/

packages/labs/context/development/
packages/labs/context/test/
packages/labs/context/node_modules/
Expand Down
3 changes: 3 additions & 0 deletions .prettierignore
Expand Up @@ -145,6 +145,9 @@ packages/labs/cli/index.d.ts
packages/labs/cli/index.d.ts.map
packages/labs/cli/test-gen/

packages/labs/cli-localize/lib/
packages/labs/cli-localize/node_modules/

packages/labs/context/development/
packages/labs/context/test/
packages/labs/context/node_modules/
Expand Down
45 changes: 45 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/labs/cli-localize/.gitignore
@@ -0,0 +1,2 @@
/lib/
/node_modules/
3 changes: 3 additions & 0 deletions packages/labs/cli-localize/CHANGELOG.md
@@ -0,0 +1,3 @@
# @lit-labs/cli

## 0.0.1
7 changes: 7 additions & 0 deletions packages/labs/cli-localize/README.md
@@ -0,0 +1,7 @@
# @lit-labs/cli-localize

Powers the `lit localize` command.

Don't use this directly, but install `@lit-labs/cli` and run `lit localize` from it.

That command will load this package from the nearest node_modules directory, or offer to install it if it's not found.

0 comments on commit 7a9fc0f

Please sign in to comment.