Skip to content

Commit e541f30

Browse files
committed
Initial commit
1 parent 3c36dbe commit e541f30

6 files changed

Lines changed: 75 additions & 6 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

README.md

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,33 @@
1-
## My Project
1+
# AWS CodeArtifact NPM Example
22

3-
TODO: Fill this README out!
3+
An example repository for creating, publishing, and installing npm packages
4+
using [AWS CodeArtifact](https://aws.amazon.com/codeartifact/)
45

5-
Be sure to:
6+
## Prerequisites
67

7-
* Change the title in this README
8-
* Edit your repository description on GitHub
8+
1. [Create an AWS account](https://aws.amazon.com/premiumsupport/knowledge-center/create-and-activate-aws-account/)
9+
2. [Install and configure the AWS Command Line Interface](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-quickstart.html)
10+
3. [Create a CodeArtifact repository](https://docs.aws.amazon.com/codeartifact/latest/ug/create-repo.html)
11+
12+
## Getting Started
13+
14+
### Find and replace the following
15+
16+
1. `my-repo` with your CodeArtifact repository name
17+
2. `my-domain` with your CodeArtifact domain
18+
3. `us-east-1` with the region of your CodeArtifact repository
19+
4. `<ACCOUNT ID>` with your AWS account ID
20+
5. `@myorg` with your org name
21+
22+
### Publish `my-package`
23+
24+
To publish `my-package`, change your working directory to [./my-package](./my-package)
25+
and run `npm publish`
26+
27+
### Install from `my-app`
28+
29+
To install your new package, change your working directory to [./my-app](./my-app)
30+
and run `npm install`
931

1032
## Security
1133

@@ -14,4 +36,3 @@ See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more inform
1436
## License
1537

1638
This library is licensed under the MIT-0 License. See the LICENSE file.
17-

my-app/index.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
* Copyright Amazon.com, Inc. and its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: MIT
4+
*
5+
* Licensed under the MIT License. See the LICENSE accompanying this file
6+
* for the specific language governing permissions and limitations under
7+
* the License.
8+
*/
9+
10+
const { helloWorld } = require("@myorg/my-package");
11+
12+
helloWorld();

my-app/package.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "my-app",
3+
"version": "1.0.0",
4+
"description": "A sample application consuming a private scoped npm package",
5+
"main": "index.js",
6+
"scripts": {
7+
"prepare": "npm run co:login",
8+
"co:login": "aws codeartifact login --tool npm --repository my-repo --domain my-domain"
9+
},
10+
"dependencies": {
11+
"@myorg/my-package": "^1.0.0"
12+
}
13+
}

my-package/index.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
* Copyright Amazon.com, Inc. and its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: MIT
4+
*
5+
* Licensed under the MIT License. See the LICENSE accompanying this file
6+
* for the specific language governing permissions and limitations under
7+
* the License.
8+
*/
9+
10+
module.exports.helloWorld = function () {
11+
console.log("Hello world!");
12+
};

my-package/package.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"name": "@myorg/my-package",
3+
"version": "1.0.0",
4+
"description": "A sample private scoped npm package",
5+
"main": "index.js",
6+
"scripts": {
7+
"prepare": "npm run co:login",
8+
"co:login": "aws codeartifact login --tool npm --repository my-repo --domain my-domain"
9+
}
10+
}

0 commit comments

Comments
 (0)