Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
88 changes: 55 additions & 33 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,63 @@
name: Test
on: push
name: Test suite
permissions:
contents: read

# in this configuration the ci runs only when code is pushed to master branch or a pull request is created
# in general it is advised to not push to master directly but to create a pull request instead
on:
push:
branches:
- master
pull_request:

jobs:
test:
lintcode:
name: Javascript lint
runs-on: ubuntu-latest
strategy:
matrix:
meteorRelease:
- '--release 1.12.1'
- '--release 2.1.1'
- '--release 2.2.3'
- '--release 2.3.5'
- '--release 2.4'
- '--release 2.5.8'
- '--release 2.6.1'
- '--release 2.7.3'
- '--release 2.8.1'
- '--release 2.9.1'
- '--release 2.10.0'
- '--release 2.11.0'
# Latest version
-
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: checkout
uses: actions/checkout@v4

- name: setup node
uses: actions/setup-node@v4
with:
node-version: 22

- name: Install Node.js
uses: actions/setup-node@v3
- name: cache dependencies
uses: actions/cache@v4
with:
node-version: '14.x'
path: ~/.npm
key: ${{ runner.os }}-node-22-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-22-
- run: |
npm ci
npm run lint:check
npm run format:check

# at the moment we only test against meteor 3.2.2
# because mtest is not working properly with meteor 3+
tests:
name: Meteor ${{ matrix.meteor }} tests
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4

- name: Install Dependencies
run: |
curl https://install.meteor.com | /bin/sh
npm i -g @zodern/mtest
- name: Setup meteor
uses: meteorengineer/setup-meteor@v1
with:
meteor-release: '3.2.2'

- name: Run Tests
run: |
# Retry tests since some of them are flaky
mtest --package ./ --once ${{ matrix.meteorRelease }} || mtest --package ./ --once ${{ matrix.meteorRelease }}
- name: cache dependencies
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-22-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-22-
- run: |
./setupTests.sh
cd testapp
npm ci
npm run test
1 change: 1 addition & 0 deletions .meteorignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
testapp/
62 changes: 52 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,79 @@
# template-package

Template package with CI and everything else to get started quickly with creating a new FOSS Meteor package.

[![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/template-package)
[![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/template-package.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Meteor-Community-Packages/template-package/context:javascript) ![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/Meteor-Community-Packages/template-package?label=latest&sort=semver) [![](https://img.shields.io/badge/semver-2.0.0-success)](http://semver.org/spec/v2.0.0.html) <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![Formatted with Biome](https://img.shields.io/badge/Formatted_with-Biome-60a5fa?style=flat&logo=biome)](https://biomejs.dev/)
[![Linted with Biome](https://img.shields.io/badge/Linted_with-Biome-60a5fa?style=flat&logo=biome)](https://biomejs.dev)
![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/Meteor-Community-Packages/template-package?label=latest&sort=semver) [![](https://img.shields.io/badge/semver-2.0.0-success)](http://semver.org/spec/v2.0.0.html) <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->

## Getting started

1. Copy this repo to your new repository
2. Update links, names and content in `package.js`, `package.json`, `CHANGELOG.md`, `CONTRIBUTING.md`, `README.md`
3. Update content in `.github` directory to your liking.

* [Funding documentation](https://help.github.com/en/github/building-a-strong-community/displaying-a-sponsor-button-in-your-repository)

## What is under the hood
## What is under the hood

### GitHub apps

* [All Contributors](https://allcontributors.org/)
* [LGTM.com](https://lgtm.com/)
* [Dependabot](https://dependabot.com/)
* [GitHub Actions](https://github.com/Meteor-Community-Packages/template-package/actions)


### Code style
[![JavaScript Style Guide](https://cdn.rawgit.com/standard/standard/master/badge.svg)](https://github.com/standard/standard)

We use Biome for linting and formatting alike. See https://biomejs.dev for more information. We created a default
configuration file `.biomerc.json` which you can adjust to your liking. Additionally, there are four scripts
in `package.json`:

- `lint:check` - runs linter in check mode
- `lint:write` - runs linter in write mode
- `format:check` - runs formatter in check mode
- `format:wrie` - runs formatter in write mode

### Semver

This repository is setup to follow the [Semantic Versioning standard](https://semver.org/).

[![](https://img.shields.io/badge/semver-2.0.0-success)](http://semver.org/spec/v2.0.0.html)

### Typescript
If you want to use TypeScript in your package follow the following steps.

#### package.js
#### Standard
You will need to adjust StandardJS according to [their guide](https://standardjs.com/index.html#typescript).
If you want to use TypeScript in your package then include the following lines to enable TypeScript support:

```js
// Enable TypeScript support
api.use('typescript');
api.mainModule('main.ts');
```

Note, you need to rename the default `.js` files to `.ts`.

### Tests

We use `meteortesting:mocha` for our tests. For this we created a minimal test app in the `testapp` directory.
This "proxy Meteor app" allows to run tests headless in CI as well as locally using puppeteer.

Before you run tests the first time, please setup the test repostiry via

```sh
./setupTests.sh
```

To run tests locally, use:

```sh
npm run test
npm run test:watch
npm run test:browser
```

## Contributors ✨

Expand All @@ -51,4 +92,5 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<!-- prettier-ignore-end -->
<!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification.
Contributions of any kind welcome!
35 changes: 35 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"$schema": "https://biomejs.dev/schemas/2.3.7/schema.json",
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
},
"files": {
"ignoreUnknown": false,
"includes": ["**", "!!testapp/"]
},
"formatter": {
"enabled": true,
"indentStyle": "tab"
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
},
"javascript": {
"formatter": {
"quoteStyle": "double"
}
},
"assist": {
"enabled": true,
"actions": {
"source": {
"organizeImports": "on"
}
}
}
}
6 changes: 3 additions & 3 deletions client/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { packageName } from '../common'
import { packageName } from "../common";
// Write your package client code here!

// Variables exported by this module can be imported by other packages and
// applications. See package-tests-client.js for an example of importing.
export const name = `${packageName}-client`
export const name = `${packageName}-client`;

export default name
export default name;
4 changes: 2 additions & 2 deletions common/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export const packageName = 'template-package'
export const packageName = "template-package";

export default packageName
export default packageName;
Loading