Skip to content

Commit

Permalink
npm workspaces and bug fixes (#912)
Browse files Browse the repository at this point in the history
* fix(decorator): validate type references
* chore(deps): update concerto-metamodel to 3.10.1
* chore(npm): move to npm workspaces
* chore(concerto-util): remove axios and colors
  • Loading branch information
dselman authored Sep 26, 2024
1 parent 89651d1 commit 61fdc5a
Show file tree
Hide file tree
Showing 42 changed files with 9,220 additions and 62,196 deletions.
22 changes: 14 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
pull_request:
branches:
- main
- v4.0.0 # Temporary, while we prepare for merge to main

jobs:
build:
Expand All @@ -15,13 +16,12 @@ jobs:
strategy:
matrix:
node-version:
- 16.x
- 18.x
- 20.x
os:
- ubuntu-latest
- windows-latest
- macOS-latest
- macos-latest
- ubuntu-latest

runs-on: ${{ matrix.os }}

Expand All @@ -30,7 +30,7 @@ jobs:
uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

Expand All @@ -40,6 +40,13 @@ jobs:
NODE_OPTIONS: "--max_old_space_size=4096"
run: npm test

- name: Archive npm failure logs
uses: actions/upload-artifact@v4
if: failure()
with:
name: npm-logs
path: C:\npm\cache\_logs\

- name: Calculate code coverage
run: npm run coverage

Expand Down Expand Up @@ -79,7 +86,7 @@ jobs:

steps:
- name: git checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Use Node.js 18.x
uses: actions/setup-node@v4
Expand All @@ -97,6 +104,5 @@ jobs:
- name: build and publish
run: |
npm config set //registry.npmjs.org/:_authToken ${{ secrets.NPM_TOKEN }}
npm version --no-git-tag-version --yes --exact ${{ steps.timestamp.outputs.stamp }}
npx lerna version --no-git-tag-version --yes --exact ${{ steps.timestamp.outputs.stamp }}
npx lerna exec -- npm publish --access public --tag=unstable 2>&1
npm version --workspaces --include-workspace-root --no-git-tag-version --yes --exact ${{ steps.timestamp.outputs.stamp }}
npm publish --workspaces --access public --tag=unstable 2>&1
8 changes: 4 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -56,7 +56,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
Expand All @@ -69,6 +69,6 @@ jobs:
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
13 changes: 6 additions & 7 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ jobs:

steps:
- name: git checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Use Node.js 16.x
- name: Use Node.js 20.x
uses: actions/setup-node@v1
with:
node-version: 16.x
node-version: 20.x

- run: npm ci
- run: npm run build --if-present
Expand All @@ -31,9 +31,8 @@ jobs:
- name: build and publish
run: |
npm config set //registry.npmjs.org/:_authToken ${{ secrets.NPM_TOKEN }}
npm version --no-git-tag-version --yes --exact ${{ github.event.release.tag_name }}
npx lerna version --no-git-tag-version --yes --exact ${{ github.event.release.tag_name }}
npx lerna exec -- npm publish --access public ${{ steps.tag.outputs.tag }} 2>&1
npm version --workspaces --include-workspace-root --no-git-tag-version --yes --exact ${{ github.event.release.tag_name }}
npm publish --workspaces --access public ${{ steps.tag.outputs.tag }} 2>&1
- name: Create PR to increment version
uses: peter-evans/create-pull-request@v3
Expand All @@ -52,4 +51,4 @@ jobs:
Update the package.json version numbers after publishing to NPM.
assignees: ${{ github.actor }}
reviewers: ${{ github.actor }}
draft: false
draft: false
4 changes: 2 additions & 2 deletions DEVELOPERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ We'd love for you to help develop improvements to Concerto technology! Please re

#### Building Concerto

To build Concerto, you clone the source code repository and use lerna to build:
To build Concerto, you clone the source code repository and use npm to build:

```shell
# Clone your Github repository:
Expand All @@ -22,7 +22,7 @@ cd concerto
git remote add upstream "https://github.com/accordproject/concerto.git"

# Install node.js dependencies:
npx lerna bootstrap
npm i
```

[apdev]: https://github.com/accordproject/techdocs/blob/master/DEVELOPERS.md
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ $ concerto compare --old model.cto --new model-with-changes.cto

## Structure of the Code

Top level repository (concerto), with sub packages. Each sub-package is published as an independent npm module using `lerna`:
Top level repository (concerto), with sub packages. Each sub-package is published as an independent npm module using npm workspaces:
* [concerto-core](https://github.com/accordproject/concerto/tree/master/packages/concerto-core) : core library for model management/parsing/validation/serialization
* [concerto-util](https://github.com/accordproject/concerto/tree/master/packages/concerto-util) : contains utility functions used in other parts of the code and fundamentally independent from Concerto as a modeling language
* [concerto-cto](https://github.com/accordproject/concerto/tree/master/packages/concerto-cto) : contains the parser for the .cto syntax for Concerto. The parser now outputs a proper Concerto object, instance of the metamodel rather than a custom JSON object.
Expand Down
7 changes: 0 additions & 7 deletions lerna.json

This file was deleted.

Loading

0 comments on commit 61fdc5a

Please sign in to comment.