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

@dvabuzyarov/product-version

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dvabuzyarov/product-version - npm Package Compare versions

Comparing version 1.0.8 to 1.0.9

8

package.json
{
"name": "@dvabuzyarov/product-version",
"version": "1.0.8",
"version": "1.0.9",
"description": "Updates production version in the environment files",

@@ -26,6 +26,6 @@ "publishConfig": {

"peerDependencies": {
"@angular-devkit/core": "^10.0.0",
"@angular-devkit/schematics": "^10.0.0",
"typescript": "~3.9.5"
"@angular-devkit/core": "*",
"@angular-devkit/schematics": "*",
"typescript": "*"
}
}

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

const text = (host.read(fileName) || {}).toString("utf-8");
const sourceFile = typescript_1.createSourceFile(fileName, text, typescript_1.ScriptTarget.Latest, true);
const nodes = ast_utils_1.getSourceNodes(sourceFile);
const sourceFile = (0, typescript_1.createSourceFile)(fileName, text, typescript_1.ScriptTarget.Latest, true);
const nodes = (0, ast_utils_1.getSourceNodes)(sourceFile);
const assignmentNode = nodes
.find(n => n.kind === typescript_1.SyntaxKind.PropertyAssignment
&& ast_utils_1.findNode(n, typescript_1.SyntaxKind.Identifier, options.propertyName || "version") !== null);
&& (0, ast_utils_1.findNode)(n, typescript_1.SyntaxKind.Identifier, options.propertyName || "version") !== null);
if (!assignmentNode)

@@ -17,0 +17,0 @@ throw new schematics_1.SchematicsException(`expected property ${options.propertyName || "version"} in ${fileName} not found`);

@@ -1,3 +0,3 @@

import { Rule } from "@angular-devkit/schematics";
import { SchematicContext, Tree } from "@angular-devkit/schematics";
import { ISchema } from "./schema";
export declare function set(options: ISchema): Rule;
export declare function set(options: ISchema): (host: Tree, context: SchematicContext) => Promise<import("@angular-devkit/schematics/src/tree/interface").Tree>;
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -8,8 +17,8 @@ exports.set = void 0;

function set(options) {
return (host, context) => {
return (host, context) => __awaiter(this, void 0, void 0, function* () {
context.logger.info("Product Version: " + JSON.stringify(options));
setup_options_1.setupOptions(options, host);
const files = get_files_1.getFiles(host, options.path);
yield (0, setup_options_1.setupOptions)(options, host);
const files = (0, get_files_1.getFiles)(host, options.path);
for (const file of files) {
const change = get_update_change_1.getUpdateChange(host, options, file);
const change = (0, get_update_change_1.getUpdateChange)(host, options, file);
const recorder = host.beginUpdate(file);

@@ -21,5 +30,5 @@ recorder.remove(change.pos, change.oldText.length);

return host;
};
});
}
exports.set = set;
//# sourceMappingURL=index.js.map
{
"$schema": "http://json-schema.org/schema",
"id": "@dvabuzyarov/product-version",
"$id": "@dvabuzyarov/product-version",
"type": "object",

@@ -5,0 +5,0 @@ "properties": {

import { Tree } from "@angular-devkit/schematics";
import { ISchema } from "./schema";
export declare function setupOptions(options: ISchema, host: Tree): void;
export declare function setupOptions(options: ISchema, host: Tree): Promise<void>;
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -7,13 +16,15 @@ exports.setupOptions = void 0;

function setupOptions(options, host) {
const workspace = config_1.getWorkspace(host);
if (!options.project) {
options.project = Object.keys(workspace.projects)[0];
}
const project = workspace.projects[options.project];
if (options.path === undefined) {
options.path = `/${project.root}/src/environments/`;
}
options.path = path_1.normalize(options.path);
return __awaiter(this, void 0, void 0, function* () {
const workspace = yield (0, config_1.getWorkspace)(host);
if (!options.project) {
options.project = Object.keys(workspace.projects)[0];
}
const project = workspace.projects.get(options.project);
if (options.path === undefined) {
options.path = `/${project === null || project === void 0 ? void 0 : project.root}/src/environments/`;
}
options.path = (0, path_1.normalize)(options.path);
});
}
exports.setupOptions = setupOptions;
//# sourceMappingURL=setup-options.js.map
/**
* @license
* Copyright Google Inc. All Rights Reserved.
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*
* https://github.com/angular/angular-cli/blob/37a06a7c37f5b4286d58b475e6e12c86f00fac5b/packages/schematics/angular/utility/workspace.ts
*/
import { experimental } from "@angular-devkit/core";
import { Rule, Tree } from "@angular-devkit/schematics";
export interface AppConfig {
/**
* Name of the app.
*/
name?: string;
/**
* Directory where app files are placed.
*/
appRoot?: string;
/**
* The root directory of the app.
*/
root?: string;
/**
* The output directory for build results.
*/
outDir?: string;
/**
* List of application assets.
*/
assets?: (string | {
/**
* The pattern to match.
*/
glob?: string;
/**
* The dir to search within.
*/
input?: string;
/**
* The output path (relative to the outDir).
*/
output?: string;
})[];
/**
* URL where files will be deployed.
*/
deployUrl?: string;
/**
* Base url for the application being built.
*/
baseHref?: string;
/**
* The runtime platform of the app.
*/
platform?: ("browser" | "server");
/**
* The name of the start HTML file.
*/
index?: string;
/**
* The name of the main entry-point file.
*/
main?: string;
/**
* The name of the polyfills file.
*/
polyfills?: string;
/**
* The name of the test entry-point file.
*/
test?: string;
/**
* The name of the TypeScript configuration file.
*/
tsconfig?: string;
/**
* The name of the TypeScript configuration file for unit tests.
*/
testTsconfig?: string;
/**
* The prefix to apply to generated selectors.
*/
prefix?: string;
/**
* Experimental support for a service worker from @angular/service-worker.
*/
serviceWorker?: boolean;
/**
* Global styles to be included in the build.
*/
styles?: (string | {
input?: string;
[name: string]: any;
})[];
/**
* Options to pass to style preprocessors
*/
stylePreprocessorOptions?: {
/**
* Paths to include. Paths will be resolved to project root.
*/
includePaths?: string[];
};
/**
* Global scripts to be included in the build.
*/
scripts?: (string | {
input: string;
[name: string]: any;
})[];
/**
* Source file for environment config.
*/
environmentSource?: string;
/**
* Name and corresponding file for environment config.
*/
environments?: {
[name: string]: any;
};
appShell?: {
app: string;
route: string;
};
budgets?: {
/**
* The type of budget
*/
type?: ("bundle" | "initial" | "allScript" | "all" | "anyScript" | "any");
/**
* The name of the bundle
*/
name?: string;
/**
* The baseline size for comparison.
*/
baseline?: string;
/**
* The maximum threshold for warning relative to the baseline.
*/
maximumWarning?: string;
/**
* The maximum threshold for error relative to the baseline.
*/
maximumError?: string;
/**
* The minimum threshold for warning relative to the baseline.
*/
minimumWarning?: string;
/**
* The minimum threshold for error relative to the baseline.
*/
minimumError?: string;
/**
* The threshold for warning relative to the baseline (min & max).
*/
warning?: string;
/**
* The threshold for error relative to the baseline (min & max).
*/
error?: string;
}[];
import { json, workspaces } from '@angular-devkit/core';
import { Rule, Tree } from '@angular-devkit/schematics';
export declare enum ProjectType {
Application = "application",
Library = "library"
}
export interface CliConfig {
$schema?: string;
/**
* The global configuration of the project.
*/
project?: {
/**
* The name of the project.
*/
name?: string;
/**
* Whether or not this project was ejected.
*/
ejected?: boolean;
};
/**
* Properties of the different applications in this project.
*/
apps?: AppConfig[];
/**
* Configuration for end-to-end tests.
*/
e2e?: {
protractor?: {
/**
* Path to the config file.
*/
config?: string;
};
};
/**
* Properties to be passed to TSLint.
*/
lint?: {
/**
* File glob(s) to lint.
*/
files?: (string | string[]);
/**
* Location of the tsconfig.json project file.
* Will also use as files to lint if 'files' property not present.
*/
project: string;
/**
* Location of the tslint.json configuration.
*/
tslintConfig?: string;
/**
* File glob(s) to ignore.
*/
exclude?: (string | string[]);
}[];
/**
* Configuration for unit tests.
*/
test?: {
karma?: {
/**
* Path to the karma config file.
*/
config?: string;
};
codeCoverage?: {
/**
* Globs to exclude from code coverage.
*/
exclude?: string[];
};
};
/**
* Specify the default values for generating.
*/
defaults?: {
/**
* The file extension to be used for style files.
*/
styleExt?: string;
/**
* How often to check for file updates.
*/
poll?: number;
/**
* Use lint to fix files after generation
*/
lintFix?: boolean;
/**
* Options for generating a class.
*/
class?: {
/**
* Specifies if a spec file is generated.
*/
spec?: boolean;
};
/**
* Options for generating a component.
*/
component?: {
/**
* Flag to indicate if a dir is created.
*/
flat?: boolean;
/**
* Specifies if a spec file is generated.
*/
spec?: boolean;
/**
* Specifies if the style will be in the ts file.
*/
inlineStyle?: boolean;
/**
* Specifies if the template will be in the ts file.
*/
inlineTemplate?: boolean;
/**
* Specifies the view encapsulation strategy.
*/
viewEncapsulation?: ("Emulated" | "Native" | "None");
/**
* Specifies the change detection strategy.
*/
changeDetection?: ("Default" | "OnPush");
};
/**
* Options for generating a directive.
*/
directive?: {
/**
* Flag to indicate if a dir is created.
*/
flat?: boolean;
/**
* Specifies if a spec file is generated.
*/
spec?: boolean;
};
/**
* Options for generating a guard.
*/
guard?: {
/**
* Flag to indicate if a dir is created.
*/
flat?: boolean;
/**
* Specifies if a spec file is generated.
*/
spec?: boolean;
};
/**
* Options for generating an interface.
*/
interface?: {
/**
* Prefix to apply to interface names. (i.e. I)
*/
prefix?: string;
};
/**
* Options for generating a module.
*/
module?: {
/**
* Flag to indicate if a dir is created.
*/
flat?: boolean;
/**
* Specifies if a spec file is generated.
*/
spec?: boolean;
};
/**
* Options for generating a pipe.
*/
pipe?: {
/**
* Flag to indicate if a dir is created.
*/
flat?: boolean;
/**
* Specifies if a spec file is generated.
*/
spec?: boolean;
};
/**
* Options for generating a service.
*/
service?: {
/**
* Flag to indicate if a dir is created.
*/
flat?: boolean;
/**
* Specifies if a spec file is generated.
*/
spec?: boolean;
};
/**
* Properties to be passed to the build command.
*/
build?: {
/**
* Output sourcemaps.
*/
sourcemaps?: boolean;
/**
* Base url for the application being built.
*/
baseHref?: string;
/**
* The ssl key used by the server.
*/
progress?: boolean;
/**
* Enable and define the file watching poll time period (milliseconds).
*/
poll?: number;
/**
* Delete output path before build.
*/
deleteOutputPath?: boolean;
/**
* Do not use the real path when resolving modules.
*/
preserveSymlinks?: boolean;
/**
* Show circular dependency warnings on builds.
*/
showCircularDependencies?: boolean;
/**
* Use a separate bundle containing code used across multiple bundles.
*/
commonChunk?: boolean;
/**
* Use file name for lazy loaded chunks.
*/
namedChunks?: boolean;
};
/**
* Properties to be passed to the serve command.
*/
serve?: {
/**
* The port the application will be served on.
*/
port?: number;
/**
* The host the application will be served on.
*/
host?: string;
/**
* Enables ssl for the application.
*/
ssl?: boolean;
/**
* The ssl key used by the server.
*/
sslKey?: string;
/**
* The ssl certificate used by the server.
*/
sslCert?: string;
/**
* Proxy configuration file.
*/
proxyConfig?: string;
};
/**
* Properties about schematics.
*/
schematics?: {
/**
* The schematics collection to use.
*/
collection?: string;
/**
* The new app schematic.
*/
newApp?: string;
};
};
/**
* Specify which package manager tool to use.
*/
packageManager?: ("npm" | "cnpm" | "yarn" | "default");
/**
* Allow people to disable console warnings.
*/
warnings?: {
/**
* Show a warning when the user enabled the --hmr option.
*/
hmrWarning?: boolean;
/**
* Show a warning when the node version is incompatible.
*/
nodeDeprecation?: boolean;
/**
* Show a warning when the user installed angular-cli.
*/
packageDeprecation?: boolean;
/**
* Show a warning when the global version is newer than the local one.
*/
versionMismatch?: boolean;
/**
* Show a warning when the TypeScript version is incompatible
*/
typescriptMismatch?: boolean;
};
}
export declare type WorkspaceSchema = experimental.workspace.WorkspaceSchema;
export declare type WorkspaceProject = experimental.workspace.WorkspaceProject;
export declare function getWorkspacePath(host: Tree): string;
export declare function getWorkspace(host: Tree): WorkspaceSchema;
export declare function addProjectToWorkspace(workspace: WorkspaceSchema, name: string, project: WorkspaceProject): Rule;
export declare const configPath = "/.angular-cli.json";
export declare function getConfig(host: Tree): CliConfig;
export declare function getAppFromConfig(config: CliConfig, appIndexOrName: string): AppConfig | null;
export declare function updateWorkspace(updater: (workspace: workspaces.WorkspaceDefinition) => void | Rule | PromiseLike<void | Rule>): Rule;
export declare function updateWorkspace(workspace: workspaces.WorkspaceDefinition): Rule;
export declare function getWorkspace(tree: Tree, path?: string): Promise<workspaces.WorkspaceDefinition>;
/**
* Build a default project path for generating.
* @param project The project which will have its default path generated.
*/
export declare function buildDefaultPath(project: workspaces.ProjectDefinition): string;
export declare function createDefaultPath(tree: Tree, projectName: string): Promise<string>;
export declare function allWorkspaceTargets(workspace: workspaces.WorkspaceDefinition): Iterable<[string, workspaces.TargetDefinition, string, workspaces.ProjectDefinition]>;
export declare function allTargetOptions(target: workspaces.TargetDefinition, skipBaseOptions?: boolean): Iterable<[string | undefined, Record<string, json.JsonValue | undefined>]>;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getAppFromConfig = exports.getConfig = exports.configPath = exports.addProjectToWorkspace = exports.getWorkspace = exports.getWorkspacePath = void 0;
/**
* @license
* Copyright Google Inc. All Rights Reserved.
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*
* https://github.com/angular/angular-cli/blob/37a06a7c37f5b4286d58b475e6e12c86f00fac5b/packages/schematics/angular/utility/workspace.ts
*/
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.allTargetOptions = exports.allWorkspaceTargets = exports.createDefaultPath = exports.buildDefaultPath = exports.getWorkspace = exports.updateWorkspace = exports.ProjectType = void 0;
const core_1 = require("@angular-devkit/core");
const schematics_1 = require("@angular-devkit/schematics");
function getWorkspacePath(host) {
const possibleFiles = ["/angular.json", "/.angular.json"];
const path = possibleFiles.filter(path => host.exists(path))[0];
return path;
var ProjectType;
(function (ProjectType) {
ProjectType["Application"] = "application";
ProjectType["Library"] = "library";
})(ProjectType = exports.ProjectType || (exports.ProjectType = {}));
function createHost(tree) {
return {
readFile(path) {
return __awaiter(this, void 0, void 0, function* () {
const data = tree.read(path);
if (!data) {
throw new Error('File not found.');
}
return core_1.virtualFs.fileBufferToString(data);
});
},
writeFile(path, data) {
return __awaiter(this, void 0, void 0, function* () {
return tree.overwrite(path, data);
});
},
isDirectory(path) {
return __awaiter(this, void 0, void 0, function* () {
// approximate a directory check
return !tree.exists(path) && tree.getDir(path).subfiles.length > 0;
});
},
isFile(path) {
return __awaiter(this, void 0, void 0, function* () {
return tree.exists(path);
});
},
};
}
exports.getWorkspacePath = getWorkspacePath;
function getWorkspace(host) {
const path = getWorkspacePath(host);
const configBuffer = host.read(path);
if (configBuffer === null) {
throw new schematics_1.SchematicsException(`Could not find (${path})`);
}
const content = configBuffer.toString();
return core_1.parseJson(content, core_1.JsonParseMode.Loose);
function updateWorkspace(updaterOrWorkspace) {
return (tree) => __awaiter(this, void 0, void 0, function* () {
const host = createHost(tree);
if (typeof updaterOrWorkspace === 'function') {
const { workspace } = yield core_1.workspaces.readWorkspace('/', host);
const result = yield updaterOrWorkspace(workspace);
yield core_1.workspaces.writeWorkspace(workspace, host);
return result || schematics_1.noop;
}
else {
yield core_1.workspaces.writeWorkspace(updaterOrWorkspace, host);
return schematics_1.noop;
}
});
}
exports.updateWorkspace = updateWorkspace;
function getWorkspace(tree, path = '/') {
return __awaiter(this, void 0, void 0, function* () {
const host = createHost(tree);
const { workspace } = yield core_1.workspaces.readWorkspace(path, host);
return workspace;
});
}
exports.getWorkspace = getWorkspace;
function addProjectToWorkspace(workspace, name, project) {
return (host, context) => {
if (workspace.projects[name]) {
throw new Error(`Project '${name}' already exists in workspace.`);
/**
* Build a default project path for generating.
* @param project The project which will have its default path generated.
*/
function buildDefaultPath(project) {
const root = project.sourceRoot ? `/${project.sourceRoot}/` : `/${project.root}/src/`;
const projectDirName = project.extensions['projectType'] === ProjectType.Application ? 'app' : 'lib';
return `${root}${projectDirName}`;
}
exports.buildDefaultPath = buildDefaultPath;
function createDefaultPath(tree, projectName) {
return __awaiter(this, void 0, void 0, function* () {
const workspace = yield getWorkspace(tree);
const project = workspace.projects.get(projectName);
if (!project) {
throw new Error('Specified project does not exist.');
}
// Add project to workspace.
workspace.projects[name] = project;
if (!workspace.defaultProject && Object.keys(workspace.projects).length === 1) {
// Make the new project the default one.
workspace.defaultProject = name;
return buildDefaultPath(project);
});
}
exports.createDefaultPath = createDefaultPath;
function* allWorkspaceTargets(workspace) {
for (const [projectName, project] of workspace.projects) {
for (const [targetName, target] of project.targets) {
yield [targetName, target, projectName, project];
}
host.overwrite(getWorkspacePath(host), JSON.stringify(workspace, null, 2));
};
}
exports.addProjectToWorkspace = addProjectToWorkspace;
exports.configPath = "/.angular-cli.json";
function getConfig(host) {
const configBuffer = host.read(exports.configPath);
if (configBuffer === null) {
throw new schematics_1.SchematicsException("Could not find .angular-cli.json");
}
const config = core_1.parseJson(configBuffer.toString(), core_1.JsonParseMode.Loose);
return config;
}
exports.getConfig = getConfig;
function getAppFromConfig(config, appIndexOrName) {
if (!config.apps) {
return null;
exports.allWorkspaceTargets = allWorkspaceTargets;
function* allTargetOptions(target, skipBaseOptions = false) {
if (!skipBaseOptions && target.options) {
yield [undefined, target.options];
}
if (parseInt(appIndexOrName) >= 0) {
return config.apps[parseInt(appIndexOrName)];
if (!target.configurations) {
return;
}
return config.apps.filter((app) => app.name === appIndexOrName)[0];
for (const [name, options] of Object.entries(target.configurations)) {
if (options !== undefined) {
yield [name, options];
}
}
}
exports.getAppFromConfig = getAppFromConfig;
exports.allTargetOptions = allTargetOptions;
//# sourceMappingURL=config.js.map

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

const dir = host.getDir(path);
return dir.subfiles.filter(value => regExp.test(value)).map(fileName => path_1.join(path, fileName));
return dir.subfiles.filter(value => regExp.test(value)).map(fileName => (0, path_1.join)(path, fileName));
}
exports.getFiles = getFiles;
//# sourceMappingURL=get-files.js.map

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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