Revised the base tsconfig to match Gutenberg more closely

This commit is contained in:
Christopher Allford 2020-09-16 15:14:53 -07:00
parent 011974ec09
commit 3a7c96b7cd
13 changed files with 12098 additions and 18013 deletions

20080
package-lock.json generated

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -42,7 +42,7 @@
"@types/create-hmac": "1.1.0", "@types/create-hmac": "1.1.0",
"@types/faker": "4.1.12", "@types/faker": "4.1.12",
"@types/jest": "25.2.1", "@types/jest": "25.2.1",
"@types/moxios": "0.4.9", "@types/moxios": "^0.4.9",
"@types/node": "13.13.5", "@types/node": "13.13.5",
"jest": "25.5.4", "jest": "25.5.4",
"jest-mock-extended": "^1.0.10", "jest-mock-extended": "^1.0.10",

View File

@ -1,4 +1,4 @@
import moxios from 'moxios'; import * as moxios from 'moxios';
import { AxiosClient } from '../axios-client'; import { AxiosClient } from '../axios-client';
import { AxiosResponseInterceptor } from '../axios-response-interceptor'; import { AxiosResponseInterceptor } from '../axios-response-interceptor';
import { HTTPResponse } from '../../http-client'; import { HTTPResponse } from '../../http-client';

View File

@ -1,5 +1,5 @@
import axios, { AxiosInstance } from 'axios'; import axios, { AxiosInstance } from 'axios';
import moxios from 'moxios'; import * as moxios from 'moxios';
import { AxiosOAuthInterceptor } from '../axios-oauth-interceptor'; import { AxiosOAuthInterceptor } from '../axios-oauth-interceptor';
describe( 'AxiosOAuthInterceptor', () => { describe( 'AxiosOAuthInterceptor', () => {
@ -22,7 +22,7 @@ describe( 'AxiosOAuthInterceptor', () => {
} ); } );
it( 'should not run unless started', async () => { it( 'should not run unless started', async () => {
moxios.stubOnce( 'GET', 'https://api.test', { status: 200 } ); moxios.stubRequest( 'https://api.test', { status: 200 } );
apiAuthInterceptor.stop( axiosInstance ); apiAuthInterceptor.stop( axiosInstance );
await axiosInstance.get( 'https://api.test' ); await axiosInstance.get( 'https://api.test' );
@ -38,7 +38,7 @@ describe( 'AxiosOAuthInterceptor', () => {
} ); } );
it( 'should use basic auth for HTTPS', async () => { it( 'should use basic auth for HTTPS', async () => {
moxios.stubOnce( 'GET', 'https://api.test', { status: 200 } ); moxios.stubRequest( 'https://api.test', { status: 200 } );
await axiosInstance.get( 'https://api.test' ); await axiosInstance.get( 'https://api.test' );
const request = moxios.requests.mostRecent(); const request = moxios.requests.mostRecent();
@ -51,7 +51,7 @@ describe( 'AxiosOAuthInterceptor', () => {
} ); } );
it( 'should use OAuth 1.0a for HTTP', async () => { it( 'should use OAuth 1.0a for HTTP', async () => {
moxios.stubOnce( 'GET', 'http://api.test', { status: 200 } ); moxios.stubRequest( 'http://api.test', { status: 200 } );
await axiosInstance.get( 'http://api.test' ); await axiosInstance.get( 'http://api.test' );
const request = moxios.requests.mostRecent(); const request = moxios.requests.mostRecent();
@ -65,7 +65,7 @@ describe( 'AxiosOAuthInterceptor', () => {
} ); } );
it( 'should work with base URL', async () => { it( 'should work with base URL', async () => {
moxios.stubOnce( 'GET', '/test', { status: 200 } ); moxios.stubRequest( '/test', { status: 200 } );
await axiosInstance.request( { await axiosInstance.request( {
method: 'GET', method: 'GET',
baseURL: 'https://api.test/', baseURL: 'https://api.test/',

View File

@ -1,5 +1,5 @@
import axios, { AxiosInstance } from 'axios'; import axios, { AxiosInstance } from 'axios';
import moxios from 'moxios'; import * as moxios from 'moxios';
import { AxiosResponseInterceptor } from '../axios-response-interceptor'; import { AxiosResponseInterceptor } from '../axios-response-interceptor';
describe( 'AxiosResponseInterceptor', () => { describe( 'AxiosResponseInterceptor', () => {

View File

@ -1,6 +1,6 @@
import { AxiosRequestConfig } from 'axios'; import type { AxiosRequestConfig } from 'axios';
import createHmac from 'create-hmac'; import * as createHmac from 'create-hmac';
import OAuth from 'oauth-1.0a'; import * as OAuth from 'oauth-1.0a';
import { AxiosInterceptor } from './axios-interceptor'; import { AxiosInterceptor } from './axios-interceptor';
/** /**

View File

@ -1,4 +1,5 @@
export { HTTPClient, HTTPResponse } from './http-client'; export { HTTPResponse } from './http-client';
export type { HTTPClient } from './http-client';
export { AxiosClient } from './axios/axios-client'; export { AxiosClient } from './axios/axios-client';
export { AxiosInterceptor } from './axios/axios-interceptor'; export { AxiosInterceptor } from './axios/axios-interceptor';

53
tests/e2e/env/package-lock.json generated vendored
View File

@ -2649,9 +2649,9 @@
"integrity": "sha1-nKUs2jY/aZxpRmwqbM2q2RPqenM=" "integrity": "sha1-nKUs2jY/aZxpRmwqbM2q2RPqenM="
}, },
"@types/node": { "@types/node": {
"version": "14.10.1", "version": "14.10.2",
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.10.1.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-14.10.2.tgz",
"integrity": "sha512-aYNbO+FZ/3KGeQCEkNhHFRIzBOUgc7QvcVNKXbfnhDkSfwUv91JsQQa10rDgKSTSLkXZ1UIyPe4FJJNVgw1xWQ==" "integrity": "sha512-IzMhbDYCpv26pC2wboJ4MMOa9GKtjplXfcAqrMeNJpUUwpM/2ATt2w1JPUXwS6spu856TvKZL2AOmeU2rAxskw=="
}, },
"@types/normalize-package-data": { "@types/normalize-package-data": {
"version": "2.4.0", "version": "2.4.0",
@ -4285,9 +4285,9 @@
"integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==" "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg=="
}, },
"caniuse-lite": { "caniuse-lite": {
"version": "1.0.30001129", "version": "1.0.30001131",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001129.tgz", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001131.tgz",
"integrity": "sha512-9945fTVKS810DZITpsAbuhQG7Lam0tEfVbZlsBaCFZaszepbryrArS05PWmJSBQ6mta+v9iz0pUIAbW1eBILIg==" "integrity": "sha512-4QYi6Mal4MMfQMSqGIRPGbKIbZygeN83QsWq1ixpUwvtfgAZot5BrCKzGygvZaV+CnELdTwD0S4cqUNozq7/Cw=="
}, },
"capture-exit": { "capture-exit": {
"version": "2.0.0", "version": "2.0.0",
@ -4932,9 +4932,9 @@
} }
}, },
"electron-to-chromium": { "electron-to-chromium": {
"version": "1.3.567", "version": "1.3.570",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.567.tgz", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.570.tgz",
"integrity": "sha512-1aKkw0Hha1Bw9JA5K5PT5eFXC/TXbkJvUfNSNEciPUMgSIsRJZM1hF2GUEAGZpAbgvd8En21EA+Lv820KOhvqA==" "integrity": "sha512-Y6OCoVQgFQBP5py6A/06+yWxUZHDlNr/gNDGatjH8AZqXl8X0tE4LfjLJsXGz/JmWJz8a6K7bR1k+QzZ+k//fg=="
}, },
"emoji-regex": { "emoji-regex": {
"version": "8.0.0", "version": "8.0.0",
@ -5091,9 +5091,9 @@
} }
}, },
"escalade": { "escalade": {
"version": "3.0.2", "version": "3.1.0",
"resolved": "https://registry.npmjs.org/escalade/-/escalade-3.0.2.tgz", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.0.tgz",
"integrity": "sha512-gPYAU37hYCUhW5euPeR+Y74F7BL+IBsV93j5cvGriSaD1aG6MGsqsV1yamRdrWrb2j3aiZvb0X+UBOWpx3JWtQ==" "integrity": "sha512-mAk+hPSO8fLDkhV7V0dXazH5pDc6MrjBTPyD3VeKzxnVFjH1MIxbCdqGZB9O8+EwWakZs3ZCbDS4IpRt79V1ig=="
}, },
"escape-string-regexp": { "escape-string-regexp": {
"version": "1.0.5", "version": "1.0.5",
@ -10901,33 +10901,12 @@
} }
}, },
"string.prototype.trim": { "string.prototype.trim": {
"version": "1.2.1", "version": "1.2.2",
"resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.1.tgz", "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.2.tgz",
"integrity": "sha512-MjGFEeqixw47dAMFMtgUro/I0+wNqZB5GKXGt1fFr24u3TzDXCPu7J9Buppzoe3r/LqkSDLDDJzE15RGWDGAVw==", "integrity": "sha512-b5yrbl3BXIjHau9Prk7U0RRYcUYdN4wGSVaqoBQS50CCE3KBuYU0TYRNPFCP7aVoNMX87HKThdMRVIP3giclKg==",
"requires": { "requires": {
"define-properties": "^1.1.3", "define-properties": "^1.1.3",
"es-abstract": "^1.17.0-next.1", "es-abstract": "^1.18.0-next.0"
"function-bind": "^1.1.1"
},
"dependencies": {
"es-abstract": {
"version": "1.17.6",
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.6.tgz",
"integrity": "sha512-Fr89bON3WFyUi5EvAeI48QTWX0AyekGgLA8H+c+7fbfCkJwRWRMLd8CQedNEyJuoYYhmtEqY92pgte1FAhBlhw==",
"requires": {
"es-to-primitive": "^1.2.1",
"function-bind": "^1.1.1",
"has": "^1.0.3",
"has-symbols": "^1.0.1",
"is-callable": "^1.2.0",
"is-regex": "^1.1.0",
"object-inspect": "^1.7.0",
"object-keys": "^1.1.1",
"object.assign": "^4.1.0",
"string.prototype.trimend": "^1.0.1",
"string.prototype.trimstart": "^1.0.1"
}
}
} }
}, },
"string.prototype.trimend": { "string.prototype.trimend": {

View File

@ -12,7 +12,7 @@
"module": "build-module/index.js", "module": "build-module/index.js",
"dependencies": { "dependencies": {
"@wordpress/e2e-test-utils": "4.6.0", "@wordpress/e2e-test-utils": "4.6.0",
"@woocommerce/model-factories": "file:../factories" "@woocommerce/api": "file:../api"
}, },
"publishConfig": { "publishConfig": {
"access": "public" "access": "public"

View File

@ -6,8 +6,6 @@
* Internal dependencies * Internal dependencies
*/ */
import { StoreOwnerFlow } from './flows'; import { StoreOwnerFlow } from './flows';
import modelRegistry from './factories';
import { SimpleProduct } from '@woocommerce/model-factories';
import { clickTab, uiUnblocked, verifyCheckboxIsUnset } from './page-utils'; import { clickTab, uiUnblocked, verifyCheckboxIsUnset } from './page-utils';
const config = require( 'config' ); const config = require( 'config' );
@ -359,11 +357,11 @@ const completeOldSetupWizard = async () => {
* Create simple product. * Create simple product.
*/ */
const createSimpleProduct = async () => { const createSimpleProduct = async () => {
const product = await modelRegistry.getFactory( SimpleProduct ).create( { /*const product = await modelRegistry.getFactory( SimpleProduct ).create( {
name: simpleProductName, name: simpleProductName,
regularPrice: '9.99' regularPrice: '9.99'
} ); } );
return product.id; return product.id;*/
} ; } ;
/** /**

View File

@ -1,24 +0,0 @@
import {
AdapterTypes,
initializeUsingBasicAuth,
ModelRegistry,
registerSimpleProduct,
} from '@woocommerce/model-factories';
const config = require( 'config' );
const modelRegistry = new ModelRegistry()
// Register all of the different factories that we're going to need.
registerSimpleProduct( modelRegistry );
// Make sure to perform the initialization AFTER registering all of the factories, otherwise the adapters might be
// missed on subsequent registrations.
initializeUsingBasicAuth( modelRegistry,
config.get( 'url' ) + '/wp-json',
config.get( 'users.admin.username' ),
config.get( 'users.admin.password' )
);
modelRegistry.changeAllFactoryAdapters( AdapterTypes.API );
export default modelRegistry;

View File

@ -1,20 +1,32 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "es5",
"module": "commonjs",
"incremental": true,
"allowJs": true, "allowJs": true,
"checkJs": true, "checkJs": true,
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,
"esModuleInterop": true, "jsx": "preserve",
"target": "es6",
"module": "commonjs",
"incremental": true,
"declaration": true, "declaration": true,
"declarationMap": true,
"composite": true, "composite": true,
"emitDeclarationOnly": true,
"isolatedModules": true,
/* Strict Type-Checking Options */
"strict": true, "strict": true,
"strictNullChecks": true,
"noImplicitAny": true, /* Additional Checks */
"noUnusedLocals": true, "noUnusedLocals": true,
"noUnusedParameters": true, "noUnusedParameters": true,
"noImplicitReturns": true, "noImplicitReturns": true,
"noFallthroughCasesInSwitch": true "noFallthroughCasesInSwitch": true,
/* Module Resolution Options */
"moduleResolution": "node",
/* This needs to be false so our types are possible to consume without setting this */
"esModuleInterop": false,
"resolveJsonModule": true
} }
} }