Skip to content

Commit

Permalink
feat(cli): upload css
Browse files Browse the repository at this point in the history
  • Loading branch information
BJvdA committed Dec 20, 2022
1 parent e4baa6d commit c4f8b31
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 10 deletions.
11 changes: 10 additions & 1 deletion packages/cli/src/commands/publish.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,14 @@ export const Publish = ({
const blockFile = createReadStream(
path.join(dirname, 'dist/blocks', blockName, entry.file),
);
let cssFile;

if (entry.css?.length) {
/** There should be at most 1 CSS file because of bundling */
cssFile = createReadStream(
path.join(dirname, 'dist/blocks', blockName, entry.css[0]),
);
}

const existingBlockConfig = config.current!.get(
`blocks.${blockName}`,
Expand All @@ -135,7 +143,8 @@ export const Publish = ({
{
input: {
blockId: blockIdToUpdate,
code: blockFile,
css: cssFile,
js: blockFile,
contentSchema,
customizerSchema,
},
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/lib/api/schema.json

Large diffs are not rendered by default.

12 changes: 8 additions & 4 deletions packages/cli/src/lib/api/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,14 +347,16 @@ export enum BlockTheme {

export type BlockVersion = {
__typename?: 'BlockVersion';
codeHash: Scalars['String'];
codeUrl: Scalars['String'];
contentSchema: ContentSchema;
contentSchemaHash: Scalars['String'];
createdAt: Scalars['DateTime'];
cssHash?: Maybe<Scalars['String']>;
cssUrl?: Maybe<Scalars['String']>;
customizerSchema: CustomizerSchema;
customizerSchemaHash: Scalars['String'];
id: Scalars['UUID'];
jsHash: Scalars['String'];
jsUrl: Scalars['String'];
tag: Scalars['Float'];
updatedAt: Scalars['DateTime'];
};
Expand Down Expand Up @@ -1156,11 +1158,12 @@ export type CursorPaging = {

export type CustomBlock = {
__typename?: 'CustomBlock';
cssUrl?: Maybe<Scalars['String']>;
id: Scalars['UUID'];
jsUrl?: Maybe<Scalars['String']>;
metadata: Scalars['Object'];
name: Scalars['String'];
refId: Scalars['String'];
url?: Maybe<Scalars['String']>;
};

export type CustomerData = {
Expand Down Expand Up @@ -3896,9 +3899,10 @@ export type PublicStore = {
export type PublishBlockVersionInput = {
/** ID of the block */
blockId: Scalars['String'];
code: Scalars['Upload'];
contentSchema: ContentSchemaInput;
css?: InputMaybe<Scalars['Upload']>;
customizerSchema: CustomizerSchemaInput;
js: Scalars['Upload'];
};

export type Query = {
Expand Down
12 changes: 8 additions & 4 deletions packages/types/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,14 +344,16 @@ export enum BlockTheme {

export type BlockVersion = {
__typename?: 'BlockVersion';
codeHash: Scalars['String'];
codeUrl: Scalars['String'];
contentSchema: ContentSchema;
contentSchemaHash: Scalars['String'];
createdAt: Scalars['DateTime'];
cssHash?: Maybe<Scalars['String']>;
cssUrl?: Maybe<Scalars['String']>;
customizerSchema: CustomizerSchema;
customizerSchemaHash: Scalars['String'];
id: Scalars['UUID'];
jsHash: Scalars['String'];
jsUrl: Scalars['String'];
tag: Scalars['Float'];
updatedAt: Scalars['DateTime'];
};
Expand Down Expand Up @@ -1153,11 +1155,12 @@ export type CursorPaging = {

export type CustomBlock = {
__typename?: 'CustomBlock';
cssUrl?: Maybe<Scalars['String']>;
id: Scalars['UUID'];
jsUrl?: Maybe<Scalars['String']>;
metadata: Scalars['Object'];
name: Scalars['String'];
refId: Scalars['String'];
url?: Maybe<Scalars['String']>;
};

export type CustomerData = {
Expand Down Expand Up @@ -3893,9 +3896,10 @@ export type PublicStore = {
export type PublishBlockVersionInput = {
/** ID of the block */
blockId: Scalars['String'];
code: Scalars['Upload'];
contentSchema: ContentSchemaInput;
css?: InputMaybe<Scalars['Upload']>;
customizerSchema: CustomizerSchemaInput;
js: Scalars['Upload'];
};

export type Query = {
Expand Down

0 comments on commit c4f8b31

Please # to comment.