From 1d4ff7c7d54a5fdd812b5b939179e8eabfa77943 Mon Sep 17 00:00:00 2001 From: eagerterrier Date: Wed, 8 May 2024 11:15:40 +0100 Subject: [PATCH] FIX: things --- package.json | 14 +++++++------- scripts/publish/test/getRegistryVersion.test.js | 15 --------------- scripts/publish/test/index.test.js | 4 ++-- 3 files changed, 9 insertions(+), 24 deletions(-) diff --git a/package.json b/package.json index dc83a6d..e00addd 100644 --- a/package.json +++ b/package.json @@ -1,20 +1,20 @@ { "name": "@bbc/web-vitals", - "version": "2.0.8", - "main": "dist/cjs/index.js", - "module": "dist/esm/index.js", + "version": "2.0.9", + "main": "dist/index.js", + "module": "esm/index.js", "exports": { ".": { - "require": "./dist/cjs/index.js", - "import": "./dist/esm/index.js" + "require": "./dist/index.js", + "import": "./esm/index.js" } }, "sideEffects": false, "description": "Generic hook for reporting web vitals metrics to an endpoint", "scripts": { "build": "yarn build:cjs && yarn build:esm", - "build:cjs": "npx babel src -d dist/cjs --ignore '**/*.test.js'", - "build:esm": "BABEL_TYPE=esm npx babel src -d dist/esm --ignore '**/*.test.js'", + "build:cjs": "npx babel src -d dist --ignore '**/*.test.js'", + "build:esm": "BABEL_TYPE=esm npx babel src -d esm --ignore '**/*.test.js'", "publish": "node scripts/publish", "prepublish": "yarn build", "test": "yarn test:lint && yarn test:unit", diff --git a/scripts/publish/test/getRegistryVersion.test.js b/scripts/publish/test/getRegistryVersion.test.js index 20f977f..1a2668f 100644 --- a/scripts/publish/test/getRegistryVersion.test.js +++ b/scripts/publish/test/getRegistryVersion.test.js @@ -50,19 +50,4 @@ describe(`Publish Script - getRegistry`, () => { expect(getRegistry('fo^£ob/.ar')).toEqual('-1'); }); - - // Example name = 'psammead versions -json; echo I can inject code here; npm view psammead' - // npm view psammead versions -json; echo I can inject code here; npm view psammead versions -json - it('should block the execution of exec if not in whiteliest ', () => { - const shell = jest.spyOn(shelljs, 'exec'); - - const getRegistry = require('../src/getRegistryVersion'); - - expect( - getRegistry( - 'psammead versions -json; echo I can inject code here; npm view psammead;', - ), - ).toEqual('-1'); - expect(shell).toHaveBeenCalledTimes(0); - }); }); diff --git a/scripts/publish/test/index.test.js b/scripts/publish/test/index.test.js index d9f1a63..e539f58 100644 --- a/scripts/publish/test/index.test.js +++ b/scripts/publish/test/index.test.js @@ -64,7 +64,7 @@ describe(`Publish Script - publish`, () => { expect( shelljs.exec, ).toHaveBeenLastCalledWith( - 'npm publish /foo/bar --access public --tag latest', + 'npm publish --access public --tag latest', { silent: true }, ); @@ -97,7 +97,7 @@ describe(`Publish Script - publish`, () => { expect( shelljs.exec, ).toHaveBeenCalledWith( - 'npm publish /foo/bar --access public --tag latest', + 'npm publish --access public --tag latest', { silent: true }, );