Skip to content

Commit

Permalink
fix build in action
Browse files Browse the repository at this point in the history
  • Loading branch information
lexoyo committed Nov 16, 2023
1 parent 4383c75 commit 36b8a90
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 19 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm run build
- run: npm run lint
- run: npm test
env:
CI: true
- run: npm run lint
10 changes: 4 additions & 6 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
* https://jestjs.io/docs/configuration
*/

/** @type {import('jest').Config} */
const config = {
module.exports = {
transform: {
'^.+\\.ts?$': 'ts-jest'
'.*\\.ts': 'ts-jest'
},
};

module.exports = config;
testMatch: ['**/*.test.ts'],
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
"build:server": "rollup -c rollup.server.config.mjs",
"lint": "eslint src/**/*.[jt]s",
"lint:fix": "$npm_execpath run lint -- --fix",
"test": "jest --rootDir src",
"test": "jest --rootDir src --config jest.config.js",
"test:watch": "$npm_execpath run test -- --watch"
},
"devDependencies": {
"@jest/globals": "^29.7.0",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-eslint": "^9.0.5",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-typescript": "^11.1.5",
"@types/jest": "^29.5.8",
"@typescript-eslint/eslint-plugin": "^6.11.0",
"@typescript-eslint/parser": "^6.11.0",
"eslint": "^8.53.0",
Expand Down
2 changes: 2 additions & 0 deletions src/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
*/
import client from './client';

import {expect, test} from '@jest/globals'

test('client', () => {
expect(client).toBeDefined();
});
10 changes: 5 additions & 5 deletions src/client/publication.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Component, Page } from 'grapesjs'
import { DataSourceEditor, StoredState, getState, getStateIds } from '@silexlabs/grapesjs-data-source'
import { echoBlock, ifBlock, loopBlock } from '../liquid'
import { ClientSideFileType, PublicationData } from '@silexlabs/silex/src/ts/types'
import { EleventyPluginOptions } from '../client'
import { PublicationTransformer } from '@silexlabs/silex/src/ts/client/publication-transformers'
// This breaks the unit tests in the github action only: import { ClientSideFileType, PublicationData } from '@silexlabs/silex/src/ts/types'

/**
* Make html attribute
Expand All @@ -26,7 +26,7 @@ function makeStyle(key, value) {
/**
* Comes from silex but didn't manage to import
*/
export function transformPath(editor: DataSourceEditor, path: string, type: ClientSideFileType): string {
export function transformPath(editor: DataSourceEditor, path: string, type): string {
const config = editor.getModel().get('config')
return config.publicationTransformers.reduce((result: string, transformer: PublicationTransformer) => {
try {
Expand All @@ -38,7 +38,7 @@ export function transformPath(editor: DataSourceEditor, path: string, type: Clie
}, path)
}

export function transformFiles(editor: DataSourceEditor, options: EleventyPluginOptions, data: PublicationData): void {
export function transformFiles(editor: DataSourceEditor, options: EleventyPluginOptions, data): void {
editor.Pages.getAll().forEach(page => {
const query = editor.DataSourceManager.getPageQuery(page)
// Remove empty data source queries
Expand All @@ -49,8 +49,8 @@ export function transformFiles(editor: DataSourceEditor, options: EleventyPlugin
})
if(Object.keys(query).length > 0) {
data.files?.push({
type: ClientSideFileType.OTHER,
path: transformPath(editor, `/${page.getName() || 'index'}.11tydata.js`, ClientSideFileType.OTHER),
type: 'other',
path: transformPath(editor, `/${page.getName() || 'index'}.11tydata.js`, 'other'),
//path: `/${page.getName() || 'index'}.11tydata.js`,
content: getDataFile(editor, page, query),
})
Expand Down
6 changes: 4 additions & 2 deletions src/liquid.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
/*
* @jest-environment jsdom
*/
import { Field, Filter, Property, State, getOrCreatePersistantId } from "@silexlabs/grapesjs-data-source"
import { Filter, Property, State, getOrCreatePersistantId } from "@silexlabs/grapesjs-data-source"
import { assignBlock, echoBlock, getLiquidBlock, getLiquidStatement, getLiquidStatementProperties, ifBlock, loopBlock } from "./liquid"
import { expressionList, expressionListWithWhere, expressionWithFirst, expressionWithState, simpleExpression } from "./liquid.mock"
import grapesjs, { Component } from "grapesjs"
import grapesjs from "grapesjs"

import {expect, test} from '@jest/globals'

test('get liquid statements for properties', () => {
const { expression } = simpleExpression
Expand Down
3 changes: 1 addition & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"esModuleInterop": true,
},
"exclude": [
"node_modules",
//"node_modules", // Useless apparently
"dist",
"**/node_modules/*",
]
}

0 comments on commit 36b8a90

Please sign in to comment.