Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration for compatibility with Meteor 3.0 #40

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
9af7ebe
build: prepare versions for Meteor 3.0
jankapunkt Jan 4, 2024
7856819
tests: upgraded test project and code to Meteor 3.0
jankapunkt Jan 5, 2024
348bf5c
fix: import lai:collection-extensions as module
jankapunkt Jan 8, 2024
3477780
published 1.0.0-beta300.0
jankapunkt Jan 8, 2024
a793678
docs: add breaking change note
jankapunkt Jan 8, 2024
b839d25
tests: update deps
jankapunkt Jan 8, 2024
0154487
fix: lint fix
jankapunkt Jan 9, 2024
fe522ee
tests: add own test project for Meteor 2.x compatibility
jankapunkt Jan 15, 2024
4d55a2e
build: Meteor 2.x backwards compatibility
jankapunkt Jan 15, 2024
d65ca0a
published 1.0.0-beta300.1 (3x + 2.x support)
jankapunkt Jan 15, 2024
486a6cb
fix: tests versions updated
jankapunkt Apr 15, 2024
9dfa67d
fix(build): no explicit versions for core package dependencies
jankapunkt Apr 15, 2024
0ab461f
release 1.0.0-beta300.2
jankapunkt Apr 15, 2024
5dc0219
tests: upgrade to 3.0-rc.2
jankapunkt Jun 11, 2024
a937534
ci: upgrade versions and node
jankapunkt Jun 11, 2024
a7437db
tests: upgrade to 3.0 rc.4
jankapunkt Jun 14, 2024
c65670a
published 1.0.0-rc300.1
jankapunkt Jun 14, 2024
228a6d9
tests: upgrade test project to 3.0.1
jankapunkt Aug 19, 2024
b21c22f
tests: remove 2x test-proxy
jankapunkt Aug 19, 2024
f2495b2
build: add 2.3 to api.versionsFrom
jankapunkt Aug 19, 2024
387a204
Merge branch 'master' of github.com:Meteor-Community-Packages/mongo-c…
jankapunkt Aug 21, 2024
c3e1426
tests: update test-deps
jankapunkt Aug 21, 2024
e15d172
publish 1.0.0
jankapunkt Aug 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 13 additions & 15 deletions .github/workflows/testsuite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: setup node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 16
node-version: 20

- name: cache dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-16-${{ hashFiles('**/package-lock.json') }}
key: ${{ runner.os }}-node-20-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-16-
${{ runner.os }}-node-20-

- run: cd test-proxy && npm ci && npm run setup && npm run lint

Expand All @@ -36,30 +36,28 @@ jobs:
strategy:
matrix:
meteorRelease:
- '2.3'
- '2.8.0'
- '2.14'
- '3.0-rc.2'
# Latest version
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 16
node-version: 20

- name: Setup meteor ${{ matrix.meteorRelease }}
uses: meteorengineer/setup-meteor@v1
with:
meteor-release: ${{ matrix.meteorRelease }}

- name: cache dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-16-${{ hashFiles('**/package-lock.json') }}
key: ${{ runner.os }}-node-20-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-16-
${{ runner.os }}-node-20-

- run: cd test-proxy && npm ci && npm run setup && npm run test
121 changes: 61 additions & 60 deletions .versions
Original file line number Diff line number Diff line change
@@ -1,60 +1,61 @@
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
dburles:[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
lai:[email protected]
local-test:dburles:[email protected]
[email protected]
[email protected]
[email protected]
meteortesting:[email protected]
meteortesting:[email protected]
meteortesting:[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
dburles:[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
lai:[email protected]
local-test:dburles:[email protected]
[email protected]
[email protected]
[email protected]
meteortesting:[email protected]
meteortesting:[email protected]
meteortesting:[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@
[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

This package augments Mongo.Collection (and the deprecated Meteor.Collection) and allows you to later lookup a Mongo Collection instance by the collection name.

## Version 1.0.0 breaking changes!

This package augments Mongo.Collection (and the deprecated Meteor.Collection) and allows you to later lookup a Mongo Collection instance by the collection name.
> Beginning with version 1.0.0, this packages requires Meteor >= 3.0

Apart from that, everything else remains the same.

## Installation

Expand Down
6 changes: 3 additions & 3 deletions mongo-instances.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/* global CollectionExtensions */
import { Mongo } from 'meteor/mongo'
import { Meteor } from 'meteor/meteor'
import { CollectionExtensions } from 'meteor/lai:collection-extensions'
const instances = []

CollectionExtensions.addExtension(function (name, options) {
CollectionExtensions.addExtension(function mongoCollectionInstances (collection, name, options) {
instances.push({
name: name,
instance: this,
instance: collection,
options: options
})
})
Expand Down
18 changes: 11 additions & 7 deletions mongo-instances.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,35 @@ import { Meteor } from 'meteor/meteor'
const randomName = () => `test${Random.id(6)}`
const equal = (a, b) => expect(a).to.equal(b)

const insert = (collection, doc) => Meteor.isClient
? collection.insert(doc)
: collection.insertAsync(doc)

describe('unit tests', () => {
let collectionName

beforeEach(() => {
collectionName = randomName() // random ID, so a new collection every time
})

it('basic - works Mongo.Collection', () => {
it('basic - works Mongo.Collection', async () => {
const Test = new Mongo.Collection(collectionName)

Test.insert({ test: true })
await insert(Test, { test: true })
const find = Mongo.Collection.get(collectionName).find({ test: true })
equal(find.count(), 1)
equal(await find.countAsync(), 1)

// get an existing collection again
const ReGet = Mongo.Collection.get(collectionName)
equal(ReGet.find().count(), 1)
equal(await ReGet.find().countAsync(), 1)
})

it('basic - works Meteor.Collection', function () {
it('basic - works Meteor.Collection', async () => {
const Test = new Meteor.Collection(collectionName)
Test.insert({ test: true })
await insert(Test, { test: true })

const find = Meteor.Collection.get(collectionName).find({ test: true })
equal(find.count(), 1)
equal(await find.countAsync(), 1)
})

it('basic - collection already exists', () => {
Expand Down
14 changes: 8 additions & 6 deletions package.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,28 @@
Package.describe({
name: 'dburles:mongo-collection-instances',
summary: 'Access your Mongo instances',
version: '0.4.0',
version: '1.0.0',
git: 'https://github.com/dburles/mongo-collection-instances.git'
})

Package.onUse(function (api) {
api.versionsFrom(['1.0', '2.3', '2.8.0'])
api.versionsFrom(['2.3', '2.8.0', '3.0'])
api.use([
'mongo',
'ecmascript',
'lai:[email protected]'])
'mongo',
'lai:[email protected]'])
api.addFiles('mongo-instances.js')
})

Package.onTest(function (api) {
api.versionsFrom(['2.3', '2.8.0', '3.0'])
api.use([
'ecmascript',
'meteortesting:[email protected]',
'accounts-base',
'mongo',
'dburles:mongo-collection-instances'
'typescript',
'meteortesting:[email protected]',
'dburles:[email protected]'
])
api.addFiles('mongo-instances.tests.js')
})
26 changes: 14 additions & 12 deletions test-proxy/.meteor/packages
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@
# 'meteor add' and 'meteor remove' will edit this file for you,
# but you can also edit it by hand.

[email protected].1 # Packages every Meteor app needs to have
[email protected].1 # Packages for a great mobile UX
mongo@1.16.8 # The database Meteor supports right now
[email protected].2 # Define static page content in .html files
[email protected].12 # Reactive variable for tracker
[email protected].3 # Meteor's client-side reactive programming library
[email protected].2 # Packages every Meteor app needs to have
[email protected].2 # Packages for a great mobile UX
mongo@2.0.0 # The database Meteor supports right now
[email protected].3 # Define static page content in .html files
[email protected].13 # Reactive variable for tracker
[email protected].4 # Meteor's client-side reactive programming library

[email protected] # CSS minifier run for production mode
[email protected] # JS minifier run for production mode
[email protected] # ECMAScript 5 compatibility for older browsers
[email protected] # Enable ECMAScript2015+ syntax in app code
[email protected] # Enable TypeScript syntax in .ts and .tsx modules
[email protected] # Server-side component of the `meteor shell` command
[email protected] # CSS minifier run for production mode
[email protected] # JS minifier run for production mode
[email protected] # ECMAScript 5 compatibility for older browsers
[email protected] # Enable ECMAScript2015+ syntax in app code
[email protected] # Enable TypeScript syntax in .ts and .tsx modules
[email protected] # Server-side component of the `meteor shell` command

[email protected]
2 changes: 1 addition & 1 deletion test-proxy/.meteor/release
Original file line number Diff line number Diff line change
@@ -1 +1 @@
METEOR@2.14
METEOR@3.0.1
Loading
Loading