Skip to content

Commit

Permalink
Convert to pnpm (#1611)
Browse files Browse the repository at this point in the history
* Converted to pnpm

* Upgrade dreambase-library for TSON-simplified fix

* Converted travis scripts to use pnpm

* Switched to pnpm in scripts and documentation

* Update node in travis ci

* Adding missing dev dep: webpack

* reinstalled webpack in test-dexie-relationships

* Trying to workaround pnpm bug
  • Loading branch information
dfahlander committed Oct 3, 2022
1 parent bd2ae88 commit 85b5f61
Show file tree
Hide file tree
Showing 33 changed files with 4,451 additions and 5,241 deletions.
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
auto-install-peers=true
14 changes: 11 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
cache:
npm: false
directories:
- "~/.pnpm-store"
before_install:
- curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm@7
- pnpm config set store-dir ~/.pnpm-store
install:
- pnpm install
language: node_js
before_install: if [[ `npm -v` != 7* ]]; then npm i -g npm@7; fi
addons:
firefox: "85.0"
node_js:
- "12"
- "16"
matrix:
fast_finish: true
services:
Expand All @@ -24,7 +32,7 @@ branches:
- master-2
- master-1
script:
- npm run build
- pnpm run build
- cd $TF
- pwd
- bash ./travis.sh
Expand Down
27 changes: 16 additions & 11 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ We appreciate contributions in forms of:
Contribute while developing your own app
========================================

Here is a little cheat-sheet for how to symlink your app's `node_modules/dexie` to a place where you can edit the source, version control your changes and create pull requests back to Dexie. Assuming you've already ran `npm install dexie --save` for the app your are developing.
Dexie uses pnpm package manager. Refer to [pnpm.io/installation](https://pnpm.io/installation) for how to install pnpm.

Here is a little cheat-sheet for how to symlink your app's `node_modules/dexie` to a place where you can edit the source, version control your changes and create pull requests back to Dexie. Assuming you've already ran `npm install dexie` for the app your are developing.

1. Fork Dexie.js from the web gui on github
2. Clone your fork locally by launching a shell/command window and cd to a neutral place (like `~repos/`, `c:\repos` or whatever)
Expand All @@ -22,39 +24,42 @@ Here is a little cheat-sheet for how to symlink your app's `node_modules/dexie`
```
git clone https://github.com/YOUR-USERNAME/Dexie.js.git dexie
cd dexie
npm install
npm run build
npm link
pnpm install
pnpm run build
npm link # Or yarn link or pnpm link --global depending on what package manager you are using.
```
3. cd to your app directory and write:
```
npm link dexie
npm link dexie # Or yarn link dexie / pnpm link dexie depending on your package manager.
```

Your app's `node_modules/dexie/` is now sym-linked to the Dexie.js clone on your hard drive so any change you do there will propagate to your app. Build dexie.js using `npm run build` or `npm run watch`. The latter will react on any source file change and rebuild the dist files.
Your app's `node_modules/dexie/` is now sym-linked to the Dexie.js clone on your hard drive so any change you do there will propagate to your app. Build dexie.js using `pnpm run build` or `pnpm run watch`. The latter will react on any source file change and rebuild the dist files.

That's it. Now you're up and running to test and commit changes to files under dexie/src/* or dexie/test/* and the changes will instantly affect the app you are developing.

If you're on yarn or pnpm, do the same procedures using yarn link / pnpm link.

Pull requests are more than welcome. Some advices are:

* Run npm test before making a pull request.
* Run pnpm test before making a pull request.
* If you find an issue, a unit test that reproduces it is lovely ;). If you don't know where to put it, put it in `test/tests-misc.js`. We use qunit. Just look at existing tests in `tests-misc.js` to see how they should be written. Tests are transpiled in the build script so you can use ES6 if you like.

Build
-----
```
npm install
npm run build
# To install pnpm, see https://pnpm.io/installation
pnpm install
pnpm run build
```

Test
----
```
npm test
pnpm test
```

Watch
-----
```
npm run watch
pnpm run watch
```
35 changes: 5 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,50 +229,25 @@ https://unpkg.com/dexie@latest/dist/dexie.d.ts
Contributing
============
Here is a little cheat-sheet for how to symlink your app's `node_modules/dexie` to a place where you can edit the source, version control your changes and create pull requests back to Dexie. Assuming you've already ran `npm install dexie --save` for the app your are developing.
1. Fork Dexie.js from the web gui on github
2. Clone your fork locally by launching a shell/command window and cd to a neutral place (like `~repos/`, `c:\repos` or whatever)
3. Run the following commands:
```
git clone https://github.com/YOUR-USERNAME/Dexie.js.git dexie
cd dexie
npm install
npm run build
npm link
```
3. cd to your app directory and write:
```
npm link dexie
```
Your app's `node_modules/dexie/` is now sym-linked to the Dexie.js clone on your hard drive so any change you do there will propagate to your app. Build dexie.js using `npm run build` or `npm run watch`. The latter will react on any source file change and rebuild the dist files.
That's it. Now you're up and running to test and commit changes to files under dexie/src/* or dexie/test/* and the changes will instantly affect the app you are developing.
Pull requests are more than welcome. Some advices are:
* Run npm test before making a pull request.
* If you find an issue, a unit test that reproduces it is lovely ;). If you don't know where to put it, put it in `test/tests-misc.js`. We use qunit. Just look at existing tests in `tests-misc.js` to see how they should be written. Tests are transpiled in the build script so you can use ES6 if you like.
See [CONTRIBUTING.md](CONTRIBUTING.md)
Build
-----
```
npm install
npm run build
pnpm install
pnpm run build
```
Test
----
```
npm test
pnpm test
```
Watch
-----
```
npm run watch
pnpm run watch
```
Expand Down
15 changes: 8 additions & 7 deletions addons/Dexie.Observable/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "dexie-observable",
"version": "4.0.0-beta.13",
"packageManager": "^pnpm@7.9.5",
"description": "Addon to Dexie that makes it possible to observe database changes no matter if they occur on other db instance or other window.",
"main": "dist/dexie-observable.js",
"module": "dist/dexie-observable.es.js",
Expand Down Expand Up @@ -36,7 +37,7 @@
"scripts": {
"build": "just-build",
"watch": "just-build --watch",
"test": "npm run build && npm run test:typings && npm run test:unit && npm run test:integration",
"test": "pnpm run build && pnpm run test:typings && pnpm run test:unit && pnpm run test:integration",
"test:unit": "karma start test/unit/karma.conf.js --single-run",
"test:integration": "karma start test/integration/karma.conf.js --single-run",
"test:typings": "just-build test-typings",
Expand Down Expand Up @@ -69,22 +70,22 @@
],
"test": [
"# Build the unit tests (integration tests need no build)",
"tsc --allowJs --moduleResolution node --lib es2015,dom -t es5 -m es2015 --outDir tools/tmp/es5/test --rootDir ../.. --sourceMap test/unit/unit-tests-all.js [--watch 'Compilation complete.']",
"rollup -c tools/build-configs/rollup.tests.config.js",
"eslint test/unit --cache --ignore-pattern bundle.js"
"tsc --allowJs --moduleResolution node --lib es2018,dom -t es5 -m es2015 --outDir tools/tmp/es5/test --rootDir ../.. --sourceMap test/unit/unit-tests-all.js [--watch 'Compilation complete.']",
"rollup -c tools/build-configs/rollup.tests.config.js"
],
"test-typings": [
"tsc -p test/typings/"
]
},
"homepage": "https://dexie.org",
"peerDependencies": {
"dexie": "^3.0.2 || ^4.0.0-alpha.1"
"dexie": "workspace:^3.0.2 || ^4.0.0-alpha.1"
},
"devDependencies": {
"dexie": "^3.0.2 || ^4.0.0-alpha.1",
"@types/node": "^18.7.14",
"dexie": "workspace:^3.0.2 || ^4.0.0-alpha.1",
"eslint": "^7.27.0",
"just-build": "^0.9.19",
"just-build": "^0.9.24",
"qunit": "^2.9.2",
"uglify-js": "^3.5.6"
}
Expand Down
6 changes: 3 additions & 3 deletions addons/Dexie.Observable/test/integration/travis.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash -e
echo "Installing dependencies for dexie-observable"
npm install >/dev/null
npm run build
npm run test:integration
pnpm install >/dev/null
pnpm run build
pnpm run test:integration
2 changes: 1 addition & 1 deletion addons/Dexie.Observable/test/typings/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"strictNullChecks": true,
"outDir": "../../tools/tmp/test-typings",
"moduleResolution": "node",
"lib": ["dom", "es2015"]
"lib": ["dom", "es2018"]
},
"files": [
"test-typings.ts"
Expand Down
8 changes: 4 additions & 4 deletions addons/Dexie.Observable/test/unit/travis.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash -e
echo "Installing dependencies for dexie-observable"
npm install >/dev/null
npm run build
npm run test:typings
npm run test:unit
pnpm install >/dev/null
pnpm run build
pnpm run test:typings
pnpm run test:unit
13 changes: 7 additions & 6 deletions addons/Dexie.Syncable/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "dexie-syncable",
"version": "4.0.0-beta.13",
"packageManager": "^pnpm@7.9.5",
"description": "Addon to Dexie that makes it possible to sync indexeDB with remote databases.",
"main": "dist/dexie-syncable.js",
"module": "dist/dexie-syncable.es.js",
Expand Down Expand Up @@ -35,7 +36,7 @@
"scripts": {
"build": "just-build",
"watch": "just-build --watch",
"test": "npm run build && npm run test:typings && npm run test:unit && npm run test:integration",
"test": "pnpm run build && pnpm run test:typings && pnpm run test:unit && pnpm run test:integration",
"test:unit": "karma start test/unit/karma.conf.js --single-run",
"test:integration": "karma start test/integration/karma.conf.js --single-run",
"test:typings": "tsc -p test/test-typings/",
Expand Down Expand Up @@ -70,14 +71,14 @@
},
"homepage": "https://dexie.org",
"peerDependencies": {
"dexie": "^3.0.2 || ^4.0.0-alpha.1",
"dexie-observable": "^3.0.0-beta.9"
"dexie": "workspace:^3.0.2 || ^4.0.0-alpha.1",
"dexie-observable": "workspace:^"
},
"devDependencies": {
"dexie": "^3.0.2 || ^4.0.0-alpha.1",
"dexie-observable": "^3.0.0-beta.9",
"dexie": "workspace:^3.0.2 || ^4.0.0-alpha.1",
"dexie-observable": "workspace:^",
"eslint": "^5.16.0",
"just-build": "^0.9.19",
"just-build": "^0.9.24",
"qunit": "^2.9.2",
"uglify-js": "^3.5.6"
}
Expand Down
10 changes: 5 additions & 5 deletions addons/Dexie.Syncable/test/integration/travis.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/bin/bash -e
cd ../../../Dexie.Observable
echo "Installing dependencies for dexie-observable"
npm install >/dev/null
pnpm install >/dev/null
echo "Building dexie-observable"
npm run build
pnpm run build
cd -
echo "Installing dependencies for dexie-syncable"
npm install >/dev/null
pnpm install >/dev/null
echo "Building dexie-syncable"
npm run build
pnpm run build

npm run test:integration
pnpm run test:integration
12 changes: 6 additions & 6 deletions addons/Dexie.Syncable/test/unit/travis.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/bin/bash -e
cd ../../../Dexie.Observable
echo "Installing dependencies for dexie-observable"
npm install >/dev/null
pnpm install >/dev/null
echo "Building dexie-observable"
npm run build
pnpm run build
cd -
echo "Installing dependencies for dexie-syncable"
npm install >/dev/null
pnpm install >/dev/null
echo "Building dexie-syncable"
npm run build
pnpm run build

npm run test:typings
npm run test:unit
pnpm run test:typings
pnpm run test:unit
9 changes: 5 additions & 4 deletions addons/dexie-cloud/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "dexie-cloud-addon",
"version": "4.0.0-beta.21",
"packageManager": "^pnpm@7.9.5",
"description": "Dexie addon that syncs with to Dexie Cloud",
"main": "dist/umd/dexie-cloud-addon.js",
"module": "dist/module-es5/dexie-cloud-addon.js",
Expand All @@ -21,7 +22,7 @@
"url": "https://github.com/dexie/Dexie.js.git"
},
"scripts": {
"test": "just-build test && npm run test-unit",
"test": "just-build test && pnpm run test-unit",
"test-unit": "karma start test/unit/karma.conf.js --single-run",
"build": "just-build && bash ./copydts.sh",
"watch": "just-build --watch",
Expand Down Expand Up @@ -87,7 +88,7 @@
"@rollup/plugin-commonjs": "^18.0.0",
"@rollup/plugin-node-resolve": "^11.2.1",
"@types/node": "*",
"dreambase-library": "^1.0.13",
"dreambase-library": "^1.0.18",
"just-build": "*",
"karma": "*",
"karma-browserstack-launcher": "*",
Expand All @@ -106,10 +107,10 @@
"universal-imports": "^1.0.3"
},
"dependencies": {
"dexie-cloud-common": "^1.0.23"
"dexie-cloud-common": "workspace:^1.0.23"
},
"peerDependencies": {
"dexie": "^4.0.0-alpha.3",
"dexie": "workspace:^4.0.0-alpha.3",
"rxjs": "^7.x"
}
}
2 changes: 1 addition & 1 deletion addons/dexie-cloud/src/default-ui/LoginDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export function LoginDialog({
}: DXCGenericUserInteraction<string, { [name: string]: DXCInputField }>) {
const [params, setParams] = useState<{ [param: string]: string }>({});

const firstFieldRef = useRef<HTMLInputElement>();
const firstFieldRef = useRef<HTMLInputElement>(null);
useLayoutEffect(()=>firstFieldRef.current?.focus(), []);

return (
Expand Down
15 changes: 8 additions & 7 deletions addons/dexie-cloud/test/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
{
"compilerOptions": {
"jsx": "react",
"jsxFactory": "h",
"jsxFragmentFactory": "Fragment",
"target": "es5",
"module": "es2015",
"target": "ES5",
"declaration": true,
"importHelpers": true,
"strictNullChecks": true,
"noImplicitAny": false,
"noImplicitReturns": true,
"moduleResolution": "node",
"lib": ["es2018", "dom"],
"lib": ["ES2018", "DOM"],
"forceConsistentCasingInFileNames": true,
"outDir": "../tools/tmp/",
"sourceMap": true,
"rootDir": "..",
"downlevelIteration": true
"jsx": "react",
"jsxFactory": "h",
"jsxFragmentFactory": "Fragment",
"downlevelIteration": true,
"outDir": "../tools/tmp/",
},
"include": [
"../src/",
Expand Down
Loading

0 comments on commit 85b5f61

Please sign in to comment.