@eik/cli 3.0.0-next.2 → 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.
- package/CHANGELOG.md +145 -9
- package/classes/alias.js +49 -22
- package/classes/index.js +47 -23
- package/classes/integrity.js +27 -16
- package/classes/login.js +21 -7
- package/classes/meta.js +20 -12
- package/classes/ping.js +20 -9
- package/classes/publish/map.js +33 -10
- package/classes/publish/package/index.js +54 -17
- package/classes/publish/package/tasks/check-bundle-sizes.js +7 -11
- package/classes/publish/package/tasks/check-if-already-published.js +8 -11
- package/classes/publish/package/tasks/cleanup.js +7 -9
- package/classes/publish/package/tasks/create-temp-directory.js +5 -9
- package/classes/publish/package/tasks/create-zip-file.js +6 -11
- package/classes/publish/package/tasks/dry-run.js +4 -8
- package/classes/publish/package/tasks/save-metafile.js +5 -7
- package/classes/publish/package/tasks/task.js +3 -5
- package/classes/publish/package/tasks/upload-files.js +16 -17
- package/classes/publish/package/tasks/validate-input.js +4 -8
- package/classes/version.js +38 -21
- package/commands/alias.js +51 -71
- package/commands/index.js +27 -0
- package/commands/init.js +69 -52
- package/commands/integrity.js +15 -32
- package/commands/login.js +23 -35
- package/commands/map-alias.js +95 -0
- package/commands/map.js +90 -0
- package/commands/meta.js +12 -29
- package/commands/npm-alias.js +90 -0
- package/commands/package-alias.js +102 -0
- package/commands/ping.js +11 -21
- package/commands/publish.js +82 -138
- package/commands/version.js +16 -33
- package/formatters/alias.js +4 -14
- package/formatters/artifact.js +4 -8
- package/formatters/file.js +3 -10
- package/formatters/index.js +5 -5
- package/formatters/version.js +5 -12
- package/index.js +53 -12
- package/package.json +49 -52
- package/readme.md +16 -4
- package/types/classes/alias.d.ts +60 -0
- package/types/classes/index.d.ts +37 -0
- package/types/classes/integrity.d.ts +35 -0
- package/types/classes/login.d.ts +25 -0
- package/types/classes/meta.d.ts +28 -0
- package/types/classes/ping.d.ts +23 -0
- package/types/classes/publish/map.d.ts +51 -0
- package/types/classes/publish/package/index.d.ts +94 -0
- package/types/classes/publish/package/tasks/check-bundle-sizes.d.ts +4 -0
- package/types/classes/publish/package/tasks/check-if-already-published.d.ts +4 -0
- package/types/classes/publish/package/tasks/cleanup.d.ts +4 -0
- package/types/classes/publish/package/tasks/create-temp-directory.d.ts +4 -0
- package/types/classes/publish/package/tasks/create-zip-file.d.ts +4 -0
- package/types/classes/publish/package/tasks/dry-run.d.ts +7 -0
- package/types/classes/publish/package/tasks/save-metafile.d.ts +4 -0
- package/types/classes/publish/package/tasks/task.d.ts +8 -0
- package/types/classes/publish/package/tasks/upload-files.d.ts +4 -0
- package/types/classes/publish/package/tasks/validate-input.d.ts +4 -0
- package/types/classes/version.d.ts +43 -0
- package/types/utils/hash/compare.d.ts +2 -0
- package/types/utils/hash/file.d.ts +2 -0
- package/types/utils/hash/files.d.ts +2 -0
- package/types/utils/hash/index.d.ts +9 -0
- package/types/utils/http/index.d.ts +12 -0
- package/types/utils/http/integrity.d.ts +2 -0
- package/types/utils/http/latest-version.d.ts +2 -0
- package/types/utils/http/request.d.ts +33 -0
- package/types/utils/http/versions.d.ts +5 -0
- package/types/utils/index.d.ts +6 -0
- package/types/utils/json/index.d.ts +9 -0
- package/types/utils/json/read.d.ts +5 -0
- package/types/utils/json/write-eik.d.ts +5 -0
- package/types/utils/json/write.d.ts +5 -0
- package/types/utils/logger.d.ts +33 -0
- package/types/utils/type-slug.d.ts +2 -0
- package/types/utils/type-title.d.ts +2 -0
- package/utils/hash/compare.js +1 -3
- package/utils/hash/file.js +3 -5
- package/utils/hash/files.js +4 -6
- package/utils/hash/index.js +4 -4
- package/utils/http/index.js +6 -5
- package/utils/http/integrity.js +2 -5
- package/utils/http/latest-version.js +2 -5
- package/utils/http/request.js +25 -19
- package/utils/http/versions.js +2 -5
- package/utils/index.js +6 -4
- package/utils/json/index.js +4 -4
- package/utils/json/read.js +5 -7
- package/utils/json/write-eik.js +4 -6
- package/utils/json/write.js +4 -6
- package/utils/logger.js +2 -5
- package/utils/type-slug.js +1 -1
- package/utils/type-title.js +1 -1
- package/utils/get-cwd.js +0 -14
package/utils/index.js
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
-
|
1
|
+
import { helpers } from '@eik/common';
|
2
|
+
import logger from './logger.js';
|
3
|
+
import typeSlug from './type-slug.js';
|
4
|
+
import typeTitle from './type-title.js';
|
2
5
|
|
3
|
-
const
|
4
|
-
const getCWD = require('./get-cwd');
|
6
|
+
const { getDefaults } = helpers;
|
5
7
|
|
6
|
-
|
8
|
+
export { logger, getDefaults, typeSlug, typeTitle };
|
package/utils/json/index.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
import read from './read.js';
|
2
|
+
import write from './write.js';
|
3
|
+
import writeEik from './write-eik.js';
|
4
4
|
|
5
|
-
|
5
|
+
export default { read, write, writeEik };
|
package/utils/json/read.js
CHANGED
@@ -1,8 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
const fs = require('fs').promises;
|
5
|
-
const { join, isAbsolute } = require('path');
|
1
|
+
import assert from 'assert';
|
2
|
+
import fs from 'node:fs/promises';
|
3
|
+
import { join, isAbsolute } from 'path';
|
6
4
|
|
7
5
|
/**
|
8
6
|
* Reads a file at a given location, assumes the contents to be JSON and then deserializes into a JavaScript object
|
@@ -10,7 +8,7 @@ const { join, isAbsolute } = require('path');
|
|
10
8
|
* @param {string|{filename:string,cwd:string}} location - Path string or object describing location for where to write JSON to.
|
11
9
|
* If location is a string it can be relative or absolute.
|
12
10
|
* If location is an object, `pathname` must be given which can be relative or absolute. `cwd` can also be given to define the current working directory.
|
13
|
-
* @return {Promise<
|
11
|
+
* @return {Promise<unknown>} - JavaScript object deserialized from JSON file contents
|
14
12
|
*
|
15
13
|
* @example json.read('/path/to/file.json');
|
16
14
|
* @example json.read('./relative/path/to/file.json');
|
@@ -18,7 +16,7 @@ const { join, isAbsolute } = require('path');
|
|
18
16
|
* @example json.read({ filename: './relative/path/to/file.json' });
|
19
17
|
* @example json.read({ filename: './relative/path/to/file.json', cwd: '/path/to/cwd });
|
20
18
|
*/
|
21
|
-
|
19
|
+
export default async (location) => {
|
22
20
|
if (typeof location !== 'string') {
|
23
21
|
assert(
|
24
22
|
location.filename,
|
package/utils/json/write-eik.js
CHANGED
@@ -1,7 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
const fs = require('fs').promises;
|
4
|
-
const { join } = require('path');
|
1
|
+
import fs from 'node:fs/promises';
|
2
|
+
import { join } from 'path';
|
5
3
|
|
6
4
|
/**
|
7
5
|
* Reads, updates and then writes data to given eik.json file (defaults to file in current directory)
|
@@ -15,10 +13,10 @@ const { join } = require('path');
|
|
15
13
|
* @example json.writeEik({ key: 'value' }, { cwd: '/path/to/cwd' });
|
16
14
|
* @example json.writeEik({ key: 'value' }, { cwd: '/path/to/cwd', filename: 'eik.json' });
|
17
15
|
*/
|
18
|
-
|
16
|
+
export default async (data = {}, options) => {
|
19
17
|
const { cwd = process.cwd(), filename = 'eik.json' } = options;
|
20
18
|
const eikpath = join(cwd, filename);
|
21
|
-
const eik = await fs.readFile(eikpath);
|
19
|
+
const eik = await fs.readFile(eikpath, 'utf-8');
|
22
20
|
const eikjson = JSON.parse(eik);
|
23
21
|
|
24
22
|
await fs.writeFile(
|
package/utils/json/write.js
CHANGED
@@ -1,8 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
const fs = require('fs').promises;
|
5
|
-
const { join, isAbsolute, dirname } = require('path');
|
1
|
+
import assert from 'assert';
|
2
|
+
import fs from 'node:fs/promises';
|
3
|
+
import { join, isAbsolute, dirname } from 'path';
|
6
4
|
|
7
5
|
/**
|
8
6
|
* Utility function that can be used to write a JavaScript object to a file at a given location.
|
@@ -21,7 +19,7 @@ const { join, isAbsolute, dirname } = require('path');
|
|
21
19
|
*
|
22
20
|
* @throws Error
|
23
21
|
*/
|
24
|
-
|
22
|
+
export default async (meta = {}, location) => {
|
25
23
|
if (typeof location !== 'string') {
|
26
24
|
assert(
|
27
25
|
location.filename,
|
package/utils/logger.js
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
1
|
/**
|
4
2
|
* Creates a logger object that wraps an instance of the "ora" module in order to provide consistent command line logging that includes a spinner
|
5
3
|
*
|
@@ -30,10 +28,9 @@ const logger = (spinner, debug = false) => ({
|
|
30
28
|
*/
|
31
29
|
info(message) {
|
32
30
|
if (typeof message !== 'string') {
|
33
|
-
// eslint-disable-next-line no-param-reassign
|
34
31
|
spinner.text = '';
|
35
32
|
spinner.stopAndPersist();
|
36
|
-
|
33
|
+
|
37
34
|
console.log(message);
|
38
35
|
spinner.start();
|
39
36
|
} else {
|
@@ -54,4 +51,4 @@ const logger = (spinner, debug = false) => ({
|
|
54
51
|
},
|
55
52
|
});
|
56
53
|
|
57
|
-
|
54
|
+
export default logger;
|
package/utils/type-slug.js
CHANGED
package/utils/type-title.js
CHANGED
package/utils/get-cwd.js
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
const av = require('yargs-parser')(process.argv.slice(2));
|
4
|
-
|
5
|
-
/**
|
6
|
-
* Returns the current working directory path
|
7
|
-
* If a --cwd or -c command line flag has been used, the value given will be returned
|
8
|
-
* Otherwise, the directory where the process was run from is used
|
9
|
-
*
|
10
|
-
* @returns {string}
|
11
|
-
*/
|
12
|
-
module.exports = function getCWD() {
|
13
|
-
return av.cwd || av.c || process.cwd();
|
14
|
-
};
|