Skip to content

Commit

Permalink
fix(svelte): remove angular-devkit deps
Browse files Browse the repository at this point in the history
  • Loading branch information
DominikPieper committed Nov 26, 2021
1 parent 1191c41 commit ad06d8c
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 34 deletions.
10 changes: 5 additions & 5 deletions packages/svelte/package.json
@@ -1,6 +1,6 @@
{
"name": "@nxext/svelte",
"version": "13.0.1",
"version": "13.0.3",
"license": "MIT",
"author": "Dominik Pieper",
"description": "Nx plugin for Svelte",
Expand All @@ -25,13 +25,13 @@
"peerDependencies": {
"svelte": "^3.42.1",
"svelte-preprocess": "^4.4.2",
"@nrwl/workspace": "^13.0.1",
"@nrwl/cypress": "^13.0.1",
"@nrwl/linter": "^13.0.1"
"@nrwl/workspace": "^13.1.4",
"@nrwl/cypress": "^13.1.4",
"@nrwl/linter": "^13.1.4"
},
"dependencies": {
"@nxext/vite": "13.0.0",
"@nrwl/devkit": "^13.0.1",
"@nrwl/devkit": "^13.1.4",
"@rollup/plugin-commonjs": "^17.0.0",
"@rollup/plugin-node-resolve": "^11.0.0",
"@rollup/plugin-typescript": "^8.2.3",
Expand Down
Expand Up @@ -4,7 +4,7 @@ import applicationGenerator from './application';
import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
import { readJson } from '@nrwl/devkit';

describe('svelte app schematic', () => {
describe('svelte app generator', () => {
let tree;
const options: SvelteApplicationSchema = {
name: 'test',
Expand Down
@@ -1,5 +1,4 @@
import { NormalizedSchema } from '../schema';
import { ProjectType } from '@nrwl/workspace';
import { addProjectConfiguration, TargetConfiguration, Tree } from '@nrwl/devkit';
import { createRollupTargets } from './project/rollup';
import { createViteTargets } from './project/vite';
Expand All @@ -15,7 +14,7 @@ export function addProject(tree: Tree, options: NormalizedSchema) {
addProjectConfiguration(tree, options.name, {
root: options.projectRoot,
sourceRoot: `${options.projectRoot}/src`,
projectType: ProjectType.Application,
projectType: 'application',
tags: options.parsedTags,
targets,
});
Expand Down
11 changes: 0 additions & 11 deletions packages/svelte/src/generators/application/lib/project/vite.ts
Expand Up @@ -58,14 +58,3 @@ function createLintTarget(options: NormalizedSchema): TargetConfiguration {
},
};
}

function createTestTarget(options: NormalizedSchema): TargetConfiguration {
return {
executor: '@nrwl/jest:jest',
options: {
outputPath: joinPathFragments('dist', options.projectRoot),
jestConfig: joinPathFragments(options.projectRoot, 'jest.config.js'),
passWithNoTests: true,
},
};
}
3 changes: 1 addition & 2 deletions packages/svelte/src/generators/component/component.spec.ts
@@ -1,6 +1,5 @@
import componentGenerator, { SvelteComponentSchema } from './component';
import { createTestProject } from '../utils/testing';
import { ProjectType } from '@nrwl/workspace';
import { uniq } from '@nrwl/nx-plugin/testing';
import { names, Tree } from '@nrwl/devkit';

Expand Down Expand Up @@ -33,7 +32,7 @@ describe('component schematic', () => {
});

it('should add file to barrel', async () => {
const tree = await createTestProject(projectName, ProjectType.Library);
const tree = await createTestProject(projectName, 'library');
await componentGenerator(tree, options);
const name = names(componentName);

Expand Down
@@ -1,6 +1,6 @@
import * as ts from 'typescript';

import { ProjectType } from '@nrwl/workspace';
import { findNodes } from '@nrwl/workspace';
import { SvelteComponentSchema } from '../component';
import {
applyChangesToString,
Expand All @@ -11,7 +11,6 @@ import {
StringChange,
Tree,
} from '@nrwl/devkit';
import { findNodes } from '@nrwl/workspace/src/utils/ast-utils';

export function addExportsToBarrel(tree: Tree, options: SvelteComponentSchema) {
const projectConfig = readProjectConfiguration(tree, options.project);
Expand All @@ -20,7 +19,7 @@ export function addExportsToBarrel(tree: Tree, options: SvelteComponentSchema) {
const indexFilePath = joinPathFragments(projectConfig.sourceRoot, 'index.ts');
const componentFile = `./components/${fileName}/${className}.svelte`;

if (projectConfig.projectType === ProjectType.Library) {
if (projectConfig.projectType === 'library') {
const { content, source } = readSourceFile(tree, indexFilePath);

const changes = applyChangesToString(
Expand Down
3 changes: 1 addition & 2 deletions packages/svelte/src/generators/library/lib/add-project.ts
@@ -1,5 +1,4 @@
import { NormalizedSchema } from '../schema';
import { ProjectType } from '@nrwl/workspace';
import {
addProjectConfiguration,
getWorkspaceLayout,
Expand All @@ -21,7 +20,7 @@ export function addProject(tree: Tree, options: NormalizedSchema) {
addProjectConfiguration(tree, options.name, {
root: options.projectRoot,
sourceRoot: `${options.projectRoot}/src`,
projectType: ProjectType.Library,
projectType: 'library',
tags: options.parsedTags,
targets,
});
Expand Down
2 changes: 1 addition & 1 deletion packages/svelte/src/generators/utils/lint.ts
@@ -1,5 +1,5 @@
import { eslintPluginSvelteVersion } from './versions';
import { offsetFromRoot } from '@nrwl/workspace';
import { offsetFromRoot } from '@nrwl/devkit';

export const extraEslintDependencies = {
dependencies: {},
Expand Down
9 changes: 4 additions & 5 deletions packages/svelte/src/generators/utils/testing.ts
@@ -1,13 +1,12 @@
import { ProjectType } from '@nrwl/workspace';
import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
import applicationGenerator from '../application/application';
import { Tree } from '@nrwl/devkit';
import { Tree, ProjectType } from '@nrwl/devkit';
import { Linter } from '@nrwl/linter';
import { libraryGenerator } from '../library/library';

export async function createTestProject(
name: string,
type: ProjectType = ProjectType.Application,
type: ProjectType = 'application',
unitTestrunner: 'none' | 'jest' = 'none',
e2eTestrunner: 'none' | 'cypress' = 'none'
): Promise<Tree> {
Expand All @@ -25,15 +24,15 @@ export async function createTestProject(
`
);

if (type === ProjectType.Application) {
if (type === 'application') {
await applicationGenerator(tree, {
name: name,
linter: Linter.EsLint,
unitTestRunner: unitTestrunner,
e2eTestRunner: e2eTestrunner,
});
}
if (type === ProjectType.Library) {
if (type === 'library') {
await libraryGenerator(tree, {
name: name,
linter: Linter.EsLint,
Expand Down
@@ -1,13 +1,12 @@
import { default as update } from './create-new-eslint-config';
import { createTestProject } from '../../generators/utils/testing';
import { ProjectType } from '@nrwl/workspace';
import { readJson, readProjectConfiguration } from '@nrwl/devkit';

describe('create-new-eslint-config', () => {
let tree;

beforeEach(async () => {
tree = await createTestProject('testproject', ProjectType.Application);
tree = await createTestProject('testproject', 'application');
tree.overwrite(
'package.json',
`
Expand Down

0 comments on commit ad06d8c

Please sign in to comment.