Skip to content

Commit

Permalink
Switch from 'build' to 'dist' (#92)
Browse files Browse the repository at this point in the history
* Switch from 'build' to 'dist'

* Update release gh workflow

* Redirect diff output to /dev/null
  • Loading branch information
joanlopez authored Jan 12, 2024
1 parent 7bc5310 commit e49d277
Show file tree
Hide file tree
Showing 60 changed files with 44 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.cache/
build/
dist/
public/
node_modules/
16 changes: 12 additions & 4 deletions .github/workflows/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Install npm packages
run: npm install

- name: Verify the build is up to date
run: |
npm run webpack -- --output-path="${RUNNER_TEMP}/dist"
if ! diff -r "${RUNNER_TEMP}/dist" dist > /dev/null; then
echo "Build is out of date, please run 'npm run webpack' and commit the changes"
exit 1
fi
- name: Install Go
uses: actions/setup-go@v4
with:
Expand All @@ -31,8 +42,5 @@ jobs:
- name: Wait for the localstack scripts to have been applied
run: sleep 30

- name: Install npm packages
run: npm install

- name: Test
run: npm run webpack && npm run ci-test
run: npm run ci-test
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ jobs:
run: |
set -x
VERSION="${GITHUB_REF##*/}"
npm run webpack && tar -zcf "k6-jslib-aws-${VERSION}.tar.gz" -C build .
npm run webpack && tar -zcf "k6-jslib-aws-${VERSION}.tar.gz" -C dist .
- name: Create release with assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -x
VERSION="${GITHUB_REF##*/}"
gh release create "${VERSION}" "k6-jslib-aws-${VERSION}.tar.gz" "build/*" --target "${GITHUB_SHA}" --title "${VERSION}"
gh release create "${VERSION}" "k6-jslib-aws-${VERSION}.tar.gz" "dist/*" --target "${GITHUB_SHA}" --title "${VERSION}"
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules/
/volume
/volume
build/
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ If the jslib-aws does not support the service you need yet, the best way to get
1. The service should have tests.
2. The service should have documentation.
3. The service should be re-exported in the `src/index.ts` file.
4. The service should be exposed in the `aws.js` file in the `build` directory when running the `npm run webpack` command.
5. The service should produce a dedicated `{service-name}.js` file in the `build` directory when running the `npm run webpack` command.
6. The service should produce source map files for the dedicated `{service-name}.js` file and the `aws.js` file in the `build` directory when running the `npm run webpack` command.
4. The service should be exposed in the `aws.js` file in the `dist` directory when running the `npm run webpack` command.
5. The service should produce a dedicated `{service-name}.js` file in the `dist` directory when running the `npm run webpack` command.
6. The service should produce source map files for the dedicated `{service-name}.js` file and the `aws.js` file in the `dist` directory when running the `npm run webpack` command.

#### Steps

Expand Down
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -417,16 +417,13 @@ The scope of this library has been kept minimal and limited to the use cases we,
npm install

# Bundle it in preparation for a publication
npm run-script webpack
npm run webpack

# Run the tests
npm test
```

### Deploying new versions

1. Build.
2. Use the `./dist/aws.js` to make a PR to [jslib.k6.io](https://github.com/grafana/jslib.k6.io).
For further details, take a look at [CONTRIBUTING.md](CONTRIBUTING.md).

## Maintainers

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion examples/event-bridge.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AWSConfig, EventBridgeClient } from '../build/event-bridge.js';
import { AWSConfig, EventBridgeClient } from '../dist/event-bridge.js';

const awsConfig = new AWSConfig({
region: __ENV.AWS_REGION,
Expand Down
2 changes: 1 addition & 1 deletion examples/kinesis.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AWSConfig, KinesisClient } from '../build/kinesis.js'
import { AWSConfig, KinesisClient } from '../dist/kinesis.js'
import encoding from 'k6/encoding'
import { fail } from 'k6'

Expand Down
2 changes: 1 addition & 1 deletion examples/kms.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import exec from 'k6/execution'

import { AWSConfig, KMSClient } from '../build/kms.js'
import { AWSConfig, KMSClient } from '../dist/kms.js'

const awsConfig = new AWSConfig({
region: __ENV.AWS_REGION,
Expand Down
2 changes: 1 addition & 1 deletion examples/lambda.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AWSConfig, LambdaClient } from '../build/lambda.js'
import { AWSConfig, LambdaClient } from '../dist/lambda.js'
import { check } from 'k6';

const awsConfig = new AWSConfig({
Expand Down
2 changes: 1 addition & 1 deletion examples/s3-multipart.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import crypto from 'k6/crypto'
import exec from 'k6/execution'

import { AWSConfig, S3Client } from '../build/s3.js'
import { AWSConfig, S3Client } from '../dist/s3.js'

const awsConfig = new AWSConfig({
region: __ENV.AWS_REGION,
Expand Down
2 changes: 1 addition & 1 deletion examples/s3.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import exec from 'k6/execution'

import { AWSConfig, S3Client } from '../build/s3.js'
import { AWSConfig, S3Client } from '../dist/s3.js'

const testFile = open('./bonjour.txt', 'r')

Expand Down
2 changes: 1 addition & 1 deletion examples/secrets-manager.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import exec from 'k6/execution'

import { AWSConfig, SecretsManagerClient } from '../build/secrets-manager.js'
import { AWSConfig, SecretsManagerClient } from '../dist/secrets-manager.js'

const awsConfig = new AWSConfig({
region: __ENV.AWS_REGION,
Expand Down
2 changes: 1 addition & 1 deletion examples/signature-presign.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
AWSConfig,
SignatureV4,
AMZ_CONTENT_SHA256_HEADER,
} from '../build/aws.js'
} from '../dist/aws.js'

const awsConfig = new AWSConfig({
region: __ENV.AWS_REGION,
Expand Down
2 changes: 1 addition & 1 deletion examples/signature-sign.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import http from 'k6/http'

import { AWSConfig, SignatureV4 } from '../build/signature.js'
import { AWSConfig, SignatureV4 } from '../dist/signature.js'

const awsConfig = new AWSConfig({
region: __ENV.AWS_REGION,
Expand Down
2 changes: 1 addition & 1 deletion examples/sqs.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import exec from 'k6/execution'

import { AWSConfig, SQSClient } from '../build/sqs.js'
import { AWSConfig, SQSClient } from '../dist/sqs.js'

const awsConfig = new AWSConfig({
region: __ENV.AWS_REGION,
Expand Down
2 changes: 1 addition & 1 deletion examples/ssm.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import exec from 'k6/execution'

import { AWSConfig, SystemsManagerClient } from '../build/ssm.js'
import { AWSConfig, SystemsManagerClient } from '../dist/ssm.js'

const awsConfig = new AWSConfig({
region: __ENV.AWS_REGION,
Expand Down
2 changes: 1 addition & 1 deletion tests/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { randomIntBetween } from 'https://jslib.k6.io/k6-utils/1.2.0/index.js'

import { AWSConfig } from '../build/aws.js'
import { AWSConfig } from '../dist/aws.js'

import { s3TestSuite } from './internal/s3.js'
import { secretsManagerTestSuite } from './internal/secrets-manager.js'
Expand Down
2 changes: 1 addition & 1 deletion tests/internal/event-bridge.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { asyncDescribe } from './helpers.js'
import { EventBridgeClient } from '../../build/event-bridge.js'
import { EventBridgeClient } from '../../dist/event-bridge.js'

export async function eventBridgeTestSuite(data) {
const eventBridge = new EventBridgeClient(data.awsConfig)
Expand Down
2 changes: 1 addition & 1 deletion tests/internal/kinesis.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { asyncDescribe } from './helpers.js'
import { KinesisClient } from '../../build/kinesis.js'
import { KinesisClient } from '../../dist/kinesis.js'
import encoding from 'k6/encoding'
import { sleep } from 'k6'

Expand Down
2 changes: 1 addition & 1 deletion tests/internal/kms.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { asyncDescribe } from './helpers.js'
import { KMSClient } from '../../build/kms.js'
import { KMSClient } from '../../dist/kms.js'

export async function kmsTestSuite(data) {
const kmsClient = new KMSClient(data.awsConfig)
Expand Down
2 changes: 1 addition & 1 deletion tests/internal/lambda.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { asyncDescribe } from './helpers.js'
import { LambdaClient } from '../../build/lambda.js'
import { LambdaClient } from '../../dist/lambda.js'

export async function lambdaTestSuite(data) {
const lambdaClient = new LambdaClient(data.awsConfig)
Expand Down
2 changes: 1 addition & 1 deletion tests/internal/s3.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { asyncDescribe } from './helpers.js'

import { S3Client, S3ServiceError } from '../../build/s3.js'
import { S3Client, S3ServiceError } from '../../dist/s3.js'

export async function s3TestSuite(data) {
const s3Client = new S3Client(data.awsConfig)
Expand Down
2 changes: 1 addition & 1 deletion tests/internal/secrets-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { asyncDescribe } from './helpers.js'
import {
SecretsManagerClient,
SecretsManagerServiceError,
} from '../../build/secrets-manager.js'
} from '../../dist/secrets-manager.js'

export async function secretsManagerTestSuite(data) {
const secretsManagerClient = new SecretsManagerClient(data.awsConfig)
Expand Down
2 changes: 1 addition & 1 deletion tests/internal/signature.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
HOST_HEADER,
SIGNING_ALGORITHM_IDENTIFIER,
UNSIGNED_PAYLOAD,
} from '../../build/signature.js'
} from '../../dist/signature.js'

import { describe, expect } from 'https://jslib.k6.io/k6chaijs/4.3.4.0/index.js'

Expand Down
2 changes: 1 addition & 1 deletion tests/internal/sqs.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { asyncDescribe } from './helpers.js'
import { b64encode } from 'k6/encoding'
import { SQSClient, SQSServiceError } from '../../build/sqs.js'
import { SQSClient, SQSServiceError } from '../../dist/sqs.js'

export async function sqsTestSuite(data) {
const sqsClient = new SQSClient(data.awsConfig)
Expand Down
2 changes: 1 addition & 1 deletion tests/internal/ssm.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { asyncDescribe } from './helpers.js'
import { SystemsManagerClient, SystemsManagerServiceError } from '../../build/ssm.js'
import { SystemsManagerClient, SystemsManagerServiceError } from '../../dist/ssm.js'

export async function ssmTestSuite(data) {
const systemsManagerClient = new SystemsManagerClient(data.awsConfig)
Expand Down
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module.exports = {
signature: path.resolve(__dirname, 'src/signature.ts'),
},
output: {
path: path.resolve(__dirname, 'build'),
path: path.resolve(__dirname, 'dist'),
libraryTarget: 'commonjs',
filename: '[name].js',
},
Expand Down

0 comments on commit e49d277

Please sign in to comment.