mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-14 09:25:43 +01:00
implemented deployment for scm-ui-components
This commit is contained in:
@@ -1,13 +1,16 @@
|
|||||||
{
|
{
|
||||||
"name": "scm-ui-components",
|
"name": "scm-ui-components",
|
||||||
|
"version": "0.0.3",
|
||||||
"description": "Lerna root for SCM-Manager UI Components",
|
"description": "Lerna root for SCM-Manager UI Components",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"bootstrap": "lerna bootstrap",
|
"bootstrap": "lerna bootstrap",
|
||||||
"link": "lerna exec -- yarn link",
|
"link": "lerna exec -- yarn link",
|
||||||
"unlink": "lerna exec --no-bail -- yarn unlink || true"
|
"unlink": "lerna exec --no-bail -- yarn unlink || true",
|
||||||
|
"deploy": "node ./scripts/publish.js"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"lerna": "^3.2.1"
|
"lerna": "^3.4.3",
|
||||||
|
"xml2js": "^0.4.19"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@scm-manager/ui-components",
|
"name": "@scm-manager/ui-components",
|
||||||
"version": "0.0.1",
|
"version": "2.0.0-SNAPSHOT",
|
||||||
"description": "UI Components for SCM-Manager and its plugins",
|
"description": "UI Components for SCM-Manager and its plugins",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"files": [
|
"files": [
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@scm-manager/ui-extensions": "^0.1.1",
|
"@scm-manager/ui-extensions": "^0.1.1",
|
||||||
"@scm-manager/ui-types": "0.0.1",
|
"@scm-manager/ui-types": "2.0.0-SNAPSHOT",
|
||||||
"classnames": "^2.2.6",
|
"classnames": "^2.2.6",
|
||||||
"moment": "^2.22.2",
|
"moment": "^2.22.2",
|
||||||
"react": "^16.5.2",
|
"react": "^16.5.2",
|
||||||
@@ -55,4 +55,4 @@
|
|||||||
]
|
]
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@scm-manager/ui-types",
|
"name": "@scm-manager/ui-types",
|
||||||
"version": "0.0.1",
|
"version": "2.0.0-SNAPSHOT",
|
||||||
"description": "Flow types for SCM-Manager related Objects",
|
"description": "Flow types for SCM-Manager related Objects",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"files": [
|
"files": [
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
],
|
],
|
||||||
"repository": "https://bitbucket.org/sdorra/scm-manager",
|
"repository": "https://bitbucket.org/sdorra/scm-manager",
|
||||||
"author": "Sebastian Sdorra <sebastian.sdorra@cloudogu.com>",
|
"author": "Sebastian Sdorra <sebastian.sdorra@cloudogu.com>",
|
||||||
"license" : "BSD-3-Clause",
|
"license": "BSD-3-Clause",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "ui-bunder lint",
|
"lint": "ui-bunder lint",
|
||||||
"check": "flow check"
|
"check": "flow check"
|
||||||
@@ -21,10 +21,16 @@
|
|||||||
[
|
[
|
||||||
"babelify",
|
"babelify",
|
||||||
{
|
{
|
||||||
"plugins": ["@babel/plugin-proposal-class-properties"],
|
"plugins": [
|
||||||
"presets": ["@babel/preset-env", "@babel/preset-flow", "@babel/preset-react"]
|
"@babel/plugin-proposal-class-properties"
|
||||||
|
],
|
||||||
|
"presets": [
|
||||||
|
"@babel/preset-env",
|
||||||
|
"@babel/preset-flow",
|
||||||
|
"@babel/preset-react"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
Arguments:
|
|
||||||
/usr/bin/node /home/ssdorra/.yarn/bin/yarn.js add --dev ui-bundler
|
|
||||||
|
|
||||||
PATH:
|
|
||||||
/home/ssdorra/.yarn/bin:/usr/local/go/bin:/home/ssdorra/Projects/go/bin:/home/ssdorra/.local/bin:/usr/local/google-cloud-sdk/bin:/usr/local/go/bin:/home/ssdorra/.sdkman/candidates/maven/current/bin:/home/ssdorra/.sdkman/candidates/groovy/current/bin:/home/ssdorra/bin:/home/ssdorra/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/home/ssdorra/Projects/go/bin
|
|
||||||
|
|
||||||
Yarn version:
|
|
||||||
1.9.2
|
|
||||||
|
|
||||||
Node version:
|
|
||||||
8.11.4
|
|
||||||
|
|
||||||
Platform:
|
|
||||||
linux x64
|
|
||||||
|
|
||||||
Trace:
|
|
||||||
Error: https://registry.yarnpkg.com/ui-bundler: Not found
|
|
||||||
at Request.params.callback [as _callback] (/home/ssdorra/.yarn/lib/cli.js:64150:18)
|
|
||||||
at Request.self.callback (/home/ssdorra/.yarn/lib/cli.js:137416:22)
|
|
||||||
at emitTwo (events.js:126:13)
|
|
||||||
at Request.emit (events.js:214:7)
|
|
||||||
at Request.<anonymous> (/home/ssdorra/.yarn/lib/cli.js:138388:10)
|
|
||||||
at emitOne (events.js:116:13)
|
|
||||||
at Request.emit (events.js:211:7)
|
|
||||||
at IncomingMessage.<anonymous> (/home/ssdorra/.yarn/lib/cli.js:138310:12)
|
|
||||||
at Object.onceWrapper (events.js:313:30)
|
|
||||||
at emitNone (events.js:111:20)
|
|
||||||
|
|
||||||
npm manifest:
|
|
||||||
{
|
|
||||||
"name": "@scm-manager/ui-types",
|
|
||||||
"version": "0.0.1",
|
|
||||||
"description": "Flow types for SCM-Manager related Objects",
|
|
||||||
"main": "src/index.js",
|
|
||||||
"files": [
|
|
||||||
"src"
|
|
||||||
],
|
|
||||||
"repository": "https://bitbucket.org/sdorra/scm-manager",
|
|
||||||
"author": "Sebastian Sdorra <sebastian.sdorra@cloudogu.com>",
|
|
||||||
"license": "MIT",
|
|
||||||
"scripts": {
|
|
||||||
"check": "flow check"
|
|
||||||
},
|
|
||||||
"devDependencies": {}
|
|
||||||
}
|
|
||||||
|
|
||||||
yarn manifest:
|
|
||||||
No manifest
|
|
||||||
|
|
||||||
Lockfile:
|
|
||||||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
||||||
# yarn lockfile v1
|
|
||||||
@@ -68,6 +68,16 @@
|
|||||||
<script>link</script>
|
<script>link</script>
|
||||||
</configuration>
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>deploy</id>
|
||||||
|
<phase>deploy</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>run</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<script>deploy</script>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
|
|||||||
140
scm-ui-components/scripts/publish.js
Normal file
140
scm-ui-components/scripts/publish.js
Normal file
@@ -0,0 +1,140 @@
|
|||||||
|
const fs = require("fs");
|
||||||
|
const path = require("path");
|
||||||
|
const {spawn} = require("child_process");
|
||||||
|
const parseString = require('xml2js').parseString;
|
||||||
|
|
||||||
|
function isSnapshot(version) {
|
||||||
|
return version.indexOf("SNAPSHOT") > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
function createSnapshotVersion(version) {
|
||||||
|
const date = new Date();
|
||||||
|
const year = date.getFullYear();
|
||||||
|
const month = date.getMonth().toString().padStart(2, "0");
|
||||||
|
const day = date.getDate().toString().padStart(2, "0");
|
||||||
|
|
||||||
|
const hours = date.getHours().toString().padStart(2, "0");
|
||||||
|
const minutes = date.getMinutes().toString().padStart(2, "0");
|
||||||
|
const seconds = date.getSeconds().toString().padStart(2, "0");
|
||||||
|
|
||||||
|
return version.replace("SNAPSHOT", `${year}${month}${day}-${hours}${minutes}${seconds}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
function createVersionForPublishing(version) {
|
||||||
|
if (isSnapshot(version)) {
|
||||||
|
return createSnapshotVersion(version);
|
||||||
|
}
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
function publishPackages(version) {
|
||||||
|
console.log(`publish ${version} of all packages`);
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const lerna = spawn("lerna", [
|
||||||
|
"exec", "--", "yarn", "publish", "--new-version", version, "--access", "public"
|
||||||
|
], {
|
||||||
|
stdio: [
|
||||||
|
process.stdin,
|
||||||
|
process.stdout,
|
||||||
|
process.stderr
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
lerna.on('close', (code) => {
|
||||||
|
if (code === 0) {
|
||||||
|
resolve();
|
||||||
|
} else {
|
||||||
|
reject(new Error("publishing of packages failed with status code: " + code));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function setVersion(package, packages, newVersion) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const packageJsonPath = path.join(package, "package.json");
|
||||||
|
fs.readFile(packageJsonPath, "utf-8" , (err, content) => {
|
||||||
|
if (err) {
|
||||||
|
reject(err);
|
||||||
|
} else {
|
||||||
|
const packageJson = JSON.parse(content);
|
||||||
|
packageJson.version = newVersion;
|
||||||
|
|
||||||
|
for (let dep in packageJson.dependencies) {
|
||||||
|
if (packages.indexOf(dep) >= 0) {
|
||||||
|
packageJson.dependencies[ dep ] = newVersion;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fs.writeFile( packageJsonPath, JSON.stringify(packageJson, null, 2), (err) => {
|
||||||
|
if (err) {
|
||||||
|
reject(err)
|
||||||
|
} else {
|
||||||
|
console.log("modified", packageJsonPath);
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function setVersions(newVersion) {
|
||||||
|
console.log("set versions of packages to", newVersion);
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
fs.readdir("packages", (err, packages) => {
|
||||||
|
if ( err ) {
|
||||||
|
reject(err);
|
||||||
|
} else {
|
||||||
|
const actions = [];
|
||||||
|
const packagesWithOrg = packages.map((name) => `@scm-manager/${name}`);
|
||||||
|
for (let pkg of packages) {
|
||||||
|
const action = setVersion(path.join("packages", pkg), packagesWithOrg, newVersion);
|
||||||
|
actions.push(action);
|
||||||
|
}
|
||||||
|
|
||||||
|
resolve(Promise.all(actions));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function getVersion() {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
fs.readFile("pom.xml", "utf8", (err, xml) => {
|
||||||
|
if (err) {
|
||||||
|
reject(err);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
parseString(xml, function (err, json) {
|
||||||
|
if (err) {
|
||||||
|
reject(err)
|
||||||
|
} else {
|
||||||
|
const project = json.project;
|
||||||
|
|
||||||
|
let version = project.version;
|
||||||
|
if (!version) {
|
||||||
|
version = project.parent.version;
|
||||||
|
}
|
||||||
|
version = version[0];
|
||||||
|
|
||||||
|
resolve(version)
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
getVersion()
|
||||||
|
.then(version => {
|
||||||
|
const publishVersion = createVersionForPublishing(version);
|
||||||
|
return setVersions(publishVersion)
|
||||||
|
.then(() => publishPackages(publishVersion))
|
||||||
|
.then(() => setVersions(version));
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
throw err;
|
||||||
|
});
|
||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user