Skip to content

Commit bff33c8

Browse files
author
winjo
committed
fix: build scripts
1 parent f994601 commit bff33c8

5 files changed

Lines changed: 17 additions & 2 deletions

File tree

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
"dotenv": "^8.2.0",
6565
"execa": "^4.1.0",
6666
"fs-extra": "^9.0.1",
67+
"glob": "^7.1.6",
6768
"gulp": "^4.0.2",
6869
"husky": "^4.3.0",
6970
"inquirer": "^7.3.3",

packages/alex/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"lib",
99
"bin",
1010
"scripts",
11-
"!script/.no-postinstall",
11+
"!scripts/.no-postinstall",
1212
"modules"
1313
],
1414
"keywords": [

packages/alex/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export * from './api/createApp';
2+
export * from './api/renderApp';

scripts/build.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
const path = require('path');
22
const signale = require('signale');
33
const args = require('minimist')(process.argv.slice(2));
4+
const glob = require('glob');
5+
const fse = require('fs-extra');
46
const { invoke, exec } = require('./utils/utils');
57

68
invoke(async () => {
@@ -13,6 +15,17 @@ invoke(async () => {
1315
const watch = args.w || args.watch ? '--watch' : '';
1416
await exec(`npx tsc --build packages/tsconfig.build.json ${watch}`);
1517
signale.success('编译成功');
18+
signale.pending('复制非 ts 资源');
19+
const cwd = path.join(__dirname, '../packages');
20+
const files = glob.sync('*/src/**/*.@(less)', { cwd, nodir: true });
21+
console.log(files);
22+
for (const file of files) {
23+
const from = path.join(cwd, file);
24+
const to = path.join(cwd, file.replace(/\/src\//, '/lib/'));
25+
await fse.mkdirp(path.dirname(to));
26+
await fse.copyFile(from, to);
27+
}
28+
signale.success('复制成功');
1629
} catch (err) {
1730
console.error(err);
1831
signale.error('编译失败');

yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5717,7 +5717,7 @@ glob@^6.0.1:
57175717
once "^1.3.0"
57185718
path-is-absolute "^1.0.0"
57195719

5720-
glob@^7.0.0, glob@^7.0.3, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4:
5720+
glob@^7.0.0, glob@^7.0.3, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6:
57215721
version "7.1.6"
57225722
resolved "https://registry.npm.alibaba-inc.com/glob/download/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6"
57235723
integrity sha1-FB8zuBp8JJLhJVlDB0gMRmeSeKY=

0 commit comments

Comments
 (0)