build: package.json 中files增加src,移除sideEffects

This commit is contained in:
roymondchen 2024-06-17 16:24:06 +08:00
parent 80e42cc997
commit e4a06bd12d
16 changed files with 55 additions and 63 deletions

View File

@ -14,7 +14,8 @@
}, },
"files": [ "files": [
"bin", "bin",
"lib" "lib",
"src"
], ],
"engines": { "engines": {
"node": ">=18" "node": ">=18"

View File

@ -2,9 +2,6 @@
"version": "1.4.8", "version": "1.4.8",
"name": "@tmagic/core", "name": "@tmagic/core",
"type": "module", "type": "module",
"sideEffects": [
"dist/*"
],
"main": "dist/tmagic-core.umd.cjs", "main": "dist/tmagic-core.umd.cjs",
"module": "dist/tmagic-core.js", "module": "dist/tmagic-core.js",
"types": "types/index.d.ts", "types": "types/index.d.ts",
@ -22,7 +19,8 @@
}, },
"files": [ "files": [
"dist", "dist",
"types" "types",
"src"
], ],
"license": "Apache-2.0", "license": "Apache-2.0",
"scripts": { "scripts": {

View File

@ -2,9 +2,6 @@
"version": "1.4.8", "version": "1.4.8",
"name": "@tmagic/data-source", "name": "@tmagic/data-source",
"type": "module", "type": "module",
"sideEffects": [
"dist/*"
],
"main": "dist/tmagic-data-source.umd.cjs", "main": "dist/tmagic-data-source.umd.cjs",
"module": "dist/tmagic-data-source.js", "module": "dist/tmagic-data-source.js",
"types": "types/index.d.ts", "types": "types/index.d.ts",
@ -18,7 +15,8 @@
}, },
"files": [ "files": [
"dist", "dist",
"types" "types",
"src"
], ],
"license": "Apache-2.0", "license": "Apache-2.0",
"scripts": { "scripts": {

View File

@ -2,9 +2,6 @@
"version": "1.4.8", "version": "1.4.8",
"name": "@tmagic/dep", "name": "@tmagic/dep",
"type": "module", "type": "module",
"sideEffects": [
"dist/*"
],
"main": "dist/tmagic-dep.umd.cjs", "main": "dist/tmagic-dep.umd.cjs",
"module": "dist/tmagic-dep.js", "module": "dist/tmagic-dep.js",
"types": "types/index.d.ts", "types": "types/index.d.ts",
@ -18,7 +15,8 @@
}, },
"files": [ "files": [
"dist", "dist",
"types" "types",
"src"
], ],
"license": "Apache-2.0", "license": "Apache-2.0",
"scripts": { "scripts": {

View File

@ -2,9 +2,6 @@
"version": "1.4.8", "version": "1.4.8",
"name": "@tmagic/design", "name": "@tmagic/design",
"type": "module", "type": "module",
"sideEffects": [
"dist/*"
],
"main": "dist/tmagic-design.umd.cjs", "main": "dist/tmagic-design.umd.cjs",
"module": "dist/tmagic-design.js", "module": "dist/tmagic-design.js",
"types": "types/index.d.ts", "types": "types/index.d.ts",
@ -18,7 +15,8 @@
}, },
"files": [ "files": [
"dist", "dist",
"types" "types",
"src"
], ],
"license": "Apache-2.0", "license": "Apache-2.0",
"scripts": { "scripts": {

View File

@ -3,7 +3,6 @@
"name": "@tmagic/editor", "name": "@tmagic/editor",
"type": "module", "type": "module",
"sideEffects": [ "sideEffects": [
"dist/*",
"src/theme/*" "src/theme/*"
], ],
"main": "dist/tmagic-editor.umd.cjs", "main": "dist/tmagic-editor.umd.cjs",
@ -24,7 +23,8 @@
}, },
"files": [ "files": [
"dist", "dist",
"types" "types",
"src"
], ],
"license": "Apache-2.0", "license": "Apache-2.0",
"scripts": { "scripts": {

View File

@ -2,9 +2,6 @@
"version": "1.4.8", "version": "1.4.8",
"name": "@tmagic/element-plus-adapter", "name": "@tmagic/element-plus-adapter",
"type": "module", "type": "module",
"sideEffects": [
"dist/*"
],
"main": "dist/tmagic-element-plus-adapter.umd.cjs", "main": "dist/tmagic-element-plus-adapter.umd.cjs",
"module": "dist/tmagic-element-plus-adapter.js", "module": "dist/tmagic-element-plus-adapter.js",
"types": "types/index.d.ts", "types": "types/index.d.ts",
@ -18,7 +15,8 @@
}, },
"files": [ "files": [
"dist", "dist",
"types" "types",
"src"
], ],
"license": "Apache-2.0", "license": "Apache-2.0",
"scripts": { "scripts": {

View File

@ -3,7 +3,6 @@
"name": "@tmagic/form", "name": "@tmagic/form",
"type": "module", "type": "module",
"sideEffects": [ "sideEffects": [
"dist/*",
"src/theme/*" "src/theme/*"
], ],
"main": "dist/tmagic-form.umd.cjs", "main": "dist/tmagic-form.umd.cjs",
@ -24,7 +23,8 @@
}, },
"files": [ "files": [
"dist", "dist",
"types" "types",
"src"
], ],
"license": "Apache-2.0", "license": "Apache-2.0",
"scripts": { "scripts": {

View File

@ -2,7 +2,6 @@
"version": "1.4.8", "version": "1.4.8",
"name": "@tmagic/schema", "name": "@tmagic/schema",
"type": "module", "type": "module",
"sideEffects": false,
"main": "dist/tmagic-schema.umd.cjs", "main": "dist/tmagic-schema.umd.cjs",
"module": "dist/tmagic-schema.js", "module": "dist/tmagic-schema.js",
"types": "types/index.d.ts", "types": "types/index.d.ts",
@ -16,7 +15,8 @@
}, },
"files": [ "files": [
"dist", "dist",
"types" "types",
"src"
], ],
"scripts": { "scripts": {
"build": "npm run build:type && vite build", "build": "npm run build:type && vite build",

View File

@ -2,9 +2,6 @@
"version": "1.4.8", "version": "1.4.8",
"name": "@tmagic/stage", "name": "@tmagic/stage",
"type": "module", "type": "module",
"sideEffects": [
"dist/*"
],
"main": "dist/tmagic-stage.umd.cjs", "main": "dist/tmagic-stage.umd.cjs",
"module": "dist/tmagic-stage.js", "module": "dist/tmagic-stage.js",
"types": "types/index.d.ts", "types": "types/index.d.ts",
@ -18,7 +15,8 @@
}, },
"files": [ "files": [
"dist", "dist",
"types" "types",
"src"
], ],
"license": "Apache-2.0", "license": "Apache-2.0",
"scripts": { "scripts": {

View File

@ -2,9 +2,6 @@
"version": "1.4.8", "version": "1.4.8",
"name": "@tmagic/table", "name": "@tmagic/table",
"type": "module", "type": "module",
"sideEffects": [
"dist/*"
],
"main": "dist/tmagic-table.umd.cjs", "main": "dist/tmagic-table.umd.cjs",
"module": "dist/tmagic-table.js", "module": "dist/tmagic-table.js",
"types": "types/index.d.ts", "types": "types/index.d.ts",
@ -22,7 +19,8 @@
}, },
"files": [ "files": [
"dist", "dist",
"types" "types",
"src"
], ],
"license": "Apache-2.0", "license": "Apache-2.0",
"scripts": { "scripts": {

View File

@ -2,9 +2,6 @@
"version": "1.4.8", "version": "1.4.8",
"name": "@tmagic/tdesign-vue-next-adapter", "name": "@tmagic/tdesign-vue-next-adapter",
"type": "module", "type": "module",
"sideEffects": [
"dist/*"
],
"main": "dist/tmagic-tdesign-vue-next-adapter.umd.cjs", "main": "dist/tmagic-tdesign-vue-next-adapter.umd.cjs",
"module": "dist/tmagic-tdesign-vue-next-adapter.js", "module": "dist/tmagic-tdesign-vue-next-adapter.js",
"types": "types/index.d.ts", "types": "types/index.d.ts",
@ -18,7 +15,8 @@
}, },
"files": [ "files": [
"dist", "dist",
"types" "types",
"src"
], ],
"license": "Apache-2.0", "license": "Apache-2.0",
"scripts": { "scripts": {

View File

@ -18,7 +18,8 @@
}, },
"files": [ "files": [
"dist", "dist",
"types" "types",
"src"
], ],
"license": "Apache-2.0", "license": "Apache-2.0",
"scripts": { "scripts": {

View File

@ -32,14 +32,14 @@
"url": "https://github.com/Tencent/tmagic-editor.git" "url": "https://github.com/Tencent/tmagic-editor.git"
}, },
"peerDependencies": { "peerDependencies": {
"@tmagic/core": "workspace:*", "@tmagic/core": ">=1.4.8",
"@tmagic/editor": "workspace:*", "@tmagic/editor": ">=1.4.8",
"@tmagic/form": "workspace:*", "@tmagic/form": ">=1.4.8",
"@tmagic/utils": "workspace:*", "@tmagic/utils": ">=1.4.8",
"@tmagic/schema": "workspace:*", "@tmagic/schema": ">=1.4.8",
"@tmagic/stage": "workspace:*", "@tmagic/stage": ">=1.4.8",
"element-plus": "^2.7.5", "element-plus": ">=2.7.5",
"vue": "^3.4.27" "vue": ">=3.4.27"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^18.19.0", "@types/node": "^18.19.0",

View File

@ -32,11 +32,11 @@
"vue-demi": "^0.14.7" "vue-demi": "^0.14.7"
}, },
"peerDependencies": { "peerDependencies": {
"@tmagic/core": "workspace:*", "@tmagic/core": ">=1.4.8",
"@tmagic/data-source": "workspace:*", "@tmagic/data-source": ">=1.4.8",
"@tmagic/schema": "workspace:*", "@tmagic/schema": ">=1.4.8",
"@tmagic/stage": "workspace:*", "@tmagic/stage": ">=1.4.8",
"@tmagic/utils": "workspace:*", "@tmagic/utils": ">=1.4.8",
"@vue/composition-api": ">=1.7.2", "@vue/composition-api": ">=1.7.2",
"typescript": "*", "typescript": "*",
"vue": ">=2.0.0 || >=3.0.0" "vue": ">=2.0.0 || >=3.0.0"

View File

@ -187,6 +187,17 @@ async function main() {
} }
} }
if (!skipGit) {
const { stdout } = await run('git', ['diff'], { stdio: 'pipe' });
if (stdout) {
step('\nCommitting changes...');
await runIfNotDry('git', ['add', '-A']);
await runIfNotDry('git', ['commit', '-m', `chore: release v${targetVersion}`, '--verify']);
} else {
console.log('No changes to commit.');
}
}
// publish packages // publish packages
step('\nPublishing packages...'); step('\nPublishing packages...');
@ -194,7 +205,9 @@ async function main() {
if (isDryRun) { if (isDryRun) {
additionalPublishFlags.push('--dry-run'); additionalPublishFlags.push('--dry-run');
} }
if (isDryRun || skipGit) {
additionalPublishFlags.push('--no-git-checks');
}
// bypass the pnpm --publish-branch restriction which isn't too useful to us // bypass the pnpm --publish-branch restriction which isn't too useful to us
// otherwise it leads to a prompt and blocks the release script // otherwise it leads to a prompt and blocks the release script
const branch = await getBranch(); const branch = await getBranch();
@ -215,7 +228,7 @@ async function main() {
if (stdout) { if (stdout) {
step('\nCommitting changes...'); step('\nCommitting changes...');
await runIfNotDry('git', ['add', '-A']); await runIfNotDry('git', ['add', '-A']);
await runIfNotDry('git', ['commit', '-m', `chore: release v${targetVersion}`, '--verify']); await runIfNotDry('git', ['commit', '-m', `chore: update lockfile v${targetVersion}`, '--verify']);
} else { } else {
console.log('No changes to commit.'); console.log('No changes to commit.');
} }
@ -362,14 +375,7 @@ async function publishPackage(pkgName, version, additionalFlags) {
// workspace:* deps // workspace:* deps
await run( await run(
'pnpm', 'pnpm',
[ ['publish', ...(releaseTag ? ['--tag', releaseTag] : []), '--access', 'public', ...additionalFlags],
'publish',
...(releaseTag ? ['--tag', releaseTag] : []),
'--access',
'public',
'--no-git-checks',
...additionalFlags,
],
{ {
cwd: getPkgRoot(pkgName), cwd: getPkgRoot(pkgName),
stdio: 'pipe', stdio: 'pipe',