Navigation Menu

Skip to content

Commit

Permalink
Merge 2c9a6b4 into 9972676
Browse files Browse the repository at this point in the history
  • Loading branch information
xavierfoucrier committed Mar 24, 2021
2 parents 9972676 + 2c9a6b4 commit 4103bee
Show file tree
Hide file tree
Showing 187 changed files with 12,372 additions and 49,855 deletions.
8 changes: 8 additions & 0 deletions .babelrc
@@ -0,0 +1,8 @@
{
"presets": [
"@babel/preset-env"
],
"plugins": [
"@babel/plugin-transform-runtime"
]
}
3 changes: 3 additions & 0 deletions .eslintignore
@@ -0,0 +1,3 @@
/dev
/dist
/coverage
127 changes: 127 additions & 0 deletions .eslintrc
@@ -0,0 +1,127 @@
{
"env": {
"node": true,
"browser": true,
"es2021": true
},
"extends": "eslint:recommended",
"globals": {
"build": false
},
"parserOptions": {
"sourceType": "module"
},
"rules": {
"array-bracket-spacing": [
"error"
],
"arrow-spacing": [
"error"
],
"comma-dangle": [
"error",
"always-multiline"
],
"comma-spacing": [
"error", {
"before": false,
"after": true
}
],
"computed-property-spacing": [
"error"
],
"func-call-spacing": [
"error"
],
"indent": [
"error",
2, {
"SwitchCase": 1
}
],
"key-spacing": [
"error"
],
"keyword-spacing": [
"error"
],
"lines-around-comment": [
"error", {
"beforeBlockComment": true
}
],
"linebreak-style": [
"error",
"unix"
],
"no-invalid-this": [
"error"
],
"no-multi-spaces": [
"error"
],
"no-multiple-empty-lines": [
"error", {
"max": 1
}
],
"no-trailing-spaces": [
"error"
],
"no-whitespace-before-property": [
"error"
],
"object-curly-spacing": [
"error",
"always"
],
"object-property-newline": [
"error"
],
"quotes": [
"error",
"single"
],
"rest-spread-spacing": [
"error"
],
"semi": [
"error",
"always"
],
"semi-spacing": [
"error"
],
"space-before-blocks": [
"error"
],
"space-before-function-paren": [
"error",
"never"
],
"space-in-parens": [
"error"
],
"space-infix-ops": [
"error"
],
"space-unary-ops": [
"error"
],
"spaced-comment": [
"error",
"always", {
"block": {
"balanced": true
}
}
],
"strict": [
"error"
],
"template-curly-spacing": [
"error"
]
}
}
49 changes: 49 additions & 0 deletions .github/workflows/ci.yml
@@ -0,0 +1,49 @@
# Github workflow for Continuous Integration

name: CI

on:
push:
branches:
- master

pull_request:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2

- name: Install dependencies
run: npm ci

- name: Lint code
run: npm run lint

- name: Setup browser testing
uses: browserstack/github-actions/setup-env@master
with:
username: ${{ secrets.BROWSERSTACK_USERNAME }}
access-key: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}

- name: Start browser testing tunnel
uses: browserstack/github-actions/setup-local@master
with:
local-testing: start

- name: Run tests with code coverage
run: npm run test

- name: Send code coverage to Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Stop browser testing tunnel
uses: 'browserstack/github-actions/setup-local@master'
with:
local-testing: stop
46 changes: 46 additions & 0 deletions .github/workflows/publish-package.yml
@@ -0,0 +1,46 @@
# Github workflow to publish package to NPM and GPR

name: Publish package

on:
release:
types: [published]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- run: npm ci
- run: npm test

publish-npm:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm run build
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

publish-gpr:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
registry-url: https://npm.pkg.github.com/
- run: npm ci
- run: npm run build
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
12 changes: 7 additions & 5 deletions .gitignore
@@ -1,5 +1,7 @@
bower_components/
node_modules/
coverage/
vendor/
npm-debug.log
/node_modules
/coverage
/dist
.DS_Store
.vscode
.env
.eslintcache
21 changes: 6 additions & 15 deletions .npmignore
@@ -1,17 +1,8 @@
node_modules/
coverage/
mockups/
vendor/
spec/
css/
js/
.travis.yml
/coverage
/spec
/src
.editorconfig
index.html
index.jade
bower.json
npm-debug.log
gulpfile.js
karma.conf.js
webpack.config.js
todo.md
webpack.*
CODE_OF_CONDUCT.md
CONTRIBUTING.md
11 changes: 0 additions & 11 deletions .travis.yml

This file was deleted.

25 changes: 25 additions & 0 deletions CONTRIBUTING.md
Expand Up @@ -10,6 +10,7 @@ The following is a set of guidelines for contributing to mojs. These are mostly
1. [Code of conduct](#code-of-conduct)
2. [Reporting bugs](#reporting-bugs)
3. [Suggesting enhancements](#suggesting-enhancements)
4. [Working with the project](#working-with-the-project)


## Code of conduct
Expand Down Expand Up @@ -52,4 +53,28 @@ This section guides you through submitting an enhancement suggestion for mojs, i

Don't hesitate to use pull requests to propose code changes.


## Working with the project

MoJS uses [Webpack](https://webpack.js.org/) and [Babel](https://babeljs.io/) for building, [Karma](https://karma-runner.github.io/) for testing and [Github Actions](https://github.com/mojs/mojs/actions) for the CI workflow.

> Most of the core files are written in [CoffeeScript](https://coffeescript.org/), but the plan is to convert to TypeScript in the future.
### Setup

Make sure you have a recent version of **NodeJS**. Actually v12.18.2 LTS works fine at the time of writing, but newer and a bit older will probably works fine too.

Run `npm install` to get all dependencies and build tools to get ready!

### Scripts

- `npm run dev` - Start a `webpack-dev-server` and allow you to **develop new features** by seing them live in your browser. Source map is also enabled to allow easy bug fixes in development.
- `npm run lint` - Run `eslint` to lint the code and **prevent syntax errors** when implementing new code.
- `npm run test` - Run all tests by creating a production-ready file, looking for **Karma tests** in the spec folder, and checking them against the `dist/mo.umd.js` file. Make sure to write new tests for all new code.
- `npm run build` - Build a **production-ready** `mo.umd.js` file with webpack and put it in the `dist` folder.

### Workflow

The Continuous Integration workflow uses **BrowserStack** to run Karma tests against a bunch of selected browsers for compatibility reasons. When running tests locally, **Headless Chrome** will be used as default browser.

Thanks for reading and happy contributing! :tada: :+1:
2 changes: 1 addition & 1 deletion LICENSE.md
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 Oleg Solomka
Copyright (c) 2021 Oleg Solomka, Xavier Foucrier, Jonas Sandstedt

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down

0 comments on commit 4103bee

Please sign in to comment.