Skip to content

Commit

Permalink
refactor: identity.ts & build fixes work in progress
Browse files Browse the repository at this point in the history
JIRA: UUI-767
  • Loading branch information
michal-oleniacz-stp committed Feb 19, 2024
1 parent 6dc3fdb commit ab50ff3
Show file tree
Hide file tree
Showing 31 changed files with 622 additions and 328 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.DS_Store
.cache
.idea
/es5
/dist
coverage
docs/
node_modules/
8 changes: 4 additions & 4 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
*
!index.js
!index.ts
!*.d.ts
!identity.js
!monetization.js
!payment.js
!identity.ts
!monetization.ts
!payment.ts
!es5/*.js
!es5/*.d.ts
!es5/*.js.map
Expand Down
4 changes: 2 additions & 2 deletions __tests__/RESTClient.intest.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

'use strict';

import RESTClient from '../src/clients/RESTClient.js';
import config from '../src/config/config.js';
import RESTClient from '../src/clients/RESTClient.ts';
import config from '../src/config/config.ts';

describe('RESTClient', () => {

Expand Down
4 changes: 2 additions & 2 deletions __tests__/RESTClient.utest.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

'use strict';

import { ENDPOINTS } from '../src/config/config.js';
import { RESTClient } from '../src/clients/RESTClient.js';
import { ENDPOINTS } from '../src/config/config.ts';
import { RESTClient } from '../src/clients/RESTClient.ts';

describe('RESTClient', () => {
test('has the REST methods for get and go', () => {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/SDKError.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

'use strict';

import SDKError from '../src/utils/SDKError.js';
import SDKError from '../src/utils/SDKError.ts';

describe('SDKError', () => {
test('Should be able to stringify an error', () => {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

'use strict';

import Cache from '../src/utils/cache.js';
import Cache from '../src/utils/cache.ts';

const webStorageMock = () => {
const mock = {
Expand Down
4 changes: 2 additions & 2 deletions __tests__/identity.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

'use strict';

import SDKError from '../src/utils/SDKError.js';
import SDKError from '../src/utils/SDKError.ts';

import Identity from '../identity.js';
import Identity from '../identity.ts';
import { compareUrls, Fixtures } from './utils.js';
import { URL } from 'url';
import { URL as u } from 'whatwg-url';
Expand Down
4 changes: 2 additions & 2 deletions __tests__/monetization.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

'use strict';

jest.mock('../src/RESTClient.js');
jest.mock('../src/RESTClient.ts');

import Monetization from '../monetization.js';
import Monetization from '../monetization.ts';

describe('Monetization', () => {

Expand Down
2 changes: 1 addition & 1 deletion __tests__/object.utest.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

'use strict';

import { cloneDefined, cloneDeep } from '../src/utils/object.js';
import { cloneDefined, cloneDeep } from '../src/utils/object.ts';

describe('object', () => {

Expand Down
2 changes: 1 addition & 1 deletion __tests__/payment.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

'use strict';

import { Payment } from '../payment.js';
import { Payment } from '../payment.ts';
import { compareUrls } from './utils.js';

describe('Payment', () => {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/popup.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

import * as popup from '../src/utils/popup.js';
import * as popup from '../src/utils/popup.ts';

describe('Popup — open', () => {
const defaultFeatures = 'scrollbars=yes,location=yes,status=no,menubar=no,toolbar=no,resizable=yes';
Expand Down
2 changes: 1 addition & 1 deletion __tests__/url.utest.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import { URL } from 'whatwg-url';
import { urlMapper } from '../src/utils/url.ts';
import RESTClient from '../src/clients/RESTClient.js';
import RESTClient from '../src/clients/RESTClient.ts';

describe('url', () => {

Expand Down
2 changes: 1 addition & 1 deletion __tests__/validate.utest.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

'use strict';

import { isStr, isStrIn, isNonEmptyString, isObject, isNonEmptyObj } from '../src/utils/validate.js';
import { isStr, isStrIn, isNonEmptyString, isObject, isNonEmptyObj } from '../src/utils/validate.ts';

describe('validate', () => {

Expand Down
1 change: 0 additions & 1 deletion identity.d.ts

This file was deleted.

5 changes: 0 additions & 5 deletions identity.js

This file was deleted.

6 changes: 3 additions & 3 deletions index.js → index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

'use strict';

export * from './identity.js';
export * from './monetization.js';
export * from './payment.js';
export { Identity } from './src/identity';
export { Monetization } from './src/monetization';
export { Payment } from './src/payment';
1 change: 0 additions & 1 deletion monetization.d.ts

This file was deleted.

5 changes: 0 additions & 5 deletions monetization.js

This file was deleted.

15 changes: 14 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
"name": "@schibsted/account-sdk-browser",
"version": "4.8.7",
"description": "Schibsted account SDK for browsers",
"main": "index.js",
"main": "dist/index.js",
"files": [
"dist"
],
"type": "module",
"scripts": {
"build": "webpack --mode production",
"build": "tsc --build --verbose",
"clean": "rimraf .cache coverage dist docs",
"docs": "rimraf docs && jsdoc -c ./jsdoc.conf.json --verbose",
"lint": "eslint .",
Expand All @@ -19,6 +22,7 @@
"author": "",
"license": "MIT",
"dependencies": {
"eventemitter3": "^5.0.1",
"tiny-emitter": "^2.1.0"
},
"devDependencies": {
Expand Down
1 change: 0 additions & 1 deletion payment.d.ts

This file was deleted.

5 changes: 0 additions & 5 deletions payment.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/__mocks__/RESTClient.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { URL } from 'url';
import { urlMapper } from '../utils/url.ts';
import { cloneDefined } from '../utils/object.js';
import { cloneDefined } from '../utils/object.ts';
import { Fixtures } from '../../__tests__/utils.js';

const goFn = () => jest.fn().mockImplementation(async ({ pathname }) => {
Expand Down
2 changes: 1 addition & 1 deletion src/es5/identity.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
'use strict';

window.regeneratorRuntime = require('regenerator-runtime');
const { Identity } = require('../identity.js');
const { Identity } = require('../identity.ts');

module.exports = { Identity };
Loading

0 comments on commit ab50ff3

Please sign in to comment.