Skip to content

Commit

Permalink
feat: Remove support for CJS. ESM only (#106)
Browse files Browse the repository at this point in the history
* feat: Remove support for CJS. ESM only

BREAKING CHANGE: This PR removes the support for CJS in this module. This module is now ESM only.

* feat: Remove CJS support. ESM only.

BREAKING CHANGE: Support for CJS is now removed in this module. It is ESM only.

* ci: use 0.0.0.0 instead of localhost

* fix: remove console.log() statement

Co-authored-by: Trygve Lie <trygve.lie@finn.no>
  • Loading branch information
trygve-lie and Trygve Lie authored Aug 22, 2022
1 parent 0fd760d commit d74f8c8
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 38 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ on:
push:
branches:
- master
- alpha
- beta
- next

jobs:
Expand All @@ -17,7 +15,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 14.x
node-version: 16.x
- name: npm install
run: |
npm install
Expand All @@ -44,7 +42,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 14.x
node-version: 16.x
- name: npm install
run: |
npm install
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
node-version: [14.x, 16.x]
node-version: [16.x, 18.x]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
Expand Down
12 changes: 2 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,17 @@
"version": "2.0.0-next.3",
"description": "A node.js client for interacting with a Eik server.",
"type": "module",
"main": "./dist/index.cjs",
"exports": {
"import": "./src/index.js",
"require": "./dist/index.cjs"
},
"main": "./src/index.js",
"files": [
"CHANGELOG.md",
"package.json",
"LICENSE",
"dist",
"src"
],
"scripts": {
"test": "tap --no-coverage",
"lint:fix": "eslint --fix .",
"lint": "eslint .",
"prepare": "npm run -s build",
"build": "rollup -c"
"lint": "eslint ."
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -50,7 +43,6 @@
"eslint-plugin-import": "2.26.0",
"eslint-plugin-prettier": "4.2.1",
"prettier": "2.7.1",
"rollup": "2.77.2",
"semantic-release": "19.0.3",
"tap": "16.3.0",
"@babel/eslint-parser": "7.18.9"
Expand Down
2 changes: 0 additions & 2 deletions release.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ module.exports = {
preset: 'angular',
branches: [
{ name: 'master' },
{ name: 'alpha', prerelease: true },
{ name: 'beta', prerelease: true },
{ name: 'next', prerelease: true },
],
};
16 changes: 0 additions & 16 deletions rollup.config.js

This file was deleted.

11 changes: 6 additions & 5 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class Server {

listen() {
return new Promise((resolve) => {
const connection = this.server.listen(0, 'localhost', () => {
const connection = this.server.listen(0, '0.0.0.0', () => {
resolve(connection);
});
});
Expand Down Expand Up @@ -175,14 +175,14 @@ tap.test('Client - Retrieve a file path - Development mode is set to "true" - Ba
tap.test('Client - Retrieve a file path - Development mode is set to "true" - Base is set to absolute URL', async (t) => {
const client = new NodeClient({
development: true,
base: 'http://localhost:7777/prefix/',
base: 'http://0.0.0.0:7777/prefix/',
path: t.context.fixture,
});
await client.load();

const resolved = client.file('/some/path/foo.js');

t.equal(resolved.value, 'http://localhost:7777/prefix/some/path/foo.js');
t.equal(resolved.value, 'http://0.0.0.0:7777/prefix/some/path/foo.js');
t.end();
});

Expand All @@ -194,6 +194,7 @@ tap.test('Client - Load maps', async (t) => {
await client.load();

const maps = client.maps();

t.same(maps, [
{ imports: { eik: '/src/eik.js' } },
{ imports: { eik: '/src/eik.js' } }
Expand Down Expand Up @@ -232,14 +233,14 @@ tap.test('Client - Retrieve a base - Development mode is set to "true" - Base is
tap.test('Client - Retrieve a base - Development mode is set to "true" - Base is set to a absolute URL', async (t) => {
const client = new NodeClient({
development: true,
base: 'http://localhost:7777/prefix/some/path/',
base: 'http://0.0.0.0:7777/prefix/some/path/',
path: t.context.fixture,
});
await client.load();

const resolved = client.base();

t.equal(resolved, 'http://localhost:7777/prefix/some/path');
t.equal(resolved, 'http://0.0.0.0:7777/prefix/some/path');
t.end();
});

Expand Down

0 comments on commit d74f8c8

Please sign in to comment.