Skip to content

Commit

Permalink
Merge pull request #444 from Meteor-Community-Packages/meteor-3
Browse files Browse the repository at this point in the history
Meteor 3.0 migration
  • Loading branch information
StorytellerCZ authored Jan 18, 2024
2 parents dd7ddfa + 604289d commit 587621f
Show file tree
Hide file tree
Showing 29 changed files with 5,010 additions and 3,146 deletions.
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Ignore artifacts:
build
coverage
12 changes: 4 additions & 8 deletions .github/workflows/testsuite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@

name: Test suite

on:
push:
branches:
- master
- develop
pull_request:
on: [push, pull_request]

jobs:
tests:
Expand All @@ -17,12 +12,12 @@ jobs:
# needs: [lintcode,lintstyle,lintdocs] # we could add prior jobs for linting, if desired
steps:
- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup meteor
uses: meteorengineer/setup-meteor@v1
with:
meteor-release: '2.2'
meteor-release: '2.13.3'

- name: cache dependencies
uses: actions/cache@v1
Expand All @@ -32,3 +27,4 @@ jobs:
restore-keys: |
${{ runner.os }}-node-
- run: cd tests && meteor npm install && meteor npm run test

5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"trailingComma": "none",
"singleQuote": true,
"printWidth": 100
}
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*

- [4.0.0-beta.5](#400-beta.3)
- [3.5.0](#350)
- [3.4.1](#341)
- [3.4.0](#340)
Expand Down Expand Up @@ -77,6 +78,17 @@

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

## 4.0.0

- Make collection2 compatible with Meteor 3.0 thanks to the [awesome work](https://github.com/Meteor-Community-Packages/meteor-collection2/pull/443) by @klablink
- Remove clean options https://github.com/Meteor-Community-Packages/meteor-collection2/pull/436
- Prettier is added to enforce a consistent style across the project
- Removed `babel-polyfill`
- Updated expect to `26.6.2`
- Use [`aldeed:simple-schema@1.13.1`](https://github.com/Meteor-Community-Packages/meteor-simple-schema/releases/tag/v1.13.1) instead of [NPM version](https://github.com/longshotlabs/simpl-schema).
- Add static & dynamic loading
- Fix error with quave:synced-cron

## 3.5.0

Add the ability to override in-built schema clean options.
Expand Down
53 changes: 32 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ This package requires the [simpl-schema](https://github.com/aldeed/simple-schema
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->

- [Installation](#installation)
- [Import using static imports](#import-using-static-imports)
- [Import using dynamic imports](#import-using-dynamic-imports)
- [Why Use Collection2](#why-use-collection2)
- [Attaching a Schema to a Collection](#attaching-a-schema-to-a-collection)
- [Attaching Multiple Schemas to the Same Collection](#attaching-multiple-schemas-to-the-same-collection)
Expand Down Expand Up @@ -59,11 +61,40 @@ This package requires the [simpl-schema](https://github.com/aldeed/simple-schema

In your Meteor app directory, enter:

### 4.0

Starting 4.0 collection2 ships with built in [`aldeed:simple-schema@1.13.1`](https://github.com/Meteor-Community-Packages/meteor-simple-schema/releases/tag/v1.13.1).

```bash
meteor add aldeed:collection2
```

### 3.x

```bash
meteor add aldeed:collection2
meteor npm install --save simpl-schema
meteor npm install --save simpl-schema@1.12.3
```

## Import using static imports

If you come from a previous version and want to "keep things as they were" then this is the option you should choose.

```js
import 'meteor/aldeed:collection2/static';
```

## Import using dynamic imports

Dynamic imports helps to cut down on bundle size but it requires you to manually load the package for things to work.

```js
import 'meteor/aldeed:collection2/dynamic';

Collection2.load();
```


## Why Use Collection2

- While adding allow/deny rules ensures that only authorized users can edit a document from the client, adding a schema ensures that only acceptable properties and values can be set within that document from the client. Thus, client side inserts and updates can be allowed without compromising security or data integrity.
Expand Down Expand Up @@ -361,26 +392,6 @@ instance for a Mongo.Collection instance. For example:
MyCollection.simpleSchema().validate(doc);
```

## Schema Clean Options

You can set the simpl-schema clean options globally in collection2. They are merged with any options defined on the schema level.

```js
import Collection2 from 'meteor/aldeed:collection2'

// The values shown are the default options used internally. Overwrite them if needed.
Collection2.cleanOptions = {
filter: true,
autoConvert: true,
removeEmptyStrings: true,
trimStrings: true,
removeNullsFromArrays: true,
}

// Or you can update individual options.
Collection2.cleanOptions.filter = false;
```

## Passing Options

In Meteor, the `update` function accepts an options argument. Collection2 changes the `insert` function signature to also accept options in the same way, as an optional second argument. Whenever this documentation says to "use X option", it's referring to this options argument. For example:
Expand Down
14 changes: 14 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "meteor-collection2",
"version": "1.0.0",
"description": "[![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) ![GitHub](https://img.shields.io/github/license/Meteor-Community-Packages/meteor-collection2) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) [![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/Meteor-Community-Packages/meteor-collection2.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Meteor-Community-Packages/meteor-collection2/context:javascript) ![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/Meteor-Community-Packages/meteor-collection2?label=latest&sort=semver) [![](https://img.shields.io/badge/semver-2.0.0-success)](http://semver.org/spec/v2.0.0.html) ![Test suite](https://github.com/Meteor-Community-Packages/meteor-collection2/workflows/Test%20suite/badge.svg)",
"main": "index.js",
"directories": {
"test": "tests"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Meteor-Community-Packages/meteor-collection2.git"
},
"keywords": [],
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/Meteor-Community-Packages/meteor-collection2/issues"
},
"homepage": "https://github.com/Meteor-Community-Packages/meteor-collection2#readme",
"devDependencies": {
"prettier": "3.1.1"
}
}
82 changes: 44 additions & 38 deletions package/collection2/.versions
Original file line number Diff line number Diff line change
@@ -1,50 +1,56 @@
aldeed:collection2@3.5.0
allow-deny@1.1.0
babel-compiler@7.7.0
babel-runtime@1.5.0
aldeed:collection2@4.0.0-beta.7
aldeed:simple-schema@1.13.1
allow-deny@1.1.1
babel-compiler@7.10.5
babel-runtime@1.5.1
base64@1.0.12
binary-heap@1.0.11
boilerplate-generator@1.7.1
callback-hook@1.3.1
check@1.3.1
ddp@1.4.0
ddp-client@2.5.0
boilerplate-generator@1.7.2
callback-hook@1.5.1
check@1.3.2
ddp@1.4.1
ddp-client@2.6.1
ddp-common@1.4.0
ddp-server@2.4.0
diff-sequence@1.1.1
dynamic-import@0.7.1
ecmascript@0.15.3
ecmascript-runtime@0.7.0
ecmascript-runtime-client@0.11.1
ecmascript-runtime-server@0.10.1
ejson@1.1.1
fetch@0.1.1
geojson-utils@1.0.10
ddp-server@2.7.0
diff-sequence@1.1.2
dynamic-import@0.7.3
ecmascript@0.16.8
ecmascript-runtime@0.8.1
ecmascript-runtime-client@0.12.1
ecmascript-runtime-server@0.11.0
ejson@1.1.3
fetch@0.1.4
geojson-utils@1.0.11
http@1.0.10
id-map@1.1.1
inter-process-messaging@0.1.1
logging@1.2.0
meteor@1.9.3
minimongo@1.7.0
modern-browsers@0.1.5
modules@0.16.0
modules-runtime@0.12.0
mongo@1.12.0
mongo-decimal@0.1.2
local-test:aldeed:collection2@4.0.0-beta.7
logging@1.3.3
meteor@1.11.4
meteortesting:browser-tests@1.6.0-beta300.0
meteortesting:mocha@3.1.0-beta300.0
meteortesting:mocha-core@8.3.1-beta300.0
minimongo@1.9.3
modern-browsers@0.1.10
modules@0.20.0
modules-runtime@0.13.1
mongo@1.16.8
mongo-decimal@0.1.3
mongo-dev-server@1.1.0
mongo-id@1.0.8
npm-mongo@3.9.1
npm-mongo@4.17.2
ordered-dict@1.1.0
promise@0.12.0
promise@0.12.2
raix:eventemitter@1.0.0
random@1.2.0
react-fast-refresh@0.1.1
random@1.2.1
react-fast-refresh@0.2.8
reload@1.3.1
retry@1.1.0
routepolicy@1.1.1
socket-stream-client@0.4.0
tmeasday:check-npm-versions@1.0.2
tracker@1.2.0
typescript@4.3.5
underscore@1.0.10
webapp@1.11.1
webapp-hashing@1.1.0
socket-stream-client@0.5.2
tracker@1.3.3
typescript@4.9.5
underscore@1.0.13
url@1.3.2
webapp@1.13.6
webapp-hashing@1.1.1
Loading

0 comments on commit 587621f

Please sign in to comment.