diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 132003d02..2d39ea456 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,10 @@ on: - main pull_request: +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.ref }} + cancel-in-progress: true + jobs: main: name: Nx Cloud - Main Job @@ -17,6 +21,7 @@ jobs: pnpm exec nx-cloud start-ci-run --stop-agents-after="build" --agent-count=3 parallel-commands: | pnpm exec nx-cloud record -- pnpm exec nx format:check + pnpm exec nx affected --target=e2e parallel-commands-on-agents: | pnpm exec nx affected --target=lint --parallel=3 pnpm exec nx affected --target=test --parallel=3 --ci --code-coverage diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000..d2304073e --- /dev/null +++ b/CHANGELOG.md @@ -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 diff --git a/docs/docs/svelte/generators.md b/docs/docs/svelte/generators.md index 3853e3e3a..7a99e48b9 100644 --- a/docs/docs/svelte/generators.md +++ b/docs/docs/svelte/generators.md @@ -238,7 +238,7 @@ Default: `vitest` Type: `string` -Possible values: `jest`, `vitest`, `none` +Possible values: `vitest`, `none` Test runner to use for unit tests. diff --git a/e2e/e2e-utils/README.md b/e2e/e2e-utils/README.md new file mode 100644 index 000000000..7a4d8f208 --- /dev/null +++ b/e2e/e2e-utils/README.md @@ -0,0 +1,3 @@ +# e2e-utils + +This library was generated with [Nx](https://nx.dev). diff --git a/e2e/e2e-utils/eslint.config.js b/e2e/e2e-utils/eslint.config.js new file mode 100644 index 000000000..b7faea0a9 --- /dev/null +++ b/e2e/e2e-utils/eslint.config.js @@ -0,0 +1,17 @@ +const baseConfig = require('../../eslint.config.js'); + +module.exports = [ + ...baseConfig, + { + files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'], + rules: {}, + }, + { + files: ['**/*.ts', '**/*.tsx'], + rules: {}, + }, + { + files: ['**/*.js', '**/*.jsx'], + rules: {}, + }, +]; diff --git a/e2e/e2e-utils/project.json b/e2e/e2e-utils/project.json new file mode 100644 index 000000000..a08519a8e --- /dev/null +++ b/e2e/e2e-utils/project.json @@ -0,0 +1,12 @@ +{ + "name": "e2e-utils", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "e2e/e2e-utils/src", + "projectType": "library", + "tags": [], + "targets": { + "lint": { + "executor": "@nx/eslint:lint" + } + } +} diff --git a/e2e/utils/index.ts b/e2e/e2e-utils/src/index.ts similarity index 88% rename from e2e/utils/index.ts rename to e2e/e2e-utils/src/index.ts index ebe8ac5e5..7431c08b8 100644 --- a/e2e/utils/index.ts +++ b/e2e/e2e-utils/src/index.ts @@ -2,7 +2,7 @@ import { join, dirname } from 'path'; import { mkdirSync, rmSync } from 'fs'; import { execSync } from 'child_process'; -export { runNxCommandUntil } from './run-commands-until'; +export { runNxCommandUntil } from './lib/run-commands-until'; /** * Creates a test project with create-nx-workspace and installs the plugin @@ -22,7 +22,7 @@ export function createTestProject() { }); execSync( - `npx --yes create-nx-workspace@latest ${projectName} --preset apps --nxCloud skip --interactive false`, + `npx --yes create-nx-workspace@latest ${projectName} --preset apps --nxCloud=skip --no-interactive`, { cwd: dirname(projectDirectory), stdio: 'inherit', @@ -37,7 +37,7 @@ export function createTestProject() { export function installPlugin(projectDirectory: string, pluginName: string) { // The plugin has been built and published to a local registry in the jest globalSetup // Install the plugin built with the latest source code into the test repo - execSync(`npm install @nxext/${pluginName}@e2e`, { + execSync(`npm install @nxext/${pluginName}@e2e `, { cwd: projectDirectory, stdio: 'inherit', env: process.env, diff --git a/e2e/utils/run-commands-until.ts b/e2e/e2e-utils/src/lib/run-commands-until.ts similarity index 77% rename from e2e/utils/run-commands-until.ts rename to e2e/e2e-utils/src/lib/run-commands-until.ts index 726125887..4ac6205ee 100644 --- a/e2e/utils/run-commands-until.ts +++ b/e2e/e2e-utils/src/lib/run-commands-until.ts @@ -7,7 +7,7 @@ export function runNxCommandUntil( criteria: (output: string) => boolean ): Promise { const pm = getPackageManagerCommand(); - const p = exec(pm.run('nx', command), { + const childProcess: ChildProcess = exec(pm.run('nx', command), { cwd: tmpProjPath(), env: { ...process.env, @@ -19,21 +19,21 @@ export function runNxCommandUntil( let output = ''; let complete = false; - function checkCriteria(c) { + function checkCriteria(c: any) { output += c.toString(); if (criteria(stripConsoleColors(output)) && !complete) { complete = true; - res(p); + res(childProcess); } } - p.stdout.on('data', checkCriteria); - p.stderr.on('data', checkCriteria); - p.on('exit', (code) => { + childProcess.stdout?.on('data', checkCriteria); + childProcess.stderr?.on('data', checkCriteria); + childProcess.on('exit', (code) => { if (!complete) { rej(`Exited with ${code}`); } else { - res(p); + res(childProcess); } }); }); diff --git a/e2e/e2e-utils/tsconfig.json b/e2e/e2e-utils/tsconfig.json new file mode 100644 index 000000000..db7b56666 --- /dev/null +++ b/e2e/e2e-utils/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "module": "commonjs", + "forceConsistentCasingInFileNames": true, + "strict": true, + "noImplicitOverride": true, + "noPropertyAccessFromIndexSignature": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true + }, + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + } + ] +} diff --git a/e2e/e2e-utils/tsconfig.lib.json b/e2e/e2e-utils/tsconfig.lib.json new file mode 100644 index 000000000..faa09cc18 --- /dev/null +++ b/e2e/e2e-utils/tsconfig.lib.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "declaration": true, + "types": ["node"] + }, + "include": ["src/**/*.ts"], + "exclude": ["src/**/*.spec.ts", "src/**/*.test.ts"] +} diff --git a/e2e/preact-e2e/project.json b/e2e/preact-e2e/project.json index b1805ef4e..476b09c06 100644 --- a/e2e/preact-e2e/project.json +++ b/e2e/preact-e2e/project.json @@ -14,8 +14,7 @@ "dependsOn": ["^build"] }, "lint": { - "executor": "@nx/eslint:lint", - "outputs": ["{options.outputFile}"] + "executor": "@nx/eslint:lint" } }, "tags": [], diff --git a/e2e/preact-e2e/tests/preact.test.ts b/e2e/preact-e2e/tests/preact.test.ts index f7c15bb6a..0e5c4cbf2 100644 --- a/e2e/preact-e2e/tests/preact.test.ts +++ b/e2e/preact-e2e/tests/preact.test.ts @@ -30,7 +30,9 @@ describe('preact e2e', () => { }); it('should generate app into directory', async () => { - await runNxCommandAsync(`generate @nxext/preact:app project/ui`); + await runNxCommandAsync( + `generate @nxext/preact:app ui --directory apps/project` + ); expect(() => checkFilesExist(`apps/project/ui/src/App.tsx`) ).not.toThrow(); @@ -38,7 +40,9 @@ describe('preact e2e', () => { it('should be able to run linter', async () => { const plugin = uniq('preactlint'); - await runNxCommandAsync(`generate @nxext/preact:app ${plugin}`); + await runNxCommandAsync( + `generate @nxext/preact:app ${plugin} --directory apps` + ); const result = await runNxCommandAsync(`lint ${plugin}`); expect(result.stdout).toContain('All files pass linting'); @@ -47,7 +51,9 @@ describe('preact e2e', () => { describe('preact lib', () => { it('should generate lib into directory', async () => { - await runNxCommandAsync(`generate @nxext/preact:lib project/uilib`); + await runNxCommandAsync( + `generate @nxext/preact:lib uilib --directory libs/project` + ); expect(() => checkFilesExist(`libs/project/uilib/src/index.ts`) ).not.toThrow(); @@ -55,13 +61,15 @@ describe('preact e2e', () => { it('should be able to run linter', async () => { const plugin = uniq('preactliblint'); - await runNxCommandAsync(`generate @nxext/preact:lib ${plugin}`); + await runNxCommandAsync( + `generate @nxext/preact:lib ${plugin} --directory libs` + ); const result = await runNxCommandAsync(`lint ${plugin}`); expect(result.stdout).toContain('All files pass linting'); }); - it('should be able build lib if buildable', async () => { + xit('should be able build lib if buildable', async () => { const plugin = uniq('preactlib'); await runNxCommandAsync( `generate @nxext/preact:lib ${plugin} --buildable` diff --git a/e2e/solid-e2e/tests/solid.test.ts b/e2e/solid-e2e/tests/solid.test.ts index 24d5788d4..9ad080b19 100644 --- a/e2e/solid-e2e/tests/solid.test.ts +++ b/e2e/solid-e2e/tests/solid.test.ts @@ -12,17 +12,17 @@ describe('solid e2e', () => { afterAll(() => { // Cleanup the test project - rmSync(projectDirectory, { + /*rmSync(projectDirectory, { recursive: true, force: true, - }); + });*/ }); describe('solid app', () => { it('should build solid application', async () => { const plugin = uniq('solid'); await runNxCommandAsync( - `generate @nxext/solid:app ${plugin} --e2eTestRunner='none' --junitTestRunner='none'` + `generate @nxext/solid:app ${plugin} --directory=apps --e2eTestRunner='none' --junitTestRunner='none'` ); const result = await runNxCommandAsync(`build ${plugin}`); @@ -34,7 +34,7 @@ describe('solid e2e', () => { it('should be able to run linter', async () => { const plugin = uniq('solidlint'); await runNxCommandAsync( - `generate @nxext/solid:app ${plugin} --e2eTestRunner='none' --junitTestRunner='none'` + `generate @nxext/solid:app ${plugin} --directory=apps --e2eTestRunner='none' --junitTestRunner='none'` ); const result = await runNxCommandAsync(`lint ${plugin}`); @@ -45,7 +45,7 @@ describe('solid e2e', () => { describe('solid lib', () => { it('should generate lib into directory', async () => { await runNxCommandAsync( - `generate @nxext/solid:lib project/uilib --e2eTestRunner='none' --junitTestRunner='none'` + `generate @nxext/solid:lib uilib --directory=libs/project --e2eTestRunner='none' --junitTestRunner='none'` ); expect(() => checkFilesExist(`libs/project/uilib/src/index.ts`) @@ -55,7 +55,7 @@ describe('solid e2e', () => { it('should be able to run linter', async () => { const plugin = uniq('solidliblint'); await runNxCommandAsync( - `generate @nxext/solid:lib ${plugin} --e2eTestRunner='none' --junitTestRunner='none'` + `generate @nxext/solid:lib ${plugin} --directory=libs --e2eTestRunner='none' --junitTestRunner='none'` ); const result = await runNxCommandAsync(`lint ${plugin}`); @@ -65,7 +65,7 @@ describe('solid e2e', () => { it('should be able build lib if buildable', async () => { const plugin = uniq('solidlib'); await runNxCommandAsync( - `generate @nxext/solid:lib ${plugin} --buildable --e2eTestRunner='none' --junitTestRunner='none'` + `generate @nxext/solid:lib ${plugin} --directory=libs --buildable --e2eTestRunner='none' --junitTestRunner='none'` ); const result = await runNxCommandAsync(`build ${plugin}`); diff --git a/e2e/svelte-e2e/tests/application.test.ts b/e2e/svelte-e2e/tests/application.test.ts index 8eda06914..6a7e70289 100644 --- a/e2e/svelte-e2e/tests/application.test.ts +++ b/e2e/svelte-e2e/tests/application.test.ts @@ -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(() => { @@ -28,7 +28,7 @@ describe('svelte e2e', () => { it('should build svelte application', async () => { const plugin = uniq('svelte'); await runNxCommandAsync( - `generate @nxext/svelte:app ${plugin} --e2eTestRunner='none' --unitTestRunner='none'` + `generate @nxext/svelte:app ${plugin} --directory=apps --e2eTestRunner='none' --unitTestRunner='none'` ); const result = await runNxCommandAsync(`build ${plugin}`); @@ -44,7 +44,7 @@ describe('svelte e2e', () => { it('should add tags to project', async () => { const plugin = uniq('sveltetags'); await runNxCommandAsync( - `generate @nxext/svelte:app ${plugin} --tags e2etag,e2ePackage --e2eTestRunner='none' --unitTestRunner='none'` + `generate @nxext/svelte:app ${plugin} --directory=apps --tags e2etag,e2ePackage --e2eTestRunner='none' --unitTestRunner='none'` ); const project = readJson(`apps/${plugin}/project.json`); expect(project.tags).toEqual(['e2etag', 'e2ePackage']); @@ -52,7 +52,7 @@ describe('svelte e2e', () => { it('should generate app into directory', async () => { await runNxCommandAsync( - `generate @nxext/svelte:app project/ui --e2eTestRunner='none' --unitTestRunner='none'` + `generate @nxext/svelte:app ui --directory=apps/project --e2eTestRunner='none' --unitTestRunner='none'` ); expect(() => checkFilesExist(`apps/project/ui/src/main.ts`) @@ -62,7 +62,7 @@ describe('svelte e2e', () => { it('should be able to run linter', async () => { const plugin = uniq('sveltelint'); await runNxCommandAsync( - `generate @nxext/svelte:app ${plugin} --e2eTestRunner='none' --unitTestRunner='none'` + `generate @nxext/svelte:app ${plugin} --directory=apps --e2eTestRunner='none' --unitTestRunner='none'` ); const result = await runNxCommandAsync(`lint ${plugin}`); @@ -72,7 +72,7 @@ describe('svelte e2e', () => { it('should be able to run check', async () => { const plugin = uniq('svelteappcheck'); await runNxCommandAsync( - `generate @nxext/svelte:app ${plugin} --e2eTestRunner='none' --unitTestRunner='none'` + `generate @nxext/svelte:app ${plugin} --directory=apps --e2eTestRunner='none' --unitTestRunner='none'` ); const result = await runNxCommandAsync(`check ${plugin}`); @@ -82,25 +82,10 @@ 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} --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( - `generate @nxext/svelte:app ${plugin} --unitTestRunner='vitest' --e2eTestRunner='none'` + `generate @nxext/svelte:app ${plugin} --directory=apps --unitTestRunner='vitest' --e2eTestRunner='none'` ); await runNxCommandAsync( `generate @nxext/svelte:component test --project=${plugin}` @@ -118,11 +103,11 @@ describe('svelte e2e', () => { it('should build svelte application with dependencies', async () => { const appName = 'svelteappwithdeps'; await runNxCommandAsync( - `generate @nxext/svelte:app ${appName} --e2eTestRunner='none' --unitTestRunner='none'` + `generate @nxext/svelte:app ${appName} --directory=apps --e2eTestRunner='none' --unitTestRunner='none'` ); const libName = uniq('sveltelib'); await runNxCommandAsync( - `generate @nxext/svelte:lib ${libName} --e2eTestRunner='none' --unitTestRunner='none'` + `generate @nxext/svelte:lib ${libName} --directory=libs --e2eTestRunner='none' --unitTestRunner='none'` ); await runNxCommandAsync( `generate @nxext/svelte:c testcomp --project=${libName}` diff --git a/e2e/svelte-e2e/tests/library.test.ts b/e2e/svelte-e2e/tests/library.test.ts index 6a41ced57..c447996f5 100644 --- a/e2e/svelte-e2e/tests/library.test.ts +++ b/e2e/svelte-e2e/tests/library.test.ts @@ -13,17 +13,17 @@ describe('svelte e2e', () => { afterAll(() => { // Cleanup the test project - rmSync(projectDirectory, { + /*rmSync(projectDirectory, { recursive: true, force: true, - }); + });*/ }); describe('Svelte lib', () => { it('should be able to run linter', async () => { const plugin = uniq('svelteliblint'); await runNxCommandAsync( - `generate @nxext/svelte:lib ${plugin} --e2eTestRunner='none' --junitTestRunner='none'` + `generate @nxext/svelte:lib ${plugin} --directory=libs --e2eTestRunner='none' --junitTestRunner='none'` ); const result = await runNxCommandAsync(`lint ${plugin}`); @@ -33,7 +33,7 @@ describe('svelte e2e', () => { it('should be able to run check', async () => { const plugin = uniq('sveltelibcheck'); await runNxCommandAsync( - `generate @nxext/svelte:lib ${plugin} --e2eTestRunner='none' --junitTestRunner='none'` + `generate @nxext/svelte:lib ${plugin} --directory=libs --e2eTestRunner='none' --junitTestRunner='none'` ); const result = await runNxCommandAsync(`check ${plugin}`); @@ -45,7 +45,7 @@ describe('svelte e2e', () => { it('should be able build lib if buildable', async () => { const plugin = uniq('sveltelib'); await runNxCommandAsync( - `generate @nxext/svelte:lib ${plugin} --buildable --e2eTestRunner='none' --junitTestRunner='none'` + `generate @nxext/svelte:lib ${plugin} --directory=libs --buildable --e2eTestRunner='none' --junitTestRunner='none'` ); const result = await runNxCommandAsync(`build ${plugin}`); @@ -55,25 +55,10 @@ 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} --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( - `generate @nxext/svelte:lib ${plugin} --unitTestRunner=vitest --e2eTestRunner='none'` + `generate @nxext/svelte:lib ${plugin} --directory=libs --unitTestRunner=vitest --e2eTestRunner='none'` ); await runNxCommandAsync( `generate @nxext/svelte:component test --project=${plugin}` @@ -89,7 +74,7 @@ describe('svelte e2e', () => { it('should be able to run storybook', async () => { const plugin = uniq('sveltestories'); await runNxCommandAsync( - `generate @nxext/svelte:lib ${plugin} --unitTestRunner='none' --e2eTestRunner='none'` + `generate @nxext/svelte:lib ${plugin} --directory=libs --unitTestRunner='none' --e2eTestRunner='none'` ); await runNxCommandAsync( `generate @nxext/svelte:storybook-configuration ${plugin}` diff --git a/e2e/vue-e2e/eslint.config.js b/e2e/vue-e2e/eslint.config.js deleted file mode 100644 index 868077d3d..000000000 --- a/e2e/vue-e2e/eslint.config.js +++ /dev/null @@ -1,21 +0,0 @@ -const baseConfig = require('../../eslint.config.js'); -module.exports = [ - ...baseConfig, - { - files: [ - 'e2e/vue-e2e/**/*.ts', - 'e2e/vue-e2e/**/*.tsx', - 'e2e/vue-e2e/**/*.js', - 'e2e/vue-e2e/**/*.jsx', - ], - rules: {}, - }, - { - files: ['e2e/vue-e2e/**/*.ts', 'e2e/vue-e2e/**/*.tsx'], - rules: {}, - }, - { - files: ['e2e/vue-e2e/**/*.js', 'e2e/vue-e2e/**/*.jsx'], - rules: {}, - }, -]; diff --git a/e2e/vue-e2e/jest.config.ts b/e2e/vue-e2e/jest.config.ts deleted file mode 100644 index b1fd1e2ee..000000000 --- a/e2e/vue-e2e/jest.config.ts +++ /dev/null @@ -1,12 +0,0 @@ -/* eslint-disable */ -export default { - displayName: 'vue-e2e', - preset: '../../jest.preset.js', - transform: { - '^.+\\.[tj]s$': ['ts-jest', { tsconfig: '/tsconfig.spec.json' }], - }, - moduleFileExtensions: ['ts', 'js', 'html'], - coverageDirectory: '../../coverage/e2e/vue-e2e', - globalSetup: '../../tools/scripts/start-local-registry.ts', - globalTeardown: '../../tools/scripts/stop-local-registry.ts', -}; diff --git a/e2e/vue-e2e/project.json b/e2e/vue-e2e/project.json deleted file mode 100644 index 807dbe096..000000000 --- a/e2e/vue-e2e/project.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "vue-e2e", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "projectType": "application", - "sourceRoot": "e2e/vue-e2e/src", - "targets": { - "e2e": { - "executor": "@nx/jest:jest", - "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], - "options": { - "jestConfig": "e2e/vue-e2e/jest.config.ts", - "runInBand": true - }, - "dependsOn": ["^build"] - }, - "lint": { - "executor": "@nx/eslint:lint", - "outputs": ["{options.outputFile}"] - } - }, - "tags": [], - "implicitDependencies": ["vue"] -} diff --git a/e2e/vue-e2e/tests/vue-preset-standalone.spec.ts b/e2e/vue-e2e/tests/vue-preset-standalone.spec.ts deleted file mode 100644 index 3ab2ff8b3..000000000 --- a/e2e/vue-e2e/tests/vue-preset-standalone.spec.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { checkFilesExist, runNxCommandAsync, uniq } from '@nx/plugin/testing'; -import { createTestProject, installPlugin } from '@nxext/e2e-utils'; -import { rmSync } from 'fs'; - -xdescribe('vue e2e', () => { - const projectName = uniq('presetappstandalone'); - let projectDirectory: string; - - beforeAll(() => { - projectDirectory = createTestProject(); - installPlugin(projectDirectory, 'vue'); - }); - - afterAll(() => { - // Cleanup the test project - rmSync(projectDirectory, { - recursive: true, - force: true, - }); - }); - - describe('preset', () => { - it('should create a vue application', async () => { - const result = await runNxCommandAsync(`build ${projectName}`); - - checkFilesExist(`src/main.ts`); - expect(result.stdout).toContain( - `Successfully ran target build for project ${projectName}` - ); - }); - }); -}); diff --git a/e2e/vue-e2e/tests/vue-preset.spec.ts b/e2e/vue-e2e/tests/vue-preset.spec.ts deleted file mode 100644 index 487641d85..000000000 --- a/e2e/vue-e2e/tests/vue-preset.spec.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { checkFilesExist, runNxCommandAsync, uniq } from '@nx/plugin/testing'; -import { createTestProject, installPlugin } from '@nxext/e2e-utils'; -import { rmSync } from 'fs'; - -xdescribe('vue e2e', () => { - const projectName = uniq('presetapp'); - - let projectDirectory: string; - - beforeAll(() => { - projectDirectory = createTestProject(); - installPlugin(projectDirectory, 'vue'); - }); - - afterAll(() => { - // Cleanup the test project - rmSync(projectDirectory, { - recursive: true, - force: true, - }); - }); - - describe('preset', () => { - it('should create a vue application', async () => { - const result = await runNxCommandAsync(`build ${projectName}`); - - checkFilesExist(`apps/${projectName}/src/main.ts`); - expect(result.stdout).toContain( - `Successfully ran target build for project ${projectName}` - ); - }); - }); -}); diff --git a/e2e/vue-e2e/tests/vue.spec.ts b/e2e/vue-e2e/tests/vue.spec.ts deleted file mode 100644 index fc0fc478e..000000000 --- a/e2e/vue-e2e/tests/vue.spec.ts +++ /dev/null @@ -1,159 +0,0 @@ -import { runNxCommandAsync, uniq, updateFile } from '@nx/plugin/testing'; -import { names } from '@nx/devkit'; -import { createTestProject, installPlugin } from '@nxext/e2e-utils'; -import { rmSync } from 'fs'; - -describe('vue e2e', () => { - let projectDirectory: string; - - beforeAll(() => { - projectDirectory = createTestProject(); - installPlugin(projectDirectory, 'vue'); - }); - - afterAll(() => { - // Cleanup the test project - rmSync(projectDirectory, { - recursive: true, - force: true, - }); - }); - - describe('application', () => { - it('should create a vue application with routing', async () => { - const projectName = uniq('vue-routing'); - await runNxCommandAsync( - `generate @nxext/vue:app ${projectName} --routing --unitTestRunner='none' --e2eTestRunner='none'` - ); - const result = await runNxCommandAsync(`build ${projectName}`); - expect(result.stdout).toContain( - `Successfully ran target build for project ${projectName}` - ); - }); - - it('should be able to run linter', async () => { - const projectName = uniq('vue-lint'); - await runNxCommandAsync( - `generate @nxext/vue:app ${projectName} --unitTestRunner='none' --e2eTestRunner='none' --linter='eslint'` - ); - const result = await runNxCommandAsync(`lint ${projectName}`); - expect(result.stdout).toContain(`All files pass linting.`); - }); - - it('should be able to run vitest', async () => { - const projectName = uniq('vue-test'); - await runNxCommandAsync( - `generate @nxext/vue:app ${projectName} --unitTestRunner='vitest' --e2eTestRunner='none'` - ); - const result = await runNxCommandAsync(`test ${projectName}`); - expect(result.stdout).toContain(`1 passed`); - expect(result.stdout).toContain( - `Successfully ran target test for project ${projectName}` - ); - }); - }); - - describe('library', () => { - it('should create a vue lib and make it buildable', async () => { - const projectName = uniq('vue-lib'); - await runNxCommandAsync( - `generate @nxext/vue:lib ${projectName} --buildable --unitTestRunner='none'` - ); - const result = await runNxCommandAsync(`build ${projectName}`); - expect(result.stdout).toContain( - `Successfully ran target build for project ${projectName}` - ); - }); - - it('should be able to run vitest', async () => { - const projectName = uniq('vue-libvitest'); - await runNxCommandAsync( - `generate @nxext/vue:lib ${projectName} --unitTestRunner='vitest' --e2eTestRunner='none'` - ); - const result = await runNxCommandAsync(`test ${projectName}`); - expect(result.stdout).toContain(`1 passed`); - expect(result.stdout).toContain( - `Successfully ran target test for project ${projectName}` - ); - }); - - it('should be able to run linter', async () => { - const projectName = uniq('vue-liblint'); - await runNxCommandAsync( - `generate @nxext/vue:lib ${projectName} --unitTestRunner='none' --e2eTestRunner='none' --linter='eslint'` - ); - const result = await runNxCommandAsync(`lint ${projectName}`); - expect(result.stdout).toContain(`All files pass linting.`); - }); - }); - - describe('library reference', () => { - it('should create a vue application with linked lib', async () => { - const projectName = uniq('vue-linkapp'); - const libName = uniq('vue-linklib'); - const libClassName = names(libName).className; - await runNxCommandAsync( - `generate @nxext/vue:app ${projectName} --unitTestRunner='none' --e2eTestRunner='none' --linter='none'` - ); - await runNxCommandAsync( - `generate @nxext/vue:lib ${libName} --buildable --unitTestRunner='none' --e2eTestRunner='none'` - ); - updateFile( - `apps/${projectName}/src/App.vue`, - ` - - -` - ); - - const result = await runNxCommandAsync(`build ${projectName}`); - expect(result.stdout).toContain( - `Successfully ran target build for project ${projectName}` - ); - }); - }); - - describe('storybook', () => { - it('should create a vue lib and add storybook', async () => { - const projectName = uniq('vue-storybook'); - await runNxCommandAsync( - `generate @nxext/vue:lib ${projectName} --buildable --unitTestRunner='none' --e2eTestRunner='none'` - ); - await runNxCommandAsync( - `generate @nxext/vue:storybook-configuration ${projectName}` - ); - - const result = await runNxCommandAsync(`build ${projectName}`); - expect(result.stdout).toContain( - `Successfully ran target build for project ${projectName}` - ); - }); - }); - - describe('e2e tests', () => { - it('should be able to run cypress', async () => { - const projectName = uniq('vue-e2e-cypress'); - await runNxCommandAsync( - `generate @nxext/vue:app ${projectName} --unitTestRunner='none' --e2eTestRunner='cypress'` - ); - const result = await runNxCommandAsync(`e2e ${projectName}-e2e`); - expect(result.stdout).toContain(`app.cy.ts`); - expect(result.stdout).toContain(`All specs passed!`); - }); - - xit('should be able to run playwright', async () => { - const projectName = uniq('vue-e2e-playwright'); - await runNxCommandAsync( - `generate @nxext/vue:app ${projectName} --unitTestRunner='none' --e2eTestRunner='playwright'` - ); - const result = await runNxCommandAsync(`e2e ${projectName}-e2e`); - expect(result.stdout).toContain( - `Successfully ran target e2e for ${projectName}-e2e` - ); - }); - }); -}); diff --git a/e2e/vue-e2e/tsconfig.json b/e2e/vue-e2e/tsconfig.json deleted file mode 100644 index b9c9d9537..000000000 --- a/e2e/vue-e2e/tsconfig.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "../../tsconfig.base.json", - "files": [], - "include": [], - "references": [ - { - "path": "./tsconfig.spec.json" - } - ] -} diff --git a/e2e/vue-e2e/tsconfig.spec.json b/e2e/vue-e2e/tsconfig.spec.json deleted file mode 100644 index 9b2a121d1..000000000 --- a/e2e/vue-e2e/tsconfig.spec.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "../../dist/out-tsc", - "module": "commonjs", - "types": ["jest", "node"] - }, - "include": [ - "jest.config.ts", - "src/**/*.test.ts", - "src/**/*.spec.ts", - "src/**/*.d.ts" - ] -} diff --git a/nx.json b/nx.json index 076da3bfb..5af5f1c8a 100644 --- a/nx.json +++ b/nx.json @@ -69,6 +69,11 @@ } }, "targetDefaults": { + "nx-release-publish": { + "options": { + "packageRoot": "dist/packages/{projectName}" + } + }, "build": { "dependsOn": ["^build"], "inputs": ["production", "^production"], @@ -120,5 +125,18 @@ }, "nxCloudAccessToken": "NTlhMGE3ZTYtYjk5OC00Mzc5LWE2ZTAtNzE4ODEzNDY5MjlmfHJlYWQ=", "parallel": 1, - "defaultBase": "main" + "defaultBase": "main", + "release": { + "projects": ["*", "!docs", "!stencil", "!common", "!*-e2e", "!e2e-*"], + "releaseTagPattern": "release/{version}", + "git": { + "commitMessage": "chore(release): {version}" + }, + "version": { + "generatorOptions": { + "packageRoot": "dist/packages/{projectName}", + "currentVersionResolver": "git-tag" + } + } + } } diff --git a/package.json b/package.json index 1fe571161..9b0097e23 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nxext", - "version": "0.0.0", + "version": "0.0.0-e2e", "license": "MIT", "keywords": [], "repository": { @@ -80,6 +80,7 @@ "@types/is-ci": "^3.0.4", "@types/jest": "29.5.12", "@types/node": "^18.16.9", + "@types/semver": "^7.5.8", "@types/yargs": "^17.0.32", "@typescript-eslint/eslint-plugin": "7.6.0", "@typescript-eslint/parser": "7.6.0", @@ -109,8 +110,9 @@ "nx": "19.3.0", "prettier": "2.7.1", "pretty-quick": "^3.1.3", - "svelte": "^4.2.12", - "svelte-preprocess": "^5.1.3", + "semver": "^7.6.2", + "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", diff --git a/packages/common/package.json b/packages/common/package.json index fc41da9c0..a88ff05e2 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -9,15 +9,15 @@ "repository": { "type": "git", "url": "https://github.com/nxext/nx-extensions", - "directory": "packages/core" + "directory": "packages/common" }, "bugs": { "url": "https://github.com/nxext/nx-extensions/issues" }, "dependencies": { - "@nx/devkit": "19.3.0", + "@nx/devkit": "^19.3.0", "typescript": "5.4.5", - "@nx/js": "19.3.0", + "@nx/js": "^19.3.0", "tslib": "^2.3.0" } } diff --git a/packages/common/project.json b/packages/common/project.json index 673008fdf..4834b0796 100644 --- a/packages/common/project.json +++ b/packages/common/project.json @@ -27,5 +27,18 @@ } } }, - "tags": [] + "tags": [], + "release": { + "version": { + "generatorOptions": { + "packageRoot": "dist/{projectRoot}", + "currentVersionResolver": "git-tag" + } + } + }, + "nx-release-publish": { + "options": { + "packageRoot": "dist/{projectRoot}" + } + } } diff --git a/packages/preact/package.json b/packages/preact/package.json index c30bfe5fd..2ce6633fa 100644 --- a/packages/preact/package.json +++ b/packages/preact/package.json @@ -23,14 +23,14 @@ "main": "src/index.js", "generators": "./generators.json", "peerDependencies": { - "@nx/devkit": "19.3.0", - "@nx/vite": "19.3.0", - "@nx/web": "19.3.0", - "@nx/cypress": "19.3.0", - "@nx/jest": "19.3.0", - "@nx/eslint": "19.3.0", + "@nx/devkit": "^19.3.0", + "@nx/vite": "^19.3.0", + "@nx/web": "^19.3.0", + "@nx/cypress": "^19.3.0", + "@nx/jest": "^19.3.0", + "@nx/eslint": "^19.3.0", "typescript": "5.4.5", - "@nx/js": "19.3.0", + "@nx/js": "^19.3.0", "tslib": "^2.3.0" }, "dependencies": {} diff --git a/packages/preact/project.json b/packages/preact/project.json index 5f3c6ae78..f2df2f045 100644 --- a/packages/preact/project.json +++ b/packages/preact/project.json @@ -52,11 +52,20 @@ ] }, "outputs": ["{options.outputPath}"] - }, - "publish": { - "command": "node tools/scripts/publish.mjs preact {args.ver} {args.tag}", - "dependsOn": ["build"] } }, - "tags": [] + "tags": [], + "release": { + "version": { + "generatorOptions": { + "packageRoot": "dist/{projectRoot}", + "currentVersionResolver": "git-tag" + } + } + }, + "nx-release-publish": { + "options": { + "packageRoot": "dist/{projectRoot}" + } + } } diff --git a/packages/preact/src/generators/application/application.ts b/packages/preact/src/generators/application/application.ts index 1e445c182..5af435860 100644 --- a/packages/preact/src/generators/application/application.ts +++ b/packages/preact/src/generators/application/application.ts @@ -117,3 +117,4 @@ export async function applicationGenerator( return runTasksInSerial(initTask, viteTask, lintTask, jestTask, cypressTask); } +export default applicationGenerator; diff --git a/packages/preact/src/generators/component/component.ts b/packages/preact/src/generators/component/component.ts index 7d8fc292a..b7b3a5145 100644 --- a/packages/preact/src/generators/component/component.ts +++ b/packages/preact/src/generators/component/component.ts @@ -16,3 +16,5 @@ export async function componentGenerator( createComponentInProject(tree, options); addExportsToBarrel(tree, options); } + +export default componentGenerator; diff --git a/packages/preact/src/generators/init/init.ts b/packages/preact/src/generators/init/init.ts index c59697843..d750d7627 100644 --- a/packages/preact/src/generators/init/init.ts +++ b/packages/preact/src/generators/init/init.ts @@ -14,3 +14,4 @@ export async function initGenerator(host: Tree, options: Schema) { } return runTasksInSerial(installTask, jestTask, cypressTask); } +export default initGenerator; diff --git a/packages/preact/src/generators/library/library.ts b/packages/preact/src/generators/library/library.ts index 963f1f356..7fd46579c 100644 --- a/packages/preact/src/generators/library/library.ts +++ b/packages/preact/src/generators/library/library.ts @@ -118,3 +118,5 @@ export async function libraryGenerator( return runTasksInSerial(initTask, viteTask, vitestTask, lintTask, jestTask); } + +export default libraryGenerator; diff --git a/packages/solid/package.json b/packages/solid/package.json index a259f4e71..0cc710b58 100644 --- a/packages/solid/package.json +++ b/packages/solid/package.json @@ -23,14 +23,14 @@ "main": "src/index.js", "generators": "./generators.json", "dependencies": { - "@nx/devkit": "19.3.0", - "@nx/vite": "19.3.0", - "@nx/web": "19.3.0", - "@nx/cypress": "19.3.0", - "@nx/jest": "19.3.0", - "@nx/eslint": "19.3.0", + "@nx/devkit": "^19.3.0", + "@nx/vite": "^19.3.0", + "@nx/web": "^19.3.0", + "@nx/cypress": "^19.3.0", + "@nx/jest": "^19.3.0", + "@nx/eslint": "^19.3.0", "typescript": "5.4.5", - "@nx/js": "19.3.0", + "@nx/js": "^19.3.0", "tslib": "^2.3.0" }, "peerDependencies": {}, diff --git a/packages/solid/project.json b/packages/solid/project.json index 711d13040..f79e06577 100644 --- a/packages/solid/project.json +++ b/packages/solid/project.json @@ -52,11 +52,20 @@ ] }, "outputs": ["{options.outputPath}"] - }, - "publish": { - "command": "node tools/scripts/publish.mjs solid {args.ver} {args.tag}", - "dependsOn": ["build"] } }, - "tags": [] + "tags": [], + "release": { + "version": { + "generatorOptions": { + "packageRoot": "dist/{projectRoot}", + "currentVersionResolver": "git-tag" + } + } + }, + "nx-release-publish": { + "options": { + "packageRoot": "dist/{projectRoot}" + } + } } diff --git a/packages/solid/src/generators/application/application.ts b/packages/solid/src/generators/application/application.ts index 91dc620e4..7f7b80e75 100644 --- a/packages/solid/src/generators/application/application.ts +++ b/packages/solid/src/generators/application/application.ts @@ -118,3 +118,4 @@ export async function applicationGeneratorInternal(tree: Tree, schema: Schema) { return runTasksInSerial(initTask, viteTask, lintTask, jestTask, cypressTask); } +export default applicationGenerator; diff --git a/packages/solid/src/generators/component/component.ts b/packages/solid/src/generators/component/component.ts index fff0e5151..62a907c0d 100644 --- a/packages/solid/src/generators/component/component.ts +++ b/packages/solid/src/generators/component/component.ts @@ -16,3 +16,4 @@ export async function componentGenerator( createComponentInProject(tree, options); addExportsToBarrel(tree, options); } +export default componentGenerator; diff --git a/packages/solid/src/generators/init/init.ts b/packages/solid/src/generators/init/init.ts index 35a86ab4a..22ce29390 100644 --- a/packages/solid/src/generators/init/init.ts +++ b/packages/solid/src/generators/init/init.ts @@ -29,3 +29,4 @@ export async function initGenerator(host: Tree, schema: Schema) { } return runTasksInSerial(...tasks); } +export default initGenerator; diff --git a/packages/solid/src/generators/library/lib/add-vite.ts b/packages/solid/src/generators/library/lib/add-vite.ts index 124cdcc85..48feb3c6a 100644 --- a/packages/solid/src/generators/library/lib/add-vite.ts +++ b/packages/solid/src/generators/library/lib/add-vite.ts @@ -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); } diff --git a/packages/solid/src/generators/library/library.ts b/packages/solid/src/generators/library/library.ts index 6c8d44db1..e7bfc7c16 100644 --- a/packages/solid/src/generators/library/library.ts +++ b/packages/solid/src/generators/library/library.ts @@ -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); @@ -119,3 +105,4 @@ export async function libraryGeneratorInternal( return runTasksInSerial(initTask, viteTask, vitestTask, lintTask, jestTask); } +export default libraryGenerator; diff --git a/packages/stencil/package.json b/packages/stencil/package.json index 4be62157d..31fe22789 100644 --- a/packages/stencil/package.json +++ b/packages/stencil/package.json @@ -26,20 +26,19 @@ "builders": "./executors.json", "executors": "./executors.json", "dependencies": { - "@nxext/common": "^19.0.0", - "@nx/devkit": "19.3.0", + "@nx/devkit": "^19.3.0", "@stencil/core": "4.12.6", - "@nx/workspace": "19.3.0", - "@nx/js": "19.3.0", + "@nx/workspace": "^19.3.0", + "@nx/js": "^19.3.0", "typescript": "5.4.5", "fs-extra": "^10.1.0", - "@nx/angular": "19.3.0", - "@nx/eslint": "19.3.0", - "@nx/react": "19.3.0", - "@nx/web": "19.3.0", - "@nx/cypress": "19.3.0", - "@nx/jest": "19.3.0", - "@nx/storybook": "19.3.0", + "@nx/angular": "^19.3.0", + "@nx/eslint": "^19.3.0", + "@nx/react": "^19.3.0", + "@nx/web": "^19.3.0", + "@nx/cypress": "^19.3.0", + "@nx/jest": "^19.3.0", + "@nx/storybook": "^19.3.0", "@phenomnomnominal/tsquery": "~5.0.1", "tslib": "^2.3.0" }, diff --git a/packages/stencil/project.json b/packages/stencil/project.json index 2b738c69d..6e44a59bb 100644 --- a/packages/stencil/project.json +++ b/packages/stencil/project.json @@ -69,11 +69,20 @@ "dependencies": true } ] - }, - "publish": { - "command": "node tools/scripts/publish.mjs stencil {args.ver} {args.tag}", - "dependsOn": ["build"] } }, - "tags": [] + "tags": [], + "release": { + "version": { + "generatorOptions": { + "packageRoot": "dist/{projectRoot}", + "currentVersionResolver": "git-tag" + } + } + }, + "nx-release-publish": { + "options": { + "packageRoot": "dist/{projectRoot}" + } + } } diff --git a/packages/stencil/src/generators/add-outputtarget/add-angular/generator.ts b/packages/stencil/src/generators/add-outputtarget/add-angular/generator.ts index 69236e5da..fd289acb1 100644 --- a/packages/stencil/src/generators/add-outputtarget/add-angular/generator.ts +++ b/packages/stencil/src/generators/add-outputtarget/add-angular/generator.ts @@ -21,7 +21,7 @@ import { addExportToModule, } from '../../../utils/angular-ast-utils'; import { getProjectTsImportPath } from '../../storybook-configuration/generator'; -import { addAfterLastImport, addImport } from '@nxext/common'; +import { addAfterLastImport, addImport } from '../../../utils/ast-utils'; import { addGlobal } from '@nx/js'; import { existsSync } from 'fs-extra'; diff --git a/packages/stencil/src/generators/add-outputtarget/add-outputtarget.ts b/packages/stencil/src/generators/add-outputtarget/add-outputtarget.ts index 9957e60e7..ee9bce2d5 100644 --- a/packages/stencil/src/generators/add-outputtarget/add-outputtarget.ts +++ b/packages/stencil/src/generators/add-outputtarget/add-outputtarget.ts @@ -54,3 +54,5 @@ export async function outputtargetGenerator( return runTasksInSerial(...tasks); } + +export default outputtargetGenerator; diff --git a/packages/stencil/src/generators/add-outputtarget/add-react/generator.ts b/packages/stencil/src/generators/add-outputtarget/add-react/generator.ts index 8df4d7455..5fe65e92b 100644 --- a/packages/stencil/src/generators/add-outputtarget/add-react/generator.ts +++ b/packages/stencil/src/generators/add-outputtarget/add-react/generator.ts @@ -14,7 +14,7 @@ import { Linter } from '@nx/eslint'; import { STENCIL_OUTPUTTARGET_VERSION } from '../../../utils/versions'; import * as ts from 'typescript'; import { getDistDir, getRelativePath } from '../../../utils/fileutils'; -import { addImport } from '@nxext/common'; +import { addImport } from '../../../utils/ast-utils'; import { addOutputTarget } from '../../../stencil-core-utils'; import { calculateStencilSourceOptions } from '../lib/calculate-stencil-source-options'; diff --git a/packages/stencil/src/generators/add-outputtarget/add-svelte/generator.ts b/packages/stencil/src/generators/add-outputtarget/add-svelte/generator.ts index 1db896249..553543f62 100644 --- a/packages/stencil/src/generators/add-outputtarget/add-svelte/generator.ts +++ b/packages/stencil/src/generators/add-outputtarget/add-svelte/generator.ts @@ -14,7 +14,7 @@ import { } from '../../../utils/versions'; import * as ts from 'typescript'; import { getDistDir, getRelativePath } from '../../../utils/fileutils'; -import { addImport } from '@nxext/common'; +import { addImport } from '../../../utils/ast-utils'; import { addOutputTarget } from '../../../stencil-core-utils'; import { calculateStencilSourceOptions } from '../lib/calculate-stencil-source-options'; diff --git a/packages/stencil/src/generators/add-outputtarget/lib/calculate-stencil-source-options.ts b/packages/stencil/src/generators/add-outputtarget/lib/calculate-stencil-source-options.ts index 4e51dd7b5..3a0a10399 100644 --- a/packages/stencil/src/generators/add-outputtarget/lib/calculate-stencil-source-options.ts +++ b/packages/stencil/src/generators/add-outputtarget/lib/calculate-stencil-source-options.ts @@ -1,7 +1,7 @@ import { readProjectConfiguration, Tree } from '@nx/devkit'; import { getNpmScope } from '@nx/js/src/utils/package-json/get-npm-scope'; import * as ts from 'typescript'; -import { readTsSourceFile } from '@nxext/common'; +import { readTsSourceFile } from '../../../utils/ast-utils'; export function calculateStencilSourceOptions(host: Tree, projectName: string) { const stencilProjectConfig = readProjectConfiguration(host, projectName); diff --git a/packages/stencil/src/generators/application/generator.ts b/packages/stencil/src/generators/application/generator.ts index bd073954c..15fd3644f 100644 --- a/packages/stencil/src/generators/application/generator.ts +++ b/packages/stencil/src/generators/application/generator.ts @@ -106,3 +106,5 @@ export async function applicationGenerator( return runTasksInSerial(initTask, lintTask, cypressTask); } + +export default applicationGenerator; diff --git a/packages/stencil/src/generators/component/component.ts b/packages/stencil/src/generators/component/component.ts index 3ad3a094b..7d29533ba 100644 --- a/packages/stencil/src/generators/component/component.ts +++ b/packages/stencil/src/generators/component/component.ts @@ -82,3 +82,4 @@ export async function componentGenerator(host: Tree, options: ComponentSchema) { await formatFiles(host); } } +export default componentGenerator; diff --git a/packages/stencil/src/generators/init/init.ts b/packages/stencil/src/generators/init/init.ts index d30f39ac7..cc4ee8683 100644 --- a/packages/stencil/src/generators/init/init.ts +++ b/packages/stencil/src/generators/init/init.ts @@ -29,3 +29,4 @@ export async function initGenerator( jestInitTask ); } +export default initGenerator; diff --git a/packages/stencil/src/generators/library/generator.ts b/packages/stencil/src/generators/library/generator.ts index c81c95e13..e5f2f5532 100644 --- a/packages/stencil/src/generators/library/generator.ts +++ b/packages/stencil/src/generators/library/generator.ts @@ -101,3 +101,4 @@ export async function libraryGenerator(host: Tree, schema: RawLibrarySchema) { return runTasksInSerial(initTask); } +export default libraryGenerator; diff --git a/packages/stencil/src/generators/make-lib-buildable/make-lib-buildable.ts b/packages/stencil/src/generators/make-lib-buildable/make-lib-buildable.ts index aece4613b..fb0649ea8 100644 --- a/packages/stencil/src/generators/make-lib-buildable/make-lib-buildable.ts +++ b/packages/stencil/src/generators/make-lib-buildable/make-lib-buildable.ts @@ -101,3 +101,4 @@ export async function makeLibBuildableGenerator( await formatFiles(host); } +export default makeLibBuildableGenerator; diff --git a/packages/stencil/src/generators/storybook-configuration/generator.ts b/packages/stencil/src/generators/storybook-configuration/generator.ts index 841a53b49..9300e520e 100644 --- a/packages/stencil/src/generators/storybook-configuration/generator.ts +++ b/packages/stencil/src/generators/storybook-configuration/generator.ts @@ -274,3 +274,4 @@ function addStorybookTask( updateProjectConfiguration(tree, projectName, projectConfig); } +export default storybookConfigurationGenerator; diff --git a/packages/stencil/src/stencil-core-utils/lib/plugins.ts b/packages/stencil/src/stencil-core-utils/lib/plugins.ts index e50844fb7..0683b66d4 100644 --- a/packages/stencil/src/stencil-core-utils/lib/plugins.ts +++ b/packages/stencil/src/stencil-core-utils/lib/plugins.ts @@ -1,5 +1,5 @@ import * as ts from 'typescript'; -import { readTsSourceFile } from '@nxext/common'; +import { readTsSourceFile } from '../../utils/ast-utils'; import { applyChangesToString, ChangeType, diff --git a/packages/stencil/src/stencil-core-utils/lib/style-plugins.ts b/packages/stencil/src/stencil-core-utils/lib/style-plugins.ts index 714c68f85..c28daf1eb 100644 --- a/packages/stencil/src/stencil-core-utils/lib/style-plugins.ts +++ b/packages/stencil/src/stencil-core-utils/lib/style-plugins.ts @@ -1,7 +1,7 @@ import * as ts from 'typescript'; import { addToPlugins } from './plugins'; import { applyChangesToString, StringChange, Tree } from '@nx/devkit'; -import { readTsSourceFile, addImport } from '@nxext/common'; +import { readTsSourceFile, addImport } from '../../utils/ast-utils'; export enum SupportedStyles { css = 'css', diff --git a/packages/svelte/package.json b/packages/svelte/package.json index ee5b4be74..65d3bb0a8 100644 --- a/packages/svelte/package.json +++ b/packages/svelte/package.json @@ -27,16 +27,16 @@ "typings": "./src/index.d.ts", "schematics": "./generators.json", "peerDependencies": { - "@nx/devkit": "19.3.0", - "@nx/vite": "19.3.0", - "@nx/web": "19.3.0", - "@nx/cypress": "19.3.0", - "@nx/jest": "19.3.0", - "@nx/eslint": "19.3.0", - "@nx/js": "19.3.0", + "@nx/devkit": "^19.3.0", + "@nx/vite": "^19.3.0", + "@nx/web": "^19.3.0", + "@nx/cypress": "^19.3.0", + "@nx/jest": "^19.3.0", + "@nx/eslint": "^19.3.0", + "@nx/js": "^19.3.0", "typescript": "5.4.5", - "@nx/storybook": "19.3.0", - "nx": "19.3.0", + "@nx/storybook": "^19.3.0", + "nx": "^19.3.0", "tslib": "^2.3.0" }, "dependencies": {} diff --git a/packages/svelte/project.json b/packages/svelte/project.json index 305d532af..b4998ba41 100644 --- a/packages/svelte/project.json +++ b/packages/svelte/project.json @@ -58,11 +58,20 @@ "dependencies": true } ] - }, - "publish": { - "command": "node tools/scripts/publish.mjs svelte {args.ver} {args.tag}", - "dependsOn": ["build"] } }, - "tags": [] + "tags": [], + "release": { + "version": { + "generatorOptions": { + "packageRoot": "dist/{projectRoot}", + "currentVersionResolver": "git-tag" + } + } + }, + "nx-release-publish": { + "options": { + "packageRoot": "dist/{projectRoot}" + } + } } diff --git a/packages/svelte/src/generators/application/application.ts b/packages/svelte/src/generators/application/application.ts index a5f078a76..da9f4935b 100644 --- a/packages/svelte/src/generators/application/application.ts +++ b/packages/svelte/src/generators/application/application.ts @@ -61,3 +61,4 @@ export async function applicationGeneratorInternal(host: Tree, schema: Schema) { return runTasksInSerial(initTask, viteTask, lintTask, jestTask, cypressTask); } +export default applicationGenerator; diff --git a/packages/svelte/src/generators/component/component.ts b/packages/svelte/src/generators/component/component.ts index 5f878fc33..40ec9bfa2 100644 --- a/packages/svelte/src/generators/component/component.ts +++ b/packages/svelte/src/generators/component/component.ts @@ -16,3 +16,4 @@ export async function componentGenerator( createComponentInProject(tree, options); addExportsToBarrel(tree, options); } +export default componentGenerator; diff --git a/packages/svelte/src/generators/init/init.ts b/packages/svelte/src/generators/init/init.ts index d1893af3d..f192f1f24 100644 --- a/packages/svelte/src/generators/init/init.ts +++ b/packages/svelte/src/generators/init/init.ts @@ -33,3 +33,4 @@ export async function initGenerator(host: Tree, schema: Schema) { } return runTasksInSerial(...tasks); } +export default initGenerator; diff --git a/packages/svelte/src/generators/library/lib/add-jest.ts b/packages/svelte/src/generators/library/lib/add-jest.ts deleted file mode 100644 index d39129b58..000000000 --- a/packages/svelte/src/generators/library/lib/add-jest.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { ensurePackage, NX_VERSION, Tree } from '@nx/devkit'; -import { NormalizedSchema } from '../schema'; - -export async function addJest(host: Tree, options: NormalizedSchema) { - if (options.unitTestRunner !== 'jest') { - return () => {}; // eslint-disable-line @typescript-eslint/no-empty-function - } - - const { jestProjectGenerator } = ensurePackage( - '@nx/jest', - NX_VERSION - ); - - return await jestProjectGenerator(host, { - project: options.name, - supportTsx: false, - skipSerializers: true, - setupFile: 'none', - babelJest: false, - }); -} diff --git a/packages/svelte/src/generators/library/lib/add-vite.ts b/packages/svelte/src/generators/library/lib/add-vite.ts index e4b2c4bfc..db867e06e 100644 --- a/packages/svelte/src/generators/library/lib/add-vite.ts +++ b/packages/svelte/src/generators/library/lib/add-vite.ts @@ -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); } diff --git a/packages/svelte/src/generators/library/lib/update-jest-config.ts b/packages/svelte/src/generators/library/lib/update-jest-config.ts deleted file mode 100644 index 4bd8e38f0..000000000 --- a/packages/svelte/src/generators/library/lib/update-jest-config.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { NormalizedSchema } from '../schema'; -import { Tree } from '@nx/devkit'; - -export function updateJestConfig(host: Tree, options: NormalizedSchema) { - if (options.unitTestRunner !== 'jest') { - return; - } - - const configPath = `${options.projectRoot}/jest.config.ts`; - const svelteConfigPath = `${options.projectRoot}/svelte.config.cjs`; - const originalContent = host.read(configPath)?.toString(); - const content = updateJestConfigContent(originalContent, svelteConfigPath); - host.write(configPath, content); -} - -function updateJestConfigContent(content: string, svelteConfigPath: string) { - return content - .replace('moduleFileExtensions: [', "moduleFileExtensions: ['svelte', ") - .replace( - 'transform: {', - `transform: {\n '^(.+\\\\.svelte$)': ['svelte-jester', {\n 'preprocess': '${svelteConfigPath}'\n }\n ],` - ); -} diff --git a/packages/svelte/src/generators/library/library.ts b/packages/svelte/src/generators/library/library.ts index fed4a1198..8e83e2c10 100644 --- a/packages/svelte/src/generators/library/library.ts +++ b/packages/svelte/src/generators/library/library.ts @@ -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) => { @@ -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); @@ -65,5 +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; diff --git a/packages/svelte/src/generators/library/schema.d.ts b/packages/svelte/src/generators/library/schema.d.ts index 9f35c0e27..78365a606 100644 --- a/packages/svelte/src/generators/library/schema.d.ts +++ b/packages/svelte/src/generators/library/schema.d.ts @@ -6,7 +6,7 @@ export interface SvelteLibrarySchema { tags?: string; projectNameAndRootFormat?: ProjectNameAndRootFormat; linter: Linter; - unitTestRunner: 'jest' | 'vitest' | 'none'; + unitTestRunner: 'vitest' | 'none'; e2eTestRunner: 'cypress' | 'none'; buildable?: boolean; directory?: string; diff --git a/packages/svelte/src/generators/library/schema.json b/packages/svelte/src/generators/library/schema.json index b59dcd747..db976ade0 100644 --- a/packages/svelte/src/generators/library/schema.json +++ b/packages/svelte/src/generators/library/schema.json @@ -26,7 +26,7 @@ }, "unitTestRunner": { "type": "string", - "enum": ["jest", "vitest", "none"], + "enum": ["vitest", "none"], "description": "Test runner to use for unit tests.", "default": "vitest" }, diff --git a/packages/svelte/src/generators/storybook-configuration/configuration.ts b/packages/svelte/src/generators/storybook-configuration/configuration.ts index c6c9bba60..82b880cfa 100644 --- a/packages/svelte/src/generators/storybook-configuration/configuration.ts +++ b/packages/svelte/src/generators/storybook-configuration/configuration.ts @@ -65,3 +65,4 @@ function normalizeSchema( ...schema, }; } +export default configurationGenerator; diff --git a/packages/svelte/src/generators/utils/versions.ts b/packages/svelte/src/generators/utils/versions.ts index 30b75f3bb..274d1f318 100644 --- a/packages/svelte/src/generators/utils/versions.ts +++ b/packages/svelte/src/generators/utils/versions.ts @@ -1,8 +1,8 @@ -export const svelteVersion = '^4.2.12'; +export const svelteVersion = '^4.2.18'; export const svelteJesterVersion = '^2.3.2'; export const svelteCheckVersion = '^2.10.2'; export const svelteLoaderVersion = '^3.1.9'; -export const sveltePreprocessVersion = '^5.1.3'; +export const sveltePreprocessVersion = '^6.0.1'; export const eslintPluginSvelteVersion = '^4.0.0'; export const tsconfigSvelteVersion = '^4.0.1'; export const testingLibrarySvelteVersion = '^3.2.2'; diff --git a/packages/sveltekit/package.json b/packages/sveltekit/package.json index 6b723a94a..07afa3a8f 100644 --- a/packages/sveltekit/package.json +++ b/packages/sveltekit/package.json @@ -22,13 +22,13 @@ "generators": "./generators.json", "executors": "./executors.json", "dependencies": { - "@nx/devkit": "19.3.0", - "nx": "19.3.0", - "@nx/vite": "19.3.0", - "@nx/eslint": "19.3.0", + "@nx/devkit": "^19.3.0", + "nx": "^19.3.0", + "@nx/vite": "^19.3.0", + "@nx/eslint": "^19.3.0", "typescript": "5.4.5", - "@nx/js": "19.3.0", - "@nx/workspace": "19.3.0", + "@nx/js": "^19.3.0", + "@nx/workspace": "^19.3.0", "tslib": "^2.3.0" }, "peerDependencies": {} diff --git a/packages/sveltekit/project.json b/packages/sveltekit/project.json index 4ebe40f02..c00714cac 100644 --- a/packages/sveltekit/project.json +++ b/packages/sveltekit/project.json @@ -46,11 +46,20 @@ } ] } - }, - "publish": { - "command": "node tools/scripts/publish.mjs sveltekit {args.ver} {args.tag}", - "dependsOn": ["build"] } }, - "tags": [] + "tags": [], + "release": { + "version": { + "generatorOptions": { + "packageRoot": "dist/{projectRoot}", + "currentVersionResolver": "git-tag" + } + } + }, + "nx-release-publish": { + "options": { + "packageRoot": "dist/{projectRoot}" + } + } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index befa41f6a..767671581 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -119,6 +119,9 @@ importers: '@types/node': specifier: ^18.16.9 version: 18.16.9 + '@types/semver': + specifier: ^7.5.8 + version: 7.5.8 '@types/yargs': specifier: ^17.0.32 version: 17.0.32 @@ -206,6 +209,9 @@ importers: pretty-quick: specifier: ^3.1.3 version: 3.1.3(prettier@2.7.1) + semver: + specifier: ^7.6.2 + version: 7.6.2 svelte: specifier: ^4.2.12 version: 4.2.12 @@ -11161,10 +11167,10 @@ packages: engines: { node: '>=10' } hasBin: true - semver@7.6.0: + semver@7.6.2: resolution: { - integrity: sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==, + integrity: sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==, } engines: { node: '>=10' } hasBin: true @@ -13365,7 +13371,7 @@ snapshots: chokidar: 3.5.3 convert-source-map: 1.8.0 reflect-metadata: 0.1.13 - semver: 7.6.0 + semver: 7.6.2 tslib: 2.6.2 typescript: 5.4.5 yargs: 17.7.2 @@ -15787,7 +15793,7 @@ snapshots: minimatch: 9.0.3 piscina: 4.4.0 rxjs: 7.8.1 - semver: 7.6.0 + semver: 7.6.2 tslib: 2.6.2 webpack: 5.88.2(@swc/core@1.5.7(@swc/helpers@0.5.11))(esbuild@0.20.2) webpack-merge: 5.9.0 @@ -15852,7 +15858,7 @@ snapshots: ignore: 5.3.1 minimatch: 9.0.3 nx: 19.3.0(@swc-node/register@1.9.2(@swc/core@1.5.7(@swc/helpers@0.5.11))(@swc/types@0.1.7)(typescript@5.4.5))(@swc/core@1.5.7(@swc/helpers@0.5.11)) - semver: 7.6.0 + semver: 7.6.2 tmp: 0.2.1 tslib: 2.6.2 yargs-parser: 21.1.1 @@ -15868,7 +15874,7 @@ snapshots: chalk: 4.1.0 confusing-browser-globals: 1.0.11 jsonc-eslint-parser: 2.3.0 - semver: 7.6.0 + semver: 7.6.2 tslib: 2.6.2 optionalDependencies: eslint-config-prettier: 9.0.0(eslint@8.57.0) @@ -15891,7 +15897,7 @@ snapshots: '@nx/js': 19.3.0(@babel/traverse@7.24.0)(@swc-node/register@1.9.2(@swc/core@1.5.7(@swc/helpers@0.5.11))(@swc/types@0.1.7)(typescript@5.4.5))(@swc/core@1.5.7(@swc/helpers@0.5.11))(@types/node@18.16.9)(nx@19.3.0(@swc-node/register@1.9.2(@swc/core@1.5.7(@swc/helpers@0.5.11))(@swc/types@0.1.7)(typescript@5.4.5))(@swc/core@1.5.7(@swc/helpers@0.5.11)))(typescript@5.4.5)(verdaccio@5.18.0(typanion@3.12.1)) '@nx/linter': 19.3.0(@babel/traverse@7.24.0)(@swc-node/register@1.9.2(@swc/core@1.5.7(@swc/helpers@0.5.11))(@swc/types@0.1.7)(typescript@5.4.5))(@swc/core@1.5.7(@swc/helpers@0.5.11))(@types/node@18.16.9)(@zkochan/js-yaml@0.0.7)(eslint@8.57.0)(nx@19.3.0(@swc-node/register@1.9.2(@swc/core@1.5.7(@swc/helpers@0.5.11))(@swc/types@0.1.7)(typescript@5.4.5))(@swc/core@1.5.7(@swc/helpers@0.5.11)))(verdaccio@5.18.0(typanion@3.12.1)) eslint: 8.57.0 - semver: 7.6.0 + semver: 7.6.2 tslib: 2.6.2 typescript: 5.4.5 optionalDependencies: @@ -15964,7 +15970,7 @@ snapshots: npm-package-arg: 11.0.1 npm-run-path: 4.0.1 ora: 5.3.0 - semver: 7.6.0 + semver: 7.6.2 source-map-support: 0.5.19 ts-node: 10.9.1(@swc/core@1.5.7(@swc/helpers@0.5.11))(@types/node@18.16.9)(typescript@5.4.5) tsconfig-paths: 4.1.2 @@ -16135,7 +16141,7 @@ snapshots: '@nx/eslint': 19.3.0(@babel/traverse@7.24.0)(@swc-node/register@1.9.2(@swc/core@1.5.7(@swc/helpers@0.5.11))(@swc/types@0.1.7)(typescript@5.4.5))(@swc/core@1.5.7(@swc/helpers@0.5.11))(@types/node@18.16.9)(@zkochan/js-yaml@0.0.7)(eslint@8.57.0)(nx@19.3.0(@swc-node/register@1.9.2(@swc/core@1.5.7(@swc/helpers@0.5.11))(@swc/types@0.1.7)(typescript@5.4.5))(@swc/core@1.5.7(@swc/helpers@0.5.11)))(verdaccio@5.18.0(typanion@3.12.1)) '@nx/js': 19.3.0(@babel/traverse@7.24.0)(@swc-node/register@1.9.2(@swc/core@1.5.7(@swc/helpers@0.5.11))(@swc/types@0.1.7)(typescript@5.4.5))(@swc/core@1.5.7(@swc/helpers@0.5.11))(@types/node@18.16.9)(nx@19.3.0(@swc-node/register@1.9.2(@swc/core@1.5.7(@swc/helpers@0.5.11))(@swc/types@0.1.7)(typescript@5.4.5))(@swc/core@1.5.7(@swc/helpers@0.5.11)))(typescript@5.4.5)(verdaccio@5.18.0(typanion@3.12.1)) '@phenomnomnominal/tsquery': 5.0.1(typescript@5.4.5) - semver: 7.6.0 + semver: 7.6.2 tslib: 2.6.2 transitivePeerDependencies: - '@babel/traverse' @@ -16524,7 +16530,7 @@ snapshots: fast-glob: 3.3.2 minimatch: 9.0.4 piscina: 4.4.0 - semver: 7.6.0 + semver: 7.6.2 slash: 3.0.0 source-map: 0.7.4 optionalDependencies: @@ -16827,7 +16833,7 @@ snapshots: graphemer: 1.4.0 ignore: 5.3.1 natural-compare: 1.4.0 - semver: 7.6.0 + semver: 7.6.2 ts-api-utils: 1.3.0(typescript@5.4.5) optionalDependencies: typescript: 5.4.5 @@ -16874,7 +16880,7 @@ snapshots: globby: 11.1.0 is-glob: 4.0.3 minimatch: 9.0.4 - semver: 7.6.0 + semver: 7.6.2 ts-api-utils: 1.3.0(typescript@5.4.5) optionalDependencies: typescript: 5.4.5 @@ -16890,7 +16896,7 @@ snapshots: '@typescript-eslint/types': 7.6.0 '@typescript-eslint/typescript-estree': 7.6.0(typescript@5.4.5) eslint: 8.57.0 - semver: 7.6.0 + semver: 7.6.2 transitivePeerDependencies: - supports-color - typescript @@ -17589,7 +17595,7 @@ snapshots: bin-version-check@5.0.0: dependencies: bin-version: 6.0.0 - semver: 7.6.0 + semver: 7.6.2 semver-truncate: 2.0.0 bin-version@6.0.0: @@ -17676,7 +17682,7 @@ snapshots: builtins@5.0.1: dependencies: - semver: 7.6.0 + semver: 7.6.2 bytes@3.0.0: {} @@ -18075,7 +18081,7 @@ snapshots: postcss-modules-scope: 3.0.0(postcss@8.4.38) postcss-modules-values: 4.0.0(postcss@8.4.38) postcss-value-parser: 4.2.0 - semver: 7.6.0 + semver: 7.6.2 webpack: 5.88.2(@swc/core@1.5.7(@swc/helpers@0.5.11))(esbuild@0.18.17) css-loader@6.8.1(webpack@5.88.2(@swc/core@1.5.7(@swc/helpers@0.5.11))(esbuild@0.20.2)): @@ -18087,7 +18093,7 @@ snapshots: postcss-modules-scope: 3.0.0(postcss@8.4.38) postcss-modules-values: 4.0.0(postcss@8.4.38) postcss-value-parser: 4.2.0 - semver: 7.6.0 + semver: 7.6.2 webpack: 5.88.2(@swc/core@1.5.7(@swc/helpers@0.5.11))(esbuild@0.20.2) css-minimizer-webpack-plugin@5.0.1(esbuild@0.20.2)(webpack@5.88.2(@swc/core@1.5.7(@swc/helpers@0.5.11))(esbuild@0.20.2)): @@ -18988,7 +18994,7 @@ snapshots: minimatch: 3.1.2 node-abort-controller: 3.0.1 schema-utils: 3.3.0 - semver: 7.6.0 + semver: 7.6.2 tapable: 2.2.1 typescript: 5.4.5 webpack: 5.88.2(@swc/core@1.5.7(@swc/helpers@0.5.11))(esbuild@0.20.2) @@ -19902,7 +19908,7 @@ snapshots: jest-util: 29.6.3 natural-compare: 1.4.0 pretty-format: 29.7.0 - semver: 7.6.0 + semver: 7.6.2 transitivePeerDependencies: - supports-color @@ -20074,7 +20080,7 @@ snapshots: acorn: 8.10.0 eslint-visitor-keys: 3.4.3 espree: 9.6.1 - semver: 7.5.4 + semver: 7.6.2 jsonc-parser@3.2.0: {} @@ -20649,7 +20655,7 @@ snapshots: dependencies: hosted-git-info: 4.1.0 is-core-module: 2.13.0 - semver: 7.6.0 + semver: 7.6.2 validate-npm-package-license: 3.0.4 normalize-path@3.0.0: {} @@ -20662,7 +20668,7 @@ snapshots: dependencies: hosted-git-info: 7.0.1 proc-log: 3.0.0 - semver: 7.6.0 + semver: 7.6.2 validate-npm-package-name: 5.0.0 npm-run-path@2.0.2: @@ -20710,7 +20716,7 @@ snapshots: npm-run-path: 4.0.1 open: 8.4.2 ora: 5.3.0 - semver: 7.6.0 + semver: 7.6.2 string-width: 4.2.3 strong-log-transformer: 2.1.0 tar-stream: 2.2.0 @@ -21053,7 +21059,7 @@ snapshots: cosmiconfig: 7.0.1 klona: 2.0.6 postcss: 8.4.38 - semver: 7.6.0 + semver: 7.6.2 webpack: 5.88.2(@swc/core@1.5.7(@swc/helpers@0.5.11))(esbuild@0.20.2) postcss-loader@7.3.3(postcss@8.4.27)(webpack@5.88.2(@swc/core@1.5.7(@swc/helpers@0.5.11))(esbuild@0.18.17)): @@ -21061,7 +21067,7 @@ snapshots: cosmiconfig: 8.2.0 jiti: 1.19.3 postcss: 8.4.27 - semver: 7.6.0 + semver: 7.6.2 webpack: 5.88.2(@swc/core@1.5.7(@swc/helpers@0.5.11))(esbuild@0.18.17) postcss-merge-longhand@6.0.0(postcss@8.4.38): @@ -21625,9 +21631,7 @@ snapshots: dependencies: lru-cache: 6.0.0 - semver@7.6.0: - dependencies: - lru-cache: 6.0.0 + semver@7.6.2: {} send@0.18.0: dependencies: @@ -22196,7 +22200,7 @@ snapshots: json5: 2.2.3 lodash.memoize: 4.1.2 make-error: 1.3.6 - semver: 7.6.0 + semver: 7.6.2 typescript: 5.4.5 yargs-parser: 21.1.1 optionalDependencies: @@ -22210,7 +22214,7 @@ snapshots: chalk: 4.1.0 enhanced-resolve: 5.15.0 micromatch: 4.0.5 - semver: 7.6.0 + semver: 7.6.2 typescript: 5.4.5 webpack: 5.88.2(@swc/core@1.5.7(@swc/helpers@0.5.11))(esbuild@0.20.2) diff --git a/tools/scripts/check-versions.ts b/tools/scripts/check-versions.ts index 398d683ab..709c2c3f5 100644 --- a/tools/scripts/check-versions.ts +++ b/tools/scripts/check-versions.ts @@ -19,7 +19,7 @@ import * as chalk from 'chalk'; import * as glob from 'glob'; import { execSync } from 'child_process'; import { readFileSync, writeFileSync } from 'fs'; -import { dasherize } from '@nx/workspace/src/utils/strings'; +import { dasherize } from '@nx/devkit/src/utils/string-utils'; const root = join(__dirname, '..'); const excluded = ['nxVersion']; diff --git a/tools/scripts/create-playground.ts b/tools/scripts/create-playground.ts index 89bc8315a..921c4e334 100644 --- a/tools/scripts/create-playground.ts +++ b/tools/scripts/create-playground.ts @@ -12,13 +12,15 @@ import { readCachedProjectGraph, readJsonFile, readProjectsConfigurationFromProjectGraph, - workspaceRoot -} from "@nx/devkit"; + workspaceRoot, +} from '@nx/devkit'; import * as glob from 'glob'; console.log('\nCreating playground. This may take a few minutes.'); -const workspaceJson = readProjectsConfigurationFromProjectGraph(readCachedProjectGraph()); +const workspaceJson = readProjectsConfigurationFromProjectGraph( + readCachedProjectGraph() +); const publishableLibNames = getPublishableLibNames(workspaceJson); execSync(`npx nx run-many --target build --projects ${publishableLibNames}`); @@ -32,7 +34,7 @@ const baseName = basename(tmpProjPath()); logger.info('Creating nx workspace...'); execSync( - `npx --yes create-nx-workspace@latest ${baseName} --preset empty --nxCloud skip --no-interactive`, + `npx --yes create-nx-workspace@latest ${baseName} --preset apps --nxCloud skip --no-interactive`, { cwd: localTmpDir, stdio: 'inherit', @@ -43,13 +45,15 @@ logger.info('Nx workspace created!'); publishableLibNames.forEach((pubLibName) => { try { + if (pubLibName === 'common') return; + logger.info(`Processing ${pubLibName} ...`); const { outputPath, packageJson } = workspaceJson.projects[pubLibName]?.targets?.build.options; const p = JSON.parse(readFileSync(tmpProjPath('package.json')).toString()); p.devDependencies[ require(`${workspaceRoot}/${packageJson}`).name - ] = `file:${workspaceRoot}/${outputPath}`; + ] = `file:${workspaceRoot}/${outputPath}`; writeFileSync(tmpProjPath('package.json'), JSON.stringify(p, null, 2)); } catch (e) { logger.info(`Problem with ${pubLibName}`); diff --git a/tools/scripts/publish.mjs b/tools/scripts/publish.mjs deleted file mode 100644 index 4991c021d..000000000 --- a/tools/scripts/publish.mjs +++ /dev/null @@ -1,67 +0,0 @@ -/** - * This is a minimal script to publish your package to "npm". - * This is meant to be used as-is or customize as you see fit. - * - * This script is executed on "dist/path/to/library" as "cwd" by default. - * - * You might need to authenticate with NPM before running this script. - */ - -import { execSync } from 'child_process'; -import { readFileSync, writeFileSync } from 'fs'; - -import devkit from '@nx/devkit'; -const { readCachedProjectGraph, NX_VERSION } = devkit; - -function invariant(condition, message) { - if (!condition) { - console.error(message); - process.exit(1); - } -} - -// Executing publish script: node path/to/publish.mjs {name} --version {version} --tag {tag} -// Default "tag" to "next" so we won't publish the "latest" tag by accident. -const [, , name, version, tag = 'next'] = process.argv; - -// A simple SemVer validation to validate the version -const validVersion = /^\d+\.\d+\.\d+(-\w+\.\d+)?/; -invariant( - version && validVersion.test(version), - `No version provided or version did not match Semantic Versioning, expected: #.#.#-tag.# or #.#.#, got ${version}.` -); - -const graph = readCachedProjectGraph(); -const project = graph.nodes[name]; - -invariant( - project, - `Could not find project "${name}" in the workspace. Is the project.json configured correctly?` -); - -const outputPath = project.data?.targets?.build?.options?.outputPath; -invariant( - outputPath, - `Could not find "build.options.outputPath" of project "${name}". Is project.json configured correctly?` -); - -process.chdir(outputPath); - -try { - const npmScope = '@nxext'; - const content = JSON.parse(readFileSync(`package.json`).toString()); - content.version = '999.9.9'; - for (const key in content.dependencies) { - if (key.startsWith(`${npmScope}/`)) { - content.dependencies[key] = version; - } - if (key.startsWith(`@nx/`)) { - content.dependencies[key] = NX_VERSION; - } - } - writeFileSync(`package.json`, JSON.stringify(json, null, 2)); -} catch (e) { - console.error(`Error reading package.json file from library build output.`); -} -// Execute "npm publish" to publish -execSync(`npm publish --access public --tag ${tag} --verbose`); diff --git a/tools/scripts/start-local-registry.ts b/tools/scripts/start-local-registry.ts index 3901a362d..77c42f5dc 100644 --- a/tools/scripts/start-local-registry.ts +++ b/tools/scripts/start-local-registry.ts @@ -6,6 +6,16 @@ import { startLocalRegistry } from '@nx/js/plugins/jest/local-registry'; import { releasePublish, releaseVersion } from 'nx/release'; export default async () => { + if ( + process.env.SKIP_LOCAL_REGISTRY_GLOBAL_SETUP && + process.env.SKIP_LOCAL_REGISTRY_GLOBAL_SETUP !== 'false' + ) { + console.log( + "Environment variable 'SKIP_LOCAL_REGISTRY_GLOBAL_SETUP' is set. Skipping global setup of Verdaccio's Local Registry..." + ); + return; + } + // local registry target to run const localRegistryTarget = 'nxext:local-registry'; // storage folder for the local registry @@ -17,11 +27,14 @@ export default async () => { verbose: false, }); await releaseVersion({ - specifier: '999.99.9:e2e', + specifier: '0.0.0-e2e', stageChanges: false, gitCommit: false, gitTag: false, firstRelease: true, + generatorOptionsOverrides: { + skipLockFileUpdate: true, + }, }); await releasePublish({ tag: 'e2e', diff --git a/tsconfig.base.json b/tsconfig.base.json index 9b5724c01..9244dd816 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -9,15 +9,14 @@ "experimentalDecorators": true, "importHelpers": true, "target": "es2015", - "module": "esnext", - "typeRoots": ["node_modules/@types"], - "lib": ["es2017", "dom", "es2020"], + "module": "commonjs", + "lib": ["es2020", "dom"], "skipLibCheck": true, "skipDefaultLibCheck": true, "baseUrl": ".", "paths": { "@nxext/common": ["packages/common/src/index.ts"], - "@nxext/e2e-utils": ["e2e/utils/index.ts"], + "@nxext/e2e-utils": ["e2e/e2e-utils/src/index.ts"], "@nxext/preact": ["packages/preact/src/index.ts"], "@nxext/stencil": ["packages/stencil/src/index.ts"], "@nxext/svelte": ["packages/svelte/src/index.ts"]