-
Notifications
You must be signed in to change notification settings - Fork 246
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bundle jsii modules as npm tarballs and embed jsii-runtime in .NET (#52)
This change modifies the way we bundle jsii modules. Instead of webpacking them and storing the code inside the assembly spec, we now simply use "npm pack" to produce an npm tarball (.tgz) and include that in the generated library. The kernel now simply accepts the path to the tarball (as oppose to the entire code passed through STDIN), and untars it into a working directory (under node_modules). This effectively allows dependencies to `require(it)`. This change also dramatically improves load-time performance (again, we are not sending a big JSON file over the wire, parse it, and then evaluate it into the VM). Bundled dependencies are now simple npm bundled dependencies. If a module uses the old- style configuration, we fail with instructions. NOTE: we currently do not support multiple versions of the same module loaded together into the same kernel space. This is a major and unacceptable limitation for production environments, which we must address, or otherwise, people will constantly hit these restrictions as jsii software stacks evolve. BREAKING CHANGE. * CR fixes * .NET: bundling of jsii-runtime and jsii tarball modules Bundle jsii tarball modules into generated .NET packages and also bundle the jsii-runtime program as an embedded resource into the dotnet runtime library. This removes the dependency on jsii-runtime, and leaves only node.js as an external dependency. It also improves load-time performance since the tarball is only passed as a path to the runtime/kernel and not the entire .js code. * Bring in a few fixes from dotnet-tarballs * Initial set of CR comments * Fix "update-version.sh" `set -euo` fails for unbound variables * Add CodeBuild build badge * Add missing tgz to pacmak tests * Ignore +build when setting jsii version * update versions * Require native type * Do not include commit sha in version Since we have version numbers in test expectations every build will get a different version number and that invariably causes tests to fail. * Improvements to pacmak tests 1. Add calc-lib 2. Create expected tarball on-the-fly to avoid binary diffs resulting from different platforms * Take only first 7 chars from commit sha * Add node_modules/.bin to PATH so we can execute lerna * Fix a couple of tests
- Loading branch information
Elad Ben-Israel
authored
Jul 11, 2018
1 parent
a5a9270
commit 0db8802
Showing
304 changed files
with
5,723 additions
and
15,727 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
.vscode | ||
|
||
*.js | ||
*.d.ts | ||
dist/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
# creates symlinks under node_modules for all packages in this repo | ||
# can be used to work against this code base. | ||
set -euo pipefail | ||
root="$(cd $(dirname $0) && pwd)" | ||
|
||
mkdir -p node_modules node_modules/.bin | ||
|
||
modules="$(find ${root}/packages -name package.json | grep -v node_modules | grep -v init-templates | xargs -n1 dirname)" | ||
for module in ${modules}; do | ||
if [[ $(basename $(dirname $module)) == @* ]]; then | ||
# This is a @scope/based package | ||
scope=$(basename $(dirname $module)) | ||
link_dir=node_modules/$(basename $(dirname $module)) | ||
mkdir -p $link_dir | ||
else | ||
link_dir=node_modules | ||
fi | ||
|
||
echo "${module} => $link_dir/$(basename $module)" | ||
ln -fs ${module} $link_dir | ||
|
||
# Symlink executable scripts into place as well. This is not completely | ||
# according to spec (we look in the bin/ directory instead of the { "scripts" | ||
# } entry in package.json but it's quite a bit easier. | ||
[[ -d $module/bin ]] && for script in $(find $module/bin -perm +111); do | ||
echo "${script} => node_modules/.bin/$(basename $script)" | ||
ln -fs ${script} node_modules/.bin | ||
done | ||
done |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
!index.js | ||
.jsii |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.export = 42; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "jsii-calc-bundled", | ||
"version": "0.5.0-beta", | ||
"main": "index.js", | ||
"private": true, | ||
"author": { | ||
"name": "Amazon Web Services", | ||
"url": "https://aws.amazon.com" | ||
}, | ||
"scripts": { | ||
"build": "true" | ||
}, | ||
"license": "LicenseRef-LICENSE", | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/awslabs/jsii" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
tsconfig.json | ||
tslint.json | ||
dist | ||
.jsii | ||
*.tgz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# Don't include original .ts files when doing `npm pack` | ||
*.ts | ||
!*.d.ts | ||
*.tgz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
tsconfig.json | ||
tslint.json | ||
dist | ||
.jsii |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# Don't include original .ts files when doing `npm pack` | ||
*.ts | ||
!*.d.ts | ||
*.tgz |
Oops, something went wrong.