BREAKING CHANGE(core): switch to esm
This commit is contained in:
parent
c7899742fe
commit
365511fee3
16376
package-lock.json
generated
16376
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
15
package.json
15
package.json
@ -5,6 +5,7 @@
|
|||||||
"description": "handle yaml in smart ways",
|
"description": "handle yaml in smart ways",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
"typings": "dist_ts/index.d.ts",
|
"typings": "dist_ts/index.d.ts",
|
||||||
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(tstest test/ --web)",
|
"test": "(tstest test/ --web)",
|
||||||
"build": "(tsbuild --web)"
|
"build": "(tsbuild --web)"
|
||||||
@ -24,15 +25,15 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://gitlab.com/pushrocks/smartyaml#README",
|
"homepage": "https://gitlab.com/pushrocks/smartyaml#README",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/js-yaml": "^3.12.5",
|
"@types/js-yaml": "^4.0.5",
|
||||||
"js-yaml": "^3.14.0"
|
"js-yaml": "^4.1.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.1.25",
|
"@gitzone/tsbuild": "^2.1.61",
|
||||||
"@gitzone/tsrun": "^1.2.12",
|
"@gitzone/tsrun": "^1.2.32",
|
||||||
"@gitzone/tstest": "^1.0.52",
|
"@gitzone/tstest": "^1.0.71",
|
||||||
"@pushrocks/tapbundle": "^3.2.9",
|
"@pushrocks/tapbundle": "^5.0.3",
|
||||||
"@types/node": "^14.14.3"
|
"@types/node": "^17.0.35"
|
||||||
},
|
},
|
||||||
"browserslist": [
|
"browserslist": [
|
||||||
"last 1 chrome versions"
|
"last 1 chrome versions"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { expect, tap } from '@pushrocks/tapbundle';
|
import { expect, tap } from '@pushrocks/tapbundle';
|
||||||
|
|
||||||
import * as smartyaml from '../ts/index';
|
import * as smartyaml from '../ts/index.js';
|
||||||
|
|
||||||
let yamlString = `someKey: someValue
|
let yamlString = `someKey: someValue
|
||||||
someKey2: someValue2
|
someKey2: someValue2
|
||||||
@ -8,21 +8,21 @@ someKey2: someValue2
|
|||||||
|
|
||||||
tap.test('should convert yaml string to object', async () => {
|
tap.test('should convert yaml string to object', async () => {
|
||||||
let myObject = await smartyaml.yamlStringToObject(yamlString);
|
let myObject = await smartyaml.yamlStringToObject(yamlString);
|
||||||
expect(myObject.someKey).to.equal('someValue');
|
expect(myObject.someKey).toEqual('someValue');
|
||||||
expect(myObject.someKey2).to.equal('someValue2');
|
expect(myObject.someKey2).toEqual('someValue2');
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.test('should convert an object to a string', async () => {
|
tap.test('should convert an object to a string', async () => {
|
||||||
let myObject = await smartyaml.yamlStringToObject(yamlString);
|
let myObject = await smartyaml.yamlStringToObject(yamlString);
|
||||||
let myString = await smartyaml.objectToYamlString(myObject);
|
let myString = await smartyaml.objectToYamlString(myObject);
|
||||||
expect(myString).to.equal(yamlString);
|
expect(myString).toEqual(yamlString);
|
||||||
});
|
});
|
||||||
|
|
||||||
// test some behaviours
|
// test some behaviours
|
||||||
tap.test('should allow dots in key', async () => {
|
tap.test('should allow dots in key', async () => {
|
||||||
let testString = `myKey.with.dots: some`;
|
let testString = `myKey.with.dots: some`;
|
||||||
let testObject = await smartyaml.yamlStringToObject(testString);
|
let testObject = await smartyaml.yamlStringToObject(testString);
|
||||||
expect(testObject['myKey.with.dots']).to.equal('some');
|
expect(testObject['myKey.with.dots']).toEqual('some');
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.start();
|
tap.start();
|
||||||
|
8
ts/00_commitinfo_data.ts
Normal file
8
ts/00_commitinfo_data.ts
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* autocreated commitinfo by @pushrocks/commitinfo
|
||||||
|
*/
|
||||||
|
export const commitinfo = {
|
||||||
|
name: '@pushrocks/smartyaml',
|
||||||
|
version: '3.0.0',
|
||||||
|
description: 'handle yaml in smart ways'
|
||||||
|
}
|
@ -1,15 +1,15 @@
|
|||||||
import * as plugins from './smartyaml.plugins';
|
import * as plugins from './smartyaml.plugins.js';
|
||||||
|
|
||||||
export let yamlStringToObject = async (
|
export let yamlStringToObject = async (
|
||||||
yamlStringArg,
|
yamlStringArg,
|
||||||
optionsArg: plugins.jsYaml.LoadOptions = {}
|
optionsArg: plugins.jsYaml.LoadOptions = {}
|
||||||
): Promise<any> => {
|
): Promise<any> => {
|
||||||
return plugins.jsYaml.safeLoad(yamlStringArg);
|
return plugins.jsYaml.load(yamlStringArg);
|
||||||
};
|
};
|
||||||
|
|
||||||
export let objectToYamlString = async (
|
export let objectToYamlString = async (
|
||||||
objectArg,
|
objectArg,
|
||||||
optionsArg: plugins.jsYaml.DumpOptions = {}
|
optionsArg: plugins.jsYaml.DumpOptions = {}
|
||||||
): Promise<string> => {
|
): Promise<string> => {
|
||||||
return plugins.jsYaml.safeDump(objectArg);
|
return plugins.jsYaml.dump(objectArg);
|
||||||
};
|
};
|
||||||
|
17
tslint.json
17
tslint.json
@ -1,17 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": ["tslint:latest", "tslint-config-prettier"],
|
|
||||||
"rules": {
|
|
||||||
"semicolon": [true, "always"],
|
|
||||||
"no-console": false,
|
|
||||||
"ordered-imports": false,
|
|
||||||
"object-literal-sort-keys": false,
|
|
||||||
"member-ordering": {
|
|
||||||
"options":{
|
|
||||||
"order": [
|
|
||||||
"static-method"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"defaultSeverity": "warning"
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user