New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

arylo-init

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arylo-init - npm Package Compare versions

Comparing version 2.1.16 to 2.1.17

dist/utils/versions.js

95

dist/commands/update.js

@@ -10,5 +10,5 @@ "use strict";

const utils_1 = require("../utils");
const out = require("./../utils/out");
const pkg_1 = require("./../utils/pkg");
const patches_1 = require("../patches");
const out = require("../utils/out");
const pkg_1 = require("../utils/pkg");
const versions_1 = require("../utils/versions");
exports.handler = () => {

@@ -28,6 +28,8 @@ const folderPath = utils_1.dealPath(process.argv[3]);

}
const ADD_MAP = {};
const UPDATE_MAP = {};
const REMOVE_MAP = {};
const versions = patches_1.diffVersions(sourceProjectVersion);
const MAPS = {
add: {},
remove: {},
update: {}
};
const versions = versions_1.diffVersions(sourceProjectVersion);
if (versions.length === 0 && sourceProjectVersion === constants.version) {

@@ -37,48 +39,69 @@ return out.pipe("\n ::", "This is Latest Project Template");

versions.forEach((version) => {
const versionObj = patches_1.getVersion(version);
const versionObj = versions_1.getVersionObj(version);
for (const filePoint of toUniList(versionObj.ADD_LIST)) {
if (REMOVE_MAP[filePoint]) {
REMOVE_MAP[filePoint] = null;
if (MAPS.remove[filePoint]) {
MAPS.remove[filePoint] = null;
}
ADD_MAP[filePoint] = [version];
MAPS.add[filePoint] = [version];
}
for (const filePoint of toUniList(versionObj.UPDATE_LIST)) {
if (ADD_MAP[filePoint]) {
if (MAPS.add[filePoint]) {
continue;
}
if (!UPDATE_MAP[filePoint]) {
UPDATE_MAP[filePoint] = [];
if (!MAPS.update[filePoint]) {
MAPS.update[filePoint] = [];
}
UPDATE_MAP[filePoint].push(version);
MAPS.update[filePoint].push(version);
}
for (const filePoint of toUniList(versionObj.REMOVE_LIST)) {
if (ADD_MAP[filePoint]) {
UPDATE_MAP[filePoint] = null;
if (MAPS.add[filePoint]) {
MAPS.update[filePoint] = null;
}
if (UPDATE_MAP[filePoint]) {
UPDATE_MAP[filePoint] = null;
if (MAPS.update[filePoint]) {
MAPS.update[filePoint] = null;
}
REMOVE_MAP[filePoint] = [version];
MAPS.remove[filePoint] = [version];
}
});
// Update Files
for (const filePoint of Object.keys(ADD_MAP)) {
add(filePoint);
}
for (const filePoint of Object.keys(UPDATE_MAP)) {
const versionList = UPDATE_MAP[filePoint];
for (const version of versionList) {
const versionObj = patches_1.getVersion(version);
if (!fs.existsSync(path.resolve(constants.targetPath, filePoint))) {
if (versionObj.IGNORE_CHECK_LIST.indexOf(filePoint.replace(/^\.\//, "")) === -1) {
utils_1.exit(`Miss \`${filePoint}\``);
// Generate Update Queue
const updateQueue = {};
for (const t of Object.keys(MAPS)) {
const map = MAPS[t];
for (const filePoint of Object.keys(map)) {
const versionList = map[filePoint];
for (const version of versionList) {
if (!updateQueue[version]) {
updateQueue[version] = [];
}
continue;
updateQueue[version].push({
filePoint,
type: t
});
}
versionObj.update(filePoint.replace(/^\.\//, ""));
}
out.pipe("UPDATE", filePoint);
}
for (const filePoint of Object.keys(REMOVE_MAP)) {
remove(filePoint);
// Update Files
for (const ver of Object.keys(updateQueue).sort(versions_1.sortFn())) {
for (const obj of updateQueue[ver]) {
const { filePoint } = obj;
switch (obj.type) {
case "add":
add(filePoint);
break;
case "update":
const versionObj = versions_1.getVersionObj(ver);
if (!fs.existsSync(path.resolve(constants.targetPath, filePoint))) {
if (!versionObj.isIgnoreCheck(filePoint)) {
utils_1.exit(`Miss \`${filePoint}\``);
}
continue;
}
versionObj.update(filePoint.replace(/^\.\//, ""));
out.pipe("UPDATE", filePoint);
break;
case "remove":
remove(filePoint);
break;
}
}
}

@@ -85,0 +108,0 @@ // Update `package.json`

@@ -6,2 +6,3 @@ "use strict";

const utils_1 = require("./utils");
const pkg_1 = require("./utils/pkg");
/**

@@ -11,3 +12,3 @@ * 模块根地址

exports.rootPath = path_1.resolve(__dirname, "..", fs_1.existsSync(`${__dirname}/../../package.json`) ? ".." : "");
exports.pkg = JSON.parse(fs_1.readFileSync(path_1.resolve(exports.rootPath, "package.json"), { encoding: "utf-8" }));
exports.pkg = new pkg_1.Pkg(exports.rootPath).toObject();
/**

@@ -33,3 +34,3 @@ * 当前模块版本

const setProjectName = (path) => {
exports.projectName = utils_1.nameFilter(path);
exports.projectName = utils_1.namePipe(path);
return true;

@@ -41,2 +42,1 @@ };

};
exports.FILE_OPTIONS = { encoding: "utf-8" };

@@ -15,3 +15,3 @@ "use strict";

};
exports.nameFilter = (name) => {
exports.namePipe = (name) => {
return name

@@ -18,0 +18,0 @@ .toLowerCase()

@@ -7,9 +7,8 @@ import fs = require("fs");

import data = require("../data");
import { IObj } from "../types/config";
import { dealPath, exit } from "../utils";
import * as out from "./../utils/out";
import { Pkg } from "./../utils/pkg";
import * as out from "../utils/out";
import { Pkg } from "../utils/pkg";
import { diffVersions, getVersionObj, sortFn } from "../utils/versions";
import { diffVersions, getVersion } from "../patches";
import { IObj } from "../utils/config";
export const handler = () => {

@@ -33,5 +32,7 @@ const folderPath = dealPath(process.argv[3]);

}
const ADD_MAP: IObj<string[]> = {};
const UPDATE_MAP: IObj<string[]> = {};
const REMOVE_MAP: IObj<string[]> = {};
const MAPS: { [type: string]: IObj<string[]> } = {
add: {},
remove: {},
update: {}
};

@@ -48,56 +49,80 @@ const versions = diffVersions(sourceProjectVersion);

versions.forEach((version) => {
const versionObj = getVersion(version);
const versionObj = getVersionObj(version);
for (const filePoint of toUniList(versionObj.ADD_LIST)) {
if (REMOVE_MAP[filePoint]) {
REMOVE_MAP[filePoint] = null;
if (MAPS.remove[filePoint]) {
MAPS.remove[filePoint] = null;
}
ADD_MAP[filePoint] = [version];
MAPS.add[filePoint] = [version];
}
for (const filePoint of toUniList(versionObj.UPDATE_LIST)) {
if (ADD_MAP[filePoint]) {
if (MAPS.add[filePoint]) {
continue;
}
if (!UPDATE_MAP[filePoint]) {
UPDATE_MAP[filePoint] = [];
if (!MAPS.update[filePoint]) {
MAPS.update[filePoint] = [];
}
UPDATE_MAP[filePoint].push(version);
MAPS.update[filePoint].push(version);
}
for (const filePoint of toUniList(versionObj.REMOVE_LIST)) {
if (ADD_MAP[filePoint]) {
UPDATE_MAP[filePoint] = null;
if (MAPS.add[filePoint]) {
MAPS.update[filePoint] = null;
}
if (UPDATE_MAP[filePoint]) {
UPDATE_MAP[filePoint] = null;
if (MAPS.update[filePoint]) {
MAPS.update[filePoint] = null;
}
REMOVE_MAP[filePoint] = [version];
MAPS.remove[filePoint] = [version];
}
});
// Update Files
for (const filePoint of Object.keys(ADD_MAP)) {
add(filePoint);
}
for (const filePoint of Object.keys(UPDATE_MAP)) {
const versionList = UPDATE_MAP[filePoint];
for (const version of versionList) {
const versionObj = getVersion(version);
if (!fs.existsSync(path.resolve(constants.targetPath, filePoint))) {
if (
versionObj.IGNORE_CHECK_LIST.indexOf(
filePoint.replace(/^\.\//, "")
) === -1
) {
exit(`Miss \`${filePoint}\``);
// Generate Update Queue
const updateQueue: {
[ver: string]: Array<{ filePoint: string; type: string }>;
} = {};
for (const t of Object.keys(MAPS)) {
const map = MAPS[t];
for (const filePoint of Object.keys(map)) {
const versionList = map[filePoint];
for (const version of versionList) {
if (!updateQueue[version]) {
updateQueue[version] = [];
}
continue;
updateQueue[version].push({
filePoint,
type: t
});
}
versionObj.update(filePoint.replace(/^\.\//, ""));
}
out.pipe(
"UPDATE",
filePoint
);
}
for (const filePoint of Object.keys(REMOVE_MAP)) {
remove(filePoint);
// Update Files
for (const ver of Object.keys(updateQueue).sort(sortFn())) {
for (const obj of updateQueue[ver]) {
const { filePoint } = obj;
switch (obj.type) {
case "add":
add(filePoint);
break;
case "update":
const versionObj = getVersionObj(ver);
if (
!fs.existsSync(
path.resolve(constants.targetPath, filePoint)
)
) {
if (!versionObj.isIgnoreCheck(filePoint)) {
exit(`Miss \`${filePoint}\``);
}
continue;
}
versionObj.update(filePoint.replace(/^\.\//, ""));
out.pipe(
"UPDATE",
filePoint
);
break;
case "remove":
remove(filePoint);
break;
}
}
}

@@ -104,0 +129,0 @@

import { existsSync, readFileSync } from "fs";
import { basename, resolve } from "path";
import { nameFilter } from "./utils";
import { namePipe } from "./utils";
import { Pkg } from "./utils/pkg";

@@ -13,5 +14,5 @@ /**

);
export const pkg = JSON.parse(
readFileSync(resolve(rootPath, "package.json"), { encoding: "utf-8" })
);
export const pkg = new Pkg(rootPath).toObject();
/**

@@ -21,2 +22,3 @@ * 当前模块版本

export const version = pkg.version;
/**

@@ -30,2 +32,3 @@ * 当前年份

const resourcesName = "public";
/**

@@ -35,2 +38,3 @@ * 资源文件源位置

export const resourcesRawPath = resolve(rootPath, resourcesName);
/**

@@ -47,3 +51,3 @@ * 资源文件使用位置

const setProjectName = (path: string) => {
projectName = nameFilter(path);
projectName = namePipe(path);
return true;

@@ -56,3 +60,1 @@ };

};
export const FILE_OPTIONS = { encoding: "utf-8" };
import ftconfig = require("ftconfig");
import * as path from "path";
import constants = require("../constants");
import { ITravis } from "../utils/yaml.d";
import { ITravis } from "../types/yaml";

@@ -6,0 +6,0 @@ export const UPDATE_LIST = [".travis.yml"];

import ftconfig = require("ftconfig");
import * as path from "path";
import constants = require("../constants");
import { ILintstagedrc } from "../utils/json.d";
import { ILintstagedrc } from "../types/json";
import { Pkg } from "../utils/pkg";

@@ -6,0 +6,0 @@

import ftconfig = require("ftconfig");
import * as path from "path";
import constants = require("../constants");
import { IHuskyrc } from "../utils/json.d";
import { IHuskyrc } from "../types/json";

@@ -6,0 +6,0 @@ export const UPDATE_LIST = [".huskyrc.json"];

import ftconfig = require("ftconfig");
import * as path from "path";
import constants = require("../constants");
import { ILintstagedrc } from "../utils/json.d";
import { ILintstagedrc } from "../types/json";
import { Pkg } from "../utils/pkg";

@@ -6,0 +6,0 @@

import * as path from "path";
import { IObj } from "./utils/config";
import { IObj } from "./types/config";

@@ -15,3 +15,3 @@ export const exit = (msg: string | string[], code = 1) => {

export const nameFilter = (name: string) => {
export const namePipe = (name: string) => {
return name

@@ -18,0 +18,0 @@ .toLowerCase()

@@ -5,3 +5,3 @@ import * as fs from "fs";

import * as path from "path";
import { IPackage } from "./json.d";
import { IPackage } from "../types/json";

@@ -8,0 +8,0 @@ export class Pkg {

{
"name": "arylo-init",
"version": "2.1.16",
"version": "2.1.17",
"description": "Initial Node.js Project for Arylo Edition",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

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