Skip to content

Commit

Permalink
fix(nx-semantic-release): add ESM support
Browse files Browse the repository at this point in the history
  • Loading branch information
goestav committed May 19, 2023
1 parent 55df58c commit ee7c63d
Show file tree
Hide file tree
Showing 16 changed files with 451 additions and 398 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.GH_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}

- name: Setup Node.js
uses: actions/setup-node@v3
Expand All @@ -22,17 +22,17 @@ jobs:

- name: Configure CI Git User
run: |
git config --global user.name 'TheUnderScorer'
git config --global user.email 'przemyslawzydek@gmail.com'
git remote set-url origin https://TheUnderScorer:$GITHUB_TOKEN@github.com/TheUnderScorer/nx-semantic-release
git config --global user.name 'goestav'
git config --global user.email '27970303+goestav@users.noreply.github.com'
git remote set-url origin https://goestav:$GITHUB_TOKEN@github.com/goestav/nx-semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install npm dependencies
run: npm ci

- name: Link package
run: npm run build:skip-cache && npm link dist/packages/nx-semantic-release && npm ls @theunderscorer/nx-semantic-release
run: npm run build:skip-cache && npm link dist/packages/nx-semantic-release && npm ls @goestav/nx-semantic-release

- name: Print versions
run: |
Expand All @@ -43,6 +43,6 @@ jobs:
- name: Release
run: npm run release
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ jobs:

- name: Configure CI Git User
run: |
git config --global user.name 'TheUnderScorer'
git config --global user.email 'przemyslawzydek@gmail.com'
git remote set-url origin https://TheUnderScorer:$GITHUB_TOKEN@github.com/TheUnderScorer/nx-semantic-release
git config --global user.name 'goestav'
git config --global user.email '27970303+goestav@users.noreply.github.com'
git remote set-url origin https://goestav:$GITHUB_TOKEN@github.com/goestav/nx-semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down
117 changes: 59 additions & 58 deletions README.md

Large diffs are not rendered by default.

649 changes: 353 additions & 296 deletions package-lock.json

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"repository": {
"type": "git",
"url": "https://github.com/TheUnderScorer/nx-semantic-release"
"url": "https://github.com/goestav/nx-semantic-release"
},
"license": "MIT",
"engines": {
Expand Down Expand Up @@ -51,7 +51,7 @@
"cosmiconfig": "^7.0.1",
"remeda": "^0.0.32",
"semantic-release": "20.1.0",
"semantic-release-plugin-decorators": "3.0.1",
"semantic-release-plugin-decorators": "github:tjg184/semantic-release-plugin-decorators#e3c3c66",
"@nx/devkit": "16.0.0"
},
"devDependencies": {
Expand All @@ -75,7 +75,6 @@
"ts-jest": "29.1.0",
"ts-node": "10.9.1",
"ttypescript": "^1.5.13",
"type-fest": "^2.8.0",
"typescript": "4.9.5",
"nx-cloud": "16.0.5",
"@nx/workspace": "16.0.0",
Expand All @@ -85,7 +84,7 @@
"@nx/web": "16.0.0",
"@nx/jest": "16.0.0",
"@nx/plugin": "16.0.0-rc.0",
"@nx/node": "16.0.0"
"@nx/node": "16.0.0",
"type-fest": "^2.8.0"
}
}

4 changes: 2 additions & 2 deletions packages/nx-semantic-release/generators.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
"install": {
"factory": "./src/generators/install/generator",
"schema": "./src/generators/install/schema.json",
"description": "@theunderscorer/nx-semantic-release installator"
"description": "@goestav/nx-semantic-release installator"
},
"setup-project": {
"factory": "./src/generators/setup-project/generator",
"schema": "./src/generators/setup-project/schema.json",
"description": "@theunderscorer/nx-semantic-release executor for setting up releases for project"
"description": "@goestav/nx-semantic-release executor for setting up releases for project"
}
}
}
6 changes: 3 additions & 3 deletions packages/nx-semantic-release/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@theunderscorer/nx-semantic-release",
"name": "@goestav/nx-semantic-release",
"version": "2.4.0",
"description": "Semantic release for NX.",
"description": "Semantic release for NX with support for ESM.",
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
Expand All @@ -20,7 +20,7 @@
},
"repository": {
"type": "git",
"url": "https://github.com/TheUnderScorer/nx-semantic-release"
"url": "https://github.com/goestav/nx-semantic-release"
},
"engines": {
"node": ">=16.0.0"
Expand Down
4 changes: 2 additions & 2 deletions packages/nx-semantic-release/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
}
},
"semantic-release": {
"executor": "@theunderscorer/nx-semantic-release:semantic-release",
"executor": "@goestav/nx-semantic-release:semantic-release",
"options": {
"branches": [
"master",
Expand All @@ -62,7 +62,7 @@
}
],
"buildTarget": "nx-semantic-release:build",
"repositoryUrl": "https://github.com/TheUnderScorer/nx-semantic-release",
"repositoryUrl": "https://github.com/goestav/nx-semantic-release",
"github": true,
"outputPath": "dist/packages/nx-semantic-release",
"releaseRules": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export async function semanticRelease(
const release = await getSemanticRelease();

await release({
extends: '@theunderscorer/nx-semantic-release',
extends: '@goestav/nx-semantic-release',
...resolvedOptions,
tagFormat,
plugins,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('Installer', () => {

it('should create example', async () => {
await runNxCommandAsync(
`generate @theunderscorer/nx-semantic-release:install --repositoryUrl=test --enforceConventionalCommits=false`
`generate @goestav/nx-semantic-release:install --repositoryUrl=test --enforceConventionalCommits=false`
);

const config = readJson(generatedConfigFileName);
Expand All @@ -34,7 +34,7 @@ describe('Installer', () => {
describe('--enforceConventionalCommits', () => {
it('should setup project to enforce conventional commits', async () => {
await runNxCommandAsync(
`generate @theunderscorer/nx-semantic-release:install --repositoryUrl=test --enforceConventionalCommits`
`generate @goestav/nx-semantic-release:install --repositoryUrl=test --enforceConventionalCommits`
);

const paths = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "http://json-schema.org/schema",
"title": "@theunderscorer/nx-semantic-release installator",
"title": "@goestav/nx-semantic-release installator",
"type": "object",
"properties": {
"baseBranch": {
Expand Down Expand Up @@ -38,7 +38,5 @@
"x-prompt": "Would you want to create npm releases?"
}
},
"required": [
"repositoryUrl"
]
"required": ["repositoryUrl"]
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "http://json-schema.org/schema",
"title": "@theunderscorer/nx-semantic-release setup generator for project",
"title": "@goestav/nx-semantic-release setup generator for project",
"type": "object",
"properties": {
"projectName": {
Expand Down Expand Up @@ -37,7 +37,5 @@
"x-prompt": "What tag format would you like to use for this project. Hint: you can use ${PROJECT_NAME} and ${VERSION} tokens here."
}
},
"required": [
"projectName"
]
"required": ["projectName"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ describe('Setup project', () => {

it('should setup project', async () => {
await runNxCommandAsync(
`generate @theunderscorer/nx-semantic-release:setup-project ${project}`
`generate @goestav/nx-semantic-release:setup-project ${project}`
);

assertProjectConfiguration({
executor: '@theunderscorer/nx-semantic-release:semantic-release',
executor: '@goestav/nx-semantic-release:semantic-release',
options: {
github: true,
changelog: true,
Expand All @@ -43,11 +43,11 @@ describe('Setup project', () => {

it('should setup project using given configuration', async () => {
await runNxCommandAsync(
`generate @theunderscorer/nx-semantic-release:setup-project ${project} --github=false --changelog=false --npm=false --tagFormat=test`
`generate @goestav/nx-semantic-release:setup-project ${project} --github=false --changelog=false --npm=false --tagFormat=test`
);

assertProjectConfiguration({
executor: '@theunderscorer/nx-semantic-release:semantic-release',
executor: '@goestav/nx-semantic-release:semantic-release',
options: {
github: false,
changelog: false,
Expand All @@ -59,7 +59,7 @@ describe('Setup project', () => {

it('should create valid project configuration that can be released', async () => {
await runNxCommandAsync(
`generate @theunderscorer/nx-semantic-release:setup-project ${project} --github=false --changelog=true --npm=true`
`generate @goestav/nx-semantic-release:setup-project ${project} --github=false --changelog=true --npm=true`
);

updateFile(projectConfigurationPath, (file) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export async function setupTestNxWorkspace() {
throw new Error(`Nx plugin dist folder does not exist at: ${distPath}`);
}

ensureNxProject('@theunderscorer/nx-semantic-release', distPath);
ensureNxProject('@goestav/nx-semantic-release', distPath);
} catch (error) {
console.error('Failed to setup test Nx workspace', error);

Expand Down
6 changes: 3 additions & 3 deletions packages/nx-semantic-release/src/tests/setup-test-repo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ async function bootstrapTestProjectsAndLibs() {
updateWorkspaceNxConfig();
linkDependencies();
await runNxCommandAsync(
`generate @theunderscorer/nx-semantic-release:install --repositoryUrl=file://${remoteGitPath} --enforceConventionalCommits=false`
`generate @goestav/nx-semantic-release:install --repositoryUrl=file://${remoteGitPath} --enforceConventionalCommits=false`
);

configureSemanticReleaseForProject('app-a', {
Expand Down Expand Up @@ -166,7 +166,7 @@ async function bootstrapTestProjectsAndLibs() {
},
});
configureSemanticReleaseForProject('common-lib', {
executor: '@theunderscorer/nx-semantic-release:semantic-release',
executor: '@goestav/nx-semantic-release:semantic-release',
options: {
dryRun: false,
buildTarget: 'build',
Expand Down Expand Up @@ -268,7 +268,7 @@ function configureSemanticReleaseForProject(
targets: {
...projectConfiguration.targets,
'semantic-release': {
executor: '@theunderscorer/nx-semantic-release:semantic-release',
executor: '@goestav/nx-semantic-release:semantic-release',
options,
},
},
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"skipDefaultLibCheck": true,
"baseUrl": ".",
"paths": {
"@theunderscorer/nx-semantic-release": [
"@goestav/nx-semantic-release": [
"packages/nx-semantic-release/src/index.ts"
]
}
Expand Down

0 comments on commit ee7c63d

Please sign in to comment.