Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

my-ci

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

my-ci - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

.my-ci.yml

31

bin/workspace-init.js

@@ -8,8 +8,13 @@ #!/usr/bin/env node

const userHomeDir = os.homedir();
const dataDir = '.my-ci';
const configFileName = '.my-ci.yml'
// 获取当前项目的根目录路径
const projectRootPath = path.resolve();
let projectName = '';
// 读取yml配置文件
try {
const wsYmlPath = path.join(projectRootPath, '.easy-ci.yml');
const wsYmlPath = path.join(projectRootPath, configFileName);
const ymlConfig = yaml.load(fs.readFileSync(wsYmlPath, 'utf8'));

@@ -19,3 +24,4 @@ // console.log(doc);

if (ymlConfig.project) {
newWorkspace(ymlConfig.project);
projectName = ymlConfig.project
newWorkspace(projectName);
} else {

@@ -26,3 +32,5 @@ throw 'project属性不能为空';

if (err?.code === 'EEXIST') {
console.error(`${ymlConfig.project}已存在,请在yml配置中设置一个不重复的project属性`);
console.error(`${projectName}已存在,请在yml配置中设置一个不重复的project属性`);
} else if (err?.code === 'ENOENT') {
console.error(`没有找到配置文件: ${configFileName}`);
} else {

@@ -34,6 +42,19 @@ console.error('项目初始化失败: ', err);

function newWorkspace(projectName) {
const wsInfoPath = path.resolve(os.homedir(), '.easy-ci', projectName);
// .my-ci文件夹不存在则先创建
try {
fs.mkdirSync(path.resolve(userHomeDir, dataDir));
console.log(`工具初始化${dataDir}`);
} catch(err) {
if (err.code === 'EEXIST') {
console.log('工具已初始化');
} else {
throw err;
}
}
// workspace初始化
const wsInfoPath = path.resolve(os.homedir(), dataDir, projectName);
fs.openSync(wsInfoPath, 'wx'); // 如果文件已经存在,会抛出错误
fs.writeFileSync(wsInfoPath, `PATH=${projectRootPath}`);
console.log('File created successfully.');
console.log('my-ci project created successfully.');
}

9

package.json
{
"name": "my-ci",
"version": "1.0.3",
"version": "1.0.4",
"description": "",

@@ -23,5 +23,10 @@ "main": "index.js",

"dependencies": {
"@koa/cors": "^4.0.0",
"arg": "^5.0.2",
"ini": "^4.1.0",
"js-yaml": "^4.1.0",
"koa": "^2.14.2"
"koa": "^2.14.2",
"koa-bodyparser": "^4.4.0",
"koa-router": "^12.0.0"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc