From 3664b9e5acda742c019d31ffd677e2e01afb0fc2 Mon Sep 17 00:00:00 2001 From: Dan Selman Date: Tue, 12 Dec 2023 00:53:53 +0000 Subject: [PATCH] fix: publish Signed-off-by: Dan Selman --- scripts/coverage.js | 50 -------------------------------------------- scripts/tag.js | 29 ------------------------- scripts/timestamp.js | 32 ---------------------------- 3 files changed, 111 deletions(-) delete mode 100755 scripts/coverage.js delete mode 100755 scripts/tag.js delete mode 100755 scripts/timestamp.js diff --git a/scripts/coverage.js b/scripts/coverage.js deleted file mode 100755 index 10cd64b..0000000 --- a/scripts/coverage.js +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env node - -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -'use strict'; - -const globPattern = process.argv[2]; - -const util = require('util'); -const fs = require('fs'); -const path = require('path'); -const copyFilePromise = util.promisify(fs.copyFile); -const glob = require('glob'); - -// eslint-disable-next-line require-jsdoc -function copyFiles(files, destDir) { - if (!fs.existsSync('coverage')) { - fs.mkdirSync('coverage'); - } - return Promise.all(files.map(f => { - return copyFilePromise(f.source, path.join(destDir, f.destination)); - })); -} - -const lcovs = glob.sync(globPattern).map((dir) => { - const packageName = dir.split('/').pop(); - return { - source: path.join(dir, 'coverage/coverage-final.json'), - destination: `${packageName}.json` - }; -}); - -// usage -copyFiles(lcovs, 'coverage').then(() => { - console.log('done'); -}).catch(err => { - console.log(err); -}); \ No newline at end of file diff --git a/scripts/tag.js b/scripts/tag.js deleted file mode 100755 index 01fc4d1..0000000 --- a/scripts/tag.js +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env node -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -'use strict'; - -const semver = require('semver'); -const targetVersion = process.argv[2]; - -if (!semver.valid(targetVersion)) { - console.error(`Error: the version "${targetVersion}" is invalid!`); - process.exit(1); -} - -const prerelease = semver.prerelease(targetVersion); -const tag = prerelease ? 'unstable' : 'latest'; - -console.log(`::set-output name=tag::--tag=${tag}`); diff --git a/scripts/timestamp.js b/scripts/timestamp.js deleted file mode 100755 index 3f38386..0000000 --- a/scripts/timestamp.js +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env node - -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -'use strict'; - -const path = require('path'); -const semver = require('semver'); -const dayjs = require('dayjs'); -const utc = require('dayjs/plugin/utc'); -dayjs.extend(utc); - -const timestamp = dayjs.utc().format('YYYYMMDDHHmmss'); - -const rootDir = path.resolve('.'); -const packageJson = path.resolve(rootDir, 'package.json'); -const meta = require(packageJson); -meta.version.replace(/-.*/, ''); -const targetVersion = semver.inc(meta.version, 'patch') + '-' + timestamp; -console.log(`::set-output name=stamp::${targetVersion}`); \ No newline at end of file