Skip to content

Commit

Permalink
Introducing y-npm (aka: Why NPM?) (#162)
Browse files Browse the repository at this point in the history
A drop-in replacement for the `npm` command that uses a local repository
as a source for packages, and falls back to the standard `npm` registry
for packages that are not locally available.

This can be used to make private packages available to consumers without
the need to set up a full blown repository and managing user
authentication and authorization; and also to overlay customized
versions of third party packages in a simple way.

The `y-npm` command has an additional sub-command `y-npm y-ls`
that will output the name and version of all packages that are locally
available.

This commit also replaces cdk-beta-npm in favor of using y-npm. Also,
the release .zip file no longer includes a full installation of the cdk,
instead only makes y-npm, so people can use y-npm instead of npm and
work as they normally would besides that (this reduces the file size of
the release zip by about 50%).
  • Loading branch information
RomainMuller committed Jun 25, 2018
1 parent c155f43 commit 0eba137
Show file tree
Hide file tree
Showing 46 changed files with 3,118 additions and 2,632 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,12 @@
## [UNRELEASED]

* Stopped bundling all dependencies in the release ZIP ([@RomainMuller] in [#161] and [awslabs/jsii#43])
* Replaced `cdk-beta-npm` with more generic `y-npm` tool ([@RomainMuller] in [#162])

[#161]: https://github.com/awslabs/aws-cdk/pull/161
[#162]: https://github.com/awslabs/aws-cdk/pull/162
[awslabs/jsii#43]: https://github.com/awslabs/jsii/pull/43

## 0.7.2 - 2018-06-19

* Add: initial construct library for [AWS Kinesis Data Streams] ([@sam-goodwin] in [#86])
Expand Down
6 changes: 6 additions & 0 deletions README.md
Expand Up @@ -50,6 +50,12 @@ Make sure the ~/.cdk/bin is in your `PATH`
export PATH=$PATH:$HOME/.cdk/bin
```

Install (or update) `aws-cdk` and `aws-cdk-docs` globally

```shell
y-npm install --global aws-cdk aws-cdk-docs
```

To check which CDK version you have installed:

```shell
Expand Down
50 changes: 27 additions & 23 deletions bundle-beta.sh
Expand Up @@ -6,43 +6,47 @@ set -euo pipefail
root=$PWD

staging="$(mktemp -d)"
cleanup() {
# Clean-up after yourself
echo "Cleaning up staging directory: ${staging}"
cd ${root}
rm -rf ${staging}
}
trap cleanup EXIT
cd ${staging}

echo "Staging: ${staging}"

# Bundle structure
# ================
#
# + bin
# + docs
# + repo
# + npm
# + maven
# + node_modules
#

# Create a local npm repository
# aws-cdk-${version}.zip
# ├─ bin
# ├─ docs
# ├─ repo
# │ └ maven
# ├─ y
# │ └─ npm
# └─ node_modules

# Creating a `y-npm` registry
echo "Preparing local NPM registry"
mkdir -p repo/npm
${root}/tools/pkgtools/bin/publish-to-verdaccio \
repo/npm \
${root}/pack \
${root}/.local-npm
mkdir -p y/npm
export Y_NPM_REPOSITORY="${staging}/y/npm"
Y_NPM="${root}/tools/y-npm/bin/y-npm"
for tarball in $(find ${root}/.local-npm -iname '*.tgz') $(find ${root}/pack -iname '*.tgz'); do
${Y_NPM} publish ${tarball}
done

echo "Installing y-npm" # using y-npm, we're so META!
${Y_NPM} install --global-style --no-save y-npm
ln -s node_modules/.bin bin

# Create a local maven repository
echo "Preparing local MVN registry"
mkdir -p repo/maven
rsync -av ${root}/packages/aws-cdk-java/maven-repo/ repo/maven/
rsync -av ${root}/node_modules/jsii-java-runtime/maven-repo/ repo/maven/

# Bootstrap a production-ready node_modules closure with all npm modules (jsii and CDK)
echo "Bootstrapping a production-ready npm closure"
npm install --global-style --production --no-save $(find repo/npm -iname '*.tgz')

# Symlink 'bin' to the root
echo "Symlinking bin"
ln -s node_modules/.bin bin

# Symlink the docs website to docs
echo "Symlinking docs"
ln -s node_modules/aws-cdk-docs/dist/docs docs
Expand Down
12 changes: 6 additions & 6 deletions packages/@aws-cdk/acm/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 16 additions & 16 deletions packages/@aws-cdk/applet-js/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/@aws-cdk/assert/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/@aws-cdk/cloudformation-diff/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions packages/@aws-cdk/cloudfront/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions packages/@aws-cdk/cloudtrail/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions packages/@aws-cdk/codebuild/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions packages/@aws-cdk/codecommit/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0eba137

Please sign in to comment.