Skip to content

Commit

Permalink
New project structure (matthewp#189)
Browse files Browse the repository at this point in the history
* New project structure

* Fix yaml syntax error

* Drop Node 14 from CI

* Add changesets

With the bot

* Add docs deploy to CI

* Update lockfile

* Add an export map

* Update the contributing guide

* Update packages/core/package.json

Co-authored-by: Grant Kiely <[email protected]>

---------

Co-authored-by: Grant Kiely <[email protected]>
  • Loading branch information
2 people authored and masto committed Mar 26, 2023
1 parent d6e1477 commit e10fd93
Show file tree
Hide file tree
Showing 29 changed files with 10,843 additions and 5,276 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
7 changes: 7 additions & 0 deletions .changeset/quick-parents-repair.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"robot3": minor
---

Drop support for Node 14

This drops support for Node 14, with it no longer being supported by the LTS in February. Robot might still work in Node 14 but is not tested in our CI.
18 changes: 7 additions & 11 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,17 @@ jobs:

strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
node-version: [16.x, 18.x]

steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Puppeteer Container
uses: ianwalter/[email protected]
- name: npm install, build, and test
run: |
npm ci
npm run server &
npm run bundlesize
npm test
env:
CI: true
- name: Install
run: npm ci
- name: Bundle size
run: npm run bundlesize --workspaces
- name: Test
run: npm run test --workspaces
43 changes: 43 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Release

on:
push:
branches:
- main
paths:
- 'packages/core/**'

jobs:
changelog:
name: Changelog PR or Release
if: ${{ github.ref_name == 'main' && github.repository_owner == 'matthewp' }}
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
steps:
- uses: actions/checkout@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

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

- name: Install NPM Dependencies
run: npm ci

- name: Build
run: npm run build --workspaces

- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
publish: npm run changeset publish
commit: '[ci] release'
title: '[ci] release'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
45 changes: 45 additions & 0 deletions .github/workflows/site.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Deploy Site

on:
push:
branches:
- main
paths:
- 'docs/**'

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18

- name: Install dependencies
run: npm install

- name: Build Site
run: npm run --workspace=docs build

- name: Sync Bucket
uses: jakejarvis/s3-sync-action@master
with:
args: --delete
env:
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
DEST_DIR: '/'
SOURCE_DIR: 'docs/_site' # optional: defaults to entire repository

- name: Invalidate CDN
uses: chetan/invalidate-cloudfront-action@master
env:
DISTRIBUTION: ${{ secrets.DISTRIBUTION }}
PATHS: '/*'
AWS_REGION: 'us-east-1'
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules/
.wireit/
_site/
.DS_Store
machine.min.js
Expand Down
9 changes: 0 additions & 9 deletions Makefile

This file was deleted.

31 changes: 31 additions & 0 deletions contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Contributing

## Tests

Core tests are in `packages/core/test`. You can run then by first launching a server:

```shell
npm run --workspace=packages/core server
```

And then loading `http://localhost:1965/test/test.html` in a browser.

To run the tests from the CLI you can run:

```shell
npm test --workspace=packages/core
```

## Submitting a PR

When you submit a PR, be sure to add a changeset, which is used to automate the release process.

```shell
npm run changeset
```

Answer the prompts which will create a file in the `.changeset/` folder. You can edit this file to write a description of the changes.

## Releases

Releases are automated with [changesets](https://github.com/changesets/changesets). Once a PR has been submitted, an action will create a new PR for the release. Submit that PR in order to release a new version.
6 changes: 3 additions & 3 deletions docs/.eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ const markdownItTocAndAnchor = require('markdown-it-toc-and-anchor').default;

module.exports = function(eleventyConfig) {
eleventyConfig.setTemplateFormats([ 'md', 'njk' ]);
eleventyConfig.addPassthroughCopy('docs/styles');
eleventyConfig.addPassthroughCopy('docs/images');
eleventyConfig.addPassthroughCopy('styles');
eleventyConfig.addPassthroughCopy('images');

eleventyConfig.addPlugin(pluginSyntaxHighlight);

Expand All @@ -28,7 +28,7 @@ module.exports = function(eleventyConfig) {

return {
data: {
dir: 'docs/_data'
dir: '_data'
}
};
};
27 changes: 27 additions & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "robot-site",
"private": true,
"devDependencies": {
"@11ty/eleventy": "^1.0.2",
"@11ty/eleventy-plugin-syntaxhighlight": "^4.2.0",
"markdown-it": "^13.0.1",
"markdown-it-toc-and-anchor": "^4.2.0"
},
"scripts": {
"build": "wireit",
"dev": "wireit"
},
"wireit": {
"build": {
"command": "eleventy --config=.eleventy.js"
},
"dev": {
"command": "eleventy --serve",
"service": {
"readyWhen": {
"lineMatches": "Serving files"
}
}
}
}
}
Loading

0 comments on commit e10fd93

Please sign in to comment.