Skip to content
This repository has been archived by the owner on Jun 5, 2023. It is now read-only.

Commit

Permalink
chore: 给npm增加更多说明
Browse files Browse the repository at this point in the history
  • Loading branch information
idler8 committed Feb 28, 2023
1 parent 16c19d4 commit ca01ffd
Showing 1 changed file with 39 additions and 13 deletions.
52 changes: 39 additions & 13 deletions scripts/package.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,44 @@
const fs = require('fs');
const path = require('path');
const version = (process.env.GITHUB_REF || 'v0.0.1-0').replace("refs/tags/", "");
const corePackageTarget = path.resolve(__dirname, '../packages/observer/libs/rollup/package.json')
fs.writeFileSync(corePackageTarget, JSON.stringify({
name: "@idler8/observer",
version: version,
main: "./index.js",
}))
const formReactPackageTarget = path.resolve(__dirname, '../packages/form-react/libs/rollup/package.json')
fs.writeFileSync(formReactPackageTarget, JSON.stringify({
name: "@idler8/form-react",
version: version,
main: "./index.js",
"dependencies": {
function makePackageFile(project, packageJson) {
const npmPublishDir = path.resolve(__dirname, '../packages/' + project + '/libs/rollup')
fs.writeFileSync(path.resolve(npmPublishDir, 'package.json'), JSON.stringify({
name: "@idler8/" + project,
version: version,
main: "./index.js",
author: {
name: "闲人",
email: 'code@idler8.com'
},
homepage: "https://github.com/idler8/observer",
repository: {
"type": "git",
"url": "https://github.com/idler8/observer"
},
...packageJson
}))
fs.writeFileSync(path.resolve(npmPublishDir, 'README.md'), `
## 该项目来自Github Actions自动构建
更多说明请查看[Github仓库]("https://github.com/idler8/observer")
`)
}
makePackageFile('observer', {
keywords: [
"observer",
"events",
"listener"
],
})
makePackageFile('form-react', {
keywords: [
"observer",
"react",
"form",
"field",
"input"
],
dependencies: {
"@idler8/observer": "~" + version
},
}))
})

0 comments on commit ca01ffd

Please sign in to comment.