-
Notifications
You must be signed in to change notification settings - Fork 75
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
[Monorepo] Adopt @glimmer/component and @glimmer/application #3
Conversation
Multi-root API
Initialize `_rootsIndex` with a value
Improved tests
Set `args` on components
With this commit, tests import everything from the package's root `index.ts` file. This facilitates testing production builds of the package, where internal modules are hoisted and thus lost.
With this commit, tests import everything from the package's root `index.ts` file. This facilitates testing production builds of the package, where internal modules are hoisted and thus lost.
Monorepo preparation
Monorepo preparation
- rm files from correct directory - fix glob for gitignore - yarn install and lerna bootstrap after import
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good @tomdale!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Need a
build
script (likely also asprepublish
).
cache: yarn | ||
|
||
addons: | ||
firefox: "54.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should update to use chrome with --headless
instead (should be a follow up PR I believe).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
} | ||
|
||
// Fail fast if we haven't done a build first. | ||
assertDistExists(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, I think we should just always ember build -prod
here instead of checking that dist
exists. This same script exists in glimmer-vm and I have published old builds at least 5 times 🤦♂️ .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugh, sorry about that. I updated the script to eagerly perform a build always.
} | ||
|
||
function assertGitIsClean() { | ||
let status = execSync('git status').toString(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should use --porcelain
option (otherwise users git
configs break this)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL, thank you
}); | ||
|
||
let glimmerVM = funnel('packages', { | ||
include: ['@glimmer/*/node_modules/@glimmer/*/dist/amd/es5/*.js'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't fully grok what is happening here. What creates packages/@glimmer/<whatever>/node_modules/@glimmer/compiler
? What prevents duplicates from being concatted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Packages are installed here by Lerna during lerna bootstrap
. Duplicates are indeed concatted, which is allowed by our AMD loader so long as it duplicates are registered before the module is reified. This is obviously not ideal, but requires a mechanism for having per-package dependencies in the tests. I wanted to get something working landed and then iterate on resolving that problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, mind creating an issue and linking to it from a comment? Just to make sure we don't lose track of the concern...
destDir: '/assets' | ||
}); | ||
|
||
let qunit = funnel(path.join(require.resolve('qunitjs'), '..'), { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this going to end up watching all of node_modules
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, because:
> require.resolve('qunitjs')
'/Users/tomdale/Code/glimmer.js/node_modules/qunitjs/qunit/qunit.js'
So this resolves to node_modules/qunitjs/qunit
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thank you for confirming.
@@ -0,0 +1,50 @@ | |||
{ | |||
"name": "glimmer.js", | |||
"version": "0.8.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems odd to bump this here (others are on 0.7.x I believe)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking we should synchronize versions here like we do with glimmer-vm since @glimmer/application
and @glimmer/component
are so coupled. They're on 0.7.2 and 0.6.0 respectively now so I think we'd need to bump to 0.8.0 if we want to sync versions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Totally agreed that we should synchronize, but what I was actually getting at was that the "bumping" of the version number should be done all at the same time with the publish script (the last time I ran the bin/publish
in glimmer-vm where one package had a different version number I got an error)
name: 'symlink-dependencies', | ||
|
||
preBuild() { | ||
rimraf('dist/@glimmer/*/node_modules'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems pretty weird: clearing dist/
when we may not even be building into dist/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is line 29 the best way to determine target output directory for the current build?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, not really (it doesn't account for ember build --output-path=./some-path
) but I don't think we can do better here without changes upstream.
I'd suggest we add a process.env.EMBER_CLI_BUILD_OUTPUT_PATH
environment variable (or expose it via some specific API that addons have access to).
@@ -0,0 +1,66 @@ | |||
'use strict'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This addon seems unused? Did you intend to add ember-addon: { paths: ['./build/symlink-dependencies']}
to the package.json
?
I'm going to block as there is a cycle. Update
|
Move Environment, DynamicScope, and Iterable modules to glimmer-application
This PR begins the process of turning this repo into a monorepo that contains "application-level" Glimmer packages (as opposed to "VM-level" packages in glimmer-vm).
To start, we import
@glimmer/component
and@glimmer/application
. These are imported using the script inscript/import-packages.sh
which preserves each repository's git history.Features
Lerna for managing dependencies
Each package can have its own dependencies; these are installed by running
lerna bootstrap
.Single Root
tsconfig.json
This prevents VS Code from getting confused when one package imports another across
tsconfig.json
boundaries, which may have different settings. The singletsconfig.json
keeps VS Code happy and also keeps code quality consistent across subpackages.Use
paths
for package resolutionWe use
tsconfig.json
'spaths
setting to allow TypeScript to find local packages, even when imported via package name. This is preferable to symlinking intonode_modules
because relying on Node module resolution causes TypeScript to look atpackage.json
, which points at.d.ts
files instead of the actual TypeScript source. The implication of this is that when you command-click a symbol from another package in VS Code, you get taken to the actual source code instead of a generated.d.ts
file, and cross-package changes are reflected in the editor immediately without waiting for a build step.Unified build
Build and test all packages in the repository via a single Broccoli build script. The build infrastructure is very similar to the recent work for glimmer-vm with some tweaks: