diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d2e47be..c77fe82 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -72,7 +72,7 @@ jobs: strategy: matrix: os: [ ubuntu-latest, windows-latest ] - node-version: [ 18, 24 ] + node-version: [ 12, 18, 24 ] runs-on: ${{ matrix.os }} steps: @@ -99,12 +99,12 @@ jobs: # node --loader ts-node/esm --experimental-specifier-resolution=node ./src/test/ts/spawn.test.ts # timeout-minutes: 5 # -# - name: Run smoke:esm tests -# if: matrix.node-version >= 12 -# run: npm run test:smoke:esm -# -# - name: Run smoke:cjs tests -# run: npm run test:smoke:cjs + - name: Run smoke:esm tests + if: matrix.node-version >= 12 + run: npm run test:smoke:esm + + - name: Run smoke:cjs tests + run: npm run test:smoke:cjs # smoke-bun: # runs-on: ubuntu-latest diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index cdd41e1..ef4c16a 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -13,7 +13,7 @@ name: "CodeQL Advanced" on: push: - branches: ["turn-on-later"] + branches: [ "turn-on-later" ] # push: # branches: [ "main" ] # pull_request: diff --git a/package.json b/package.json index 81c3ad5..11730ad 100644 --- a/package.json +++ b/package.json @@ -30,8 +30,8 @@ "test:target": "git diff --exit-code --quiet || (echo 'Uncommitted changes' && exit 1)", "_test:lint": "eslint -c src/test/lint/.eslintrc.json src", "test:unit": "c8 -r lcov -r text -o target/coverage -x src/scripts -x src/test -x target node --experimental-specifier-resolution=node src/test/ts/ip.test.ts", - "_test:smoke:esm": "node ./src/test/smoke/invoke.test.mjs", - "_test:smoke:cjs": "node src/test/smoke/invoke.test.cjs", + "test:smoke:esm": "node ./src/test/smoke/ip.test.mjs", + "test:smoke:cjs": "node src/test/smoke/ip.test.cjs", "test:jsr": "jsr publish --dry-run", "test:audit": "npm audit", "_publish:draft": "npm run build && npm publish --no-git-tag-version", diff --git a/src/main/ts/ip.ts b/src/main/ts/ip.ts index 21ec276..ac7e64a 100644 --- a/src/main/ts/ip.ts +++ b/src/main/ts/ip.ts @@ -1 +1,5 @@ export const foo = 'bar' + +export const ip = {foo} + +export default ip diff --git a/src/test/smoke/ip.test.cjs b/src/test/smoke/ip.test.cjs new file mode 100644 index 0000000..2eedac0 --- /dev/null +++ b/src/test/smoke/ip.test.cjs @@ -0,0 +1,9 @@ +const assert = require('assert') +const ip = require('@webpod/ip') + +// Smoke CJS test +{ + assert.equal(ip.foo, 'bar') +} + +console.log('smoke cjs: ok') diff --git a/src/test/smoke/ip.test.mjs b/src/test/smoke/ip.test.mjs new file mode 100644 index 0000000..cdd13f1 --- /dev/null +++ b/src/test/smoke/ip.test.mjs @@ -0,0 +1,9 @@ +import assert from 'assert' +import ip from '@webpod/ip' + +// Smoke ESM test +{ + assert.equal(ip.foo, 'bar') +} + +console.log('smoke ems: ok') diff --git a/target/cjs/ip.cjs b/target/cjs/ip.cjs index f892412..924cdac 100644 --- a/target/cjs/ip.cjs +++ b/target/cjs/ip.cjs @@ -8,11 +8,16 @@ const { // src/main/ts/ip.ts var ip_exports = {}; __export(ip_exports, { - foo: () => foo + default: () => ip_default, + foo: () => foo, + ip: () => ip }); module.exports = __toCommonJS(ip_exports); var foo = "bar"; +var ip = { foo }; +var ip_default = ip; // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { - foo + foo, + ip }); \ No newline at end of file diff --git a/target/dts/ip.d.ts b/target/dts/ip.d.ts index c48b893..444eab9 100644 --- a/target/dts/ip.d.ts +++ b/target/dts/ip.d.ts @@ -1 +1,5 @@ export declare const foo = "bar"; +export declare const ip: { + foo: string; +}; +export default ip; diff --git a/target/esm/ip.mjs b/target/esm/ip.mjs index 50a257e..b04ba96 100644 --- a/target/esm/ip.mjs +++ b/target/esm/ip.mjs @@ -1,5 +1,9 @@ // src/main/ts/ip.ts var foo = "bar"; +var ip = { foo }; +var ip_default = ip; export { - foo + ip_default as default, + foo, + ip };