Closed daveseah closed 9 months ago
These new modules are intended to function in at three contexts from a single set of source files:
Initial attempt to update the build system proved too difficult due to the legacy nature of the NetCreate 1.0 codebase and could have taken months. The next course of action was to add a secondary build system alongside the old such that new code to still run inside the old code without ruining the developer experience. This also helps with the plan to make our modules reusable in the future.
see source Whimsical Diagram for updates
.eslintrc.js
), improve prompts for detected NodeJS version and netcreate-config.js
statusDropped features:
Reviewing...
Confirm nvm use
Confirm everything works...Template Edit BUG (Ben's bug probably) -- To reproduce
./ur
-- results in an error:
Oh, that is inadvertently including some test code that I didn't think I committed yet. Good catch!
Confirmed ./ur
error fixed.
All other tests passed.
I've pushed a few refinements to detect zsh vs bash issues, but I don't think you need to retest. I've updated the testing instructions also to fill-in missing information.
Looks like the Template.jsx fix also worked. Thanks! Merge away?
Looks like the Template.jsx fix also worked. Thanks! Merge away?
@benloh I did one final change: removed the restriction on requiring zsh, which also opened up compatible detection for linux. This means that it should work with bash OR zsh
If you could give the PR one last check to see if npm run dev
works both inside VSCODE integrated terminal and also in a standalone terminal window. The output should be different in each case, but really just wanting to avoid a crash
@benloh You don't have to retest anything else, just run npm run dev
to make sure it doesn't crash.
Examples of the output you should be seeing (these are zsh on macos on an M1):
Running inside VSCODE opened through the provided netcreate-itest.code-workspace
(these have been standard in our projects for quite some time):
Running inside VSCODE but folder was opened directly, skipping the workspace project which has project-specific settings, in particular ensuring that certain plugins are turned off and running workspace scripts:
Running outside of VSCODE in a regular terminal window
The new script should on bash
now as well as I am not using any (?) zsh features. Also, this should cover the case of running linux on DO as well but I haven't tested that.
There is now also a hard stop if there is a node version mismatch. This has been there for a while but thought I would point it out:
Confirmed:
NODE VERSION MISMATCH
warnings.bash
and zsh
both work
Merging!
This stage defines a new modular code system that will be used for NetCreate 2.0 features (e.g. commenting, data processing). The intent is to create a portable system that (1) can be easily added to existing and new projects and (2) maintain the highest possible developer experience (DX) for programmers of all skill levels.
OVERVIEW OF CHANGES
There are now two build systems and three packages.
brunch 2
build system used with NetCreate for the main root directory that works as it did before.esbuild
with its ownpackage.json
exporting@ursys/netcreate
esbuild
with its ownpackage.json
, exporting@ursys/nc-addons
The new build system defines multiple "entry points" for each
package.json
. The new code is exported to_ur/_dist
as both legacy CommonJS modules and the newer ES Modules in either nodejs or browser contexts.The repo is also technically a "monorepo" now, which allows the root-level
npm
commands to handle multiple independent packages at the same time when usingnpm ci
andnpm build
similar tolerna
in the GEM-STEP project.BACKGROUND INFO
This pull request (PR) establishes the seeds of systematic modular thinking by providing an initial implementation, which has two main thrusts:
Offer explicit definitions of modularity with an additional emphasis on "model-first" approach to code design and its implementation. This will help developers with different backgrounds understand what the code does by discouraging spaghetti coding.
Encourage and standardize the use of existing models in industry to help developers understand the conventions around common-but-complex functions in a systematic way. Topics include asynchronous programming, event handling, animation, user interface, data architecture. This will help developers by providing simple models of use for well-established tools, terminology, and practice.
We are at the very beginning of a team-wide initiative to really nail down how we will do modular programming by capturing and systemizing software concepts as they apply to our realtime projects.
This is a long-term initiative, and there will be future stages of modular architecture refinement as we try out our starting system. The system and its components will be based on the experience we've gained since 2014 working on these particular problems together.
NEXT STEPS
KNOWN ISSUES
_ur_mods
with_ur
as a single compiled library instead of two.HOW TO TEST
This PR does not add any new NetCreate features, but does have minimal integration with the existing codebase that we can test. The most important test is Confirm Netcreate Still Works (Test 1); the other tests are optional to perform but I would appreciate that they are tested.
As the build system has been modified, it's important to do a clean install.
TEST 1: CONFIRM NETCREATE STILL WORKS
dev-ds/ur-modules2
netcreate-itest.code-workspace
project filezshrc: VISUAL STUDIO CODE INTEGRATED TERMINAL DETECTED
with possibly different text below. Capture a screenshot of the entire terminal window and post as a comment here (even if successful).Before proceeding, we want to save your settings just in case...
npm run clean
thennpm ci
runtime
directory (this shouldn't be necessary but play it safe)netcreate-config.js
file in theapp-config
directory.netcreate-config.js
toold-config.js
or delete the file; you will recreate it in a future step.Now we run NetCreate
npm ci
followed bynpm run dev
./nc.js
netcreate-config.js
file.--- compilation complete ---
...it should look like this (even on M1 systems):TEST 2: EXPLORE THE NEW SYSTEM
cd _ur
. This is the home of the secondary build system._dist
directory in the folder. it should be grayed out because it's an ignored file../ur
to execute the build system script placeholder._ur/_dist
folder. It should now exist and include a number of.js
and.map
files.Now we will test integration with the old NetCreate codebase.
localhost:3000
in a Chromium-based browser (e.g. Chrome or Arc)init.jsx
entry to see the full debug context.Confirm this is what you see
UR
andURMOD
.@client.ts
filename is showing on the right. Click it.:void
appears which is not regular Javascript.TEST 3: CONFIRM LINTING AND TYPE CHECKING
These are the systems that ensure developers using Visual Studio Code are not introduce issues into the code base.
npm run lint
no-unused-vars
which are the majority of the warningsnc-logic.js
. These are the critical errors that we don't want in our codebase.Now shift attention back to the Visual Studio Code editor itself
Open the file
app/system/datastore.js
(a plain javascript file)On line 26 insert the line 'banana'...red squiggles should appear under the word, indicating an error. Hovering over the highlighted word tells you what the error is.
Modify the line to read
banana = banana ++ 1
. the error shifts. When there are multiple errors in a file, some errors are masked until you fix them.This shows that the ESLINT vscode extension is functioning properly
Open the file
_ur/browser-client/env-browser.ts
(a typescript file)On line 9 insert
type FOO = string;
followed byconst test: FOO = 123;
You should see
test
underlined in red. Hovering over the highlighted area for a second should show you ts errors as well aseslint
errors.This shows that Typescript configuration is correctly installed.
Open the file
_ur/node-server/files.mts
(a nodejs typescript module file)Confirm that the
type FOO = string; const test: FOO = 123;
generates the same error as the previous version.TEST 4: HIDDEN FILES
There are several files that are now excluded from the file explorer. These files are generally things that no one should be touching, not even other developers. Here's how to find them, though:
netcreate-itest.code-workspace
.editorconfig
in the list:netcreate-itest.code-workspace
file directly, which should have this section:That concludes the testing of surface features in this pull request.