@travetto/pack 2.2.0 → 2.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/cli-pack.ts CHANGED
@@ -1,11 +1,10 @@
1
- import { BasePackPlugin } from './pack-base';
1
+ import { BaseOptions, BasePackCommand } from './pack-base';
2
2
  import { Pack, AllConfig } from './operation/pack';
3
3
 
4
- export class PackPlugin extends BasePackPlugin<AllConfig> {
4
+ export class PackCommand extends BasePackCommand<BaseOptions, AllConfig> {
5
5
  operation = Pack;
6
6
 
7
- // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
8
- getOptions() {
7
+ getOptions(): BaseOptions {
9
8
  return this.defaultOptions();
10
9
  }
11
10
  }
@@ -1,10 +1,17 @@
1
- import { BasePackPlugin } from './pack-base';
1
+ import { OptionConfig } from '@travetto/cli/src/command';
2
+
3
+ import { BaseOptions, BasePackCommand } from './pack-base';
2
4
  import { Assemble, AssembleConfig } from './operation/assemble';
3
5
 
4
- export class PackAssemblePlugin extends BasePackPlugin<AssembleConfig> {
6
+ type Options = BaseOptions & {
7
+ keepSource: OptionConfig<boolean>;
8
+ readonly: OptionConfig<boolean>;
9
+ };
10
+
11
+ export class PackAssembleCommand extends BasePackCommand<Options, AssembleConfig> {
5
12
  operation = Assemble;
6
- // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
7
- getOptions() {
13
+
14
+ getOptions(): Options {
8
15
  return {
9
16
  ...this.defaultOptions(),
10
17
  keepSource: this.boolOption({ desc: 'Should source be preserved' }),
@@ -1,14 +1,21 @@
1
1
  import * as fs from 'fs/promises';
2
2
 
3
3
  import { FsUtil, PathUtil } from '@travetto/boot';
4
- import { BasePlugin } from '@travetto/cli/src/plugin-base';
4
+ import { CliCommand, OptionConfig, ListOptionConfig } from '@travetto/cli/src/command';
5
5
 
6
- export class PackDockerExportPlugin extends BasePlugin {
6
+ type Options = {
7
+ app: OptionConfig<string>;
8
+ image: OptionConfig<string>;
9
+ port: OptionConfig<number>;
10
+ add: ListOptionConfig<string>;
11
+ output: OptionConfig<string>;
12
+ };
13
+
14
+ export class PackDockerExportCommand extends CliCommand<Options> {
7
15
 
8
16
  name = 'pack:docker-export';
9
17
 
10
- // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
11
- getOptions() {
18
+ getOptions(): Options {
12
19
  return {
13
20
  app: this.option({ desc: 'The application target to run', def: 'rest' }),
14
21
  image: this.option({ desc: 'Docker image to extend', def: 'node:16-alpine' }),
@@ -1,11 +1,21 @@
1
- import { BasePackPlugin } from './pack-base';
1
+ import { OptionConfig, ListOptionConfig } from '@travetto/cli/src/command';
2
+
3
+ import { BaseOptions, BasePackCommand } from './pack-base';
2
4
  import { Docker, DockerConfig } from './operation/docker';
3
5
 
4
- export class PackDockerPlugin extends BasePackPlugin<DockerConfig> {
6
+ type Options = BaseOptions & {
7
+ image: OptionConfig<string>;
8
+ name: OptionConfig<string>;
9
+ tag: ListOptionConfig<string>;
10
+ port: ListOptionConfig<string>;
11
+ push: OptionConfig<boolean>;
12
+ registry: OptionConfig<string>;
13
+ };
14
+
15
+ export class PackDockerCommand extends BasePackCommand<Options, DockerConfig> {
5
16
  operation = Docker;
6
17
 
7
- // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
8
- getOptions() {
18
+ getOptions(): Options {
9
19
  return {
10
20
  ...this.defaultOptions(),
11
21
  image: this.option({ desc: 'Docker Image to extend' }),
@@ -1,11 +1,16 @@
1
- import { BasePackPlugin } from './pack-base';
1
+ import { OptionConfig } from '@travetto/cli/src/command';
2
+
3
+ import { BaseOptions, BasePackCommand } from './pack-base';
2
4
  import { Zip, ZipConfig } from './operation/zip';
3
5
 
4
- export class PackZipPlugin extends BasePackPlugin<ZipConfig> {
6
+ type Options = BaseOptions & {
7
+ output: OptionConfig<string>;
8
+ };
9
+
10
+ export class PackZipCommand extends BasePackCommand<Options, ZipConfig> {
5
11
  operation = Zip;
6
12
 
7
- // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
8
- getOptions() {
13
+ getOptions(): Options {
9
14
  return {
10
15
  ...this.defaultOptions(),
11
16
  output: this.option({ desc: 'Output File' })
package/bin/pack-base.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as os from 'os';
2
2
 
3
- import { BasePlugin } from '@travetto/cli/src/plugin-base';
3
+ import { CliCommand, OptionConfig } from '@travetto/cli/src/command';
4
4
  import { color } from '@travetto/cli/src/color';
5
5
  import { PathUtil, Package, FsUtil } from '@travetto/boot';
6
6
 
@@ -12,10 +12,14 @@ const packName = `pack_${Package.name}`
12
12
  .replace(/[^a-z]+/g, '_')
13
13
  .replace(/_+/g, '_');
14
14
 
15
+ export type BaseOptions = {
16
+ workspace: OptionConfig<string>;
17
+ };
18
+
15
19
  /**
16
20
  * Supports packing a project into a directory, ready for archiving
17
21
  */
18
- export abstract class BasePackPlugin<C extends CommonConfig> extends BasePlugin {
22
+ export abstract class BasePackCommand<V extends BaseOptions, C extends CommonConfig> extends CliCommand<V> {
19
23
 
20
24
  /**
21
25
  * Package stage name
@@ -26,8 +30,7 @@ export abstract class BasePackPlugin<C extends CommonConfig> extends BasePlugin
26
30
  return this.operation.key ? `pack:${this.operation.key}` : 'pack';
27
31
  }
28
32
 
29
- // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
30
- defaultOptions() {
33
+ defaultOptions(): BaseOptions {
31
34
  return { workspace: this.option({ desc: 'Working directory' }) } as const;
32
35
  }
33
36
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@travetto/pack",
3
3
  "displayName": "Pack",
4
- "version": "2.2.0",
4
+ "version": "2.2.3",
5
5
  "description": "Code packing utilities",
6
6
  "keywords": [
7
7
  "travetto",
@@ -25,12 +25,12 @@
25
25
  "directory": "module/pack"
26
26
  },
27
27
  "dependencies": {
28
- "@travetto/base": "^2.2.0",
28
+ "@travetto/base": "^2.2.3",
29
29
  "@types/picomatch": "^2.3.0",
30
30
  "picomatch": "^2.3.1"
31
31
  },
32
32
  "optionalPeerDependencies": {
33
- "@travetto/cli": "^2.2.0"
33
+ "@travetto/cli": "^2.2.3"
34
34
  },
35
35
  "docDependencies": {
36
36
  "@travetto/rest": true