Skip to content

Commit

Permalink
Move src/ to packages/ (#138)
Browse files Browse the repository at this point in the history
  • Loading branch information
huntharo authored Nov 28, 2021
1 parent db25d25 commit be27e3a
Show file tree
Hide file tree
Showing 125 changed files with 434 additions and 170 deletions.
26 changes: 13 additions & 13 deletions .github/workflows/main-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:

- name: Generate Projen Files
run: |
cd src/microapps-cdk/
cd packages/microapps-cdk/
npm run projen
- name: Build All TypeScript
Expand All @@ -65,12 +65,12 @@ jobs:

- name: Install CDK Construct Deps
run: |
cd src/microapps-cdk
cd packages/microapps-cdk
npm ci
- name: Build CDK Construct
run: |
cd src/microapps-cdk
cd packages/microapps-cdk
npm run build
- name: Check for new commits
Expand All @@ -83,7 +83,7 @@ jobs:
uses: actions/upload-artifact@v2
with:
name: cdk-construct-dist
path: src/microapps-cdk/dist
path: packages/microapps-cdk/dist
container:
image: ghcr.io/pwrdrvr/jsii-node-16

Expand Down Expand Up @@ -149,17 +149,17 @@ jobs:
with:
name: publish-tool-dist
path: |
src/microapps-publish/
!src/microapps-publish/node_modules/
packages/microapps-publish/
!packages/microapps-publish/node_modules/
- name: Upload Datalib artifact
if: ${{ steps.git_remote.outputs.latest_commit == github.sha }}
uses: actions/upload-artifact@v2
with:
name: datalib-dist
path: |
src/common/microapps-datalib/
!src/common/microapps-datalib/node_modules/
packages/microapps-datalib/
!packages/microapps-datalib/node_modules/
#
# Release Assets
Expand All @@ -176,19 +176,19 @@ jobs:
uses: actions/download-artifact@v2
with:
name: cdk-construct-dist
path: src/microapps-cdk/dist
path: packages/microapps-cdk/dist

- name: Download Publish Tool build artifacts
uses: actions/download-artifact@v2
with:
name: publish-tool-dist
path: src/microapps-publish
path: packages/microapps-publish

- name: Download Datalib build artifacts
uses: actions/download-artifact@v2
with:
name: datalib-dist
path: src/common/microapps-datalib
path: packages/microapps-datalib

#
# Publish other non-JSII Artifacts to NPM
Expand All @@ -198,12 +198,12 @@ jobs:

- name: Release Publish Tool - NPM
run: |
cd src/microapps-publish
cd packages/microapps-publish
npm publish --dry-run
- name: Release DataLib - NPM
run: |
cd src/common/microapps-datalib
cd packages/microapps-datalib
npm publish --dry-run
container:
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/prbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ jobs:
- name: Install Node Modules
run: npm ci

# Projen keeps creating `src/microapps-cdk/test/hello.test.ts`
# Projen keeps creating `packages/microapps-cdk/test/hello.test.ts`
- name: Generate Projen Files
run: |
cd src/microapps-cdk/
cd packages/microapps-cdk/
npx projen --version
npm run projen
ls -la test/
Expand All @@ -61,8 +61,8 @@ jobs:
- name: Modify microapps-cdk tsconfig.json
run: |
mv ./src/microapps-cdk/tsconfig.json ./src/microapps-cdk/tsconfig.jsii.json
jq ".compilerOptions += { \"skipLibCheck\": true }" ./src/microapps-cdk/tsconfig.jsii.json > ./src/microapps-cdk/tsconfig.json
mv packages/microapps-cdk/tsconfig.json packages/microapps-cdk/tsconfig.jsii.json
jq ".compilerOptions += { \"skipLibCheck\": true }" packages/microapps-cdk/tsconfig.jsii.json > packages/microapps-cdk/tsconfig.json
- name: Build All TypeScript
run: npm run build --if-present
Expand All @@ -79,7 +79,7 @@ jobs:

- name: Build CDK Construct
run: |
cd src/microapps-cdk
cd packages/microapps-cdk
npm ci
npm run build
Expand Down
48 changes: 24 additions & 24 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Based on projen template from src/microapps-cdk/.github/workflows/release.yml
# Based on projen template from packages/microapps-cdk/.github/workflows/release.yml
# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".

name: Release Packages
Expand Down Expand Up @@ -59,7 +59,7 @@ jobs:

- name: Generate Projen Files
run: |
cd src/microapps-cdk/
cd packages/microapps-cdk/
npm run projen
- name: Build All TypeScript
Expand All @@ -70,16 +70,16 @@ jobs:

- name: Install CDK Construct Deps
run: |
cd src/microapps-cdk
cd packages/microapps-cdk
npm ci
- name: Build CDK Construct
run: |
cd src/microapps-cdk
cd packages/microapps-cdk
npx projen release
- name: Apply Version to Everything (Deployer / Datalib)
run: npm version v$(cat src/microapps-cdk/dist/version.txt) --no-git-tag-version --workspaces
run: npm version v$(cat packages/microapps-cdk/dist/version.txt) --no-git-tag-version --workspaces

- name: Check for new commits
id: git_remote
Expand All @@ -91,12 +91,12 @@ jobs:
uses: actions/upload-artifact@v2
with:
name: version-txt
path: src/microapps-cdk/dist/version.txt
path: packages/microapps-cdk/dist/version.txt

- name: Create release
if: ${{ steps.git_remote.outputs.latest_commit == github.sha }}
run: |
cd src/microapps-cdk
cd packages/microapps-cdk
gh release create v$(cat dist/version.txt) -F dist/changelog.md -t v$(cat dist/version.txt)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -106,7 +106,7 @@ jobs:
uses: actions/upload-artifact@v2
with:
name: cdk-construct-dist
path: src/microapps-cdk/dist
path: packages/microapps-cdk/dist
container:
image: ghcr.io/pwrdrvr/jsii-node-16

Expand Down Expand Up @@ -181,17 +181,17 @@ jobs:
with:
name: publish-tool-dist
path: |
src/microapps-publish/
!src/microapps-publish/node_modules/
packages/microapps-publish/
!packages/microapps-publish/node_modules/
- name: Upload Datalib artifact
if: ${{ steps.git_remote.outputs.latest_commit == github.sha }}
uses: actions/upload-artifact@v2
with:
name: datalib-dist
path: |
src/common/microapps-datalib/
!src/common/microapps-datalib/node_modules/
packages/microapps-datalib/
!packages/microapps-datalib/node_modules/
#
# Release Assets
Expand All @@ -208,33 +208,33 @@ jobs:
uses: actions/download-artifact@v2
with:
name: cdk-construct-dist
path: src/microapps-cdk/dist
path: packages/microapps-cdk/dist

- name: Download Publish Tool build artifacts
uses: actions/download-artifact@v2
with:
name: publish-tool-dist
path: src/microapps-publish
path: packages/microapps-publish

- name: Download Datalib build artifacts
uses: actions/download-artifact@v2
with:
name: datalib-dist
path: src/common/microapps-datalib
path: packages/microapps-datalib

# Docs for GitHub Nuget
# https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-nuget-registry
# Docs for jsii-release-nuget
# https://github.com/cdklabs/jsii-release#nuget
# - name: Release CDK Construct - GitHub NuGet
# run: cd src/microapps-cdk && npx -p jsii-release@latest jsii-release-nuget
# run: cd packages/microapps-cdk && npx -p jsii-release@latest jsii-release-nuget
# env:
# NUGET_SERVER: https://nuget.pkg.github.com/pwrdrvr/index.json
# NUGET_API_KEY: ${{ secrets.GITHUB_TOKEN }}

- name: Release CDK Construct - NuGet.org
run: |
cd src/microapps-cdk
cd packages/microapps-cdk
npx -p jsii-release@latest jsii-release-nuget
env:
NUGET_API_KEY: ${{ secrets.NUGET_MICROAPPS }}
Expand All @@ -245,7 +245,7 @@ jobs:
# https://github.com/cdklabs/jsii-release#maven
- name: Release CDK Construct - Maven
run: |
cd src/microapps-cdk
cd packages/microapps-cdk
npx -p jsii-release@latest jsii-release-maven
env:
MAVEN_SERVER_ID: github
Expand All @@ -258,15 +258,15 @@ jobs:
# Docs for jsii-release-npm
# https://github.com/cdklabs/jsii-release#npm
# - name: Release CDK Construct - GitHub NPM
# run: cd src/microapps-cdk && npx -p jsii-release@latest jsii-release-npm
# run: cd packages/microapps-cdk && npx -p jsii-release@latest jsii-release-npm
# env:
# NPM_DIST_TAG: latest
# NPM_REGISTRY: npm.pkg.github.com
# NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Release CDK Construct - npmjs.org
run: |
cd src/microapps-cdk
cd packages/microapps-cdk
npx -p jsii-release@latest jsii-release-npm
env:
NPM_TOKEN: ${{ secrets.NPMJSORG_PUBLISH_TOKEN }} # jsii-release requires NPM_TOKEN as an env var
Expand All @@ -275,12 +275,12 @@ jobs:
# Publish other non-JSII Artifacts to GitHub Packages
#
# - name: Release Publish Tool - GitHub NPM
# run: npm config set registry https://npm.pkg.github.com && cd src/microapps-publish/dist && npm publish
# run: npm config set registry https://npm.pkg.github.com && cd packages/microapps-publish/dist && npm publish
# env:
# NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# - name: Release DataLib - GitHub NPM
# run: npm config set registry https://npm.pkg.github.com && cd src/common/microapps-datalib/dist && npm publish
# run: npm config set registry https://npm.pkg.github.com && cd packages/microapps-datalib/dist && npm publish
# env:
# NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand All @@ -292,12 +292,12 @@ jobs:

- name: Release Publish Tool - NPM
run: |
cd src/microapps-publish
cd packages/microapps-publish
npm publish
- name: Release DataLib - NPM
run: |
cd src/common/microapps-datalib
cd packages/microapps-datalib
npm publish
# - name: Github package registry authentication
Expand Down
30 changes: 16 additions & 14 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,39 @@
"name": "Debug microapps-publish",
"type": "pwa-node",
"request": "launch",
"cwd": "${workspaceFolder}/src/microapps-publish/",
"cwd": "${workspaceFolder}/packages/microapps-publish/",
// "cwd": "/Users/huntharo/pwrdrvr/microapps-app-release/",
"skipFiles": ["${workspaceFolder}/src/microapps-publish/<node_internals>/**"],
"skipFiles": ["${workspaceFolder}/packages/microapps-publish/<node_internals>/**"],
"runtimeVersion": "15.3.0",
"envFile": "${workspaceFolder}/.env",
// "outFiles": ["${workspaceFolder}/src/microapps-publish/dist/**/*.js"],
// "outFiles": ["${workspaceFolder}/packages/microapps-publish/dist/**/*.js"],
"runtimeArgs": ["-r", "ts-node/register/transpile-only"],
"args": ["${workspaceFolder}/src/microapps-publish/src/index.ts", "--new-version", "0.1.5"]
"args": [
"${workspaceFolder}/packages/microapps-publish/src/index.ts",
"--new-version",
"0.1.5"
]
},
{
"name": "Debug TS Router",
"type": "node",
"request": "launch",
"cwd": "${workspaceFolder}/src/microapps-router/",
"skipFiles": ["${workspaceFolder}/src/microapps-router/<node_internals>/**"],
"cwd": "${workspaceFolder}/packages/microapps-router/",
"skipFiles": ["${workspaceFolder}/packages/microapps-router/<node_internals>/**"],
"runtimeVersion": "15.3.0",
"env": {
"DEBUG": "true"
},
"envFile": "${workspaceFolder}/.env",
"runtimeArgs": ["-r", "ts-node/register/transpile-only"],
"args": ["${workspaceFolder}/src/microapps-router/src/index.ts"]
"args": ["${workspaceFolder}/packages/microapps-router/src/index.ts"]
},
{
"name": "Debug TS Deployer",
"type": "node",
"request": "launch",
"cwd": "${workspaceFolder}/src/microapps-deployer/",
"skipFiles": ["${workspaceFolder}/src/microapps-deployer/<node_internals>/**"],
"cwd": "${workspaceFolder}/packages/microapps-deployer/",
"skipFiles": ["${workspaceFolder}/packages/microapps-deployer/<node_internals>/**"],
"runtimeVersion": "15.3.0",
"env": {
"DEBUG": "true",
Expand All @@ -52,7 +56,7 @@
},
"envFile": "${workspaceFolder}/.env",
"runtimeArgs": ["-r", "ts-node/register/transpile-only"],
"args": ["${workspaceFolder}/src/microapps-deployer/src/index.ts"]
"args": ["${workspaceFolder}/packages/microapps-deployer/src/index.ts"]
},
{
"type": "node",
Expand All @@ -76,12 +80,10 @@
"-p",
"tsconfig.json",
"--ignore",
"\"./src/**/node_modules/**/*.spec.ts\"",
"\"./packages/**/node_modules/**/*.spec.ts\"",
"--retries",
"2",
"--require",
"./src/fixtures.ts",
"\"./src/**/*.spec.ts\""
"\"./packages/**/*.spec.ts\""
],
"cwd": "${workspaceFolder}/",
"console": "integratedTerminal",
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ npm run preinstall
```log
npm ERR! code ENOENT
npm ERR! syscall chmod
npm ERR! path /Users/myusername/pwrdrvr/microapps-core/node_modules/@pwrdrvr/microapps-publish/dist/src/index.js
npm ERR! path /Users/myusername/pwrdrvr/microapps-core/node_modules/@pwrdrvr/microapps-publish/dist/index.js
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, chmod '/Users/myusername/pwrdrvr/microapps-core/node_modules/@pwrdrvr/microapps-publish/dist/src/index.js'
npm ERR! enoent ENOENT: no such file or directory, chmod '/Users/myusername/pwrdrvr/microapps-core/node_modules/@pwrdrvr/microapps-publish/dist/index.js'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
```
Expand All @@ -38,7 +38,7 @@ npx projen new awscdk-construct --no-git --name @pwrdrvr/microapps-cdk --author

# Releasing NPM Packages

Challenge: `projen` does not support monorepos well, so it can build, tag, version, and release the CDK Construct library in `src/microapps-cdk` but it cannot be invoked to release `src/microapps-publish` and, because it doesn't support monorepos well, it cannot build and publish both in one invocation.
Challenge: `projen` does not support monorepos well, so it can build, tag, version, and release the CDK Construct library in `packages/microapps-cdk` but it cannot be invoked to release `packages/microapps-publish` and, because it doesn't support monorepos well, it cannot build and publish both in one invocation.

Below are tips, tricks, and commands used to build and release `microapps-publish` to NPM after `microapps-cdk` is done being published by `projen`.

Expand Down
Loading

0 comments on commit be27e3a

Please sign in to comment.