@eik/cli 3.1.2 → 3.1.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/CHANGELOG.md +7 -0
- package/classes/alias.js +6 -2
- package/classes/integrity.js +2 -2
- package/classes/meta.js +6 -3
- package/classes/publish/map.js +2 -1
- package/classes/publish/package/tasks/check-if-already-published.js +1 -1
- package/classes/publish/package/tasks/cleanup.js +11 -7
- package/classes/publish/package/tasks/create-zip-file.js +4 -4
- package/classes/publish/package/tasks/upload-files.js +3 -2
- package/classes/version.js +1 -1
- package/package.json +2 -6
- package/types/utils/url.d.ts +6 -0
- package/utils/url.js +10 -0
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## [3.1.3](https://github.com/eik-lib/cli/compare/v3.1.2...v3.1.3) (2024-08-19)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* add support for Windows ([#584](https://github.com/eik-lib/cli/issues/584)) ([3d2dc7e](https://github.com/eik-lib/cli/commit/3d2dc7ef87abc48a3b4b796e5d717b280837974b))
|
7
|
+
|
1
8
|
## [3.1.2](https://github.com/eik-lib/cli/compare/v3.1.1...v3.1.2) (2024-08-19)
|
2
9
|
|
3
10
|
|
package/classes/alias.js
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
import assert from 'assert';
|
2
2
|
import abslog from 'abslog';
|
3
|
-
import { join } from 'path';
|
4
3
|
import { schemas, validators } from '@eik/common';
|
5
4
|
import { request } from '../utils/http/index.js';
|
6
5
|
import { typeSlug } from '../utils/index.js';
|
6
|
+
import { joinUrlPathname } from '../utils/url.js';
|
7
7
|
|
8
8
|
/**
|
9
9
|
* @typedef {object} AliasOptions
|
@@ -74,7 +74,11 @@ export default class Alias {
|
|
74
74
|
`Requesting creation of ${this.type} alias "v${this.alias}" for ${this.name} v${this.version} on ${this.server}`,
|
75
75
|
);
|
76
76
|
|
77
|
-
const pathname =
|
77
|
+
const pathname = joinUrlPathname(
|
78
|
+
this.type,
|
79
|
+
this.name,
|
80
|
+
`v${this.alias}`,
|
81
|
+
);
|
78
82
|
try {
|
79
83
|
const { message } = await request({
|
80
84
|
host: this.server,
|
package/classes/integrity.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import abslog from 'abslog';
|
2
|
-
import { join } from 'path';
|
3
2
|
import eik from '@eik/common';
|
4
3
|
import { typeSlug } from '../utils/index.js';
|
4
|
+
import { joinUrlPathname } from '../utils/url.js';
|
5
5
|
|
6
6
|
const { schemas } = eik;
|
7
7
|
|
@@ -79,7 +79,7 @@ export default class Integrity {
|
|
79
79
|
this.log.debug('Requesting meta information from asset server');
|
80
80
|
try {
|
81
81
|
const url = new URL(
|
82
|
-
|
82
|
+
joinUrlPathname(typeSlug(this.type), this.name, this.version),
|
83
83
|
this.server,
|
84
84
|
);
|
85
85
|
this.log.debug(` ==> url: ${url}`);
|
package/classes/meta.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import abslog from 'abslog';
|
2
|
-
import { join } from 'path';
|
3
2
|
import { schemas } from '@eik/common';
|
3
|
+
import { joinUrlPathname } from '../utils/url.js';
|
4
4
|
|
5
5
|
const types = ['pkg', 'map', 'npm'];
|
6
6
|
|
@@ -40,7 +40,10 @@ export default class Meta {
|
|
40
40
|
try {
|
41
41
|
const typeFetches = [];
|
42
42
|
for (const type of types) {
|
43
|
-
const url = new URL(
|
43
|
+
const url = new URL(
|
44
|
+
joinUrlPathname(type, this.name),
|
45
|
+
this.server,
|
46
|
+
);
|
44
47
|
url.search = `?t=${Date.now()}`;
|
45
48
|
typeFetches.push(fetch(url));
|
46
49
|
}
|
@@ -64,7 +67,7 @@ export default class Meta {
|
|
64
67
|
for (let i = 0; i < data[type].versions.length; i++) {
|
65
68
|
const { version } = data[type].versions[i];
|
66
69
|
const url = new URL(
|
67
|
-
|
70
|
+
joinUrlPathname(type, name, version),
|
68
71
|
this.server,
|
69
72
|
);
|
70
73
|
|
package/classes/publish/map.js
CHANGED
@@ -4,6 +4,7 @@ import { join, parse, isAbsolute } from 'path';
|
|
4
4
|
import { existsSync } from 'fs';
|
5
5
|
import { schemas } from '@eik/common';
|
6
6
|
import { request } from '../../utils/http/index.js';
|
7
|
+
import { joinUrlPathname } from '../../utils/url.js';
|
7
8
|
|
8
9
|
/**
|
9
10
|
* @typedef {object} PublishMapOptions
|
@@ -79,7 +80,7 @@ export default class PublishMap {
|
|
79
80
|
await request({
|
80
81
|
method: 'PUT',
|
81
82
|
host: this.server,
|
82
|
-
pathname:
|
83
|
+
pathname: joinUrlPathname('map', this.name, this.version),
|
83
84
|
map: this.absoluteFile,
|
84
85
|
token: this.token,
|
85
86
|
});
|
@@ -1,6 +1,7 @@
|
|
1
|
-
import { join } from 'path';
|
2
|
-
import
|
3
|
-
import {
|
1
|
+
import { join } from 'node:path';
|
2
|
+
import { existsSync } from 'node:fs';
|
3
|
+
import { readdir } from 'node:fs/promises';
|
4
|
+
import { rimraf } from 'rimraf';
|
4
5
|
import Task from './task.js';
|
5
6
|
|
6
7
|
export default class Cleanup extends Task {
|
@@ -8,10 +9,13 @@ export default class Cleanup extends Task {
|
|
8
9
|
const { log, path } = this;
|
9
10
|
log.debug('Cleaning up');
|
10
11
|
|
11
|
-
if (
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
if (existsSync(path)) {
|
13
|
+
const dir = await readdir(path);
|
14
|
+
await Promise.all(
|
15
|
+
dir
|
16
|
+
.filter((file) => file !== 'integrity.json')
|
17
|
+
.map((file) => rimraf(join(path, file))),
|
18
|
+
);
|
15
19
|
}
|
16
20
|
}
|
17
21
|
}
|
@@ -10,13 +10,13 @@ export default class CreateZipFile extends Task {
|
|
10
10
|
const { log, path } = this;
|
11
11
|
const { name, map, server, out, files } = this.config;
|
12
12
|
|
13
|
-
log.debug(
|
14
|
-
log.debug(` ==> ${join(path,
|
13
|
+
log.debug('Creating zip file');
|
14
|
+
log.debug(` ==> ${join(path, 'eik.tgz')}`);
|
15
15
|
|
16
16
|
const filesToZip = [];
|
17
17
|
|
18
18
|
try {
|
19
|
-
const eikPathDest = join(path, '
|
19
|
+
const eikPathDest = join(path, 'eik.json');
|
20
20
|
writeFileSync(
|
21
21
|
eikPathDest,
|
22
22
|
JSON.stringify(
|
@@ -59,7 +59,7 @@ export default class CreateZipFile extends Task {
|
|
59
59
|
}
|
60
60
|
|
61
61
|
try {
|
62
|
-
const zipFile = resolve(
|
62
|
+
const zipFile = resolve(path, 'eik.tgz');
|
63
63
|
|
64
64
|
await tar.c(
|
65
65
|
{
|
@@ -1,6 +1,7 @@
|
|
1
|
-
import { join } from 'path';
|
2
1
|
import { request } from '../../../../utils/http/index.js';
|
3
2
|
import { typeSlug } from '../../../../utils/index.js';
|
3
|
+
import { joinUrlPathname } from '../../../../utils/url.js';
|
4
|
+
|
4
5
|
import Task from './task.js';
|
5
6
|
|
6
7
|
export default class UploadFiles extends Task {
|
@@ -9,7 +10,7 @@ export default class UploadFiles extends Task {
|
|
9
10
|
const { server, name, version, type, token } = this.config;
|
10
11
|
log.debug('Uploading zip file to server');
|
11
12
|
try {
|
12
|
-
const pathname =
|
13
|
+
const pathname = joinUrlPathname(
|
13
14
|
typeSlug(type),
|
14
15
|
encodeURIComponent(name),
|
15
16
|
version,
|
package/classes/version.js
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@eik/cli",
|
3
|
-
"version": "3.1.
|
3
|
+
"version": "3.1.3",
|
4
4
|
"description": "CLI tool for publishing assets to an Eik server",
|
5
5
|
"main": "./classes/index.js",
|
6
6
|
"types": "./types/classes/index.d.ts",
|
@@ -25,10 +25,6 @@
|
|
25
25
|
"test:integration": "cross-env HTTP_PORT=0 LOG_LEVEL=fatal tap --timeout 0 --disable-coverage test/integration/**/*.test.mjs",
|
26
26
|
"test:unit": "cross-env HTTP_PORT=0 LOG_LEVEL=fatal tap --timeout 0 --disable-coverage test/*.test.mjs",
|
27
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
28
|
"lint": "eslint .",
|
33
29
|
"lint:fix": "eslint --fix .",
|
34
30
|
"format:check": "prettier -c .",
|
@@ -62,7 +58,7 @@
|
|
62
58
|
"devDependencies": {
|
63
59
|
"@eik/eslint-config": "1.0.2",
|
64
60
|
"@eik/semantic-release-config": "1.0.0",
|
65
|
-
"@eik/service": "2.3.
|
61
|
+
"@eik/service": "2.3.1",
|
66
62
|
"@eik/sink-memory": "1.1.2",
|
67
63
|
"@eik/typescript-config": "1.0.0",
|
68
64
|
"cross-env": "7.0.3",
|
package/utils/url.js
ADDED