Skip to content

Commit

Permalink
Work in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
microbit-matt-hillsdon committed Sep 9, 2024
0 parents commit 8ffe08e
Show file tree
Hide file tree
Showing 31 changed files with 14,020 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react-hooks/recommended',
'plugin:storybook/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
plugins: ['react-refresh'],
rules: {
// Should be "warn". Two to fix.
'react-refresh/only-export-components': [
'off',
{ allowConstantExport: true },
],
},
};
49 changes: 49 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: build
on:
release:
types: [created]
push:
branches:
- '**'
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
cache: npm
- uses: microbit-foundation/npm-package-versioner-action@v1
- run: npm ci
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: npm run ci
- name: Upload GitHub packages artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./storybook-static
- run: npm publish
if: github.event_name == 'release' && github.event.action == 'created'
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
deploy:
# https://github.com/actions/deploy-pages
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
needs: build
# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
if: github.ref == 'refs/heads/main'
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
28 changes: 28 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

*storybook.log
*.tgz
storybook-static/
34 changes: 34 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
.*
*.log

# tools configs
**/tsconfig.json
tsconfig.*.json
tslint.json
**/webpack.config.js
**/jest.config.js
**/prettier.config.js

# build scripts
config/
scripts/

# Test files
**/*.spec.js
**/*.test.js
**/*.test.d.ts
**/*.spec.d.ts
__tests__
coverage

**/stories/*

# Sources
node_modules
src
docs
examples

## this is generated by `npm pack`
*.tgz
package
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@microbit-foundation:registry=https://npm.pkg.github.com/microbit-foundation
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"singleQuote": true,
"arrowParens": "always",
"bracketSpacing": true,
"trailingComma": "es5",
"printWidth": 80
}
16 changes: 16 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import type { StorybookConfig } from '@storybook/react-vite';

const config: StorybookConfig = {
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@chromatic-com/storybook',
'@storybook/addon-interactions',
],
framework: {
name: '@storybook/react-vite',
options: {},
},
};
export default config;
14 changes: 14 additions & 0 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import type { Preview } from "@storybook/react";

const preview: Preview = {
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
},
};

export default preview;
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) YEAR AUTHOR

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# React/JavaScript library for embedding Microsoft MakeCode as an iframe

This project is a work in progress.

It is intended to be used by other Micro:bit Educational Foundation projects
that need to embed MakeCode and, when the API stabilises, to be useful to others
who embed MakeCode.

## License

This software is under the MIT open source license.

[SPDX-License-Identifier: MIT](LICENSE)

We use dependencies via the NPM registry as specified by the package.json file under common Open Source licenses.

The MakeCode/PXT types are derived from the [Microsoft MakeCode/PXT repository](https://github.com/Microsoft/pxt) as of 954d72b3a763608ca6f484807f511591ce48691a under a MIT license.

Full details of each package can be found by running `license-checker`:

```bash
$ npx license-checker --direct --summary --production
```

Omit the flags as desired to obtain more detail.

## Code of Conduct

Trust, partnership, simplicity and passion are our core values we live and
breathe in our daily work life and within our projects. Our open-source
projects are no exception. We have an active community which spans the globe
and we welcome and encourage participation and contributions to our projects
by everyone. We work to foster a positive, open, inclusive and supportive
environment and trust that our community respects the micro:bit code of
conduct. Please see our [code of conduct](https://microbit.org/safeguarding/)
which outlines our expectations for all those that participate in our
community and details on how to report any concerns and what would happen
should breaches occur.
70 changes: 70 additions & 0 deletions docs/makecode-status.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
## Done

- [x] closeflyout
- [x] compile
- [x] editorcontentloaded
- [x] gettoolboxcategories
- [x] hidesimulator
- [x] importexternalproject
- [x] importproject
- [x] importtutorial
- [x] info
- [x] newproject
- [x] openheader
- [x] pair
- [x] print
- [x] redo
- [x] renderblocks
- [x] renderbyblockid
- [x] renderpython
- [x] renderxml
- [x] restartsimulator
- [x] saveproject
- [x] sethighcontrast
- [x] setlanguagerestriction
- [x] setscale
- [x] setsimulatorfullscreen
- [x] settracestate
- [x] shareproject
- [x] showsimulator
- [x] startactivity
- [x] startsimulator
- [x] stopsimulator
- [x] switchblocks
- [x] switchjavascript
- [x] switchpython
- [x] togglegreenscreen
- [x] togglehighcontrast
- [x] toggletrace
- [x] tutorialevent
- [x] undo
- [x] unloadproject
- [x] workspaceevent
- [x] workspaceloaded
- [x] workspacereset
- [x] workspacesave
- [x] workspacesync

## Later

- [ ] serviceworkerregistered
- Requires investigation
- [ ] runeval
- For the new teacher tool.
- [ ] proxytosim
- Requires investigation

## Can't be implemented

- [ ] simevent
- This one doesn't seem to respect controller=N so doesn't fire.
- [ ] workspacediagnostics
- This one doesn't seem to respect controller=N so doesn't fire.
- [ ] requestprojectcloudstatus
- Unsurprisingly these requests fail (with an error inside MakeCode)
- [ ] convertcloudprojectstolocal
- [ ] savelocalprojectstocloud
- Assumed won't work
- [ ] projectcloudstatus
- Is send in response to a message that errors
- [ ] event
Loading

0 comments on commit 8ffe08e

Please sign in to comment.