Skip to content

Commit

Permalink
feat: fix commonjs, removed rollup and umd
Browse files Browse the repository at this point in the history
  • Loading branch information
nmccready committed Sep 13, 2024
1 parent 50eeaff commit 44e115a
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 37 deletions.
8 changes: 2 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"umd"
],
"scripts": {
"build": "rollup -c ./rollup.config.js",
"build": "rm -rf lib && npx tsc",
"coveralls": "cat ./coverage/lcov.info | coveralls",
"docs:api:markdown": "npx typedoc --theme markdown --exclude ./src/test --out ./docs/api ./src",
"docs:api:website": "npx typedoc --exclude ./src/test --out docs ./src",
Expand All @@ -42,8 +42,6 @@
"@biiaidt/node-memwatch": "2.0.1",
"@commitlint/cli": "^19",
"@commitlint/config-conventional": "^19",
"@rollup/plugin-commonjs": "^26.0.1",
"@rollup/plugin-typescript": "^11.1.6",
"@types/debug": "^4",
"@types/jest": "^29.5.13",
"@znemz/js-common-eslint-config": "^0.2.2",
Expand All @@ -56,12 +54,10 @@
"hook-std": "0.X",
"jest": "^29.7.0",
"prettier": "^1.18.2",
"rollup": "4.21.3",
"sort-package-json": "^2.10.1",
"typescript": "^5.6.2"
},
"engines": {
"node": ">= 14"
},
"umd": "umd/index.js"
}
}
28 changes: 0 additions & 28 deletions rollup.config.js

This file was deleted.

10 changes: 10 additions & 0 deletions scripts/mockPublish
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
set -e
set -o pipefail

mkdir -p ./tmp
npm pack
mv *.tgz ./tmp
tar xvzf tmp/*.tgz -C ./tmp

exit 0
41 changes: 41 additions & 0 deletions test/publish.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
const os = require('os');
const del = require('del');

const { exec } = require('child_process');

const isWindows = os.platform() === 'win32';

const cleanUp = async () => {
return del(['./tmp']);
};

function makeTestPackage(cb) {
if (isWindows) {
this.skip();
}

exec('./scripts/mockPublish', cb);
}

describe('mock publish', () => {
beforeEach(makeTestPackage);
afterEach(cleanUp);

// with regards to averting npm publishing disasters https://github.com/gulp-sourcemaps/gulp-sourcemaps/issues/246
it('can load a published version', (done) => {
if (isWindows) {
this.skip();
}

try {
// attempt to load a packed / unpacked potential deployed version
// eslint-disable-next-line import/no-unresolved
require('../tmp/package/lib/index');
} catch (error) {
done(error);
return;
}

done();
});
});
6 changes: 3 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
"noLib": false,
"emitDecoratorMetadata": true,
"noImplicitAny": false,
"module": "ESNext",
"module": "CommonJS",
"target": "ES2020",
"experimentalDecorators": true,
"declaration": true,
"noResolve": false,
"moduleResolution": "node",
"outDir": ".tmp",
"outDir": "lib",
"allowJs": true,
},
"exclude": ["node_modules", ".tmp", "jest.config.js"]
"include": ["src/**/*"]
}

0 comments on commit 44e115a

Please sign in to comment.