-
Notifications
You must be signed in to change notification settings - Fork 17
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(config-cli): New config-cli package includes dump basemaps screenshots command line tool #2231
Conversation
import 'source-map-support/register.js'; | ||
import { CommandScreenShot } from './screenshot.js'; | ||
|
||
export class ScreenshotCommandLine extends BaseCommandLine { |
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.
lets call this BasemapsConfig
as we will add more sub tools to it like the config import
bmc
as the script name? or basemaps-config
?
import { Browser, chromium } from 'playwright'; | ||
import { CommandLineAction, CommandLineFlagParameter, CommandLineStringParameter } from '@rushstack/ts-command-line'; | ||
|
||
const TileTest = [ |
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.
after this pull request it would be great to store these as a JSON file.
await page.waitForTimeout(1000); | ||
await page.waitForLoadState('networkidle'); | ||
} else { | ||
throw new Error('Not supported on production yet'); |
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.
this is now in production we can take this logic out.
packages/config-cli/bmc.js
Outdated
@@ -0,0 +1,3 @@ | |||
#!/usr/bin/env node |
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.
this file should be referenced by the bin field in the package.json, it also wont be published.
Its best to put this into ./bin/bmc.mjs
(being specific is super helpful for these)
then add bin/
to the files exported and add a bin
section to map it to basemaps-screenshot
?
export class BasemapsConfig extends BaseCommandLine { | ||
constructor() { | ||
super({ | ||
toolFilename: 'screenshot', |
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.
this should the same name as the bin file
lng: number; | ||
z: number; | ||
} | ||
interface TileTest { |
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.
can we use zod to parse these?
defaultValue: './test-tiles/default.test.tiles.json', | ||
}); | ||
|
||
this.verbose = this.defineFlagParameter({ |
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.
verbose is handled by being a part of BaseCommandLine
./bmc --verbose screenshot
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.
All fixed. Can you give another look?
const host = this.host.value ?? this.host.defaultValue; | ||
const tag = this.tag.value ?? this.tag.defaultValue; | ||
const tiles = this.tiles.value ?? this.tiles.defaultValue; | ||
if (host == null || tag == null || tiles == null) |
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.
can this ever happen?
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.
I don't think so. But we need a checking in typescript to parse them as string
instead of string | undefiened
This pull request introduces 1 alert when merging a6e3544 into e7b6a9e - view on LGTM.com new alerts:
|
Dump the screenshots from basemaps production | ||
|
||
```bash | ||
./bin/bmc.js screenshot |
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.
NIT: if its described as bin : { "bmc": ... }
the actual command will be bmc
once you npm install it
packages/config-cli/README.md
Outdated
Dump the screenshots from different host and tag | ||
|
||
```bash | ||
.bin//bmc.js screenshot --host HOST --tag PR-TAG |
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.
NIT: //
packages/config-cli/package.json
Outdated
"access": "public" | ||
}, | ||
"files": [ | ||
"build/" |
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.
missing bin/
export class BasemapsConfig extends BaseCommandLine { | ||
constructor() { | ||
super({ | ||
toolFilename: 'bin', |
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.
bmc
@@ -0,0 +1,16 @@ | |||
#!/usr/bin/env node |
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.
this file should never be executed directly.
} | ||
} | ||
|
||
new BasemapsConfig().run(); |
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.
I would move this .run()
part into the bin file. that way this file could in theory be imported
import { z } from 'zod'; | ||
|
||
enum TileMatrixIdentifier { | ||
NZTM = 'NZTM2000Quad', |
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.
Do we not have this as a enum somewhere else?
We should be specific here Nztm2000Quad
so we know we are talking about nztm2000quad tms and not the other one.
No description provided.