diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..96d0e36 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,105 @@ + +version: 2.1 +orbs: + commitlint: conventional-changelog/commitlint@1.0.0 + +executors: + default-executor: + docker: + - image: "cimg/node:lts" + working_directory: ~/project + resource_class: medium + +commands: + restore_test_cache: + steps: + - restore_cache: + keys: + - v1-deps-{{ .Environment.CIRCLE_JOB }}-{{ .Branch }}-{{ .Revision }} + - v1-deps-{{ .Environment.CIRCLE_JOB }}-{{ .Branch }} + - v1-deps- + save_test_cache: + steps: + - save_cache: + key: v1-deps-{{ .Environment.CIRCLE_JOB }}-{{ .Branch }}-{{ .Revision }} + paths: + - node_modules + - ~/.npm + setup: + steps: + - run: + name: Setup + command: | + npm prune + test: + steps: + - run: + name: Test + command: | + npm run test + deploy: + steps: + - run: + name: Deploy + command: | + npm run semantic-release + +jobs: + build-and-test: + executor: default-executor + steps: + - checkout + - restore_test_cache + - setup + - save_test_cache + - test + - persist_to_workspace: + root: ~/project + paths: . + deploy: + executor: default-executor + steps: + - attach_workspace: + at: ~/project + - deploy + +workflows: + commitlint: + when: + not: + or: + - equal: [ master, <<pipeline.git.branch>> ] + - equal: [ develop, <<pipeline.git.branch>> ] + - matches: { pattern: "^hotfix.*", value: <<pipeline.git.branch>> } + - matches: { pattern: "^release.*", value: <<pipeline.git.branch>> } + jobs: + - commitlint/lint: + target-branch: master + + build-and-test-workflow: + when: + not: + or: + - equal: [ master, <<pipeline.git.branch>> ] + - equal: [ develop, <<pipeline.git.branch>> ] + - matches: { pattern: "^hotfix.*", value: <<pipeline.git.branch>> } + - matches: { pattern: "^release.*", value: <<pipeline.git.branch>> } + jobs: + - build-and-test + + deploy-workflow: + when: + or: + - equal: [ master, <<pipeline.git.branch>> ] + - equal: [ develop, <<pipeline.git.branch>> ] + - matches: { pattern: "^hotfix.*", value: <<pipeline.git.branch>> } + - matches: { pattern: "^release.*", value: <<pipeline.git.branch>> } + - matches: { pattern: "^v[0-9]*.[0-9]*.[0-9]*$", value: <<pipeline.git.branch>> } + + jobs: + - build-and-test + - deploy: + context: + - scratch-npm-creds + requires: + - build-and-test diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index b38a7f9..0000000 --- a/.travis.yml +++ /dev/null @@ -1,20 +0,0 @@ -sudo: false -language: node_js -cache: - directories: - - node_modules - - ~/.npm -notifications: - email: false -node_js: - - 'node' -before_script: - - npm prune -script: - - commitlint-travis - - npm test -after_success: - - npm run semantic-release -branches: - except: - - /^v\d+\.\d+\.\d+$/ diff --git a/README.md b/README.md index 0b8cb57..4c21bc9 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,24 @@ # scratch-parser -#### Parser for Scratch projects +Parser for Scratch projects -[](https://travis-ci.org/LLK/scratch-parser) -[](https://david-dm.org/llk/scratch-parser) -[](https://david-dm.org/llk/scratch-parser?type=dev) +[](https://app.circleci.com/pipelines/github/LLK/scratch-parser?branch=master) ## Overview -The Scratch Parser is a [Node.js](https://nodejs.org) module that parses and validates [Scratch](https://scratch.mit.edu) projects. + +The Scratch Parser is a [Node.js](https://nodejs.org) module that parses and validates +[Scratch](https://scratch.mit.edu) projects. ## API -#### Installation -```bash +### Installation + +```sh npm install scratch-parser ``` -#### Basic Use +### Basic Use + ```js var fs = require('fs'); var parser = require('scratch-parser'); @@ -28,8 +30,10 @@ parser(buffer, function (err, project) { }); ``` -#### "Info" -In addition to the `_meta` data described above, Scratch projects include an attribute called `info` that *may* include the following: +### "Info" + +In addition to the `_meta` data described above, Scratch projects include an attribute called `info` that *may* +include the following: | Key | Description | | ----------------- | -------------------------------------------------------- | @@ -40,22 +44,26 @@ In addition to the `_meta` data described above, Scratch projects include an att ## Testing -#### Running the Test Suite -```bash +### Running the Test Suite + +```sh npm test ``` -#### Code Coverage Report -```bash +### Code Coverage Report + +```sh make coverage ``` -#### Performance Benchmarks / Stress Testing -```bash +### Performance Benchmarks / Stress Testing + +```sh make benchmark ``` ## Committing + This project uses [semantic release](https://github.com/semantic-release/semantic-release) to ensure version bumps follow semver so that projects using the config don't break unexpectedly. @@ -63,7 +71,8 @@ break unexpectedly. In order to automatically determine the type of version bump necessary, semantic release expects commit messages to be formatted following [conventional-changelog](https://github.com/bcoe/conventional-changelog-standard/blob/master/convention.md). -``` + +```text <type>(<scope>): <subject> <BLANK LINE> <body> @@ -76,6 +85,7 @@ where you would include `BREAKING CHANGE` and `ISSUES FIXED` sections if applicable. `type` is one of: + * `fix`: A bug fix **Causes a patch release (0.0.x)** * `feat`: A new feature **Causes a minor release (0.x.0)** * `docs`: Documentation only changes @@ -90,7 +100,7 @@ applicable. Use the [commitizen CLI](https://github.com/commitizen/cz-cli) to make commits formatted in this way: -```bash +```sh npm install -g commitizen npm install ``` @@ -98,6 +108,7 @@ npm install Now you're ready to make commits using `git cz`. ## Breaking changes + If you're committing a change that will require changes to existing code, ensure your commit specifies a breaking change. In your commit body, prefix the changes with "BREAKING CHANGE: " This will cause a major version bump so downstream projects must choose to upgrade diff --git a/lib/sb3_schema.json b/lib/sb3_schema.json index 19dc552..f85e97e 100644 --- a/lib/sb3_schema.json +++ b/lib/sb3_schema.json @@ -17,6 +17,9 @@ }, "agent": { "type": "string" + }, + "origin": { + "type": "string" } }, "required": [