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
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist/* binary
lib/* binary
16 changes: 16 additions & 0 deletions .github/workflows/bat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Build and Test
on: [push]
permissions:
contents: read

jobs:
bat:
name: Build and Test
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
with:
node-version: 20
- name: Perform npm tasks
run: npm run ci
77 changes: 77 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Publish
on:
release:
types: published
permissions:
contents: write

jobs:
build:
name: Build
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.update-package-version.outputs.version }}
steps:
- uses: actions/checkout@v5
- name: Configure git
run: |
git config user.name 'Release Action'
git config user.email '<>'
- uses: actions/setup-node@v5
with:
node-version: 20

# Call `npm version`. It increments the version and commits the changes.
# We'll save the output (new version string) for use in the following
# steps
- name: Update package version
id: update-package-version
run: |
git tag -d "${{ github.event.release.tag_name }}"
VERSION=$(npm version "${{ github.event.release.tag_name }}" --no-git-tag-version)
git add package.json package-lock.json
git commit -m "[skip ci] Bump $VERSION"
git push origin HEAD:main

# Now carry on, business as usual
- name: Perform npm tasks
run: npm run ci

# Finally, create a detached commit containing the built artifacts and tag
# it with the release. Note: the fact that the branch is locally updated
# will not be relayed (pushed) to origin
- name: Commit to release branch
id: release_info
run: |
# Check for semantic versioning
longVersion="${{github.event.release.tag_name}}"
echo "Preparing release for version $longVersion"
[[ $longVersion == v[0-9]*.[0-9]*.[0-9]* ]] || (echo "must follow semantic versioning" && exit 1)
majorVersion=$(echo ${longVersion%.*.*})
minorVersion=$(echo ${longVersion%.*})

# Add the built artifacts. Using --force because dist/lib should be in
# .gitignore
git add --force dist lib

# Make the commit
MESSAGE="Build for $(git rev-parse --short HEAD)"
git commit --allow-empty -m "$MESSAGE"
git tag -f -a -m "Release $longVersion" $longVersion

# Get the commit of the tag you just released
commitHash=$(git rev-list -n 1 $longVersion)

# Delete the old major and minor version tags locally
git tag -d $majorVersion || true
git tag -d $minorVersion || true

# Make new major and minor version tags locally that point to the commit you got from the "git rev-list" above
git tag -f $majorVersion $commitHash
git tag -f $minorVersion $commitHash

# Force push the new minor version tag to overwrite the old tag remotely
echo "Pushing new tags"
git push -f origin $longVersion
git push -f origin $majorVersion
git push -f origin $minorVersion
123 changes: 123 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
## For development environment
.vscode

# Don't include intermediate TypeScript compilation;
# it should be forcibly added on release
lib

# Leave out dist; it should be forcibly added on release
dist

## https://raw.githubusercontent.com/github/gitignore/master/Node.gitignore
# Logs
logs/
*.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
# dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
14 changes: 14 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## No need to work on final dist
dist

## Ignore external node_modules
node_modules

## Don't include intermediate TypeScript compilation
tsout

## Ignore code coverage
coverage

## Editor related
.vscode
6 changes: 6 additions & 0 deletions .prettierrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
tabWidth: 4
printWidth: 100
overrides:
- files: "*.yml"
options:
tabWidth: 2
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# common-utils
# common-utils
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this repo be public? Do you plan on adding some information to the README?

(A brief README example: https://github.com/matlab-actions/workflow-generator)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will have to public since the rest of the project is open source. A README would probably be beneficial, although I don't see it as a super critical priority since the repo isn't intended for direct customer use (and that should be clear via context)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I don't mind deleting the README in its current form. If we want to keep it in the repo, then perhaps a sentence or two would be necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The repo will indeed need to be public. I'm not sure what are the guidelines for a public repo.

I'm okay with removing the README as well if the guidelines don't have a strict requirement. Yeah, makes sense to add a few lines in the README if we need to keep it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mcafaro, do you think having a README is a requirement for this repo?

6 changes: 6 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Reporting Security Vulnerabilities

If you believe you have discovered a security vulnerability, please report it to
[security@mathworks.com](mailto:security@mathworks.com). Please see
[MathWorks Vulnerability Disclosure Policy for Security Researchers](https://www.mathworks.com/company/aboutus/policies_statements/vulnerability-disclosure-policy.html)
for additional information.
6 changes: 6 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
preset: "ts-jest",
testEnvironment: "node",
testRunner: "jest-circus/runner",
collectCoverage: true,
};
File renamed without changes.
Loading