@eik/cli 3.0.0-next.1 → 3.0.2

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.
Files changed (95) hide show
  1. package/CHANGELOG.md +156 -3
  2. package/classes/alias.js +43 -16
  3. package/classes/index.js +47 -23
  4. package/classes/integrity.js +27 -16
  5. package/classes/login.js +21 -7
  6. package/classes/meta.js +20 -12
  7. package/classes/ping.js +20 -9
  8. package/classes/publish/map.js +33 -10
  9. package/classes/publish/package/index.js +54 -17
  10. package/classes/publish/package/tasks/check-bundle-sizes.js +7 -11
  11. package/classes/publish/package/tasks/check-if-already-published.js +8 -11
  12. package/classes/publish/package/tasks/cleanup.js +7 -9
  13. package/classes/publish/package/tasks/create-temp-directory.js +5 -9
  14. package/classes/publish/package/tasks/create-zip-file.js +6 -11
  15. package/classes/publish/package/tasks/dry-run.js +4 -8
  16. package/classes/publish/package/tasks/save-metafile.js +5 -7
  17. package/classes/publish/package/tasks/task.js +3 -5
  18. package/classes/publish/package/tasks/upload-files.js +16 -17
  19. package/classes/publish/package/tasks/validate-input.js +4 -8
  20. package/classes/version.js +38 -21
  21. package/commands/alias.js +105 -0
  22. package/commands/index.js +27 -0
  23. package/commands/init.js +69 -52
  24. package/commands/integrity.js +15 -32
  25. package/commands/login.js +23 -35
  26. package/commands/map-alias.js +16 -26
  27. package/commands/map.js +90 -0
  28. package/commands/meta.js +12 -29
  29. package/commands/npm-alias.js +16 -26
  30. package/commands/package-alias.js +21 -28
  31. package/commands/ping.js +11 -21
  32. package/commands/publish.js +82 -138
  33. package/commands/version.js +16 -33
  34. package/formatters/alias.js +4 -8
  35. package/formatters/artifact.js +4 -8
  36. package/formatters/file.js +3 -10
  37. package/formatters/index.js +5 -5
  38. package/formatters/version.js +5 -12
  39. package/index.js +53 -12
  40. package/package.json +49 -52
  41. package/readme.md +16 -4
  42. package/types/classes/alias.d.ts +60 -0
  43. package/types/classes/index.d.ts +37 -0
  44. package/types/classes/integrity.d.ts +35 -0
  45. package/types/classes/login.d.ts +25 -0
  46. package/types/classes/meta.d.ts +28 -0
  47. package/types/classes/ping.d.ts +23 -0
  48. package/types/classes/publish/map.d.ts +51 -0
  49. package/types/classes/publish/package/index.d.ts +94 -0
  50. package/types/classes/publish/package/tasks/check-bundle-sizes.d.ts +4 -0
  51. package/types/classes/publish/package/tasks/check-if-already-published.d.ts +4 -0
  52. package/types/classes/publish/package/tasks/cleanup.d.ts +4 -0
  53. package/types/classes/publish/package/tasks/create-temp-directory.d.ts +4 -0
  54. package/types/classes/publish/package/tasks/create-zip-file.d.ts +4 -0
  55. package/types/classes/publish/package/tasks/dry-run.d.ts +7 -0
  56. package/types/classes/publish/package/tasks/save-metafile.d.ts +4 -0
  57. package/types/classes/publish/package/tasks/task.d.ts +8 -0
  58. package/types/classes/publish/package/tasks/upload-files.d.ts +4 -0
  59. package/types/classes/publish/package/tasks/validate-input.d.ts +4 -0
  60. package/types/classes/version.d.ts +43 -0
  61. package/types/utils/hash/compare.d.ts +2 -0
  62. package/types/utils/hash/file.d.ts +2 -0
  63. package/types/utils/hash/files.d.ts +2 -0
  64. package/types/utils/hash/index.d.ts +9 -0
  65. package/types/utils/http/index.d.ts +12 -0
  66. package/types/utils/http/integrity.d.ts +2 -0
  67. package/types/utils/http/latest-version.d.ts +2 -0
  68. package/types/utils/http/request.d.ts +33 -0
  69. package/types/utils/http/versions.d.ts +5 -0
  70. package/types/utils/index.d.ts +6 -0
  71. package/types/utils/json/index.d.ts +9 -0
  72. package/types/utils/json/read.d.ts +5 -0
  73. package/types/utils/json/write-eik.d.ts +5 -0
  74. package/types/utils/json/write.d.ts +5 -0
  75. package/types/utils/logger.d.ts +33 -0
  76. package/types/utils/type-slug.d.ts +2 -0
  77. package/types/utils/type-title.d.ts +2 -0
  78. package/utils/hash/compare.js +1 -3
  79. package/utils/hash/file.js +3 -5
  80. package/utils/hash/files.js +4 -6
  81. package/utils/hash/index.js +4 -4
  82. package/utils/http/index.js +6 -5
  83. package/utils/http/integrity.js +2 -5
  84. package/utils/http/latest-version.js +2 -5
  85. package/utils/http/request.js +25 -19
  86. package/utils/http/versions.js +2 -5
  87. package/utils/index.js +6 -4
  88. package/utils/json/index.js +4 -4
  89. package/utils/json/read.js +5 -7
  90. package/utils/json/write-eik.js +4 -6
  91. package/utils/json/write.js +4 -6
  92. package/utils/logger.js +2 -5
  93. package/utils/type-slug.js +1 -1
  94. package/utils/type-title.js +1 -1
  95. package/utils/get-cwd.js +0 -14
@@ -1,14 +1,7 @@
1
- /* eslint-disable no-restricted-properties */
2
- /* eslint-disable prefer-template */
3
- /* eslint-disable one-var */
4
- /* eslint-disable no-underscore-dangle */
5
-
6
- 'use strict';
7
-
8
- const { join } = require('path');
9
- const chalk = require('chalk');
10
- const formatDistance = require('date-fns/formatDistance');
11
- const File = require('./file');
1
+ import { join } from 'path';
2
+ import chalk from 'chalk';
3
+ import { formatDistance } from 'date-fns/formatDistance';
4
+ import File from './file.js';
12
5
 
13
6
  class Version {
14
7
  constructor({
@@ -65,4 +58,4 @@ class Version {
65
58
  }
66
59
  }
67
60
 
68
- module.exports = Version;
61
+ export default Version;
package/index.js CHANGED
@@ -1,14 +1,31 @@
1
1
  #!/usr/bin/env node
2
+ import chalk from 'chalk';
3
+ import yargs from 'yargs';
4
+ import { hideBin } from 'yargs/helpers';
5
+ import boxen from 'boxen';
6
+ import { join } from 'path';
7
+ import { readFileSync } from 'fs';
8
+ import { fileURLToPath } from 'url';
9
+ import { dirname } from 'path';
10
+ import { commands } from './commands/index.js';
2
11
 
3
- 'use strict';
12
+ const __filename = fileURLToPath(import.meta.url);
13
+ const __dirname = dirname(__filename);
4
14
 
5
- const chalk = require('chalk');
6
- const yargs = require('yargs');
7
- const boxen = require('boxen');
8
- const { join } = require('path');
9
- const { readFileSync } = require('fs');
15
+ const { version } = JSON.parse(
16
+ readFileSync(join(__dirname, './package.json'), { encoding: 'utf-8' }),
17
+ );
18
+
19
+ // short circuit and provide a -v and --version flag
20
+ if (
21
+ process.argv.includes('-v') ||
22
+ // last position only to avoid conflict with publish command
23
+ process.argv[process.argv.length - 1].includes('--version')
24
+ ) {
25
+ console.log(version);
26
+ process.exit(0);
27
+ }
10
28
 
11
- const { version } = JSON.parse(readFileSync(join(__dirname, './package.json')));
12
29
  const greeting = chalk.white.bold(`Eik CLI (v${version})`);
13
30
 
14
31
  const boxenOptions = {
@@ -18,26 +35,50 @@ const boxenOptions = {
18
35
  borderColor: 'green',
19
36
  backgroundColor: '#555555',
20
37
  };
38
+ // @ts-expect-error
21
39
  const msgBox = boxen(greeting, boxenOptions);
22
40
 
23
- // eslint-disable-next-line no-console
24
41
  console.log(msgBox);
25
42
 
26
- // eslint-disable-next-line no-unused-expressions
27
- yargs
43
+ yargs(hideBin(process.argv))
44
+ .options({
45
+ config: {
46
+ alias: 'c',
47
+ describe:
48
+ 'Provide an exact path to an eik.json or package.json file to use as config. Default is eik.json in the current working directory.',
49
+ },
50
+ cwd: {
51
+ describe: 'Alter the current working directory.',
52
+ default: process.cwd(),
53
+ },
54
+ debug: {
55
+ describe: 'Logs additional messages',
56
+ default: false,
57
+ type: 'boolean',
58
+ },
59
+ })
60
+ // @ts-expect-error
28
61
  .example('eik init')
62
+ // @ts-expect-error
29
63
  .example('eik login --server https://assets.myserver.com --key ######')
64
+ // @ts-expect-error
30
65
  .example('eik publish')
66
+ // @ts-expect-error
31
67
  .example('eik meta my-app --server https://assets.myserver.com')
32
68
  .example(
69
+ // @ts-expect-error
33
70
  'eik npm-alias lit-html 1.0.0 1 --server https://assets.myserver.com --token ######',
34
71
  )
35
72
  .example(
73
+ // @ts-expect-error
36
74
  'eik map my-map 1.0.0 ./import-map.json --server https://assets.myserver.com --token ######',
37
75
  )
76
+ // @ts-expect-error
38
77
  .example('eik map-alias my-map 1.0.0 1')
39
- .commandDir('commands')
78
+ // @ts-expect-error
79
+ .command(commands)
40
80
  .demandCommand()
41
81
  .wrap(150)
42
82
  .version(false)
43
- .help().argv;
83
+ .help()
84
+ .parse();
package/package.json CHANGED
@@ -1,8 +1,10 @@
1
1
  {
2
2
  "name": "@eik/cli",
3
- "version": "3.0.0-next.1",
4
- "description": "Cli tool for publishing assets",
3
+ "version": "3.0.2",
4
+ "description": "CLI tool for publishing assets to an Eik server",
5
5
  "main": "./classes/index.js",
6
+ "types": "./types/classes/index.d.ts",
7
+ "type": "module",
6
8
  "bin": {
7
9
  "eik": "index.js"
8
10
  },
@@ -14,69 +16,64 @@
14
16
  "commands",
15
17
  "classes",
16
18
  "utils",
17
- "formatters"
19
+ "formatters",
20
+ "types"
18
21
  ],
19
22
  "scripts": {
20
- "test": "HTTP_PORT=0 LOG_LEVEL=fatal tap --no-coverage-report --no-cov --timeout 0 --test-regex=.test.js --test-ignore=node_modules",
21
- "test:integration": "HTTP_PORT=0 LOG_LEVEL=fatal tap --no-coverage-report --no-cov --timeout 0 test/integration/**/*.test.js",
22
- "test:unit": "HTTP_PORT=0 LOG_LEVEL=fatal tap --no-coverage-report --no-cov --timeout 0 test/*.test.js",
23
- "test:tasks": "HTTP_PORT=0 LOG_LEVEL=fatal tap --no-coverage-report --no-cov --timeout 0 test/tasks/*.test.js",
24
- "test:ci": "npm run test:unit -- --jobs=1 && npm run test:tasks -- --jobs=1 && npm run test:integration -- --jobs=1",
25
- "lint:check": "eslint .",
23
+ "clean": "rimraf .tap node_modules types",
24
+ "test": "cross-env HTTP_PORT=0 LOG_LEVEL=fatal tap --timeout 0 --disable-coverage test/**/*.test.mjs",
25
+ "test:integration": "cross-env HTTP_PORT=0 LOG_LEVEL=fatal tap --timeout 0 --disable-coverage test/integration/**/*.test.mjs",
26
+ "test:unit": "cross-env HTTP_PORT=0 LOG_LEVEL=fatal tap --timeout 0 --disable-coverage test/*.test.mjs",
27
+ "test:tasks": "cross-env HTTP_PORT=0 LOG_LEVEL=fatal tap --timeout 0 --disable-coverage test/tasks/*.test.mjs",
28
+ "test:ci:integration": "npm run test:integration -- --jobs=1",
29
+ "test:ci:unit": "npm run test:unit -- --jobs=1",
30
+ "test:ci:tasks": "npm run test:tasks -- --jobs=1",
31
+ "test:ci": "run-s test:ci:*",
32
+ "lint": "eslint .",
26
33
  "lint:fix": "eslint --fix .",
27
34
  "format:check": "prettier -c .",
28
35
  "format:fix": "prettier -w .",
29
- "fix": "npm run lint:fix && npm run format:fix"
36
+ "fix": "run-s lint:fix format:fix",
37
+ "types": "run-s types:module types:test",
38
+ "types:module": "tsc",
39
+ "types:test": "tsc --project tsconfig.test.json"
30
40
  },
31
41
  "keywords": [],
32
42
  "author": "",
33
43
  "license": "MIT",
34
44
  "dependencies": {
35
- "@eik/common-config-loader": "^4.0.0-next.8",
36
- "@eik/common-schemas": "^4.0.0-next.8",
37
- "@eik/common-utils": "^4.0.0-next.8",
38
- "@eik/common-validators": "^4.0.0-next.8",
39
- "abslog": "2.4.0",
40
- "boxen": "5.1.2",
45
+ "@eik/common": "4.1.0",
46
+ "abslog": "2.4.4",
47
+ "boxen": "8.0.0",
41
48
  "bytes": "3.1.2",
42
- "chalk": "4.1.2",
43
- "copy": "0.3.2",
44
- "date-fns": "2.28.0",
49
+ "chalk": "5.3.0",
50
+ "date-fns": "3.6.0",
45
51
  "form-data": "4.0.0",
46
- "glob": "7.2.0",
47
- "gzip-size": "6.0.0",
48
- "make-dir": "3.1.0",
49
- "node-fetch": "2.6.7",
50
- "ora": "5.4.1",
51
- "pkg-dir": "6.0.1",
52
- "read-pkg-up": "9.0.0",
53
- "rimraf": "3.0.2",
54
- "semver": "7.3.5",
55
- "ssri": "8.0.1",
56
- "tar": "6.1.11",
57
- "temp-dir": "2.0.0",
58
- "yargs": "17.3.1",
59
- "yargs-parser": "21.0.0"
52
+ "gzip-size": "7.0.0",
53
+ "make-dir": "5.0.0",
54
+ "ora": "8.0.1",
55
+ "rimraf": "6.0.1",
56
+ "semver": "7.6.3",
57
+ "ssri": "10.0.6",
58
+ "tar": "7.4.3",
59
+ "yargs": "17.7.2",
60
+ "yargs-parser": "21.1.1"
60
61
  },
61
62
  "devDependencies": {
62
- "@eik/core": "1.2.28",
63
- "@eik/service": "1.2.98",
64
- "@semantic-release/changelog": "6.0.1",
65
- "@semantic-release/git": "10.0.1",
66
- "eslint": "8.8.0",
67
- "eslint-config-airbnb-base": "15.0.0",
68
- "eslint-config-prettier": "8.3.0",
69
- "eslint-plugin-import": "2.25.4",
70
- "eslint-plugin-prettier": "4.0.0",
71
- "fastify": "3.27.0",
72
- "fastify-cors": "6.0.2",
73
- "fs-extra": "10.0.0",
74
- "prettier": "2.5.1",
75
- "puppeteer": "13.1.2",
76
- "react": "17.0.2",
77
- "react-dom": "17.0.2",
78
- "semantic-release": "19.0.2",
79
- "semantic-release-slack-bot": "3.5.2",
80
- "tap": "15.1.6"
63
+ "@eik/eslint-config": "1.0.2",
64
+ "@eik/semantic-release-config": "1.0.0",
65
+ "@eik/service": "2.3.0",
66
+ "@eik/sink-memory": "1.1.1",
67
+ "@eik/typescript-config": "1.0.0",
68
+ "cross-env": "7.0.3",
69
+ "eslint": "9.8.0",
70
+ "fastify": "4.28.1",
71
+ "fs-extra": "11.2.0",
72
+ "npm-run-all": "4.1.5",
73
+ "prettier": "3.3.3",
74
+ "semantic-release": "24.0.0",
75
+ "semantic-release-slack-bot": "4.0.2",
76
+ "tap": "21.0.0",
77
+ "typescript": "5.5.4"
81
78
  }
82
79
  }
package/readme.md CHANGED
@@ -1,9 +1,21 @@
1
- # Eik CLI
1
+ # @eik/cli
2
2
 
3
- ## Installation
3
+ The Eik CLI helps you publish to an [Eik server](https://eik.dev/docs/introduction/) and manage import maps and aliases.
4
+
5
+ ## Installing
6
+
7
+ Run this command to install the Eik CLI globally.
4
8
 
5
9
  ```sh
6
- npm install -g @eik/cli
10
+ npm install --global @eik/cli
7
11
  ```
8
12
 
9
- See Eik [documentation site](https://eik.dev/) for usage instructions.
13
+ This makes the `eik` command available in your shell.
14
+
15
+ ```sh
16
+ eik --version
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ See [the CLI reference documentation](https://eik.dev/docs/reference/at-eik-cli) to learn about the available commands.
@@ -0,0 +1,60 @@
1
+ /**
2
+ * @typedef {object} AliasOptions
3
+ * @property {import('abslog').AbstractLoggerOptions} [logger]
4
+ * @property {string} server
5
+ * @property {"package" | "npm" | "map"} [type="package"]
6
+ * @property {string} name
7
+ * @property {string} version
8
+ * @property {string} alias
9
+ * @property {string} token
10
+ */
11
+ /**
12
+ * @typedef {object} AliasResult
13
+ * @property {string} server
14
+ * @property {string} type
15
+ * @property {string} name
16
+ * @property {string} alias
17
+ * @property {string} version
18
+ * @property {boolean} update
19
+ * @property {string[]} files
20
+ * @property {string} org
21
+ * @property {string} integrity
22
+ */
23
+ export default class Alias {
24
+ /**
25
+ * @param {AliasOptions} options
26
+ */
27
+ constructor({ logger, server, token, type, name, version, alias }: AliasOptions);
28
+ log: abslog.ValidLogger;
29
+ server: string;
30
+ token: string;
31
+ type: any;
32
+ name: string;
33
+ alias: string;
34
+ version: string;
35
+ /**
36
+ * @returns {Promise<AliasResult>}
37
+ */
38
+ run(): Promise<AliasResult>;
39
+ }
40
+ export type AliasOptions = {
41
+ logger?: import("abslog").AbstractLoggerOptions;
42
+ server: string;
43
+ type?: "package" | "npm" | "map";
44
+ name: string;
45
+ version: string;
46
+ alias: string;
47
+ token: string;
48
+ };
49
+ export type AliasResult = {
50
+ server: string;
51
+ type: string;
52
+ name: string;
53
+ alias: string;
54
+ version: string;
55
+ update: boolean;
56
+ files: string[];
57
+ org: string;
58
+ integrity: string;
59
+ };
60
+ import abslog from 'abslog';
@@ -0,0 +1,37 @@
1
+ declare namespace _default {
2
+ /**
3
+ * @param {import('./alias.js').AliasOptions} opts
4
+ */
5
+ function alias(opts: import("./alias.js").AliasOptions): Promise<import("./alias.js").AliasResult>;
6
+ /**
7
+ * @param {import('./integrity.js').IntegrityOptions} opts
8
+ */
9
+ function integrity(opts: import("./integrity.js").IntegrityOptions): Promise<any>;
10
+ /**
11
+ * Log in using a key to get a Bearer token for use with other commands.
12
+ *
13
+ * @param {import('./login.js').LoginOptions} opts
14
+ */
15
+ function login(opts: import("./login.js").LoginOptions): Promise<string | false>;
16
+ /**
17
+ * @param {import('./publish/map.js').PublishMapOptions} opts
18
+ */
19
+ function map(opts: import("./publish/map.js").PublishMapOptions): Promise<import("./publish/map.js").PublishMapResult>;
20
+ /**
21
+ * @param {import('./meta.js').MetaOptions} opts
22
+ */
23
+ function meta(opts: import("./meta.js").MetaOptions): Promise<unknown>;
24
+ /**
25
+ * @param {import('./ping.js').PingOptions} opts
26
+ */
27
+ function ping(opts: import("./ping.js").PingOptions): Promise<boolean>;
28
+ /**
29
+ * @param {import('./publish/package/index.js').PublishOptions} opts
30
+ */
31
+ function publish(opts: import("./publish/package/index.js").PublishOptions): Promise<import("./publish/package/index.js").PublishResult>;
32
+ /**
33
+ * @param {import('./version.js').VersionOptions} opts
34
+ */
35
+ function version(opts: import("./version.js").VersionOptions): Promise<string>;
36
+ }
37
+ export default _default;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * @typedef {object} IntegrityOptions
3
+ * @property {import('abslog').AbstractLoggerOptions} [logger]
4
+ * @property {string} server
5
+ * @property {"package" | "npm" | "map"} [type="package"]
6
+ * @property {string} name
7
+ * @property {string} version
8
+ * @property {string} [cwd]
9
+ * @property {boolean} [debug]
10
+ */
11
+ export default class Integrity {
12
+ /**
13
+ *
14
+ * @param {IntegrityOptions} options
15
+ */
16
+ constructor({ logger, name, version, server, type, debug, cwd, }: IntegrityOptions);
17
+ log: abslog.ValidLogger;
18
+ server: string;
19
+ name: string;
20
+ version: string;
21
+ debug: boolean;
22
+ cwd: string;
23
+ type: "map" | "package" | "npm";
24
+ run(): Promise<any>;
25
+ }
26
+ export type IntegrityOptions = {
27
+ logger?: import("abslog").AbstractLoggerOptions;
28
+ server: string;
29
+ type?: "package" | "npm" | "map";
30
+ name: string;
31
+ version: string;
32
+ cwd?: string;
33
+ debug?: boolean;
34
+ };
35
+ import abslog from 'abslog';
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @typedef {object} LoginOptions
3
+ * @property {import('abslog').AbstractLoggerOptions} [logger]
4
+ * @property {string} server
5
+ * @property {string} key
6
+ */
7
+ export default class Login {
8
+ /**
9
+ * @param {LoginOptions} options
10
+ */
11
+ constructor({ logger, server, key }: LoginOptions);
12
+ log: abslog.ValidLogger;
13
+ server: string;
14
+ key: string;
15
+ /**
16
+ * @returns {Promise<string | false>} Bearer token, or false if login fails
17
+ */
18
+ run(): Promise<string | false>;
19
+ }
20
+ export type LoginOptions = {
21
+ logger?: import("abslog").AbstractLoggerOptions;
22
+ server: string;
23
+ key: string;
24
+ };
25
+ import abslog from 'abslog';
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @typedef {object} MetaOptions
3
+ * @property {import('abslog').AbstractLoggerOptions} [logger]
4
+ * @property {string} server
5
+ * @property {string} name
6
+ * @property {string} version
7
+ */
8
+ export default class Meta {
9
+ /**
10
+ * @param {MetaOptions} options
11
+ */
12
+ constructor({ logger, server, name, version }: MetaOptions);
13
+ log: abslog.ValidLogger;
14
+ server: string;
15
+ name: string;
16
+ version: string;
17
+ /**
18
+ * @returns {Promise<unknown | false>}
19
+ */
20
+ run(): Promise<unknown | false>;
21
+ }
22
+ export type MetaOptions = {
23
+ logger?: import("abslog").AbstractLoggerOptions;
24
+ server: string;
25
+ name: string;
26
+ version: string;
27
+ };
28
+ import abslog from 'abslog';
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @typedef {object} PingOptions
3
+ * @property {string} [server]
4
+ * @property {import('abslog').AbstractLoggerOptions} [logger]
5
+ */
6
+ export default class Ping {
7
+ /**
8
+ * @param {PingOptions} options
9
+ */
10
+ constructor({ logger, server }?: PingOptions);
11
+ log: abslog.ValidLogger;
12
+ server: string;
13
+ /**
14
+ * Run the ping command
15
+ * @returns {Promise<boolean>}
16
+ */
17
+ run(): Promise<boolean>;
18
+ }
19
+ export type PingOptions = {
20
+ server?: string;
21
+ logger?: import("abslog").AbstractLoggerOptions;
22
+ };
23
+ import abslog from 'abslog';
@@ -0,0 +1,51 @@
1
+ /**
2
+ * @typedef {object} PublishMapOptions
3
+ * @property {import('abslog').AbstractLoggerOptions} [logger]
4
+ * @property {string} server
5
+ * @property {string} [cwd]
6
+ * @property {string} token
7
+ * @property {string} file
8
+ * @property {string} name
9
+ * @property {string} version
10
+ */
11
+ /**
12
+ * @typedef {object} PublishMapResult
13
+ * @property {string} server
14
+ * @property {string} name
15
+ * @property {string} version
16
+ * @property {string} type
17
+ */
18
+ export default class PublishMap {
19
+ /**
20
+ * @param {PublishMapOptions} options
21
+ */
22
+ constructor({ logger, cwd, server, token, file, name, version, }: PublishMapOptions);
23
+ log: abslog.ValidLogger;
24
+ cwd: string;
25
+ server: string;
26
+ token: string;
27
+ name: string;
28
+ version: string;
29
+ file: string;
30
+ /**
31
+ * @returns {Promise<PublishMapResult>}
32
+ */
33
+ run(): Promise<PublishMapResult>;
34
+ absoluteFile: string;
35
+ }
36
+ export type PublishMapOptions = {
37
+ logger?: import("abslog").AbstractLoggerOptions;
38
+ server: string;
39
+ cwd?: string;
40
+ token: string;
41
+ file: string;
42
+ name: string;
43
+ version: string;
44
+ };
45
+ export type PublishMapResult = {
46
+ server: string;
47
+ name: string;
48
+ version: string;
49
+ type: string;
50
+ };
51
+ import abslog from 'abslog';
@@ -0,0 +1,94 @@
1
+ /**
2
+ * @typedef {object} PublishOptions
3
+ * @property {import('abslog').AbstractLoggerOptions} [logger]
4
+ * @property {string} [cwd]
5
+ * @property {string} token
6
+ * @property {boolean} [dryRun=false]
7
+ * @property {string} server
8
+ * @property {"package" | "map" | "npm"} [type="package"]
9
+ * @property {string} name
10
+ * @property {string} [version="1.0.0"]
11
+ * @property {string[]} [map]
12
+ * @property {string} [out="./.eik"]
13
+ * @property {Record<string, string>} files
14
+ */
15
+ /**
16
+ * @typedef {object} PublishResult
17
+ * @property {string} type
18
+ * @property {string} server
19
+ * @property {string} name
20
+ * @property {unknown} level
21
+ * @property {boolean} dryRun
22
+ * @property {string} integrity
23
+ * @property {unknown} created
24
+ * @property {unknown} author
25
+ * @property {string} org
26
+ * @property {string} version
27
+ * @property {unknown} response
28
+ * @property {Array<{ pathname: string; type: string; }>} files
29
+ */
30
+ export default class Publish {
31
+ /**
32
+ * @param {PublishOptions} options
33
+ */
34
+ constructor({ logger, cwd, token, dryRun, server, type, name, version, map, out, files, }: PublishOptions);
35
+ log: abslog.ValidLogger;
36
+ cwd: string;
37
+ dryRun: boolean;
38
+ config: EikConfig;
39
+ path: string;
40
+ validateInput: ValidateInput;
41
+ createTempDirectory: CreateTempDirectory;
42
+ createZipFile: CreateZipFile;
43
+ checkBundleSizes: CheckBundleSizes;
44
+ runDryRun: DryRun;
45
+ checkIfAlreadyPublished: CheckIfAlreadyPublished;
46
+ uploadFiles: UploadFiles;
47
+ saveMetafile: SaveMetafile;
48
+ cleanup: Cleanup;
49
+ /**
50
+ * @returns {Promise<PublishResult>}
51
+ */
52
+ run(): Promise<PublishResult>;
53
+ }
54
+ export type PublishOptions = {
55
+ logger?: import("abslog").AbstractLoggerOptions;
56
+ cwd?: string;
57
+ token: string;
58
+ dryRun?: boolean;
59
+ server: string;
60
+ type?: "package" | "map" | "npm";
61
+ name: string;
62
+ version?: string;
63
+ map?: string[];
64
+ out?: string;
65
+ files: Record<string, string>;
66
+ };
67
+ export type PublishResult = {
68
+ type: string;
69
+ server: string;
70
+ name: string;
71
+ level: unknown;
72
+ dryRun: boolean;
73
+ integrity: string;
74
+ created: unknown;
75
+ author: unknown;
76
+ org: string;
77
+ version: string;
78
+ response: unknown;
79
+ files: Array<{
80
+ pathname: string;
81
+ type: string;
82
+ }>;
83
+ };
84
+ import abslog from 'abslog';
85
+ import { EikConfig } from '@eik/common';
86
+ import ValidateInput from './tasks/validate-input.js';
87
+ import CreateTempDirectory from './tasks/create-temp-directory.js';
88
+ import CreateZipFile from './tasks/create-zip-file.js';
89
+ import CheckBundleSizes from './tasks/check-bundle-sizes.js';
90
+ import DryRun from './tasks/dry-run.js';
91
+ import CheckIfAlreadyPublished from './tasks/check-if-already-published.js';
92
+ import UploadFiles from './tasks/upload-files.js';
93
+ import SaveMetafile from './tasks/save-metafile.js';
94
+ import Cleanup from './tasks/cleanup.js';
@@ -0,0 +1,4 @@
1
+ export default class CheckBundleSizes extends Task {
2
+ process(): Promise<void>;
3
+ }
4
+ import Task from './task.js';
@@ -0,0 +1,4 @@
1
+ export default class CheckIfAlreadyPublished extends Task {
2
+ process(): Promise<string>;
3
+ }
4
+ import Task from './task.js';
@@ -0,0 +1,4 @@
1
+ export default class Cleanup extends Task {
2
+ process(): Promise<void>;
3
+ }
4
+ import Task from './task.js';
@@ -0,0 +1,4 @@
1
+ export default class CreateTempDir extends Task {
2
+ process(): Promise<void>;
3
+ }
4
+ import Task from './task.js';
@@ -0,0 +1,4 @@
1
+ export default class CreateZipFile extends Task {
2
+ process(): Promise<string>;
3
+ }
4
+ import Task from './task.js';