diff --git a/__tests__/e2e.test.js b/__tests__/e2e.test.js index a0ef183..39dc481 100644 --- a/__tests__/e2e.test.js +++ b/__tests__/e2e.test.js @@ -23,7 +23,7 @@ async function diff() { const height = p.h; await page.setViewport( { width: p.w, height: p.h } ); - const pageUrl = `http://127.0.0.1:${port}/packages/${p.path || ''}`; + const pageUrl = `http://127.0.0.1:${port}/examples/${p.path || ''}`; await page.goto(pageUrl); await delay(p.delay || 100); const buf = await page.screenshot(); diff --git a/__tests__/snapshot/board/examples/test/event.html.jpg b/__tests__/snapshot/board/test/event.html.jpg similarity index 100% rename from __tests__/snapshot/board/examples/test/event.html.jpg rename to __tests__/snapshot/board/test/event.html.jpg diff --git a/__tests__/snapshot/board/examples/test/main.html.jpg b/__tests__/snapshot/board/test/main.html.jpg similarity index 100% rename from __tests__/snapshot/board/examples/test/main.html.jpg rename to __tests__/snapshot/board/test/main.html.jpg diff --git a/__tests__/snapshot/board/examples/test/scale.html.jpg b/__tests__/snapshot/board/test/scale.html.jpg similarity index 100% rename from __tests__/snapshot/board/examples/test/scale.html.jpg rename to __tests__/snapshot/board/test/scale.html.jpg diff --git a/__tests__/snapshot/board/examples/test/scroll.html.jpg b/__tests__/snapshot/board/test/scroll.html.jpg similarity index 100% rename from __tests__/snapshot/board/examples/test/scroll.html.jpg rename to __tests__/snapshot/board/test/scroll.html.jpg diff --git a/__tests__/snapshot/core/examples/test/api.html.jpg b/__tests__/snapshot/core/test/api.html.jpg similarity index 100% rename from __tests__/snapshot/core/examples/test/api.html.jpg rename to __tests__/snapshot/core/test/api.html.jpg diff --git a/__tests__/snapshot/core/examples/test/elements.html.jpg b/__tests__/snapshot/core/test/elements.html.jpg similarity index 100% rename from __tests__/snapshot/core/examples/test/elements.html.jpg rename to __tests__/snapshot/core/test/elements.html.jpg diff --git a/__tests__/snapshot/core/examples/test/resource.html.jpg b/__tests__/snapshot/core/test/resource.html.jpg similarity index 100% rename from __tests__/snapshot/core/examples/test/resource.html.jpg rename to __tests__/snapshot/core/test/resource.html.jpg diff --git a/__tests__/snapshot/idraw/examples/test/api.html.jpg b/__tests__/snapshot/idraw/examples/test/api.html.jpg deleted file mode 100644 index 0ddd702..0000000 Binary files a/__tests__/snapshot/idraw/examples/test/api.html.jpg and /dev/null differ diff --git a/__tests__/snapshot/idraw/test/api.html.jpg b/__tests__/snapshot/idraw/test/api.html.jpg new file mode 100644 index 0000000..e5bb48e Binary files /dev/null and b/__tests__/snapshot/idraw/test/api.html.jpg differ diff --git a/packages/board/examples/features/lib/action.js b/examples/board/features/lib/action.js similarity index 100% rename from packages/board/examples/features/lib/action.js rename to examples/board/features/lib/action.js diff --git a/packages/board/examples/features/lib/data.js b/examples/board/features/lib/data.js similarity index 100% rename from packages/board/examples/features/lib/data.js rename to examples/board/features/lib/data.js diff --git a/packages/board/examples/features/lib/draw.js b/examples/board/features/lib/draw.js similarity index 100% rename from packages/board/examples/features/lib/draw.js rename to examples/board/features/lib/draw.js diff --git a/packages/board/examples/features/lib/event.js b/examples/board/features/lib/event.js similarity index 100% rename from packages/board/examples/features/lib/event.js rename to examples/board/features/lib/event.js diff --git a/packages/board/examples/features/lib/opts.js b/examples/board/features/lib/opts.js similarity index 100% rename from packages/board/examples/features/lib/opts.js rename to examples/board/features/lib/opts.js diff --git a/packages/board/examples/features/lib/scale.js b/examples/board/features/lib/scale.js similarity index 100% rename from packages/board/examples/features/lib/scale.js rename to examples/board/features/lib/scale.js diff --git a/packages/board/examples/features/lib/scroll.js b/examples/board/features/lib/scroll.js similarity index 100% rename from packages/board/examples/features/lib/scroll.js rename to examples/board/features/lib/scroll.js diff --git a/packages/board/examples/features/main.html b/examples/board/features/main.html similarity index 96% rename from packages/board/examples/features/main.html rename to examples/board/features/main.html index 9f1b15a..d89578c 100644 --- a/packages/board/examples/features/main.html +++ b/examples/board/features/main.html @@ -59,7 +59,7 @@ - + + + + + + \ No newline at end of file diff --git a/packages/core/examples/features/parent.html b/examples/core/features/parent.html similarity index 100% rename from packages/core/examples/features/parent.html rename to examples/core/features/parent.html diff --git a/packages/core/examples/features/top.html b/examples/core/features/top.html similarity index 100% rename from packages/core/examples/features/top.html rename to examples/core/features/top.html diff --git a/packages/core/examples/images/building-001.png b/examples/core/images/building-001.png similarity index 100% rename from packages/core/examples/images/building-001.png rename to examples/core/images/building-001.png diff --git a/packages/core/examples/images/building-002.png b/examples/core/images/building-002.png similarity index 100% rename from packages/core/examples/images/building-002.png rename to examples/core/images/building-002.png diff --git a/packages/core/examples/images/building-003.png b/examples/core/images/building-003.png similarity index 100% rename from packages/core/examples/images/building-003.png rename to examples/core/images/building-003.png diff --git a/packages/core/examples/images/chart.png b/examples/core/images/chart.png similarity index 100% rename from packages/core/examples/images/chart.png rename to examples/core/images/chart.png diff --git a/packages/core/examples/images/computer.png b/examples/core/images/computer.png similarity index 100% rename from packages/core/examples/images/computer.png rename to examples/core/images/computer.png diff --git a/packages/core/examples/images/phone.png b/examples/core/images/phone.png similarity index 100% rename from packages/core/examples/images/phone.png rename to examples/core/images/phone.png diff --git a/packages/core/examples/test/api.html b/examples/core/test/api.html similarity index 99% rename from packages/core/examples/test/api.html rename to examples/core/test/api.html index 21c5a0b..21c2427 100644 --- a/packages/core/examples/test/api.html +++ b/examples/core/test/api.html @@ -99,9 +99,9 @@ - + + + + + \ No newline at end of file diff --git a/packages/idraw/examples/react/demo.jsx b/examples/idraw/react/demo.jsx similarity index 100% rename from packages/idraw/examples/react/demo.jsx rename to examples/idraw/react/demo.jsx diff --git a/packages/idraw/examples/test/api.html b/examples/idraw/test/api.html similarity index 98% rename from packages/idraw/examples/test/api.html rename to examples/idraw/test/api.html index fd991cc..89817d5 100644 --- a/packages/idraw/examples/test/api.html +++ b/examples/idraw/test/api.html @@ -63,7 +63,7 @@ - + - + + \ No newline at end of file diff --git a/package.json b/package.json index d2fc803..f47ff52 100644 --- a/package.json +++ b/package.json @@ -2,13 +2,13 @@ "name": "root", "private": false, "scripts": { - "start": "node ./scripts/dev-vite.js", - "dev": "node ./scripts/dev-rollup.js", + "dev": "node ./scripts/dev.js", + "dev:rollup": "node ./scripts/dev-rollup.js", "build": "npm run build:mod && npm run build:bundle && npm run build:min", "build:bundle": "NODE_ENV=production BUILD_MODE=reset node ./scripts/build-bundle.js", "build:mod": "node ./scripts/build-module.js", "build:min": "node ./scripts/minify.js", - "snapshot": "node ./scripts/build.js && node ./scripts/snapshot.js", + "snapshot": "npm run build:bundle && node ./scripts/snapshot.js", "e2e": "mocha --exit ./__tests__/e2e.test.js", "init": "lerna bootstrap", "init:cnpm": "lerna bootstrap --npm-client=cnpm", diff --git a/scripts/build-bundle.js b/scripts/build-bundle.js index 7c8fdc8..5739e4e 100644 --- a/scripts/build-bundle.js +++ b/scripts/build-bundle.js @@ -25,7 +25,6 @@ async function main() { [ '-c', './scripts/rollup.config.js', - `--target-pkg=${process.argv[2] || ''}`, ], { stdio: 'inherit' }); } diff --git a/scripts/dev-rollup.js b/scripts/dev-rollup.js index 24dc303..a8ee55c 100644 --- a/scripts/dev-rollup.js +++ b/scripts/dev-rollup.js @@ -9,7 +9,6 @@ async function main() { '-w', '-c', './scripts/rollup.config.js', - `--target-pkg=${process.argv[2] || ''}`, ], { stdio: 'inherit' } ) } diff --git a/scripts/dev-vite.js b/scripts/dev.js similarity index 100% rename from scripts/dev-vite.js rename to scripts/dev.js diff --git a/scripts/rollup.config.js b/scripts/rollup.config.js index e830c76..aa22a17 100644 --- a/scripts/rollup.config.js +++ b/scripts/rollup.config.js @@ -5,7 +5,7 @@ const { terser } = require('rollup-plugin-terser'); const cleanup = require('rollup-plugin-cleanup'); const { nodeResolve } = require('@rollup/plugin-node-resolve'); const json = require('@rollup/plugin-json'); -const { getTargetPackage } = require('./config'); +const { packages } = require('./config'); const dtsPlugin = require('./util/dts-plugin'); const stylePlugin = require('./util/style-plugin'); // const cleanPlugin = require('./util/clean-plugin'); @@ -13,8 +13,6 @@ const stylePlugin = require('./util/style-plugin'); const resolveFile = function(names = []) { return path.join(__dirname, '..', 'packages', ...names) } -const targetMod = process.argv[5] || process.argv[4]; -const packages = getTargetPackage(targetMod); const modules = []; const external = [ '@idraw/types', '@idraw/util', '@idraw/board', '@idraw/core' ]; diff --git a/scripts/screen.config.js b/scripts/screen.config.js index be65401..a744d7b 100644 --- a/scripts/screen.config.js +++ b/scripts/screen.config.js @@ -1,12 +1,12 @@ const pageList = [ - { path: 'board/examples/test/main.html', w: 620, h: 270, delay: 500 }, - { path: 'board/examples/test/scale.html', w: 930, h: 540, delay: 500 }, - { path: 'board/examples/test/scroll.html', w: 620, h: 270, delay: 500 }, - { path: 'board/examples/test/event.html', w: 620, h: 270, delay: 500 }, - { path: 'core/examples/test/elements.html', w: 930, h: 810, delay: 800 }, - { path: 'core/examples/test/api.html', w: 930, h: 1570, delay: 800 }, - { path: 'core/examples/test/resource.html', w: 930, h: 540, delay: 800 }, - { path: 'idraw/examples/test/api.html', w: 930, h: 540, delay: 800 }, + { path: 'board/test/main.html', w: 620, h: 270, delay: 500 }, + { path: 'board/test/scale.html', w: 930, h: 540, delay: 500 }, + { path: 'board/test/scroll.html', w: 620, h: 270, delay: 500 }, + { path: 'board/test/event.html', w: 620, h: 270, delay: 500 }, + { path: 'core/test/elements.html', w: 930, h: 810, delay: 800 }, + { path: 'core/test/api.html', w: 930, h: 1570, delay: 800 }, + { path: 'core/test/resource.html', w: 930, h: 540, delay: 800 }, + { path: 'idraw/test/api.html', w: 930, h: 540, delay: 800 }, ] module.exports = { diff --git a/scripts/snapshot.js b/scripts/snapshot.js index d78f9f2..bb47238 100644 --- a/scripts/snapshot.js +++ b/scripts/snapshot.js @@ -17,7 +17,7 @@ async function main() { const { page, port } = ctx; console.log(`[${i+1}/${pageList.length}] Screen: ${p.path}`) await page.setViewport( { width: p.w, height: p.h } ); - const pageUrl = `http://127.0.0.1:${port}/packages/${p.path || ''}`; + const pageUrl = `http://127.0.0.1:${port}/examples/${p.path || ''}`; const result = await page.goto(pageUrl); if (result.status() === 404) { console.error(`404 Not Found: ${pageUrl}`)