Skip to content

Commit 71a6727

Browse files
committed
test: implement cjs and esm check test
1 parent 97843c6 commit 71a6727

File tree

10 files changed

+58
-7
lines changed

10 files changed

+58
-7
lines changed

package-lock.json

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
"actualize-issue-templates": "npx tsx ./tools/actualize-issue-templates.ts"
1717
},
1818
"workspaces": [
19-
"packages/*",
20-
"test/esm-bundler-import-repo"
19+
"packages/*"
2120
],
2221
"author": "artalar",
2322
"license": "MIT",

packages/cjs-import-check/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#reatom CJS issue
2+
Reproduce for CJS-related reatom issue
3+
4+
This repo is used to reproduce problems with import of "module" exported files.
5+
6+
```
7+
yarn
8+
yarn build
9+
yarn start
10+
```
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "@reatom-private/cjs-import-check",
3+
"version": "1.0.0",
4+
"main": "index.js",
5+
"type": "commonjs",
6+
"private": true,
7+
"license": "MIT",
8+
"dependencies": {
9+
"@reatom/framework": "^3.4.37"
10+
},
11+
"scripts": {
12+
"build": "tsc -p tsconfig.json",
13+
"start": "node ./dist/hello.js",
14+
"pretest": "npm run build",
15+
"test": "node ./dist/hello.js"
16+
},
17+
"devDependencies": {
18+
"typescript": "5.4.5"
19+
}
20+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
const {atom, createCtx} = require('@reatom/framework')
2+
const me = atom('check ✅', 'me')
3+
const ctx = createCtx()
4+
console.log('CommonJS import:', ctx.get(me))
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"compilerOptions": {
3+
"rootDir": "src",
4+
"target": "ES2022",
5+
"module": "ES2022",
6+
"moduleResolution": "Node10",
7+
"esModuleInterop": true,
8+
"forceConsistentCasingInFileNames": true,
9+
"strict": true,
10+
"skipLibCheck": true,
11+
"outDir": "./dist",
12+
},
13+
}
14+

test/esm-bundle-import-repo/package.json renamed to packages/esm-import-check/package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
{
2-
"name": "check-ts-issue",
2+
"name": "@reatom-private/esm-import-check",
33
"version": "1.0.0",
44
"main": "index.js",
55
"type": "module",
66
"license": "MIT",
7+
"private": true,
78
"dependencies": {
89
"@reatom/framework": "^3.4.37"
910
},
1011
"scripts": {
1112
"build": "tsc -p tsconfig.json",
12-
"start": "node ./dist/hello.js"
13+
"start": "node ./dist/hello.js",
14+
"pretest": "npm run build",
15+
"test": "node ./dist/hello.js"
1316
},
1417
"devDependencies": {
1518
"typescript": "5.4.5"
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
import {atom, createCtx} from '@reatom/framework'
2-
const me = atom('hello', 'me')
2+
const me = atom('check ✅', 'me')
33
const ctx = createCtx()
4-
console.log('mol:', ctx.get(me))
4+
console.log('ESM import:', ctx.get(me))

0 commit comments

Comments
 (0)