mirror of
https://github.com/ivuorinen/base-configs-semantic-release.git
synced 2026-01-26 03:34:00 +00:00
feat: upgrade yarn, prettier format all, upgrade actions (#74)
* feat: upgrade yarn, prettier format all, upgrade actions * fix: postinstall script and .releaserc.json
This commit is contained in:
@@ -1,26 +1,30 @@
|
||||
'use strict'
|
||||
"use strict";
|
||||
|
||||
/* eslint no-console: "off", n/no-process-exit: "off", no-undefined: "off" -- CLI app that gives users feedback */
|
||||
|
||||
const fs = require('node:fs')
|
||||
const path = require('node:path')
|
||||
const fs = require("node:fs");
|
||||
const path = require("node:path");
|
||||
// noinspection NpmUsedModulesInstalled
|
||||
const process = require('node:process')
|
||||
const checkConfig = require('@ivuorinen/config-checker')
|
||||
const foundConfig = checkConfig('release')
|
||||
const process = require("node:process");
|
||||
const checkConfig = require("@ivuorinen/config-checker");
|
||||
const foundConfig = checkConfig("release");
|
||||
|
||||
if (foundConfig.length > 0) {
|
||||
console.log('semantic-release-config: Found existing semantic-release config file, skipping creation.')
|
||||
console.log('semantic-release-config: If you want to create a new config file, please remove the existing one.')
|
||||
console.log(`semantic-release-config: Found config files at: ${foundConfig.join(', ')}`)
|
||||
process.exit(0)
|
||||
console.log("semantic-release-config: Found existing semantic-release config file, skipping creation.");
|
||||
console.log("semantic-release-config: If you want to create a new config file, please remove the existing one.");
|
||||
console.log(`semantic-release-config: Found config files at: ${foundConfig.join(", ")}`);
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
const filePath = path.join(process.env.INIT_CWD, '.releaserc.json')
|
||||
const filePath = path.join(process.env.INIT_CWD || process.cwd(), ".releaserc.json");
|
||||
const fileConfigObject = {
|
||||
extends: ['@ivuorinen/semantic-release-config']
|
||||
}
|
||||
extends: ["@ivuorinen/semantic-release-config"],
|
||||
};
|
||||
|
||||
if (!fs.existsSync(filePath)) {
|
||||
fs.writeFileSync(filePath, JSON.stringify(fileConfigObject, undefined, 2))
|
||||
try {
|
||||
fs.writeFileSync(filePath, JSON.stringify(fileConfigObject, undefined, 2), { flag: "wx" });
|
||||
} catch (err) {
|
||||
if (err.code !== "EEXIST") {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user