Skip to content
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

Scratch package refactor merge #377

Open
wants to merge 54 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
a6f38fe
Added scratch gui package
pmalacho-mit Apr 1, 2024
80b3a6a
added vm
pmalacho-mit Apr 1, 2024
a5ba0de
Add pnpm
pmalacho-mit Apr 1, 2024
7a34807
preparing to bundle
pmalacho-mit Apr 1, 2024
ea6fd2d
changes to get things building
pmalacho-mit Apr 2, 2024
3f3f721
finalized necessary type changes
pmalacho-mit Apr 2, 2024
09d76c7
deleting packages folder
pmalacho-mit Apr 2, 2024
3a7129f
Merge branch 'dev-with-no-packages' into scratch-package-refactor
pmalacho-mit Apr 2, 2024
7de7b1d
working my way through it
pmalacho-mit Apr 2, 2024
512f6bb
updating scratch gui
pmalacho-mit Apr 5, 2024
2664f01
updating scratch-vm
pmalacho-mit May 17, 2024
3258fb7
adding lock and updates for scratch-gui
pmalacho-mit May 22, 2024
ed0eff0
readme edits
mayarajan3 May 22, 2024
f5f1040
updating extension readme
mayarajan3 May 22, 2024
260d1e3
Correcting workflows
pmalacho-mit May 22, 2024
be88f4c
upgraded to latest vm
pmalacho-mit May 22, 2024
011ca75
adding in pnpm setup step
pmalacho-mit May 22, 2024
7b3502d
split out vm declarations
pmalacho-mit May 22, 2024
982ecfc
add submodules true
pmalacho-mit May 22, 2024
6670ff6
attemptign to resolve default import error in textClassification
pmalacho-mit May 22, 2024
1971f35
likely resolved build issues (but at what cost)
pmalacho-mit May 22, 2024
df3045a
adding spaces
mayarajan3 May 22, 2024
b44ade1
path name?
mayarajan3 May 22, 2024
c7ec378
adding pnpm commands
mayarajan3 May 22, 2024
8c1f963
maybe resolved build error
pmalacho-mit May 22, 2024
8a03977
editing package.json and root package name
mayarajan3 May 23, 2024
008190f
changing package json template file
mayarajan3 May 23, 2024
c9e85e0
tagged template attempt
mayarajan3 May 23, 2024
15b815e
instance reporter
mayarajan3 May 23, 2024
d1be1dc
removing more types and cleanup?
mayarajan3 May 24, 2024
4e950d0
commands and minor improvement
mayarajan3 May 24, 2024
52d424f
changes
pmalacho-mit May 24, 2024
94c93e5
progress?
mayarajan3 May 24, 2024
586026e
adding mapping
mayarajan3 May 24, 2024
afdfb65
typing decorator implementation
pmalacho-mit May 24, 2024
6121ad8
Merge remote-tracking branch 'origin/tagged-template-block_make-use-o…
pmalacho-mit May 24, 2024
2eda943
Merge remote-tracking branch 'origin/scratch-package-refactor' into t…
pmalacho-mit Jun 18, 2024
5b09b69
not sure why I made these changes
pmalacho-mit Jun 18, 2024
e66be8b
type changes
pmalacho-mit Jun 18, 2024
f054523
figured out args issue
pmalacho-mit Jun 18, 2024
33e8641
Integrating multiple changes
pmalacho-mit Jun 18, 2024
5eb35cf
Updated simple example
pmalacho-mit Jun 21, 2024
42c6466
tagged tempalte working
pmalacho-mit Jun 21, 2024
d79473d
Merge pull request #362 from mitmedialab/tagged-template-block_finalize
pmalacho-mit Jun 21, 2024
4ed6014
Merge pull request #356 from mitmedialab/scratch-package-refactor-readme
pmalacho-mit Jun 21, 2024
ed0264a
Fix for bundling vm without common code
pmalacho-mit Jun 21, 2024
e9c2165
removed dead code
pmalacho-mit Jun 21, 2024
25d15e5
removing erroneous folder
pmalacho-mit Jun 21, 2024
6c13325
changes to complex example
pmalacho-mit Jun 21, 2024
8dde8e7
Adding icon picture for selfie segmentation
pmalacho-mit Jul 16, 2024
b5db77f
merging in dev
pmalacho-mit Jul 24, 2024
8e110f5
ran install
pmalacho-mit Jul 24, 2024
afde318
pulling in mayas documentation (thanks maya)
pmalacho-mit Jul 24, 2024
18592d6
updating to lastest
pmalacho-mit Jul 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
File renamed without changes
File renamed without changes
13 changes: 9 additions & 4 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,20 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.17.1]
node-version: [18]
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
with:
submodules: true
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: npm install, build, and test
run: npm run build
- uses: pnpm/action-setup@v4
with:
version: 8
- name: install & build
run: pnpm build
env:
CI: true
- name: Extract branch name
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/generate-extension-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,22 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.17.1]
node-version: [18]
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- uses: pnpm/action-setup@v4
with:
version: 8
- name: Initialize
run: npm run init
run: pnpm install
- name: Generate
run: npm run document:extensions
run: pnpm document:extensions
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: 're-generate extension documentation\n\nskip-checks:true'
Expand Down
8 changes: 8 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[submodule "scratch-packages/scratch-gui"]
path = scratch-packages/scratch-gui
url = git@github.com:mitmedialab/prg-raise-playground-scratch-gui.git
branch = main
[submodule "scratch-packages/scratch-vm"]
path = scratch-packages/scratch-vm
url = git@github.com:mitmedialab/prg-raise-playground-scratch-vm.git
branch = main
3 changes: 3 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
include-workspace-root=true
shared-workspace-lockfile=false
shamefully-hoist=true
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"request": "launch",
"runtimeExecutable": "node",
"resolveSourceMapLocations": [
"${workspaceFolder}/packages/scratch-vm/**",
"${workspaceFolder}/scratch-packages/scratch-vm/**",
"!**/node_modules/**"
],
"runtimeArgs": [
Expand All @@ -18,7 +18,7 @@
"args": [
"scripts/transpile.ts"
],
"cwd": "${workspaceRoot}/packages/scratch-vm/",
"cwd": "${workspaceRoot}/scratch-packages/scratch-vm/",
"internalConsoleOptions": "openOnSessionStart",
"skipFiles": [
"<node_internals>/**",
Expand Down
92 changes: 0 additions & 92 deletions BACKGROUND.md

This file was deleted.

30 changes: 0 additions & 30 deletions DEVELOPMENT.md

This file was deleted.

47 changes: 23 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,29 @@ This section contains concise explanations on how to accomplish something (often
Assuming you have...
- Git installed (if not, jump to: [Git](#Git))
- **_(Windows only)_** WSL setup (if not, jump to: [Windows Setup](#windows-only))
- Node <=16 is installed (if not, jump to: [Node](#Node))
- NPM >= 8.3.0 installed (if not, jump to: [NPM](#NPM))
- Node is installed (if not, jump to: [Node](#Node))
- PNPM is installed: [PNPM](#PNPM)
- VS Code installed with Typescript Extension added (if not, jump to: [Vs Code](#VS-Code-(Recommended)))

Run the following from the command line:

(**NOTE:** If using gitpod, this all will be done for you on startup)

```shell script
git clone git@github.com:mitmedialab/prg-extension-boilerplate.git
# Clone the repository onto your computer. This could take a while (~5m), grab a beverage!
git clone --recurse-submodules git@github.com:mitmedialab/prg-extension-boilerplate.git
# Clone the repository (including git submodules: scratch-gui and scratch-vm) onto your computer. This could take a while (~5m), grab a beverage!

cd prg-extension-boilerplate/
# Change directory (cd) to the repository

git checkout dev

npm run init
pnpm install
# This will symlink the packages together to allow for seamless local development, and installs dependencies for each package.
# This should only need to be ran once (unless you checkout a branch that adds new package dependencies).
# Takes ~1.5 minutes

npm run dev -- --include examples
pnpm dev -i examples
# This starts up a development server, serving the two "example" extensions.
# It takes about ~20s to initially startup and serve everything.
# Open http://localhost:8601/ in your browser (keep refreshing if nothing's coming up)
Expand All @@ -61,8 +61,8 @@ git checkout dev
git pull # Update branch with any remote changes
git checkout -b <my branch> # Checkout your 'feature' branch, e.g. git checkout -b new_rad_extension

npm run new:extension <folder to contain extension>
# For example: npm run new:extension my_awesome_extension
pnpm new:extension <folder to contain extension>
# For example: pnpm new:extension my_awesome_extension
# If succesful, the output of this command will tell you where to find your new extension file.
# It will be an index.ts file, and its documentation should help you get started
```
Expand All @@ -72,7 +72,7 @@ npm run new:extension <folder to contain extension>
If you're a pro extension-maker, use the following command to make a new extension that contains no documentation and/or filler text.

```shell script
npm run new:extension <folder to contain extension> barebones
pnpm new:extension <folder to contain extension> barebones
# Note the 'barenones' at the end
```

Expand All @@ -84,24 +84,22 @@ After you've [made your extension](#-making-an-extension), run the following com
cd prg-extension-boilerplate/ # If not already there
# Change directory (cd) to prg-extension-boilerplate/

npm run dev -- --include <folder name of extension(s)>
# For example: npm run dev -- --include my_awesome_extension
pnpm dev -i <folder name of extension(s)>
# For example: pnpm dev -i my_awesome_extension
# Start a development server to view your extension and reload it as you make changes
# This command will take ~20s to startup and serve everything to http://localhost:8601/

# Note: you can use the '-i' shorthand instead of writing out '--include'
npm run dev -- -i <folder name of extension(s)>
pnpm dev -i <folder name of extension(s)>

# Alternatively, serve all the currently implemented extensions
npm run dev -- --include all
pnpm dev -i all
# NOTE: This will be much more intensive on your computer
```

> **_FYI:_** If you're wondering why the extra `--` are necessary in the above commands, it's to ensure that node does not parse the `--include` flag (or any other options following the standalone `--`) as node options, and instead passes those arguments to the appropriate script. [See more.](https://nodejs.org/docs/latest-v8.x/api/cli.html#cli_1)

Then, after navigating to http://localhost:8601/, follow the 'Adding Extensions' guidance in the [official extension documentation](https://en.scratch-wiki.info/wiki/Extension) to add your extension to the workspace.

As long as the development server is running (meaning the `npm run dev` command is still executing), every change you make to the extension file(s) will trigger the page to refresh and your changes will be reflected automagically 🪄.
As long as the development server is running (meaning the `pnpm dev` command is still executing), every change you make to the extension file(s) will trigger the page to refresh and your changes will be reflected automagically 🪄.

### 📦 Committing, pushing, and deploying an extension

Expand Down Expand Up @@ -170,7 +168,7 @@ First, read through the documentation of the `index.ts` file (written inside of

Also, try hovering over fields to view their documentation (typically a [summary](https://jsdoc.app/tags-summary.html), [examples](https://jsdoc.app/tags-example.html), and a [longer desrciption](https://jsdoc.app/tags-description.html)).

![Gif of video hovering over fields to peak documentation](/documentation/assets/hover.gif)
![Gif of video hovering over fields to peak documentation](//.assets/hover.gif)

Still stuck? Check out our [From 0 to Extension guide](#-from-0-to-extension) and/or contact more experienced extension developers, like [Parker](https://github.com/pmalacho-mit) or [Randi](https://github.com/randi-c-dubs)

Expand Down Expand Up @@ -217,22 +215,23 @@ Please [install git](https://git-scm.com/downloads), which helps us with [source

Like many web development projects, this project requires [node](https://nodejs.org/en/).

Also, [due to a Webpack 4 issue](https://github.com/webpack/webpack/issues/14532), we require a node version <=16.

Please locate the [latest v16 release](https://nodejs.org/en/blog/release) and install a suitable version for your operating system. If you already have node and need to downgrade to a version <= 16, please see these [instructions for downgrading node](https://www.educative.io/answers/how-to-downgrade-node-version).
If you don't have Node installed, check out [this page](https://nodejs.org/en/download/package-manager) on how to download it.

#### Maintainer Note (9/15/22)

> In October 2022, node 18 LTS will be released, making it slightly harder to get node 16 LTS.
Before then, we either need to upgrade webpack to be able to use node 18, or revise the above instructions to help users locate node 16.

### NPM
### PNPM

[NPM](https://www.npmjs.com/) (Node Package Manager) is a [package manager](https://en.wikipedia.org/wiki/Package_manager) that is *usually* automatically installed with [Node](#Node).
[PNPM](https://pnpm.io/) (Performant Node Package Manager) is a [package manager](https://en.wikipedia.org/wiki/Package_manager) that enhances dependency management for JavaScript projects by storing package files globally and using symbolic links in the `node_modules` folder. This approach reduces disk space usage and maintains the module dependency tree, making it a faster and more space-efficient alternative to traditional package managers like [NPM](https://www.npmjs.com/), [Node](#Node)'s default package manager.

This project requires you to have NPM version ***8.3.0*** or later (in order to leverage [overrides](https://docs.npmjs.com/cli/v8/configuring-npm/package-json#overrides)).
If you've already installed [Node](#Node), you'll likely have NPM automatically installed. Run the command below to install PNPM using NPM.
```shell script
npm install -g pnpm
```

Please follow [these instructions](https://docs.npmjs.com/try-the-latest-stable-version-of-npm) to check which version of NPM you have and upgrade it if it's older than ***8.3.0***.
If you don't have NPM, you can [follow these instructions](https://pnpm.io/installation) to install PNPM.

### VS Code (Recommended)

Expand Down
Loading
Loading