Skip to content

feat: skeleton MAPCO-7912 #1

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

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
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
26 changes: 26 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# EditorConfig is awesome: https://EditorConfig.org

# Top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true

# Set default charset
charset = utf-8

# 2 space indentation (default)
indent_style = space
indent_size = 2

# 2 space indentation (JS and JSX and TS files)
[*.{js,jsx,ts}]
indent_size = 2

# Trim trailing whitespace
trim_trailing_whitespace = true

# Max line length
max_line_length = 150
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#prevent git from changing line endings of sh file to /r/n on windows systems
*.sh text eol=lf
*.* text eol=lf
23 changes: 23 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!--
Make sure you've read the contributing guidelines (CONTRIBUTING.md)
-->

| Question | Answer |
| --------------- | ------ |
| Bug fix | ✔/✖ |
| New feature | ✔/✖ |
| Breaking change | ✔/✖ |
| Deprecations | ✔/✖ |
| Documentation | ✔/✖ |
| Tests added | ✔/✖ |
| Chore | ✔/✖ |

Related issues: #XXX , #XXX ...
Closes #XXX ...

Further information:

<!--
Here you can provide more information regarding any of the questions written above.
In addition, you can add screenshots, ask the maintainers questions.
-->
47 changes: 47 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# yaml-language-server: $schema=https://json.schemastore.org/dependabot-2.0.json
version: 2
updates:
# deps
- package-ecosystem: npm
target-branch: 'master'
schedule:
interval: weekly
allow:
- dependency-type: production
directory: /
commit-message:
prefix: 'deps'
groups:
map-colonies:
patterns:
- '@map-colonies/*'
patch:
update-types:
- patch
# dev-deps
- package-ecosystem: npm
schedule:
interval: weekly
allow:
- dependency-type: development
directory: /
commit-message:
prefix: 'devdeps'
groups:
map-colonies:
patterns:
- '@map-colonies/*'
types:
patterns:
- '@types/*'
dev-patch:
update-types:
- patch

# github deps
- package-ecosystem: github-actions
schedule:
interval: weekly
commit-message:
prefix: 'ci'
directory: '/'
73 changes: 73 additions & 0 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: pull_request

on: [pull_request, workflow_dispatch]

jobs:
eslint:
name: Run TS Project eslint
runs-on: ubuntu-latest

strategy:
matrix:
node: [20.x]

steps:
- name: Check out TS Project Git repository
uses: actions/checkout@v4

- name: Init nodejs
uses: MapColonies/shared-workflows/actions/init-npm@init-npm-v1.0.0
with:
node-version: ${{ matrix.node }}

- name: Run TS Project linters
run: npm run lint

build-check:
name: Check Build Output
runs-on: ubuntu-latest

strategy:
matrix:
node: [20.x]

steps:
- name: Check out TS Project Git repository
uses: actions/checkout@v4

- name: Init nodejs
uses: MapColonies/shared-workflows/actions/init-npm@init-npm-v1.0.0
with:
node-version: ${{ matrix.node }}

- name: Build TypeScript project
run: npm run build

- name: Check for uncommitted changes in dist
run: |
git diff --exit-code
echo 'Build check: TypeScript built and dist is up-to-date.'
echo 'No uncommitted changes detected in compiled files.'

tests:
name: Run Tests
runs-on: ubuntu-latest

strategy:
matrix:
node: [20.x]

steps:
- name: Check out TS Project Git repository
uses: actions/checkout@v4

- name: Init nodejs
uses: MapColonies/shared-workflows/actions/init-npm@init-npm-v1.0.0

- name: Run tests
run: npm run test
- name: 'Report Coverage'
# Set if: always() to also generate the report if tests are failing
# Only works if you set `reportOnFailure: true` in your vite config as specified above
if: always()
uses: davelosert/vitest-coverage-report-action@v2
105 changes: 105 additions & 0 deletions .github/workflows/release-please.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: Release actions

on:
push:
branches:
- master

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: googleapis/release-please-action@a02a34c4d625f9be7cb89156071d8567266a2445 # v4.2.0
id: release
with:
config-file: release-please-config.json
manifest-file: .release-please-manifest.json
target-branch: ${{ github.ref_name }}

# We release full semver versions major.minor.patch. We need to make sure
# that v2 is updated as well as v2.0, so that people can pin to the major
# or major.minor versions if they want.
#
# `steps.release.outputs` will contain `<type>/<name>--release_created:
# true` for each component that was released.
# We then need to look at `<type>/<name>--tag_name to extract the tag
# name, which will be <name>-<semver>. From that, we can work out the
# major and minor tags and update them to point at the value of
# `<actions>/<name>--sha`.
- name: tag major and minor versions
if: steps.release.outputs.releases_created == 'true'
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
env:
RELEASES: ${{ toJSON(steps.release.outputs) }}
with:
script: |
const createOrUpdateTag = async (tag, sha) => {
const ref = `refs/tags/${tag}`;
let existingRef = null;
try {
const { data } = await github.rest.git.getRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `tags/${tag}`, // Use tags/${tag} for getRef - see https://github.com/octokit/rest.js/issues/339
});

existingRef = data;
console.log(`Tag ${tag} exists:`, existingRef);
} catch (e) {
if (e.status === 404) {
console.log(`Tag ${tag} does not exist.`);
} else {
console.error(`Error fetching tag ${tag}:`, e);
throw e;
}
}

if (existingRef) {
console.log(`Updating tag ${tag} from ${existingRef.object.sha} to ${sha}`);
await github.rest.git.updateRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `tags/${tag}`, // Use tags/${tag} for updateRef - see https://github.com/octokit/rest.js/issues/339
sha,
force: true
});
} else {
console.log(`Creating tag ${tag} at ${sha}`);
await github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref,
sha
});
}
}

const rsplit = (str, sep, maxsplit) => {
var split = str.split(sep);
return maxsplit ?
[split.slice(0, -maxsplit).join(sep)].concat(split.slice(-maxsplit)) :
split;
}

const releases = JSON.parse(process.env.RELEASES);
// Filter `releases` to get the `*--release_created` outputs where
// the value is `"true"`. Then strip off that suffix to get an array
// of components that were released.
const components = Object.entries(releases)
.filter(([key, value]) => key.endsWith('--release_created') && value === 'true')
.map(([key]) => key.replace(/--release_created$/, ''));

console.log(`Components released: ${components.join(', ')}`);

for (const component of components) {
const tag = releases[`${component}--tag_name`];
const sha = releases[`${component}--sha`];

console.log(`Updating major and minor tags for ${component} to ${sha}`);

const [name, semver] = rsplit(tag, '-', 1);
const [major, minor] = semver.split('.');

await createOrUpdateTag(`${name}-${major}`, sha);
await createOrUpdateTag(`${name}-${major}.${minor}`, sha);
}
111 changes: 111 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Development tools
.idea

# 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/

# TypeScript v1 declaration files
typings/

# 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
config.json

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

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
html
# 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

# Jest
jest_html_reporters.html
reports
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx commitlint --edit ${1}
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx pretty-quick --staged
Loading
Loading