Skip to content

Commit

Permalink
Check if a theme directory
Browse files Browse the repository at this point in the history
  • Loading branch information
andershagbard committed Oct 7, 2024
1 parent 3e275fc commit 7ac93c7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/actions/parts/build-from-environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import * as core from '@actions/core';
import fs from 'fs-extra';
import config from '../../helpers/config';
import { BUILD_DIR, THEME_KIT_ENVIRONMENT } from '../../inputs';
import { getIgnoredAssets } from '../../helpers/shopify';
import {getIgnoredAssets, themeDirectories} from '../../helpers/shopify';
import path from "path";

export default async (): Promise<void> => {
const environment = config[THEME_KIT_ENVIRONMENT];
Expand All @@ -14,12 +15,15 @@ export default async (): Promise<void> => {
core.info(`Copying directory "${directory}" to "${BUILD_DIR}"`);

fs.emptyDirSync(BUILD_DIR);
fs.copySync(directory, BUILD_DIR, {
filter: (src) => {
core.info(`Src: ${src}`)

return !src.includes('node_modules')
},
themeDirectories.forEach((folder) => {
fs.copySync(path.join(directory, folder), BUILD_DIR, {
filter: (src) => {
core.info(`Src: ${src}`)

return !src.includes('node_modules')
},
});
});

// Copy ignored files from environment
Expand Down
10 changes: 10 additions & 0 deletions src/helpers/shopify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,13 @@ export const getPreviewURL = (id: number) =>

export const getCustomizeURL = (id: number) =>
`https://${environment.store}/admin/themes/${id}/editor`;

export const themeDirectories = [
'assets',
'config',
'layout',
'locales',
'sections',
'snippets',
'templates',
];

0 comments on commit 7ac93c7

Please sign in to comment.