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

Adapt to ES6 modules #538

Merged
merged 22 commits into from
Oct 14, 2022
Merged
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
46 changes: 38 additions & 8 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
{
"env": {
"es6": true,
},
"parserOptions": {
"ecmaVersion": 13,
"sourceType": "module"
},
"extends": "eslint:recommended",
"rules": {
// Enforce one true brace style (opening brace on the same line)
// Allow single line (for now) because of the vast number of changes needed
Expand Down Expand Up @@ -194,17 +202,13 @@
"no-empty": 2,

// Disallow declaring the same variable more than once (we use let anyway).
//"no-redeclare": 2,
"no-redeclare": 2,

// Warn about declaration of variables already declared in the outer scope.
// This isn't an error because it sometimes is useful to use the same name
// in a small helper function rather than having to come up with another
// random name. Still, making this a warning can help people avoid being
// confused.
//"no-shadow": 2,
"no-shadow": 2,

// Disallow global and local variables that aren't used, but allow unused function arguments.
//"no-unused-vars": [2, {"vars": "all", "args": "none", "varsIgnorePattern": "EXPORTED_SYMBOLS"}],
"no-unused-vars": [2, {"vars": "all", "args": "none" }],

// Require padding inside curly braces
"object-curly-spacing": [2, "always"],
Expand Down Expand Up @@ -431,5 +435,31 @@

// Enforce consistent indentation (2-space)
//"indent": [2, 2, { "SwitchCase": 1 }],
}

"no-prototype-builtins": 2,

// Disallow var, use let or const instead
"no-var": 2
},
"overrides": [
{
"files": ["test/**/*.js"],
"env": {
"mocha": true,
"node": true
},
"globals": {
"ICAL": "readonly",
"assert": "readonly",
"testSupport": "readonly",
"perfTest": "readonly"
}
},
{
"files": ["test/performance/**/*.js"],
"globals": {
"perfCompareSuite": "readonly"
}
}
]
}
5 changes: 3 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/" # Location of package manifests
directory: "/"
schedule:
interval: "weekly"
interval: "daily"
open-pull-requests-limit: 10
103 changes: 77 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,31 @@ jobs:
uses: actions/checkout@v2

- name: "Setup node"
uses: actions/setup-node@v1
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}

- name: "npm ci"
run: npm ci

- name: "Linters"
run: grunt linters
- name: "Build"
run: npm run build

- name: "grunt package-zones"
run: grunt package-zones
- name: "Linters"
run: npm run lint

- name: "Node Unit Tests"
run: grunt unit-node-ci
run: npm run test-unit

# Disabled for the moment, I can't get sauce labs to work
# - name: "Browser Unit Tests"
# env:
# SAUCE_USERNAME: ${{secrets.SAUCE_USERNAME}}
# SAUCE_ACCESS_KEY: ${{secrets.SAUCE_ACCESS_KEY}}
# run: grunt unit-browser-ci
- name: "Node Acceptance Tests"
run: npm run test-acceptance

- name: "Coverage Prepare"
run: grunt coverage
# Disabled for the moment, I can't get sauce labs to work
# - name: "Browser Unit Tests"
# env:
# SAUCE_USERNAME: ${{secrets.SAUCE_USERNAME}}
# SAUCE_ACCESS_KEY: ${{secrets.SAUCE_ACCESS_KEY}}
# run: npm run test-browser

- name: "Coverage Push"
uses: coverallsapp/github-action@master
Expand All @@ -54,6 +54,13 @@ jobs:
flag-name: unit-${{ matrix.node }}
parallel: true

- name: "Artifacts"
uses: actions/upload-artifact@v2
with:
name: distribution
path: dist/*.js


ghpages:
name: "GH Pages"
if: github.ref == 'refs/heads/main'
Expand All @@ -63,27 +70,71 @@ jobs:
uses: actions/checkout@v2

- name: "Setup node"
uses: actions/setup-node@v1
uses: actions/setup-node@v2
with:
node-version: 17

- name: "npm ci"
run: npm ci

- name: "GH Pages Prepare"
run: grunt ghpages-prepare
run: npm run ghpages

- name: "GH Pages Push"
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: grunt ghpages-push
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{secrets.GITHUB_TOKEN}}
publish_dir: docs

timezones:
name: "Timezones"
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v2

- name: "Setup node"
uses: actions/setup-node@v2
with:
node-version: 17

- name: "npm ci"
run: npm ci

- name: "Download tzdb"
id: tzdb
run: |
export TZDB_VERSION=$(node tools/scriptutils.js tzdb-version)
mkdir -p tools/tzdb
cd tools/tzdb
wget "https://data.iana.org/time-zones/releases/tzdata${TZDB_VERSION}.tar.gz" -O - | tar xz

- name: "Build vzic"
run: |
git clone https://github.com/libical/vzic tools/vzic
cd tools/vzic
make TZID_PREFIX="" OLSON_DIR="$(readlink -f ../tzdb)"

- name: "Run vzic"
run: tools/vzic/vzic --olson-dir tools/tzdb --output-dir tools/tzdb/zoneinfo

- name: "Create zones"
run: |
mkdir -p dist
node tools/scriptutils.js generate-zones tools/tzdb > dist/ical.timezones.js

- name: "Artifacts"
uses: actions/upload-artifact@v2
with:
name: timezones
path: dist/ical.timezones.js

finish:
needs: build-and-test
needs: [build-and-test, timezones]
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true

- name: Coveralls Finished
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true
14 changes: 6 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
node_modules
bower_components
*.pyc
tools/vzic
tools/tzdb
tools/libical
zoneinfo
api
ghpages-stage
/validator.html
dist/
docs/api/
docs/validator.html
tools/vzic/
tools/tzdb/
tools/libical/
coverage/
build/
61 changes: 23 additions & 38 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,55 +1,40 @@
Woohoo, a new contributor!
==========================
Thank you so much for looking into ical.js. With your work you are doing good
by making it easier to process calendar data on the web.

To give you a feeling about what you are dealing with, ical.js was originally
created as a replacement for [libical], meant to be used in [Lightning], the
calendaring extension to Thunderbird. Using binary components in Mozilla
extensions often leads to compatibility issues so a pure JavaScript
implementation was needed. It was also used in the Firefox OS calendaring
Thank you so much for looking into ical.js. With your work you are doing good by making it easier to
process calendar data on the web.

To give you a feeling about what you are dealing with, ical.js was originally created as a
replacement for [libical], meant to be used in [Lightning], the calendaring extension to
Thunderbird. Using binary components in Mozilla extensions often leads to compatibility issues so a
pure JavaScript implementation was needed. It was also used in the Firefox OS calendaring
application.

Work on the library prompted creating some standards around it. One of them is
jCal ([rfc7265]), an alternative text format for iCalendar data using JSON. The
other document is jCard ([rfc7095]), which is the counterpart for vCard data.
Work on the library prompted creating some standards around it. One of them is jCal ([rfc7265]), an
alternative text format for iCalendar data using JSON. The other document is jCard ([rfc7095]),
which is the counterpart for vCard data.

Pull Requests
-------------
In general we are happy about any form of contribution to ical.js. Note however
that since the library is used in at least one larger projects, drastic changes
to the API should be discussed in an issue beforehand. If you have a bug fix
that doesn't affect the API or just adds methods and you don't want to waste
time discussing it, feel free to just send a pull request and we'll see.

Also, you should check for linter errors and run the tests using `grunt
linters` and `grunt test-node`. See the next section for details on tests. As
they take a while, you can skip the performance tests using `grunt
test-node:unit` and `grunt test-node:acceptance`, but if you are uncertain if
your change may affect performance, you should run all tests.

Currently the team working on ical.js consists of a very small number of
voluntary contributors. If you don't get a reply in a timely manner please
don't feel turned down. If you are getting impatient with us, go ahead and send
one or more reminders via email or comment.

Tests
-----
To make sure there are no regressions, we use unit testing and continuous
integration via Github Actions. Sending a pull request with a unit test for the
bug you are fixing or feature you are adding will greatly improve the speed of
reviewing and the pull request being merged. Please read the page on [running
tests] in the wiki to set these up and make sure everything passes.
In general we are happy about any form of contribution to ical.js. Note however that since the
library is used in at least one larger projects, drastic changes to the API should be discussed in
an issue beforehand. If you have a bug fix that doesn't affect the API or just adds methods and you
don't want to waste time discussing it, feel free to just send a pull request and we'll see.

Also, you should check for linter errors and run the tests using `npm run lint` `npm run test`.
There are also performance tests and browser tests if you want to be thourough.

Currently the team working on ical.js consists of a very small number of voluntary contributors. If
you don't get a reply in a timely manner please don't feel turned down. If you are getting impatient
with us, go ahead and send one or more reminders via email or comment.

License
-------
ical.js is licensed under the [Mozilla Public License], version 2.0.

Last words
----------
If you have any questions please don't hesitate to get in touch. You can leave
a comment on an issue, send [@kewisch] an email, or for ad-hoc questions contact
`Fallen` on [chat.mozilla.org].
If you have any questions please don't hesitate to get in touch. You can leave a comment on an
issue, send [@kewisch] an email, or for ad-hoc questions contact `Fallen` on [chat.mozilla.org].

[libical]: https://github.com/libical/libical/
[Lightning]: http://www.mozilla.org/projects/calendar/
Expand Down
Loading