Skip to content

Commit

Permalink
feat(core): add angular workspaces compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastiandg7 committed Mar 26, 2021
1 parent 640a3b1 commit b875d01
Show file tree
Hide file tree
Showing 11 changed files with 87 additions and 8 deletions.
17 changes: 17 additions & 0 deletions packages/nx-shopify/executors.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,22 @@
"schema": "./src/executors/deploy/schema.json",
"description": "Deploy a Shopify theme to Shopify"
}
},
"builders": {
"build": {
"implementation": "./src/executors/build/ng-compat",
"schema": "./src/executors/build/schema.json",
"description": "Build a Shopify theme"
},
"serve": {
"implementation": "./src/executors/serve/ng-compat",
"schema": "./src/executors/serve/schema.json",
"description": "Serves a Shopify theme for local development"
},
"deploy": {
"implementation": "./src/executors/deploy/ng-compat",
"schema": "./src/executors/deploy/schema.json",
"description": "Deploy a Shopify theme to Shopify"
}
}
}
52 changes: 47 additions & 5 deletions packages/nx-shopify/generators.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"init": {
"factory": "./src/generators/init/init.generator",
"schema": "./src/generators/init/schema.json",
"description": "Initialize plugin"
"description": "Initialize @trafilea/nx-shopify plugin",
"aliases": ["ng-add"]
},
"theme": {
"factory": "./src/generators/theme/theme.generator",
Expand All @@ -16,22 +17,63 @@
"layout": {
"factory": "./src/generators/layout/layout.generator",
"schema": "./src/generators/layout/schema.json",
"description": "Generate a theme layout"
"description": "Generate a theme layout",
"aliases": ["l"]
},
"template": {
"factory": "./src/generators/template/template.generator",
"schema": "./src/generators/template/schema.json",
"description": "Generate a theme template"
"description": "Generate a theme template",
"aliases": ["t"]
},
"snippet": {
"factory": "./src/generators/snippet/snippet.generator",
"schema": "./src/generators/snippet/schema.json",
"description": "Generate a theme snippet"
"description": "Generate a theme snippet",
"aliases": ["snip"]
},
"section": {
"factory": "./src/generators/section/section.generator",
"schema": "./src/generators/section/schema.json",
"description": "Generate a theme section"
"description": "Generate a theme section",
"aliases": ["sec"]
}
},
"schematics": {
"init": {
"factory": "./src/generators/init/init.generator#nxShopifyInitSchematic",
"schema": "./src/generators/init/schema.json",
"description": "Initialize @trafilea/nx-shopify plugin",
"aliases": ["ng-add"]
},
"theme": {
"factory": "./src/generators/theme/theme.generator#nxShopifyThemeSchematic",
"schema": "./src/generators/theme/schema.json",
"description": "Generate a new Shopify theme"
},
"layout": {
"factory": "./src/generators/layout/layout.generator#nxShopifyLayoutSchematic",
"schema": "./src/generators/layout/schema.json",
"description": "Generate a theme layout",
"aliases": ["l"]
},
"template": {
"factory": "./src/generators/template/template.generator#nxShopifyTemplateSchematic",
"schema": "./src/generators/template/schema.json",
"description": "Generate a theme template",
"aliases": ["t"]
},
"snippet": {
"factory": "./src/generators/snippet/snippet.generator#nxShopifySnippetSchematic",
"schema": "./src/generators/snippet/schema.json",
"description": "Generate a theme snippet",
"aliases": ["snip"]
},
"section": {
"factory": "./src/generators/section/section.generator#nxShopifySectionSchematic",
"schema": "./src/generators/section/schema.json",
"description": "Generate a theme section",
"aliases": ["sec"]
}
}
}
4 changes: 4 additions & 0 deletions packages/nx-shopify/src/executors/build/ng-compat.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { convertNxExecutor } from '@nrwl/devkit';
import { buildExecutor } from './build.executor';

export default convertNxExecutor(buildExecutor);
4 changes: 4 additions & 0 deletions packages/nx-shopify/src/executors/deploy/ng-compat.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { convertNxExecutor } from '@nrwl/devkit';
import { deployExecutor } from './deploy.executor';

export default convertNxExecutor(deployExecutor);
4 changes: 4 additions & 0 deletions packages/nx-shopify/src/executors/serve/ng-compat.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { convertNxExecutor } from '@nrwl/devkit';
import { serveExecutor } from './serve.executor';

export default convertNxExecutor(serveExecutor);
4 changes: 2 additions & 2 deletions packages/nx-shopify/src/executors/serve/serve.executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import {
} from '../../utils/local-server/network-utils';
import { normalizeBuildOptions } from '../../utils/normalize-utils';
import {
isLiveTheme,
getThemekitEnvironmentConfig,
isLiveTheme,
} from '../../utils/themekit';
import { getSourceRoot } from '../../utils/workspace-utils';
import { getShopifyWebpackConfig } from '../../webpack/configs/shopify.config';
Expand Down Expand Up @@ -91,7 +91,7 @@ export async function serveExecutor(
devServer,
themekitEnvConfig,
});
return new Promise(() => {
return new Promise<{ success: boolean }>(() => {
assetServer.start(options);
});
} catch (error) {
Expand Down
2 changes: 2 additions & 0 deletions packages/nx-shopify/src/generators/layout/layout.generator.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
convertNxGenerator,
formatFiles,
generateFiles,
getProjects,
Expand Down Expand Up @@ -105,3 +106,4 @@ export async function layoutGenerator(
}

export default layoutGenerator;
export const nxShopifyLayoutSchematic = convertNxGenerator(layoutGenerator);
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
convertNxGenerator,
formatFiles,
generateFiles,
getProjects,
Expand Down Expand Up @@ -105,3 +106,4 @@ export async function sectionGenerator(
}

export default sectionGenerator;
export const nxShopifySectionSchematic = convertNxGenerator(sectionGenerator);
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
convertNxGenerator,
formatFiles,
generateFiles,
getProjects,
Expand Down Expand Up @@ -105,3 +106,4 @@ export async function snippetGenerator(
}

export default snippetGenerator;
export const nxShopifySnippetSchematic = convertNxGenerator(snippetGenerator);
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
convertNxGenerator,
formatFiles,
generateFiles,
getProjects,
Expand Down Expand Up @@ -105,3 +106,4 @@ export async function templateGenerator(
}

export default templateGenerator;
export const nxShopifyTemplateSchematic = convertNxGenerator(templateGenerator);
Original file line number Diff line number Diff line change
Expand Up @@ -257,4 +257,4 @@ export async function themeGenerator(
}

export default themeGenerator;
export const themeSchematic = convertNxGenerator(themeGenerator);
export const nxShopifyThemeSchematic = convertNxGenerator(themeGenerator);

0 comments on commit b875d01

Please sign in to comment.