Skip to content

Commit

Permalink
chore(release): publish 0.0.0-e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
DominikPieper committed Jun 25, 2024
1 parent 61a7e39 commit 8a9bbe1
Show file tree
Hide file tree
Showing 17 changed files with 130 additions and 137 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## 0.0.0-e2e (2024-06-24)

### 🚀 Features

- **sveltekit:** upgrade versions and allow CLI overrides ([f867fb34](https://github.com/nxext/nx-extensions/commit/f867fb34))

### 🩹 Fixes

- **stencil:** allow ArrayLiteralExpression in addCodeIntoArray ([f24475d5](https://github.com/nxext/nx-extensions/commit/f24475d5))
- **stencil:** resolve `validateConfig` error from @stencil/core@14.17.0 onward ([f5b87252](https://github.com/nxext/nx-extensions/commit/f5b87252))
- **stencil:** remove gitignore addage ([b6e8e8be](https://github.com/nxext/nx-extensions/commit/b6e8e8be))

### ❤️ Thank You

- Dominik Pieper @DominikPieper
- kristianmandrup @kristianmandrup
- Maarten Van Hoof @mrtnvh
- Sharief Orie
2 changes: 1 addition & 1 deletion docs/docs/svelte/generators.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ Default: `vitest`

Type: `string`

Possible values: `jest`, `vitest`, `none`
Possible values: `vitest`, `none`

Test runner to use for unit tests.

Expand Down
4 changes: 2 additions & 2 deletions e2e/solid-e2e/tests/solid.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ describe('solid e2e', () => {

afterAll(() => {
// Cleanup the test project
rmSync(projectDirectory, {
/*rmSync(projectDirectory, {
recursive: true,
force: true,
});
});*/
});

describe('solid app', () => {
Expand Down
17 changes: 1 addition & 16 deletions e2e/svelte-e2e/tests/application.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
import { createTestProject, installPlugin } from '@nxext/e2e-utils';
import { rmSync } from 'fs';

describe('svelte e2e', () => {
xdescribe('svelte e2e', () => {
let projectDirectory: string;

beforeAll(() => {
Expand Down Expand Up @@ -82,21 +82,6 @@ describe('svelte e2e', () => {
});

describe('should be able to run tests', () => {
it('with jest', async () => {
const plugin = uniq('svelteapptests');
await runNxCommandAsync(
`generate @nxext/svelte:app ${plugin} --directory=apps --unitTestRunner='jest' --e2eTestRunner='none'`
);
await runNxCommandAsync(
`generate @nxext/svelte:component test --project=${plugin}`
);

const result = await runNxCommandAsync(`test ${plugin}`);
expect(`${result.stdout}${result.stderr}`).toContain(
'Ran all test suites'
);
});

it('with vitest', async () => {
const plugin = uniq('svelteapptests');
await runNxCommandAsync(
Expand Down
19 changes: 2 additions & 17 deletions e2e/svelte-e2e/tests/library.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ describe('svelte e2e', () => {

afterAll(() => {
// Cleanup the test project
rmSync(projectDirectory, {
/*rmSync(projectDirectory, {
recursive: true,
force: true,
});
});*/
});

describe('Svelte lib', () => {
Expand Down Expand Up @@ -55,21 +55,6 @@ describe('svelte e2e', () => {
});

describe('should be able to run tests', () => {
it('with jest', async () => {
const plugin = uniq('jest');
await runNxCommandAsync(
`generate @nxext/svelte:lib ${plugin} --directory=libs --unitTestRunner=jest --e2eTestRunner='none'`
);
await runNxCommandAsync(
`generate @nxext/svelte:component test --project=${plugin}`
);

const result = await runNxCommandAsync(`test ${plugin}`);
expect(`${result.stdout}${result.stderr}`).toContain(
'Ran all test suites'
);
});

it('with vitest', async () => {
const plugin = uniq('vitest');
await runNxCommandAsync(
Expand Down
17 changes: 16 additions & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@
}
},
"targetDefaults": {
"nx-release-publish": {
"options": {
"packageRoot": "dist/packages/{projectName}"
}
},
"build": {
"dependsOn": ["^build"],
"inputs": ["production", "^production"],
Expand Down Expand Up @@ -122,6 +127,16 @@
"parallel": 1,
"defaultBase": "main",
"release": {
"projects": ["*", "!docs", "!stencil", "!*-e2e", "!e2e-*"]
"projects": ["*", "!docs", "!stencil", "!common", "!*-e2e", "!e2e-*"],
"releaseTagPattern": "release/{version}",
"git": {
"commitMessage": "chore(release): {version}"
},
"version": {
"generatorOptions": {
"packageRoot": "dist/packages/{projectName}",
"currentVersionResolver": "git-tag"
}
}
}
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@
"prettier": "2.7.1",
"pretty-quick": "^3.1.3",
"semver": "^7.6.2",
"svelte": "^4.2.12",
"svelte-preprocess": "^5.1.3",
"svelte": "^4.2.18",
"svelte-preprocess": "^6.0.1",
"tcp-port-used": "^1.0.2",
"ts-jest": "29.1.2",
"ts-node": "10.9.2",
Expand Down
15 changes: 14 additions & 1 deletion packages/common/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,18 @@
}
}
},
"tags": []
"tags": [],
"release": {
"version": {
"generatorOptions": {
"packageRoot": "dist/{projectRoot}",
"currentVersionResolver": "git-tag"
}
}
},
"nx-release-publish": {
"options": {
"packageRoot": "dist/{projectRoot}"
}
}
}
52 changes: 41 additions & 11 deletions packages/solid/src/generators/library/lib/add-vite.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,46 @@
import { ensurePackage, NX_VERSION, Tree } from '@nx/devkit';
import {
ensurePackage,
GeneratorCallback,
NX_VERSION,
runTasksInSerial,
Tree,
} from '@nx/devkit';
import { NormalizedSchema } from '../schema';
import { createOrEditViteConfig } from '@nx/vite';

export async function addVite(host: Tree, options: NormalizedSchema) {
const { viteConfigurationGenerator } = ensurePackage<
typeof import('@nx/vite')
>('@nx/vite', NX_VERSION);
const tasks: GeneratorCallback[] = [];

return await viteConfigurationGenerator(host, {
uiFramework: 'none',
project: options.name,
newProject: true,
includeVitest: options.unitTestRunner === 'vitest',
inSourceTests: false,
});
if (options.buildable || options.publishable) {
const { viteConfigurationGenerator } = ensurePackage<
typeof import('@nx/vite')
>('@nx/vite', NX_VERSION);

const viteTask = await viteConfigurationGenerator(host, {
uiFramework: 'none',
project: options.name,
newProject: true,
includeLib: true,
includeVitest: options.unitTestRunner === 'vitest',
inSourceTests: false,
skipFormat: true,
});
tasks.push(viteTask);

createOrEditViteConfig(
host,
{
project: options.name,
includeLib: true,
includeVitest: options.unitTestRunner === 'vitest',
inSourceTests: false,
rollupOptionsExternal: [],
imports: [`import solidPlugin from 'vite-plugin-solid'`],
plugins: [`solidPlugin()`],
},
false
);
}

return runTasksInSerial(...tasks);
}
14 changes: 0 additions & 14 deletions packages/solid/src/generators/library/library.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,20 +93,6 @@ export async function libraryGeneratorInternal(
const lintTask = await addLinting(host, options);
const jestTask = await addJest(host, options);
const viteTask = await addVite(host, options);
createOrEditViteConfig(
host,
{
project: options.name,
includeLib: false,
includeVitest: options.unitTestRunner === 'vitest',
inSourceTests: false,
rollupOptionsExternal: [],
imports: [`import solidPlugin from 'vite-plugin-solid'`],
plugins: [`solidPlugin()`],
},
false
);

const vitestTask = await addVitest(host, options);

updateTsConfig(host, options);
Expand Down
21 changes: 0 additions & 21 deletions packages/svelte/src/generators/library/lib/add-jest.ts

This file was deleted.

32 changes: 28 additions & 4 deletions packages/svelte/src/generators/library/lib/add-vite.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,46 @@
import { Tree, ensurePackage, NX_VERSION } from '@nx/devkit';
import {
Tree,
ensurePackage,
NX_VERSION,
GeneratorCallback,
runTasksInSerial,
} from '@nx/devkit';
import { NormalizedSchema } from '../schema';
import { createOrEditViteConfig } from '@nx/vite';

export async function addVite(host: Tree, options: NormalizedSchema) {
const tasks: GeneratorCallback[] = [];

if (options.buildable || options.publishable) {
const { viteConfigurationGenerator } = ensurePackage<
typeof import('@nx/vite')
>('@nx/vite', NX_VERSION);

return await viteConfigurationGenerator(host, {
const viteTask = await viteConfigurationGenerator(host, {
uiFramework: 'none',
project: options.name,
newProject: true,
includeLib: true,
includeVitest: options.unitTestRunner === 'vitest',
inSourceTests: false,
skipFormat: true,
});
tasks.push(viteTask);

createOrEditViteConfig(
host,
{
project: options.name,
includeLib: false,
includeVitest: options.unitTestRunner === 'vitest',
inSourceTests: false,
rollupOptionsExternal: [],
imports: [`import { svelte } from '@sveltejs/vite-plugin-svelte'`],
plugins: [`svelte()`],
},
false
);
}

// eslint-disable-next-line @typescript-eslint/no-empty-function
return () => {};
return runTasksInSerial(...tasks);
}
23 changes: 0 additions & 23 deletions packages/svelte/src/generators/library/lib/update-jest-config.ts

This file was deleted.

21 changes: 1 addition & 20 deletions packages/svelte/src/generators/library/library.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,10 @@ import { addProject } from './lib/add-project';
import { updateTsConfig } from './lib/update-tsconfig';
import { formatFiles, Tree, updateJson, runTasksInSerial } from '@nx/devkit';
import { addLinting } from './lib/add-linting';
import { addJest } from './lib/add-jest';
import { updateJestConfig } from './lib/update-jest-config';
import { addVite } from './lib/add-vite';
import { createProjectFiles } from './lib/create-project-files';
import { addVitest } from './lib/add-vitest';
import { normalizeOptions } from './lib/normalize-options';
import { createOrEditViteConfig } from '@nx/vite';

function updateLibPackageNpmScope(host: Tree, options: NormalizedSchema) {
return updateJson(host, `${options.projectRoot}/package.json`, (json) => {
Expand All @@ -36,26 +33,10 @@ export async function libraryGenerator(
await createProjectFiles(host, options);

const lintTask = await addLinting(host, options);
const jestTask = await addJest(host, options);
const viteTask = await addVite(host, options);
createOrEditViteConfig(
host,
{
project: options.name,
includeLib: false,
includeVitest: options.unitTestRunner === 'vitest',
inSourceTests: false,
rollupOptionsExternal: [],
imports: [`import { svelte } from '@sveltejs/vite-plugin-svelte'`],
plugins: [`svelte()`],
},
false
);

const vitestTask = await addVitest(host, options);

updateTsConfig(host, options);
updateJestConfig(host, options);

if (options.publishable || options.buildable) {
updateLibPackageNpmScope(host, options);
Expand All @@ -65,6 +46,6 @@ export async function libraryGenerator(
await formatFiles(host);
}

return runTasksInSerial(initTask, lintTask, viteTask, jestTask, vitestTask);
return runTasksInSerial(initTask, lintTask, viteTask, vitestTask);
}
export default libraryGenerator;
Loading

0 comments on commit 8a9bbe1

Please sign in to comment.