Skip to content

Commit

Permalink
feat: use mako
Browse files Browse the repository at this point in the history
feat: use mako
  • Loading branch information
xiaohuoni authored Jun 3, 2024
2 parents 3736e38 + 07a233b commit 86f5998
Show file tree
Hide file tree
Showing 19 changed files with 608 additions and 184 deletions.
1 change: 1 addition & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"@examples/legacy",
"@example/lint",
"@examples/locale",
"@examples/mako",
"@examples/min",
"@examples/mobile2",
"@examples/mobile5",
Expand Down
11 changes: 11 additions & 0 deletions .changeset/quiet-rivers-chew.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
'@alita/plugin-lowcode': minor
'create-alita': minor
'@alita/plugin-azure': minor
'@alita/autoimport': minor
'@alita/plugins': minor
'@alita/native': minor
'alita': minor
---

feat: use mako
1 change: 1 addition & 0 deletions examples/mako/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PORT=9999
7 changes: 7 additions & 0 deletions examples/mako/config/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { defineConfig } from 'alita';

export default defineConfig({
appType: 'pc',
keepalive: [/./],
mako: {},
});
11 changes: 11 additions & 0 deletions examples/mako/e2e/boilerplate.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { expect, test } from '@playwright/test';

test.beforeEach(async ({ page }) => {
await page.goto('http://localhost:9999/');
});

test.describe('basic', () => {
test('render', async ({ page }) => {
await expect(page.getByText('Hello Mako')).toBeVisible();
});
});
15 changes: 15 additions & 0 deletions examples/mako/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "@examples/mako",
"private": true,
"scripts": {
"dev": "alita dev",
"build": "alita build",
"plugin": "alita plugin list",
"test:e2e": "start-test dev :9999/__umi/api/status test:pw",
"test:pw": "playwright test",
"start": "npm run dev"
},
"dependencies": {
"alita": "workspace:*"
}
}
93 changes: 93 additions & 0 deletions examples/mako/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
import { defineConfig, devices } from '@playwright/test';

/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
// require('dotenv').config();

/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: './e2e',
/* Maximum time one test can run for. */
timeout: 30 * 1000,
expect: {
/**
* Maximum time expect() should wait for the condition to be met.
* For example in `await expect(locator).toHaveText();`
*/
timeout: 5000,
},
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'html',
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
actionTimeout: 0,
/* Base URL to use in actions like `await page.goto('/')`. */
// baseURL: 'http://localhost:8000',

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',

// See https://playwright.dev/docs/network#missing-network-events-and-service-workers
serviceWorkers: 'block',
},

/* Configure projects for major browsers */
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},

// {
// name: 'firefox',
// use: { ...devices['Desktop Firefox'] },
// },

// {
// name: 'webkit',
// use: { ...devices['Desktop Safari'] },
// },

/* Test against mobile viewports. */
// {
// name: 'Mobile Chrome',
// use: { ...devices['Pixel 5'] },
// },
// {
// name: 'Mobile Safari',
// use: { ...devices['iPhone 12'] },
// },

/* Test against branded browsers. */
// {
// name: 'Microsoft Edge',
// use: { channel: 'msedge' },
// },
// {
// name: 'Google Chrome',
// use: { channel: 'chrome' },
// },
],

/* Folder for test artifacts such as screenshots, videos, traces, etc. */
// outputDir: 'test-results/',

/* Run your local dev server before starting the tests */
// webServer: {
// command: 'pnpm start',
// port: 3000,
// },
});
5 changes: 5 additions & 0 deletions examples/mako/src/pages/index/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import React from 'react';

export default () => {
return <div>Hello Mako</div>;
};
31 changes: 31 additions & 0 deletions examples/mako/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "dist",
"sourceMap": true,
"jsx": "react",
"declaration": false,
"module": "esnext",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"importHelpers": true,
"target": "es2017",
"typeRoots": ["node_modules/@types"],
"lib": ["es2018", "dom"],
"allowSyntheticDefaultImports": true,
"rootDirs": ["/src", "/test", "/mock", "./typings"],
"forceConsistentCasingInFileNames": true,
"noImplicitReturns": true,
"suppressImplicitAnyIndexErrors": true,
"noUnusedLocals": true,
"allowJs": true,
"strict": true,
"paths": {
"@/*": ["./src/*"],
"@@/*": ["./src/.umi/*"],
"alita": ["./src/.umi/*"]
}
}
}
13 changes: 13 additions & 0 deletions examples/mako/typings.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
declare module '*.css';
declare module '*.less';
declare module '*.scss';
declare module '*.sass';
declare module '*.svg';
declare module '*.png';
declare module '*.jpg';
declare module '*.jpeg';
declare module '*.gif';
declare module '*.bmp';
declare module '*.tiff';
declare module '*.json';

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
"@types/react-dom": "^18.0.5",
"@types/resolve": "^1.20.2",
"@types/rimraf": "3.0.2",
"@umijs/plugin-docs": "4.2.5",
"@umijs/utils": "4.2.5",
"@umijs/plugin-docs": "4.2.8",
"@umijs/utils": "4.2.8",
"@vercel/ncc": "0.33.3",
"start-server-and-test": "^1.15.3",
"all-contributors-cli": "^6.20.4",
Expand Down Expand Up @@ -82,7 +82,7 @@
"turbo": "^1.3.1",
"typescript": "^4.7.2",
"uglify-js": "^3.15.4",
"umi": "4.2.5",
"umi": "4.2.8",
"umi-scripts": "workspace:*",
"yorkie": "^2.0.0",
"zx": "^7.2.0",
Expand Down
12 changes: 6 additions & 6 deletions packages/alita/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@
"@alita/native": "3.3.0",
"@alita/plugins": "3.4.0",
"@alita/plugin-azure": "3.1.0",
"@umijs/core": "4.2.5",
"@umijs/bundler-webpack": "4.2.5",
"@umijs/babel-preset-umi": "4.2.5",
"@umijs/preset-umi": "4.2.5",
"@umijs/utils": "4.2.5",
"umi": "4.2.5"
"@umijs/core": "4.2.8",
"@umijs/bundler-webpack": "4.2.8",
"@umijs/babel-preset-umi": "4.2.8",
"@umijs/preset-umi": "4.2.8",
"@umijs/utils": "4.2.8",
"umi": "4.2.8"
}
}
4 changes: 2 additions & 2 deletions packages/autoimport/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"access": "public"
},
"dependencies": {
"@umijs/bundler-utils": "4.2.5",
"@umijs/utils": "4.2.5"
"@umijs/bundler-utils": "4.2.8",
"@umijs/utils": "4.2.8"
}
}
2 changes: 1 addition & 1 deletion packages/create-alita/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@
"create-alita": "bin/create-alita.js"
},
"dependencies": {
"@umijs/utils": "4.2.5"
"@umijs/utils": "4.2.8"
}
}
2 changes: 1 addition & 1 deletion packages/native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"dependencies": {
"@alita/types": "3.1.2",
"@umijs/utils": "4.2.5"
"@umijs/utils": "4.2.8"
},
"license": "MIT"
}
2 changes: 1 addition & 1 deletion packages/plugin-azure/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"access": "public"
},
"dependencies": {
"@umijs/utils": "4.2.5",
"@umijs/utils": "4.2.8",
"openai": "^4.19.1"
}
}
2 changes: 1 addition & 1 deletion packages/plugin-lowcode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@
},
"dependencies": {
"@alita/types": "3.1.2",
"@umijs/utils": "4.2.5"
"@umijs/utils": "4.2.8"
}
}
6 changes: 3 additions & 3 deletions packages/plugins/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
"@alita/inspx": "0.0.2",
"@alita/request": "3.1.2",
"@alita/types": "3.1.2",
"@umijs/bundler-utils": "4.2.5",
"@umijs/plugins": "4.2.5",
"@umijs/utils": "4.2.5",
"@umijs/bundler-utils": "4.2.8",
"@umijs/plugins": "4.2.8",
"@umijs/utils": "4.2.8",
"ahooks": "^3.0.8",
"antd-mobile-alita": "^2.3.4",
"antd-mobile-icons": "^0.2.2",
Expand Down
Loading

0 comments on commit 86f5998

Please sign in to comment.